44 size_t read_count) = 0;
This Class provides the methods to read and write bytes from an I2CBus.
virtual ErrorCode write_readv(uint8_t address, const uint8_t *write_buffer, size_t write_count, uint8_t *read_buffer, size_t read_count)=0
This virtual method writes bytes to an I2CBus from an array, then reads bytes into an array of ReadBu...
bool scan_
Should we scan ? Can be set in the yaml.
std::vector< std::pair< uint8_t, bool > > scan_results_
array containing scan results
virtual ~I2CBus()=default
ErrorCode write(uint8_t address, const uint8_t *buffer, size_t len, bool stop=true)
void i2c_scan_()
Scans the I2C bus for devices.
ErrorCode read(uint8_t address, uint8_t *buffer, size_t len)
virtual int get_port() const =0
Returns the I2C port number.
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
@ ERROR_CRC
bytes received with a CRC error
@ ERROR_OK
No error found during execution of method.
@ ERROR_TOO_LARGE
requested a transfer larger than buffers can hold
@ ERROR_INVALID_ARGUMENT
method called invalid argument(s)
@ NO_ERROR
No error found during execution of method.
@ ERROR_TIMEOUT
timeout while waiting to receive bytes
@ ERROR_NOT_ACKNOWLEDGED
I2C bus acknowledgment not received.
@ ERROR_NOT_INITIALIZED
call method to a not initialized bus
@ ERROR_UNKNOWN
miscellaneous I2C error during execution