|
|
|
@ -22,6 +22,7 @@ public:
@@ -22,6 +22,7 @@ public:
|
|
|
|
|
BATTMONITOR_SMBUS_CURRENT = 0x0A, // Current
|
|
|
|
|
BATTMONITOR_SMBUS_REMAINING_CAPACITY = 0x0F, // Remaining Capacity
|
|
|
|
|
BATTMONITOR_SMBUS_FULL_CHARGE_CAPACITY = 0x10, // Full Charge Capacity
|
|
|
|
|
BATTMONITOR_SMBUS_CYCLE_COUNT = 0x17, // Cycle Count
|
|
|
|
|
BATTMONITOR_SMBUS_SPECIFICATION_INFO = 0x1A, // Specification Info
|
|
|
|
|
BATTMONITOR_SMBUS_SERIAL = 0x1C, // Serial Number
|
|
|
|
|
BATTMONITOR_SMBUS_MANUFACTURE_NAME = 0x20, // Manufacture Name
|
|
|
|
@ -44,7 +45,10 @@ public:
@@ -44,7 +45,10 @@ public:
|
|
|
|
|
|
|
|
|
|
// don't allow reset of remaining capacity for SMBus
|
|
|
|
|
bool reset_remaining(float percentage) override { return false; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return true if cycle count can be provided and fills in cycles argument
|
|
|
|
|
bool get_cycle_count(uint16_t &cycles) const override; |
|
|
|
|
|
|
|
|
|
void init(void) override; |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
@ -68,6 +72,9 @@ protected:
@@ -68,6 +72,9 @@ protected:
|
|
|
|
|
// returns true if the read was successful, or the number was already known
|
|
|
|
|
bool read_serial_number(void); |
|
|
|
|
|
|
|
|
|
// reads the battery's cycle count
|
|
|
|
|
void read_cycle_count(); |
|
|
|
|
|
|
|
|
|
// read word from register
|
|
|
|
|
// returns true if read was successful, false if failed
|
|
|
|
|
bool read_word(uint8_t reg, uint16_t& data) const; |
|
|
|
@ -81,8 +88,9 @@ protected:
@@ -81,8 +88,9 @@ protected:
|
|
|
|
|
|
|
|
|
|
int32_t _serial_number = -1; // battery serial number
|
|
|
|
|
uint16_t _full_charge_capacity; // full charge capacity, used to stash the value before setting the parameter
|
|
|
|
|
|
|
|
|
|
bool _has_cell_voltages; // smbus backends flag this as true once they have recieved a valid cell voltage report
|
|
|
|
|
bool _has_cell_voltages; // smbus backends flag this as true once they have received a valid cell voltage report
|
|
|
|
|
uint16_t _cycle_count = 0; // number of cycles the battery has experienced. An amount of discharge approximately equal to the value of DesignCapacity.
|
|
|
|
|
bool _has_cycle_count; // true if cycle count has been retrieved from the battery
|
|
|
|
|
|
|
|
|
|
virtual void timer(void) = 0; // timer function to read from the battery
|
|
|
|
|
|
|
|
|
|