APM:Libraries
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AP_BattMonitor_SMBus Class Referenceabstract

#include <AP_BattMonitor_SMBus.h>

Inheritance diagram for AP_BattMonitor_SMBus:
[legend]
Collaboration diagram for AP_BattMonitor_SMBus:
[legend]

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 &params, 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
 
- Public Member Functions inherited from AP_BattMonitor_Backend
 AP_BattMonitor_Backend (AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params &params)
 
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
 
- Protected Attributes inherited from AP_BattMonitor_Backend
AP_BattMonitor_mon
 
AP_BattMonitor::BattMonitor_State_state
 
AP_BattMonitor_Params_params
 

Detailed Description

Definition at line 14 of file AP_BattMonitor_SMBus.h.

Member Enumeration Documentation

◆ BATTMONITOR_SMBUS

Enumerator
BATTMONITOR_SMBUS_TEMP 
BATTMONITOR_SMBUS_VOLTAGE 
BATTMONITOR_SMBUS_CURRENT 
BATTMONITOR_SMBUS_REMAINING_CAPACITY 
BATTMONITOR_SMBUS_FULL_CHARGE_CAPACITY 
BATTMONITOR_SMBUS_SPECIFICATION_INFO 
BATTMONITOR_SMBUS_SERIAL 
BATTMONITOR_SMBUS_MANUFACTURE_NAME 
BATTMONITOR_SMBUS_MANUFACTURE_DATA 

Definition at line 19 of file AP_BattMonitor_SMBus.h.

Constructor & Destructor Documentation

◆ AP_BattMonitor_SMBus()

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.

◆ ~AP_BattMonitor_SMBus()

virtual AP_BattMonitor_SMBus::~AP_BattMonitor_SMBus ( )
inlinevirtual

Definition at line 38 of file AP_BattMonitor_SMBus.h.

Member Function Documentation

◆ get_PEC()

uint8_t AP_BattMonitor_SMBus::get_PEC ( const uint8_t  i2c_addr,
uint8_t  cmd,
bool  reading,
const uint8_t  buff[],
uint8_t  len 
) const
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().

Here is the caller graph for this function:

◆ has_cell_voltages()

bool AP_BattMonitor_SMBus::has_cell_voltages ( ) const
inlineoverridevirtual

Reimplemented from AP_BattMonitor_Backend.

Definition at line 40 of file AP_BattMonitor_SMBus.h.

◆ has_current()

bool AP_BattMonitor_SMBus::has_current ( ) const
inlineoverridevirtual

returns true if battery monitor instance provides current info

Implements AP_BattMonitor_Backend.

Definition at line 43 of file AP_BattMonitor_SMBus.h.

Here is the call graph for this function:

◆ init()

void AP_BattMonitor_SMBus::init ( void  )
overridevirtual

Implements AP_BattMonitor_Backend.

Definition at line 16 of file AP_BattMonitor_SMBus.cpp.

Referenced by has_current().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

void AP_BattMonitor_SMBus::read ( void  )
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().

Here is the caller graph for this function:

◆ read_full_charge_capacity()

bool AP_BattMonitor_SMBus::read_full_charge_capacity ( void  )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_remaining_capacity()

bool AP_BattMonitor_SMBus::read_remaining_capacity ( void  )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_serial_number()

bool AP_BattMonitor_SMBus::read_serial_number ( void  )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_temp()

bool AP_BattMonitor_SMBus::read_temp ( void  )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_word()

bool AP_BattMonitor_SMBus::read_word ( uint8_t  reg,
uint16_t &  data 
) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timer()

virtual void AP_BattMonitor_SMBus::timer ( void  )
protectedpure virtual

Implemented in AP_BattMonitor_SMBus_Maxell, and AP_BattMonitor_SMBus_Solo.

Referenced by init().

Here is the caller graph for this function:

Member Data Documentation

◆ _dev

AP_HAL::OwnPtr<AP_HAL::I2CDevice> AP_BattMonitor_SMBus::_dev
protected

◆ _full_charge_capacity

uint16_t AP_BattMonitor_SMBus::_full_charge_capacity
protected

Definition at line 80 of file AP_BattMonitor_SMBus.h.

Referenced by read(), and read_full_charge_capacity().

◆ _has_cell_voltages

bool AP_BattMonitor_SMBus::_has_cell_voltages
protected

◆ _pec_supported

bool AP_BattMonitor_SMBus::_pec_supported
protected

◆ _serial_number

int32_t AP_BattMonitor_SMBus::_serial_number = -1
protected

Definition at line 79 of file AP_BattMonitor_SMBus.h.

Referenced by read(), and read_serial_number().


The documentation for this class was generated from the following files: