Add compile flags around Windows-specific code
This commit is contained in:
parent
9e963e5cc7
commit
b17d87a15b
2 changed files with 31 additions and 1 deletions
|
|
@ -9,7 +9,17 @@
|
||||||
|
|
||||||
#include "CorsairProController.h"
|
#include "CorsairProController.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void Sleep(unsigned int milliseconds)
|
||||||
|
{
|
||||||
|
usleep(1000 * milliseconds);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev)
|
CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev_id dev)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,29 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
//winsize, termio, and termios structs are redefined in
|
||||||
|
//asm/termios.h, to prevent compiler errors from multply
|
||||||
|
//defining them, use a #define to rename them -
|
||||||
|
//essentially to undef them before they are redefined
|
||||||
|
#define winsize undefine_winsize
|
||||||
|
#define termio undefine_termio
|
||||||
|
#define termios undefine_termios
|
||||||
|
|
||||||
|
#include <asm/termios.h>
|
||||||
|
#include <asm-generic/ioctls.h>
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//Serial Port Class
|
//Serial Port Class
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue