51 return readv(address, &buf, 1);
63 return write(address, buffer, len,
true);
77 return writev(address, &buf, 1, stop);
81 return writev(address, buffers, cnt,
true);
98 for (uint8_t address = 8; address < 120; address++) {
99 auto err = writev(address,
nullptr, 0);
101 scan_results_.emplace_back(address,
true);
103 scan_results_.emplace_back(address,
false);
the WriteBuffer structure stores a pointer to a write buffer and its length
void i2c_scan_()
Scans the I2C bus for devices.
std::vector< std::pair< uint8_t, bool > > scan_results_
array containing scan results
virtual ErrorCode write(uint8_t address, const uint8_t *buffer, size_t len, bool stop)
Creates a WriteBuffer and calls the writev() method to send the bytes from this buffer.
the ReadBuffer structure stores a pointer to a read buffer and its length
method called invalid argument(s)
uint8_t * data
pointer to the read buffer
timeout while waiting to receive bytes
No error found during execution of method.
virtual ErrorCode writev(uint8_t address, WriteBuffer *buffers, size_t cnt)
size_t len
length of the buffer
No error found during execution of method.
I2C bus acknowledgment not received.
bytes received with a CRC error
This Class provides the methods to read and write bytes from an I2CBus.
size_t len
length of the buffer
requested a transfer larger than buffers can hold
virtual ErrorCode read(uint8_t address, uint8_t *buffer, size_t len)
Creates a ReadBuffer and calls the virtual readv() method to read bytes into this buffer...
virtual ErrorCode write(uint8_t address, const uint8_t *buffer, size_t len)
const uint8_t * data
pointer to the write buffer
Implementation of SPI Controller mode.
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
miscellaneous I2C error during execution
call method to a not initialized bus