Path: blob/master/libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Generic.h
9761 views
#pragma once12#include "AP_BattMonitor_SMBus.h"34#if AP_BATTERY_SMBUS_GENERIC_ENABLED56#if CONFIG_HAL_BOARD == HAL_BOARD_SITL7#define BATTMONITOR_SMBUS_NUM_CELLS_MAX 148#else9#define BATTMONITOR_SMBUS_NUM_CELLS_MAX 1210#endif1112class AP_BattMonitor_SMBus_Generic : public AP_BattMonitor_SMBus13{14public:1516// Constructor17AP_BattMonitor_SMBus_Generic(AP_BattMonitor &mon,18AP_BattMonitor::BattMonitor_State &mon_state,19AP_BattMonitor_Params ¶ms);2021private:2223void timer(void) override;2425// check if PEC supported with the version value in SpecificationInfo() function26// returns true once PEC is confirmed as working or not working27bool check_pec_support();2829uint8_t _pec_confirmed; // count of the number of times PEC has been confirmed as working30uint32_t _last_cell_update_us[BATTMONITOR_SMBUS_NUM_CELLS_MAX]; // system time of last successful read of cell voltage31uint32_t _cell_count_check_start_us; // system time we started attempting to count the number of cells32uint8_t _cell_count; // number of cells returning voltages33bool _cell_count_fixed; // true when cell count check is complete34};3536#endif // AP_BATTERY_SMBUS_GENERIC_ENABLED373839