diff --git a/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp b/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp index 5cf4de049c..20bc2ea115 100644 --- a/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp +++ b/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp @@ -10,7 +10,8 @@ using namespace Empty; static EmptyUARTDriver uartADriver; static EmptyUARTDriver uartBDriver; static EmptyUARTDriver uartCDriver; -static EmptyI2CDriver i2cDriver; +static EmptySemaphore i2cSemaphore; +static EmptyI2CDriver i2cDriver(&i2cSemaphore); static EmptySPIDeviceManager spiDeviceManager; static EmptyAnalogIn analogIn; static EmptyStorage storageDriver; diff --git a/libraries/AP_HAL_Empty/I2CDriver.h b/libraries/AP_HAL_Empty/I2CDriver.h index 615b16e497..b23b9aa495 100644 --- a/libraries/AP_HAL_Empty/I2CDriver.h +++ b/libraries/AP_HAL_Empty/I2CDriver.h @@ -6,6 +6,7 @@ class Empty::EmptyI2CDriver : public AP_HAL::I2CDriver { public: + EmptyI2CDriver(AP_HAL::Semaphore* semaphore) : _semaphore(semaphore) {} void begin(); void end(); void setTimeout(uint16_t ms); @@ -31,6 +32,10 @@ public: uint8_t lockup_count(); + AP_HAL::Semaphore* get_semaphore() { return _semaphore; } + +private: + AP_HAL::Semaphore* _semaphore; }; #endif // __AP_HAL_EMPTY_I2CDRIVER_H__