From 4e910ef9700c99b886bd3b56cd8e20daefd7b201 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 13 Mar 2019 20:30:49 +0900 Subject: [PATCH] I2C support is only Linux. So code should be compiled under Linux, not avoiding Apple. --- I2CController.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/I2CController.cpp b/I2CController.cpp index b44ab03..247129c 100644 --- a/I2CController.cpp +++ b/I2CController.cpp @@ -63,7 +63,7 @@ int CI2CController::write(const unsigned char* buffer, unsigned int length) #include #include #include -#if !defined(__APPLE__) +#if defined(__linux__) #include #endif @@ -81,7 +81,7 @@ bool CI2CController::open() { assert(m_fd == -1); -#if !defined(__APPLE__) +#if defined(__linux__) m_fd = ::open(m_device.c_str(), O_RDWR); if (m_fd < 0) { LogError("Cannot open device - %s", m_device.c_str()); @@ -100,7 +100,7 @@ bool CI2CController::open() return false; } #else - #warning "I2C controller does not support OSX" + #warning "I2C controller supports Linux only" #endif return true; @@ -117,7 +117,7 @@ int CI2CController::read(unsigned char* buffer, unsigned int length) unsigned int offset = 0U; while (offset < length) { -#if !defined(__APPLE__) +#if defined(__linux__) ssize_t n = ::read(m_fd, buffer + offset, 1U); if (n < 0) { if (errno != EAGAIN) { @@ -145,7 +145,7 @@ int CI2CController::write(const unsigned char* buffer, unsigned int length) unsigned int ptr = 0U; while (ptr < length) { ssize_t n = 0U; -#if !defined(__APPLE__) +#if defined(__linux__) n = ::write(m_fd, buffer + ptr, 1U); #endif if (n < 0) {