7 namespace sensirion_common {
96 template<
class T>
bool write_command(T i2c_register,
const std::vector<uint16_t> &data) {
97 return write_command_(i2c_register,
sizeof(T), data.data(), data.size());
106 template<
class T>
bool write_command(T i2c_register,
const uint16_t *data, uint8_t len) {
108 static_assert(
sizeof(i2c_register) == 1 ||
sizeof(i2c_register) == 2,
109 "only 8 or 16 bit command types are supported.");
bool get_register_(uint16_t reg, CommandLen command_len, uint16_t *data, uint8_t len, uint8_t delay)
get data words from i2c register.
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_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)
Write a command to the i2c device.
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
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_(uint16_t command, CommandLen command_len, const uint16_t *data, uint8_t data_len)
Write a command with arguments as words.
bool read_data(uint16_t *data, uint8_t len)
Read data words from i2c device.
uint8_t sht_crc_(uint16_t data)
8-bit CRC checksum that is transmitted after each data word for read and write operation ...
uint8_t sht_crc_(uint8_t data1, uint8_t data2)
8-bit CRC checksum that is transmitted after each data word for read and write operation ...
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
bool write_command(T i2c_register, uint16_t data)
Write a command and one data word to the i2c device .
bool write_command(T i2c_register, const uint16_t *data, uint8_t len)
Write a command with arguments as words.
bool get_register(uint16_t command, uint16_t *data, uint8_t len, uint8_t delay=0)
get data words from i2c register.
bool read_data(uint16_t &data)
Read 1 data word from i2c device.
i2c::ErrorCode last_error_
last error code from i2c operation
Implementation of SPI Controller mode.
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
bool write_command(T i2c_register, const std::vector< uint16_t > &data)
Write a command with arguments as words.
This Class provides the methods to read/write bytes from/to an i2c device.
void IRAM_ATTR HOT delay(uint32_t ms)