mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
AP_HAL_AVR: add semaphore to I2CDriver
This commit is contained in:
parent
3da864499d
commit
4c31cc0c2b
@ -21,7 +21,8 @@ AVRUARTDriverInstance(avrUart0Driver, 0);
|
||||
AVRUARTDriverInstance(avrUart1Driver, 1);
|
||||
AVRUARTDriverInstance(avrUart3Driver, 3);
|
||||
|
||||
static AVRI2CDriver avrI2CDriver;
|
||||
static AVRSemaphore i2cSemaphore;
|
||||
static AVRI2CDriver avrI2CDriver(&i2cSemaphore);
|
||||
static APM1SPIDeviceManager apm1SPIDriver;
|
||||
static AVRAnalogIn avrAnalogIn;
|
||||
static AVREEPROMStorage avrEEPROMStorage;
|
||||
|
@ -21,7 +21,8 @@ AVRUARTDriverInstance(avrUart0Driver, 0);
|
||||
AVRUARTDriverInstance(avrUart1Driver, 1);
|
||||
AVRUARTDriverInstance(avrUart2Driver, 2);
|
||||
|
||||
static AVRI2CDriver avrI2CDriver;
|
||||
static AVRSemaphore i2cSemaphore;
|
||||
static AVRI2CDriver avrI2CDriver(&i2cSemaphore);
|
||||
static APM2SPIDeviceManager apm2SPIDriver;
|
||||
static AVRAnalogIn avrAnalogIn;
|
||||
static AVREEPROMStorage avrEEPROMStorage;
|
||||
|
@ -316,5 +316,4 @@ SIGNAL(TWI_vect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
class AP_HAL_AVR::AVRI2CDriver : public AP_HAL::I2CDriver {
|
||||
public:
|
||||
AVRI2CDriver() {}
|
||||
AVRI2CDriver(AP_HAL::Semaphore *sem) : _sem(sem) {}
|
||||
|
||||
void begin();
|
||||
void end();
|
||||
@ -26,6 +26,8 @@ public:
|
||||
uint8_t len, uint8_t* data);
|
||||
uint8_t lockup_count() { return _lockup_count; }
|
||||
|
||||
AP_HAL::Semaphore* get_semaphore() { return _sem; }
|
||||
|
||||
private:
|
||||
uint8_t _start();
|
||||
uint8_t _stop();
|
||||
@ -39,6 +41,8 @@ private:
|
||||
|
||||
uint8_t _lockup_count;
|
||||
uint16_t _timeoutDelay;
|
||||
|
||||
AP_HAL::Semaphore *_sem;
|
||||
};
|
||||
|
||||
#endif // __AP_HAL_AVR_I2C_DRIVER_H__
|
||||
|
Loading…
Reference in New Issue
Block a user