8namespace sensirion_common {
18static const uint8_t CRC_POLYNOMIAL = 0x31;
111 static_assert(
sizeof(i2c_register) == 1 ||
sizeof(i2c_register) == 2,
"Only 8 or 16 bit command types supported");
This Class provides the methods to read/write bytes from/to an i2c device.
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
bool get_register_(uint16_t reg, CommandLen command_len, uint16_t *data, uint8_t len, uint8_t delay)
get data words from I2C register.
i2c::ErrorCode last_error_
last error code from I2C operation
bool write_command(T i2c_register, const std::vector< uint16_t > &data)
Write a command with arguments as words.
bool get_8bit_register(uint8_t i2c_register, uint16_t *data, uint8_t len, uint8_t delay=0)
get data words from I2C register.
bool get_register(uint16_t command, uint16_t *data, uint8_t len, uint8_t delay=0)
get data words from I2C register.
bool get_8bit_register(uint8_t i2c_register, uint16_t &data, uint8_t delay=0)
Read 1 data word from 8 bit I2C register.
bool write_command(T i2c_register, uint16_t data)
Write a command and one data word to the I2C device .
bool get_register(uint16_t i2c_register, uint16_t &data, uint8_t delay=0)
Read 1 data word from 16 bit I2C register.
bool write_command(T i2c_register)
Write a command to the I2C device.
bool read_data(uint16_t *data, uint8_t len)
Read data words from I2C device.
bool read_data(uint16_t &data)
Read 1 data word from I2C device.
bool write_command_(uint16_t command, CommandLen command_len, const uint16_t *data, uint8_t data_len)
Write a command with arguments as words.
bool write_command(T i2c_register, const uint16_t *data, uint8_t len)
Write a command with arguments as words.
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
Providing packet encoding functions for exchanging data with a remote host.
void IRAM_ATTR HOT delay(uint32_t ms)