APM:Libraries
|
#include <AP_BattMonitor_SMBus.h>
Public Types | |
enum | BATTMONITOR_SMBUS { BATTMONITOR_SMBUS_TEMP = 0x08, BATTMONITOR_SMBUS_VOLTAGE = 0x09, BATTMONITOR_SMBUS_CURRENT = 0x0A, BATTMONITOR_SMBUS_REMAINING_CAPACITY = 0x0F, BATTMONITOR_SMBUS_FULL_CHARGE_CAPACITY = 0x10, BATTMONITOR_SMBUS_SPECIFICATION_INFO = 0x1A, BATTMONITOR_SMBUS_SERIAL = 0x1C, BATTMONITOR_SMBUS_MANUFACTURE_NAME = 0x20, BATTMONITOR_SMBUS_MANUFACTURE_DATA = 0x23 } |
Public Member Functions | |
AP_BattMonitor_SMBus (AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms, AP_HAL::OwnPtr< AP_HAL::I2CDevice > dev) | |
Constructor. More... | |
virtual | ~AP_BattMonitor_SMBus () |
bool | has_cell_voltages () const override |
bool | has_current () const override |
returns true if battery monitor instance provides current info More... | |
void | init (void) override |
![]() | |
AP_BattMonitor_Backend (AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms) | |
virtual | ~AP_BattMonitor_Backend (void) |
virtual bool | has_consumed_energy () const |
returns true if battery monitor instance provides consumed energy info More... | |
uint8_t | capacity_remaining_pct () const |
capacity_remaining_pct - returns the % battery capacity remaining (0 ~ 100) More... | |
void | update_resistance_estimate () |
virtual void | handle_bi_msg (float voltage, float current, float temperature) |
Protected Member Functions | |
void | read (void) override |
read the battery_voltage and current, should be called at 10hz More... | |
bool | read_full_charge_capacity (void) |
bool | read_remaining_capacity (void) |
bool | read_temp (void) |
bool | read_serial_number (void) |
bool | read_word (uint8_t reg, uint16_t &data) const |
uint8_t | get_PEC (const uint8_t i2c_addr, uint8_t cmd, bool reading, const uint8_t buff[], uint8_t len) const |
get_PEC - calculate packet error correction code of buffer More... | |
virtual void | timer (void)=0 |
Protected Attributes | |
AP_HAL::OwnPtr< AP_HAL::I2CDevice > | _dev |
bool | _pec_supported |
int32_t | _serial_number = -1 |
uint16_t | _full_charge_capacity |
bool | _has_cell_voltages |
![]() | |
AP_BattMonitor & | _mon |
AP_BattMonitor::BattMonitor_State & | _state |
AP_BattMonitor_Params & | _params |
Definition at line 14 of file AP_BattMonitor_SMBus.h.
Definition at line 19 of file AP_BattMonitor_SMBus.h.
AP_BattMonitor_SMBus::AP_BattMonitor_SMBus | ( | AP_BattMonitor & | mon, |
AP_BattMonitor::BattMonitor_State & | mon_state, | ||
AP_BattMonitor_Params & | params, | ||
AP_HAL::OwnPtr< AP_HAL::I2CDevice > | dev | ||
) |
Constructor.
Definition at line 5 of file AP_BattMonitor_SMBus.cpp.
|
inlinevirtual |
Definition at line 38 of file AP_BattMonitor_SMBus.h.
|
protected |
get_PEC - calculate packet error correction code of buffer
Definition at line 129 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current(), AP_BattMonitor_SMBus_Solo::read_block(), AP_BattMonitor_SMBus_Maxell::read_block(), and read_word().
|
inlineoverridevirtual |
Reimplemented from AP_BattMonitor_Backend.
Definition at line 40 of file AP_BattMonitor_SMBus.h.
|
inlineoverridevirtual |
returns true if battery monitor instance provides current info
Implements AP_BattMonitor_Backend.
Definition at line 43 of file AP_BattMonitor_SMBus.h.
|
overridevirtual |
Implements AP_BattMonitor_Backend.
Definition at line 16 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current().
|
overrideprotectedvirtual |
read the battery_voltage and current, should be called at 10hz
Implements AP_BattMonitor_Backend.
Definition at line 23 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current().
|
protected |
Definition at line 39 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current(), AP_BattMonitor_SMBus_Solo::timer(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protected |
Definition at line 55 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current(), AP_BattMonitor_SMBus_Solo::timer(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protected |
Definition at line 86 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current(), AP_BattMonitor_SMBus_Solo::timer(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protected |
Definition at line 72 of file AP_BattMonitor_SMBus.cpp.
Referenced by has_current(), AP_BattMonitor_SMBus_Solo::timer(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protected |
Definition at line 102 of file AP_BattMonitor_SMBus.cpp.
Referenced by AP_BattMonitor_SMBus_Maxell::check_pec_support(), has_current(), read_full_charge_capacity(), read_remaining_capacity(), read_serial_number(), read_temp(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protectedpure virtual |
Implemented in AP_BattMonitor_SMBus_Maxell, and AP_BattMonitor_SMBus_Solo.
Referenced by init().
|
protected |
Definition at line 76 of file AP_BattMonitor_SMBus.h.
Referenced by init(), AP_BattMonitor_SMBus_Solo::read_block(), AP_BattMonitor_SMBus_Maxell::read_block(), and read_word().
|
protected |
Definition at line 80 of file AP_BattMonitor_SMBus.h.
Referenced by read(), and read_full_charge_capacity().
|
protected |
Definition at line 82 of file AP_BattMonitor_SMBus.h.
Referenced by has_cell_voltages(), AP_BattMonitor_SMBus_Solo::timer(), and AP_BattMonitor_SMBus_Maxell::timer().
|
protected |
Definition at line 77 of file AP_BattMonitor_SMBus.h.
Referenced by AP_BattMonitor_SMBus_Solo::AP_BattMonitor_SMBus_Solo(), AP_BattMonitor_SMBus_Maxell::check_pec_support(), AP_BattMonitor_SMBus_Maxell::read_block(), and read_word().
|
protected |
Definition at line 79 of file AP_BattMonitor_SMBus.h.
Referenced by read(), and read_serial_number().