SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
BatteryStatus Class Reference

#include <GaugeBQ27220.hpp>

Public Member Functions

 BatteryStatus (uint16_t bitmaps)
 Constructor for BatteryStatus class.
 
bool isFullDischargeDetected () const
 Check if full discharge is detected.
 
bool isOcvMeasurementUpdateComplete () const
 Check if the OCV measurement update is complete.
 
bool isOcvReadFailedDueToCurrent () const
 Check if the OCV read failed due to current.
 
bool isInSleepMode () const
 Check if the device is in sleep mode.
 
bool isOverTemperatureDuringCharging () const
 Check if over-temperature is detected during charging.
 
bool isOverTemperatureDuringDischarge () const
 Check if over-temperature is detected during discharge.
 
bool isFullChargeDetected () const
 Check if full charge is detected.
 
bool isChargeInhibited () const
 Check if charging is inhibited.
 
bool isChargingTerminationAlarm () const
 Check if the charging termination alarm is triggered.
 
bool isGoodOcvMeasurement () const
 Check if a good OCV measurement was made.
 
bool isBatteryInserted () const
 Check if a battery is inserted.
 
bool isBatteryPresent () const
 Check if a battery is present.
 
bool isDischargeTerminationAlarm () const
 Check if the discharge termination alarm is triggered.
 
bool isSystemShutdownRequired () const
 Check if system shutdown is required.
 
bool isInDischargeMode () const
 Check if the device is in discharge mode.
 

Protected Attributes

struct { 
 
   bool   fullDischargeDetected 
 
   bool   ocvMeasurementUpdateComplete 
 
   bool   ocvReadFailedDueToCurrent 
 
   bool   inSleepMode 
 
   bool   overTemperatureDuringCharging 
 
   bool   overTemperatureDuringDischarge 
 
   bool   fullChargeDetected 
 
   bool   chargeInhibited 
 
   bool   chargingTerminationAlarm 
 
   bool   goodOcvMeasurement 
 
   bool   batteryInserted 
 
   bool   batteryPresent 
 
   bool   dischargeTerminationAlarm 
 
   bool   systemShutdownRequired 
 
