12 #include <hal/I2CTypes.h>
14 #include "frc/ErrorBase.h"
26 enum Port { kOnboard = 0, kMXP };
34 I2C(Port port,
int deviceAddress);
39 I2C& operator=(
I2C&&) =
default;
55 bool Transaction(uint8_t* dataToSend,
int sendSize, uint8_t* dataReceived,
79 bool Write(
int registerAddress, uint8_t data);
107 bool Read(
int registerAddress,
int count, uint8_t* data);
120 bool ReadOnly(
int count, uint8_t* buffer);
137 bool VerifySensor(
int registerAddress,
int count,
const uint8_t* expected);
bool Write(int registerAddress, uint8_t data)
Execute a write transaction with the device.
bool Transaction(uint8_t *dataToSend, int sendSize, uint8_t *dataReceived, int receiveSize)
Generic transaction.
bool ReadOnly(int count, uint8_t *buffer)
Execute a read only transaction with the device.
bool Read(int registerAddress, int count, uint8_t *data)
Execute a read transaction with the device.
I2C(Port port, int deviceAddress)
Constructor.
Base class for most objects.
Definition: ErrorBase.h:104
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
I2C bus interface class.
Definition: I2C.h:24
bool WriteBulk(uint8_t *data, int count)
Execute a bulk write transaction with the device.
bool VerifySensor(int registerAddress, int count, const uint8_t *expected)
Verify that a device's registers contain expected values.
bool AddressOnly()
Attempt to address a device on the I2C bus.