12 #include "ErrorBase.h" 14 enum HAL_I2CPort : int32_t;
26 enum Port { kOnboard = 0, kMXP };
28 I2C(Port port,
int deviceAddress);
32 I2C& operator=(
const I2C&) =
delete;
34 bool Transaction(uint8_t* dataToSend,
int sendSize, uint8_t* dataReceived,
37 bool Write(
int registerAddress, uint8_t data);
39 bool Read(
int registerAddress,
int count, uint8_t* data);
40 bool ReadOnly(
int count, uint8_t* buffer);
41 bool VerifySensor(
int registerAddress,
int count,
const uint8_t* expected);
Definition: RobotController.cpp:14
I2C(Port port, int deviceAddress)
Constructor.
Definition: I2C.cpp:23
~I2C() override
Destructor.
Definition: I2C.cpp:35
bool Transaction(uint8_t *dataToSend, int sendSize, uint8_t *dataReceived, int receiveSize)
Generic transaction.
Definition: I2C.cpp:49
bool ReadOnly(int count, uint8_t *buffer)
Execute a read only transaction with the device.
Definition: I2C.cpp:141
bool Read(int registerAddress, int count, uint8_t *data)
Execute a read transaction with the device.
Definition: I2C.cpp:117
bool VerifySensor(int registerAddress, int count, const uint8_t *expected)
Verify that a device's registers contain expected values.
Definition: I2C.cpp:168
bool WriteBulk(uint8_t *data, int count)
Execute a bulk write transaction with the device.
Definition: I2C.cpp:98
bool Write(int registerAddress, uint8_t data)
Execute a write transaction with the device.
Definition: I2C.cpp:79
bool AddressOnly()
Attempt to address a device on the I2C bus.
Definition: I2C.cpp:66
I2C bus interface class.
Definition: I2C.h:24
Base class for most objects.
Definition: ErrorBase.h:74