mirror of https://github.com/ArduPilot/ardupilot
HAL_Empty: fixed I2CDriver for use in Linux subtypes
This commit is contained in:
parent
ec6a679482
commit
9fe25f9c71
|
@ -35,4 +35,14 @@ uint8_t I2CDriver::readRegisters(uint8_t addr, uint8_t reg,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
uint8_t I2CDriver::readRegistersMultiple(uint8_t addr, uint8_t reg,
|
||||
uint8_t len, uint8_t count,
|
||||
uint8_t* data)
|
||||
{
|
||||
memset(data, 0, len*count);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t I2CDriver::lockup_count() {return 0;}
|
||||
|
|
|
@ -7,29 +7,41 @@
|
|||
class Empty::I2CDriver : public AP_HAL::I2CDriver {
|
||||
public:
|
||||
I2CDriver(AP_HAL::Semaphore* semaphore) : _semaphore(semaphore) {}
|
||||
void begin();
|
||||
void end();
|
||||
void setTimeout(uint16_t ms);
|
||||
void setHighSpeed(bool active);
|
||||
void begin() override;
|
||||
void end() override;
|
||||
void setTimeout(uint16_t ms) override;
|
||||
void setHighSpeed(bool active) override;
|
||||
|
||||
/* write: for i2c devices which do not obey register conventions */
|
||||
uint8_t write(uint8_t addr, uint8_t len, uint8_t* data);
|
||||
uint8_t write(uint8_t addr, uint8_t len, uint8_t* data) override;
|
||||
|
||||
/* writeRegister: write a single 8-bit value to a register */
|
||||
uint8_t writeRegister(uint8_t addr, uint8_t reg, uint8_t val);
|
||||
uint8_t writeRegister(uint8_t addr, uint8_t reg, uint8_t val) override;
|
||||
|
||||
/* writeRegisters: write bytes to contigious registers */
|
||||
uint8_t writeRegisters(uint8_t addr, uint8_t reg,
|
||||
uint8_t len, uint8_t* data);
|
||||
uint8_t len, uint8_t* data) override;
|
||||
|
||||
/* read: for i2c devices which do not obey register conventions */
|
||||
uint8_t read(uint8_t addr, uint8_t len, uint8_t* data);
|
||||
uint8_t read(uint8_t addr, uint8_t len, uint8_t* data) override;
|
||||
|
||||
/* readRegister: read from a device register - writes the register,
|
||||
* then reads back an 8-bit value. */
|
||||
uint8_t readRegister(uint8_t addr, uint8_t reg, uint8_t* data);
|
||||
uint8_t readRegister(uint8_t addr, uint8_t reg, uint8_t* data) override;
|
||||
|
||||
/* readRegister: read contigious device registers - writes the first
|
||||
* register, then reads back multiple bytes */
|
||||
uint8_t readRegisters(uint8_t addr, uint8_t reg,
|
||||
uint8_t len, uint8_t* data);
|
||||
uint8_t len, uint8_t* data) override;
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
/* readRegistersMultiple: read contigious device registers.
|
||||
Equivalent to count calls to readRegisters() */
|
||||
virtual uint8_t readRegistersMultiple(uint8_t addr, uint8_t reg,
|
||||
uint8_t len, uint8_t count,
|
||||
uint8_t* data) override;
|
||||
#endif
|
||||
|
||||
uint8_t lockup_count();
|
||||
|
||||
AP_HAL::Semaphore* get_semaphore() { return _semaphore; }
|
||||
|
|
Loading…
Reference in New Issue