10 #include "SensorBase.h"
23 enum Port { kOnboard, kMXP };
25 I2C(Port port,
int deviceAddress);
29 I2C& operator=(
const I2C&) =
delete;
31 bool Transaction(uint8_t* dataToSend,
int sendSize, uint8_t* dataReceived,
34 bool Write(
int registerAddress, uint8_t data);
36 bool Read(
int registerAddress,
int count, uint8_t* data);
37 bool ReadOnly(
int count, uint8_t* buffer);
39 bool VerifySensor(
int registerAddress,
int count,
const uint8_t* expected);
I2C(Port port, int deviceAddress)
Constructor.
Definition: I2C.cpp:22
Base class for all sensors.
Definition: SensorBase.h:22
bool Transaction(uint8_t *dataToSend, int sendSize, uint8_t *dataReceived, int receiveSize)
Generic transaction.
Definition: I2C.cpp:48
bool ReadOnly(int count, uint8_t *buffer)
Execute a read only transaction with the device.
Definition: I2C.cpp:140
bool Read(int registerAddress, int count, uint8_t *data)
Execute a read transaction with the device.
Definition: I2C.cpp:116
bool VerifySensor(int registerAddress, int count, const uint8_t *expected)
Send a broadcast write to all devices on the I2C bus.
Definition: I2C.cpp:180
bool WriteBulk(uint8_t *data, int count)
Execute a bulk write transaction with the device.
Definition: I2C.cpp:97
bool Write(int registerAddress, uint8_t data)
Execute a write transaction with the device.
Definition: I2C.cpp:78
virtual ~I2C()
Destructor.
Definition: I2C.cpp:34
bool AddressOnly()
Attempt to address a device on the I2C bus.
Definition: I2C.cpp:65
I2C bus interface class.
Definition: I2C.h:21