   bool   inDischargeMode 
 
status 
 

Detailed Description

Definition at line 112 of file gauge/ti/GaugeBQ27220.hpp.

Constructor & Destructor Documentation

◆ BatteryStatus()

BatteryStatus::BatteryStatus ( uint16_t  bitmaps)
inline

Constructor for BatteryStatus class.

Initializes the battery status fields based on the given 16-bit bitmaps.

Parameters
bitmapsA 16-bit unsigned integer representing the battery status bitmaps.

Definition at line 158 of file gauge/ti/GaugeBQ27220.hpp.

References sensorlib::_bv(), and status.

Member Function Documentation

◆ isBatteryInserted()

bool BatteryStatus::isBatteryInserted ( ) const
inline

Check if a battery is inserted.

Returns
True if a battery is inserted, false otherwise.

Definition at line 272 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isBatteryPresent()

bool BatteryStatus::isBatteryPresent ( ) const
inline

Check if a battery is present.

Returns
True if a battery is present, false otherwise.

Definition at line 280 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isChargeInhibited()

bool BatteryStatus::isChargeInhibited ( ) const
inline

Check if charging is inhibited.

If set, indicates that charging should not begin because the Temperature() is outside the range [Charge Inhibit Temp Low, Charge Inhibit Temp High].

Returns
True if charging is inhibited, false otherwise.

Definition at line 247 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isChargingTerminationAlarm()

bool BatteryStatus::isChargingTerminationAlarm ( ) const
inline

Check if the charging termination alarm is triggered.

This flag is set and cleared based on the selected SOC Flag Config A option.

Returns
True if the charging termination alarm is triggered, false otherwise.

Definition at line 256 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isDischargeTerminationAlarm()

bool BatteryStatus::isDischargeTerminationAlarm ( ) const
inline

Check if the discharge termination alarm is triggered.

This flag is set and cleared according to the selected SOC Flag Config A option.

Returns
True if the discharge termination alarm is triggered, false otherwise.

Definition at line 289 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isFullChargeDetected()

bool BatteryStatus::isFullChargeDetected ( ) const
inline

Check if full charge is detected.

This flag is set and cleared based on the SOC Flag Config A and SOC Flag Config B options selected.

Returns
True if full charge is detected, false otherwise.

Definition at line 238 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isFullDischargeDetected()

bool BatteryStatus::isFullDischargeDetected ( ) const
inline

Check if full discharge is detected.

This flag is set and cleared based on the SOC Flag Config B option selected.

Returns
True if full discharge is detected, false otherwise.

Definition at line 185 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isGoodOcvMeasurement()

bool BatteryStatus::isGoodOcvMeasurement ( ) const
inline

Check if a good OCV measurement was made.

Returns
True if a good OCV measurement was made, false otherwise.

Definition at line 264 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isInDischargeMode()

bool BatteryStatus::isInDischargeMode ( ) const
inline

Check if the device is in discharge mode.

When set, the device is in DISCHARGE mode; when cleared, the device is in CHARGING or RELAXATION mode.

Returns
True if the device is in discharge mode, false otherwise.

Definition at line 307 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isInSleepMode()

bool BatteryStatus::isInSleepMode ( ) const
inline

Check if the device is in sleep mode.

This bit will be temporarily cleared during AD measurements in SLEEP mode.

Returns
True if the device is in sleep mode, false otherwise.

Definition at line 211 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isOcvMeasurementUpdateComplete()

bool BatteryStatus::isOcvMeasurementUpdateComplete ( ) const
inline

Check if the OCV measurement update is complete.

Returns
True if the OCV measurement update is complete, false otherwise.

Definition at line 193 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isOcvReadFailedDueToCurrent()

bool BatteryStatus::isOcvReadFailedDueToCurrent ( ) const
inline

Check if the OCV read failed due to current.

This bit can only be set if a battery is present after receiving an OCV_CMD().

Returns
True if the OCV read failed due to current, false otherwise.

Definition at line 202 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isOverTemperatureDuringCharging()

bool BatteryStatus::isOverTemperatureDuringCharging ( ) const
inline

Check if over-temperature is detected during charging.

If Operation Config B [INT_OT] bit = 1, the SOC_INT pin toggles once when the [OTC] bit is set.

Returns
True if over-temperature is detected during charging, false otherwise.

Definition at line 220 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isOverTemperatureDuringDischarge()

bool BatteryStatus::isOverTemperatureDuringDischarge ( ) const
inline

Check if over-temperature is detected during discharge.

If Operation Config B [INT_OT] bit = 1, the SOC_INT pin toggles once when the [OTD] bit is set.

Returns
True if over-temperature is detected during discharge, false otherwise.

Definition at line 229 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

◆ isSystemShutdownRequired()

bool BatteryStatus::isSystemShutdownRequired ( ) const
inline

Check if system shutdown is required.

If set, the SOC_INT pin toggles once.

Returns
True if system shutdown is required, false otherwise.

Definition at line 298 of file gauge/ti/GaugeBQ27220.hpp.

References status.

Referenced by loop().

Member Data Documentation

◆ batteryInserted

bool BatteryStatus::batteryInserted

Definition at line 142 of file gauge/ti/GaugeBQ27220.hpp.

◆ batteryPresent

bool BatteryStatus::batteryPresent

Definition at line 144 of file gauge/ti/GaugeBQ27220.hpp.

◆ chargeInhibited

bool BatteryStatus::chargeInhibited

Definition at line 136 of file gauge/ti/GaugeBQ27220.hpp.

◆ chargingTerminationAlarm

bool BatteryStatus::chargingTerminationAlarm

Definition at line 138 of file gauge/ti/GaugeBQ27220.hpp.

◆ dischargeTerminationAlarm

bool BatteryStatus::dischargeTerminationAlarm

Definition at line 146 of file gauge/ti/GaugeBQ27220.hpp.

◆ fullChargeDetected

bool BatteryStatus::fullChargeDetected

Definition at line 133 of file gauge/ti/GaugeBQ27220.hpp.

◆ fullDischargeDetected

bool BatteryStatus::fullDischargeDetected

Definition at line 117 of file gauge/ti/GaugeBQ27220.hpp.

◆ goodOcvMeasurement

bool BatteryStatus::goodOcvMeasurement

Definition at line 140 of file gauge/ti/GaugeBQ27220.hpp.

◆ inDischargeMode

bool BatteryStatus::inDischargeMode

Definition at line 150 of file gauge/ti/GaugeBQ27220.hpp.

◆ inSleepMode

bool BatteryStatus::inSleepMode

Definition at line 125 of file gauge/ti/GaugeBQ27220.hpp.

◆ ocvMeasurementUpdateComplete

bool BatteryStatus::ocvMeasurementUpdateComplete

Definition at line 119 of file gauge/ti/GaugeBQ27220.hpp.

◆ ocvReadFailedDueToCurrent

bool BatteryStatus::ocvReadFailedDueToCurrent

Definition at line 122 of file gauge/ti/GaugeBQ27220.hpp.

◆ overTemperatureDuringCharging

bool BatteryStatus::overTemperatureDuringCharging

Definition at line 128 of file gauge/ti/GaugeBQ27220.hpp.

◆ overTemperatureDuringDischarge

bool BatteryStatus::overTemperatureDuringDischarge

Definition at line 131 of file gauge/ti/GaugeBQ27220.hpp.

◆ [struct]

◆ systemShutdownRequired

bool BatteryStatus::systemShutdownRequired

Definition at line 148 of file gauge/ti/GaugeBQ27220.hpp.


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