Ardupilot2/libraries/AP_HAL/I2CDriver.h
Pat Hickey 46f31aa69c AP_HAL_AVR: Implement I2CDriver based on libraries/I2C
* Removed a ton of code we don't need from that driver, which should make
  writing new drivers easier.
2012-12-20 14:51:20 +11:00

29 lines
817 B
C++

#ifndef __AP_HAL_I2C_DRIVER_H__
#define __AP_HAL_I2C_DRIVER_H__
#include <stdint.h>
#include "AP_HAL_Namespace.h"
class AP_HAL::I2CDriver {
public:
I2CDriver() {}
virtual void begin() = 0;
virtual void end() = 0;
virtual void setTimeout(uint16_t ms) = 0;
virtual void setHighSpeed(bool active) = 0;
virtual uint8_t writeRegister(uint8_t addr, uint8_t reg, uint8_t val) = 0;
virtual uint8_t writeRegisters(uint8_t addr, uint8_t reg,
uint8_t len, uint8_t* data) = 0;
virtual uint8_t readRegister(uint8_t addr, uint8_t reg, uint8_t* data) = 0;
virtual uint8_t readRegisters(uint8_t addr, uint8_t reg,
uint8_t len, uint8_t* data) = 0;
virtual uint8_t lockup_count();
};
#endif // __AP_HAL_I2C_DRIVER_H__