Add compile flags around Windows-specific code

This commit is contained in:
Adam Honse 2019-08-14 20:23:50 -05:00
parent 9e963e5cc7
commit b17d87a15b
2 changed files with 31 additions and 1 deletions

View file

@ -9,7 +9,17 @@
#include "CorsairProController.h"
#include <cstring>
#ifdef WIN32
#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)
{

View file

@ -13,9 +13,29 @@
#include <string.h>
#include <stdio.h>
#ifdef WIN32
#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