PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <SMBus.hpp>
Public Member Functions | |
SMBus (int bus_num, uint16_t address) | |
~SMBus () override=default | |
int | block_write (const uint8_t cmd_code, void *data, uint8_t byte_count, bool use_pec) |
Sends a block write command. More... | |
int | block_read (const uint8_t cmd_code, void *data, const uint8_t length, bool use_pec) |
Sends a block read command. More... | |
int | read_word (const uint8_t cmd_code, uint16_t &data) |
Sends a read word command. More... | |
int | write_word (const uint8_t cmd_code, uint16_t data) |
Sends a write word command. More... | |
uint8_t | get_pec (uint8_t *buffer, uint8_t length) |
Calculates the PEC from the data. More... | |
|
overridedefault |
int SMBus::block_read | ( | const uint8_t | cmd_code, |
void * | data, | ||
const uint8_t | length, | ||
bool | use_pec | ||
) |
Sends a block read command.
cmd_code | The command code. |
data | The returned data. |
length | The number of bytes being read |
Definition at line 93 of file SMBus.cpp.
References get_pec().
Referenced by BATT_SMBUS::dataflash_read(), BATT_SMBUS::manufacturer_name(), and BATT_SMBUS::manufacturer_read().
int SMBus::block_write | ( | const uint8_t | cmd_code, |
void * | data, | ||
uint8_t | byte_count, | ||
bool | use_pec | ||
) |
Sends a block write command.
cmd_code | The command code. |
data | The data to be written. |
length | The number of bytes being written. |
Definition at line 120 of file SMBus.cpp.
References get_pec().
Referenced by BATT_SMBUS::dataflash_read(), BATT_SMBUS::dataflash_write(), BATT_SMBUS::manufacturer_read(), and BATT_SMBUS::manufacturer_write().
uint8_t SMBus::get_pec | ( | uint8_t * | buffer, |
uint8_t | length | ||
) |
Calculates the PEC from the data.
buffer | The buffer that stores the data to perform the CRC over. |
length | The number of bytes being written. |
Definition at line 151 of file SMBus.cpp.
References SMBUS_PEC_POLYNOMIAL.
Referenced by block_read(), block_write(), read_word(), and write_word().
int SMBus::read_word | ( | const uint8_t | cmd_code, |
uint16_t & | data | ||
) |
Sends a read word command.
cmd_code | The command code. |
data | The 2 bytes of returned data plus a 1 byte CRC if used. |
Definition at line 53 of file SMBus.cpp.
References get_pec().
Referenced by BATT_SMBUS::get_cell_voltages(), BATT_SMBUS::get_serial_number(), BATT_SMBUS::get_startup_info(), BATT_SMBUS::manufacture_date(), and BATT_SMBUS::Run().
int SMBus::write_word | ( | const uint8_t | cmd_code, |
uint16_t | data | ||
) |
Sends a write word command.
cmd_code | The command code. |
data | The 2 bytes of data to be transfered. |
Definition at line 77 of file SMBus.cpp.
References get_pec().
Referenced by BATT_SMBUS::unseal().