45 #define SMBUS_PEC_POLYNOMIAL 0x07 47 class SMBus :
public device::I2C
50 SMBus(
int bus_num, uint16_t address);
51 ~SMBus()
override =
default;
60 int block_write(
const uint8_t cmd_code,
void *
data, uint8_t byte_count,
bool use_pec);
69 int block_read(
const uint8_t cmd_code,
void *data,
const uint8_t length,
bool use_pec);
77 int read_word(
const uint8_t cmd_code, uint16_t &data);
85 int write_word(
const uint8_t cmd_code, uint16_t data);
93 uint8_t
get_pec(uint8_t *buffer, uint8_t length);
int block_read(const uint8_t cmd_code, void *data, const uint8_t length, bool use_pec)
Sends a block read command.
SMBus(int bus_num, uint16_t address)
int block_write(const uint8_t cmd_code, void *data, uint8_t byte_count, bool use_pec)
Sends a block write command.
int read_word(const uint8_t cmd_code, uint16_t &data)
Sends a read word command.
int write_word(const uint8_t cmd_code, uint16_t data)
Sends a write word command.
uint8_t get_pec(uint8_t *buffer, uint8_t length)
Calculates the PEC from the data.
~SMBus() override=default
Base class for devices connected via I2C.