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

#include <GaugeAXP2602.hpp>

Inheritance diagram for GaugeAXP2602:
[legend]

Classes

struct  GaugeData
 

Public Types

enum  CurrentSenseResistor { SENSE_RESISTOR_10_MOHM = 0x00 , SENSE_RESISTOR_5_MOHM = 0x01 , SENSE_RESISTOR_20_MOHM = 0x02 , SENSE_RESISTOR_40_MOHM = 0x03 }
 
enum  IRQStatus {
  IRQ_STATUS_NONE = 0x00 , IRQ_STATUS_LOW_BATTERY = 0x01 , IRQ_STATUS_SOC_UPDATE = 0x02 , IRQ_STATUS_OVER_TEMPERATURE = 0x03 ,
  IRQ_STATUS_WDT_TIMEOUT = 0x04
}
 
enum  IRQEnable { IRQ_ENABLE_WDT_TIMEOUT = 0x08 , IRQ_ENABLE_OVER_TEMPERATURE = 0x04 , IRQ_ENABLE_SOC_UPDATE = 0x02 , IRQ_ENABLE_LOW_BATTERY = 0x01 }
 
enum  OperatingMode { OPERATING_MODE_HIGH_PRECISION = 0x00 , OPERATING_MODE_NORMAL = 0x02 , OPERATING_MODE_LOW_POWER = 0x06 }
 

Public Member Functions

 GaugeAXP2602 ()=default
 
 ~GaugeAXP2602 ()=default
 
bool begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback)
 Begin with custom callback functions.
 
bool refresh () override
 Refresh the AXP2602 chip data.
 
float getCurrentResolution (CurrentSenseResistor resistor)
 Obtain current resolution based on the sampling resistor.
 
uint16_t getChipID () override
 Get the chip ID.
 
float getTemperature () override
 Get the temperature.
 
uint8_t getBatteryStatus ()
 Get the battery health status.
 
uint16_t getStateOfCharge () override
 Get the battery percentage.
 
uint16_t getTimeToEmpty () override
 Get the battery time to empty.
 
uint16_t getTimeToFull () override
 Get the battery time to full.
 
uint8_t getLowBatterySOCThreshold ()
 Get the low battery SOC threshold.
 
uint8_t getOverTemperatureThreshold ()
 Get the over-temperature threshold.
 
float getThermalDieTemperature ()
 Get the actual die temperature.
 
uint16_t getThermalDieTemperatureRaw ()
 Get the thermal die temperature.
 
uint16_t getVoltage () override
 Get the battery voltage.
 
bool isCharging () override
 Checks if the battery is charging.
 
bool isDischarging () override
 Checks if the battery is discharging.
 
float getChargingPower ()
 Get charging power (positive or 0)
 
float getDischargingPower ()
 Get discharging power (positive or 0)
 
float getAbsolutePower ()
 Get the absolute power (always positive)
 
float getCurrent () override
 Get the actual current value (considering the sampling resistor)
 
int16_t getCurrentRaw ()
 Get the battery current.
 
void reset () override
 Reset Gauge AXP2602.
 
void sleep ()
 Put the AXP2602 chip into sleep mode.
 
bool isSleepModeEnabled ()
 Check if the AXP2602 chip is in sleep mode.
 
void wakeup ()
 Wake up the AXP2602 chip.
 
void setLowBatterySOCThreshold (uint8_t threshold)
 Set the low battery SOC threshold.
 
void setOverTemperatureThreshold (uint8_t threshold)
 Set the over-temperature threshold.
 
void setThermalDieMeasurement (bool enable)
 Enable or disable the thermal die measurement.
 
bool isThermalDieMeasurementEnabled ()
 Check if thermal die measurement is enabled.
 
void setCurrentMeasurement (bool enable)
 Enable or disable battery current detection.
 
bool isCurrentMeasurementEnabled ()
 Check if battery current measurement is enabled.
 
void setBatteryDetection (bool enable)
 Enable or disable battery voltage detection.
 
bool isBatteryVoltageMeasurementEnabled ()
 Check if battery voltage measurement is enabled.
 
void setCurrentSenseResistor (CurrentSenseResistor resistorValue)
 Set the current sense resistor value.
 
CurrentSenseResistor getCurrentSenseResistor ()
 Get the current sense resistor value.
 
IRQStatus getIRQStatus ()
 Get the IRQ status.
 
void enableIRQ (IRQEnable irq)
 Enable a specific IRQ.
 
void disableIRQ (IRQEnable irq)
 Disable a specific IRQ.
 
void disableAllIRQ ()
 Disable all IRQs.
 
void enableIRQ (IRQEnable irq, bool enable, bool low_level_trigger=true)
 Enable or disable specific IRQs.
 
void clearIRQStatus ()
 Clear the IRQ status.
 
void setOperatingMode (OperatingMode mode)
 Set the operating mode.
 
OperatingMode getOperatingMode ()
 Get the operating mode.
 
bool writeGaugeData (uint8_t *data, uint8_t len)
 Write Gauge Data.
 
bool compareGaugeData (uint8_t *data, uint8_t len)
 Compare Gauge Data.
 
void enableWDT ()
 
void disableWDT ()
 
- Public Member Functions inherited from GaugeBase
virtual ~GaugeBase ()=default
 
 GaugeBase (const GaugeBase &)=delete
 
GaugeBaseoperator= (const GaugeBase &)=delete
 
- Public Member Functions inherited from I2CDeviceWithHal
bool begin (SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
 Initialize the sensor using custom callback interface.
 
- Public Member Functions inherited from DeviceBeginCommon
virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 

Protected Attributes

GaugeData data
 
- Protected Attributes inherited from DeviceBeginCommon
std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Static Protected Attributes

static constexpr uint8_t REG_AXP2602_ID = 0x00
 
static constexpr uint8_t REG_BROM = 0x01
 
static constexpr uint8_t REG_MODE = 0x02
 
static constexpr uint8_t REG_PARA_CONFIG = 0x03
 
static constexpr uint8_t REG_VBAT_ADC_HIGH = 0x04
 
static constexpr uint8_t REG_VBAT_ADC_LOW = 0x05
 
static constexpr uint8_t REG_TEMP_RESULT = 0x06
 
static constexpr uint8_t REG_SOH = 0x07
 
static constexpr uint8_t REG_SOC = 0x08
 
static constexpr uint8_t REG_TIME_TO_EMPTY_HIGH = 0x0A
 
static constexpr uint8_t REG_TIME_TO_EMPTY_LOW = 0x0B
 
static constexpr uint8_t REG_TIME_TO_FULL_HIGH = 0x0C
 
static constexpr uint8_t REG_TIME_TO_FULL_LOW = 0x0D
 
static constexpr uint8_t REG_LOW_SOC_THLD = 0x0E
 
static constexpr uint8_t REG_OT_THLD = 0x0F
 
static constexpr uint8_t REG_COMM_CONFIG = 0x11
 
static constexpr uint8_t REG_IBAT_ADC_HIGH = 0x14
 
static constexpr uint8_t REG_IBAT_ADC_LOW = 0x15
 
static constexpr uint8_t REG_RDC25_CONFIG_HIGH = 0x1A
 
static constexpr uint8_t REG_RDC25_CONFIG_LOW = 0x1B
 
static constexpr uint8_t REG_QMAX_CONFIG_HIGH = 0x1E
 
static constexpr uint8_t REG_QMAX_CONFIG_LOW = 0x1F
 
static constexpr uint8_t REG_IRQ_STATUS = 0x20
 
static constexpr uint8_t REG_IRQ_ENABLE = 0x21
 
static constexpr uint8_t REG_TDIE_ADC_HIGH = 0xC2
 
static constexpr uint8_t REG_TDIE_ADC_LOW = 0xC3
 
static constexpr uint8_t REG_RDC25_QMAX_SEL = 0xC5
 
static constexpr uint8_t REG_OPERATING_MODE = 0xC6
 
static constexpr uint8_t AXP2602_CHIP_ID = 0x1C
 

Additional Inherited Members

- Protected Member Functions inherited from GaugeBase
 GaugeBase ()=default
 
- Protected Member Functions inherited from I2CDeviceWithHal
bool ensureValid () const override
 Ensure the communication interface is valid.
 
- Protected Member Functions inherited from DeviceBeginCommon
 DeviceBeginCommon ()=default
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void afterInitSuccess (uint8_t param)
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 

Detailed Description

Definition at line 41 of file gauge/xpowers/GaugeAXP2602.hpp.

Member Enumeration Documentation

◆ CurrentSenseResistor

Enumerator
SENSE_RESISTOR_10_MOHM 
SENSE_RESISTOR_5_MOHM 
SENSE_RESISTOR_20_MOHM 
SENSE_RESISTOR_40_MOHM 

Definition at line 44 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ IRQEnable

Enumerator
IRQ_ENABLE_WDT_TIMEOUT 
IRQ_ENABLE_OVER_TEMPERATURE 
IRQ_ENABLE_SOC_UPDATE 
IRQ_ENABLE_LOW_BATTERY 

Definition at line 59 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ IRQStatus

Enumerator
IRQ_STATUS_NONE 
IRQ_STATUS_LOW_BATTERY 
IRQ_STATUS_SOC_UPDATE 
IRQ_STATUS_OVER_TEMPERATURE 
IRQ_STATUS_WDT_TIMEOUT 

Definition at line 51 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ OperatingMode

Enumerator
OPERATING_MODE_HIGH_PRECISION 
OPERATING_MODE_NORMAL 
OPERATING_MODE_LOW_POWER 

Definition at line 65 of file gauge/xpowers/GaugeAXP2602.hpp.

Constructor & Destructor Documentation

◆ GaugeAXP2602()

GaugeAXP2602::GaugeAXP2602 ( )
default

◆ ~GaugeAXP2602()

GaugeAXP2602::~GaugeAXP2602 ( )
default

Member Function Documentation

◆ begin()

bool GaugeAXP2602::begin ( SensorCommCustom::CustomCallback  callback,
SensorCommCustomHal::CustomHalCallback  hal_callback 
)
inline

Begin with custom callback functions.

Note
This function initializes the AXP2602 chip with user-defined callback functions.
Parameters
callbackThe custom callback function for communication.
hal_callbackThe custom callback function for hardware abstraction layer.
Return values
Trueif initialization is successful, false otherwise.

Definition at line 184 of file gauge/xpowers/GaugeAXP2602.hpp.

References I2CDeviceWithHal::begin(), and hal_callback().

Referenced by setup().

◆ clearIRQStatus()

void GaugeAXP2602::clearIRQStatus ( )
inline

◆ compareGaugeData()

bool GaugeAXP2602::compareGaugeData ( uint8_t *  data,
uint8_t  len 
)
inline

Compare Gauge Data.

Note
This function compares the provided gauge data with the data in the gauge.
Parameters
*dataPointer to the data buffer to compare.
lenLength of the data buffer (should be 128 bytes).
Return values
Trueif the data matches, false otherwise.

Definition at line 786 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), data, i, SensorCommWrapper::readReg(), REG_BROM, REG_MODE, REG_PARA_CONFIG, and SensorCommWrapper::setRegBit().

Referenced by writeGaugeData().

◆ disableAllIRQ()

void GaugeAXP2602::disableAllIRQ ( )
inline

Disable all IRQs.

Note
This function disables all IRQs by writing 0x00 to the IRQ_ENABLE register.

Definition at line 673 of file gauge/xpowers/GaugeAXP2602.hpp.

References REG_IRQ_ENABLE, and SensorCommWrapper::writeReg().

◆ disableIRQ()

void GaugeAXP2602::disableIRQ ( IRQEnable  irq)
inline

Disable a specific IRQ.

Parameters
irqThe IRQ to disable.

Definition at line 664 of file gauge/xpowers/GaugeAXP2602.hpp.

References enableIRQ().

◆ disableWDT()

void GaugeAXP2602::disableWDT ( )
inline

◆ enableIRQ() [1/2]

void GaugeAXP2602::enableIRQ ( IRQEnable  irq)
inline

Enable a specific IRQ.

Parameters
irqThe IRQ to enable.

Definition at line 655 of file gauge/xpowers/GaugeAXP2602.hpp.

References enableIRQ().

Referenced by disableIRQ(), and enableIRQ().

◆ enableIRQ() [2/2]

void GaugeAXP2602::enableIRQ ( IRQEnable  irq,
bool  enable,
bool  low_level_trigger = true 
)
inline

Enable or disable specific IRQs.

Parameters
irqThe IRQ to enable or disable.
enableA boolean value to enable (true) or disable (false) the specified IRQ.
low_level_triggerA boolean value to set the IRQ trigger level.

Definition at line 684 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::readReg(), REG_IRQ_ENABLE, and SensorCommWrapper::writeReg().

◆ enableWDT()

void GaugeAXP2602::enableWDT ( )
inline

◆ getAbsolutePower()

float GaugeAXP2602::getAbsolutePower ( )
inline

Get the absolute power (always positive)

Return values
Theabsolute power (W)

Definition at line 456 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::power.

Referenced by loop().

◆ getBatteryStatus()

uint8_t GaugeAXP2602::getBatteryStatus ( )
inline

Get the battery health status.

Return values
Thebattery health status as an 8-bit unsigned integer.

Definition at line 330 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::soh.

Referenced by loop().

◆ getChargingPower()

float GaugeAXP2602::getChargingPower ( )
inline

Get charging power (positive or 0)

Return values
Chargingpower (W), returns 0 if not charging

Definition at line 438 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::current, data, and GaugeAXP2602::GaugeData::power.

Referenced by loop().

◆ getChipID()

uint16_t GaugeAXP2602::getChipID ( )
inlineoverridevirtual

Get the chip ID.

Note
This function retrieves the unique identifier for the AXP2602 chip.
Return values
Thechip ID as an integer. Default value is 0x1C for AXP2602.

Implements GaugeBase.

Definition at line 312 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::readReg(), and REG_AXP2602_ID.

◆ getCurrent()

float GaugeAXP2602::getCurrent ( )
inlineoverridevirtual

Get the actual current value (considering the sampling resistor)

Return values
Actualcurrent value (mA)

Implements GaugeBase.

Definition at line 465 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::current, and data.

Referenced by loop().

◆ getCurrentRaw()

int16_t GaugeAXP2602::getCurrentRaw ( )
inline

Get the battery current.

Return values
Thebattery current ADC value.

Definition at line 474 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::currentRaw, and data.

Referenced by loop().

◆ getCurrentResolution()

float GaugeAXP2602::getCurrentResolution ( CurrentSenseResistor  resistor)
inline

Obtain current resolution based on the sampling resistor.

Parameters
resistorSampling resistor value
Return values
Currentresolution (mA/LSB)

Definition at line 291 of file gauge/xpowers/GaugeAXP2602.hpp.

References SENSE_RESISTOR_10_MOHM, SENSE_RESISTOR_20_MOHM, SENSE_RESISTOR_40_MOHM, and SENSE_RESISTOR_5_MOHM.

Referenced by refresh().

◆ getCurrentSenseResistor()

CurrentSenseResistor GaugeAXP2602::getCurrentSenseResistor ( )
inline

Get the current sense resistor value.

Return values
Thecurrent sense resistor value.

Definition at line 636 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::senseResistor.

◆ getDischargingPower()

float GaugeAXP2602::getDischargingPower ( )
inline

Get discharging power (positive or 0)

Return values
Dischargingpower (W), returns 0 if not discharging

Definition at line 447 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::current, data, and GaugeAXP2602::GaugeData::power.

Referenced by loop().

◆ getIRQStatus()

IRQStatus GaugeAXP2602::getIRQStatus ( )
inline

Get the IRQ status.

Return values
TheIRQ status.

Definition at line 646 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::irqStatus.

Referenced by loop().

◆ getLowBatterySOCThreshold()

uint8_t GaugeAXP2602::getLowBatterySOCThreshold ( )
inline

Get the low battery SOC threshold.

Return values
Thelow battery SOC threshold as an 8-bit unsigned integer.

Definition at line 366 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::readReg(), and REG_LOW_SOC_THLD.

◆ getOperatingMode()

OperatingMode GaugeAXP2602::getOperatingMode ( )
inline

Get the operating mode.

Return values
Thecurrent operating mode.

Definition at line 738 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, GaugeAXP2602::GaugeData::operatingMode, SensorCommWrapper::readReg(), and REG_OPERATING_MODE.

◆ getOverTemperatureThreshold()

uint8_t GaugeAXP2602::getOverTemperatureThreshold ( )
inline

Get the over-temperature threshold.

Return values
Theover-temperature threshold as an 8-bit unsigned integer.

Definition at line 379 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::readReg(), and REG_OT_THLD.

◆ getStateOfCharge()

uint16_t GaugeAXP2602::getStateOfCharge ( )
inlineoverridevirtual

Get the battery percentage.

Return values
Thebattery percentage as an 8-bit unsigned integer.

Implements GaugeBase.

Definition at line 339 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::soc.

Referenced by loop().

◆ getTemperature()

float GaugeAXP2602::getTemperature ( )
inlineoverridevirtual

Get the temperature.

Return values
Thetemperature in degrees Celsius (°C).

Implements GaugeBase.

Definition at line 321 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::temperature.

Referenced by loop().

◆ getThermalDieTemperature()

float GaugeAXP2602::getThermalDieTemperature ( )
inline

Get the actual die temperature.

Return values
Actualtemperature value (°C)

Definition at line 392 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::actualDieTemperature, and data.

Referenced by loop().

◆ getThermalDieTemperatureRaw()

uint16_t GaugeAXP2602::getThermalDieTemperatureRaw ( )
inline

Get the thermal die temperature.

Return values
Thethermal die temperature ADC value.

Definition at line 401 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::tdieTemperatureRaw.

Referenced by loop().

◆ getTimeToEmpty()

uint16_t GaugeAXP2602::getTimeToEmpty ( )
inlineoverridevirtual

Get the battery time to empty.

Return values
Thebattery time to empty in minutes.

Implements GaugeBase.

Definition at line 348 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::timeToEmpty.

Referenced by loop().

◆ getTimeToFull()

uint16_t GaugeAXP2602::getTimeToFull ( )
inlineoverridevirtual

Get the battery time to full.

Return values
Thebattery time to full in minutes.

Implements GaugeBase.

Definition at line 357 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::timeToFull.

Referenced by loop().

◆ getVoltage()

uint16_t GaugeAXP2602::getVoltage ( )
inlineoverridevirtual

Get the battery voltage.

Return values
Thebattery voltage in millivolts (mV).

Implements GaugeBase.

Definition at line 410 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::voltage.

Referenced by loop().

◆ isBatteryVoltageMeasurementEnabled()

bool GaugeAXP2602::isBatteryVoltageMeasurementEnabled ( )
inline

Check if battery voltage measurement is enabled.

Return values
Trueif battery voltage measurement is enabled, false otherwise.

Definition at line 613 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::batteryDetectionEnabled, and data.

◆ isCharging()

bool GaugeAXP2602::isCharging ( )
inlineoverridevirtual

Checks if the battery is charging.

Return values
Returnstrue for charging, false for discharging

Implements GaugeBase.

Definition at line 420 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::current, and data.

Referenced by loop().

◆ isCurrentMeasurementEnabled()

bool GaugeAXP2602::isCurrentMeasurementEnabled ( )
inline

Check if battery current measurement is enabled.

Return values
Trueif battery current measurement is enabled, false otherwise.

Definition at line 590 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::currentMeasurementEnabled, and data.

◆ isDischarging()

bool GaugeAXP2602::isDischarging ( )
inlineoverridevirtual

Checks if the battery is discharging.

Return values
Returnstrue for discharging and false for charging

Implements GaugeBase.

Definition at line 429 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::current, and data.

Referenced by loop().

◆ isSleepModeEnabled()

bool GaugeAXP2602::isSleepModeEnabled ( )
inline

Check if the AXP2602 chip is in sleep mode.

Return values
Trueif the chip is in sleep mode, false otherwise.

Definition at line 504 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::getRegBit(), and REG_MODE.

Referenced by loop().

◆ isThermalDieMeasurementEnabled()

bool GaugeAXP2602::isThermalDieMeasurementEnabled ( )
inline

Check if thermal die measurement is enabled.

Return values
Trueif thermal die measurement is enabled, false otherwise.

Definition at line 567 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, and GaugeAXP2602::GaugeData::thermalDieEnabled.

◆ refresh()

◆ reset()

void GaugeAXP2602::reset ( )
inlineoverridevirtual

Reset Gauge AXP2602.

Implements GaugeBase.

Definition at line 482 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), DeviceBeginCommon::hal, REG_MODE, and SensorCommWrapper::setRegBit().

◆ setBatteryDetection()

void GaugeAXP2602::setBatteryDetection ( bool  enable)
inline

Enable or disable battery voltage detection.

Parameters
enableA boolean value to enable (true) or disable (false) the battery detection.

Definition at line 599 of file gauge/xpowers/GaugeAXP2602.hpp.

References GaugeAXP2602::GaugeData::batteryDetectionEnabled, SensorCommWrapper::clrRegBit(), data, REG_COMM_CONFIG, and SensorCommWrapper::setRegBit().

◆ setCurrentMeasurement()

void GaugeAXP2602::setCurrentMeasurement ( bool  enable)
inline

Enable or disable battery current detection.

Parameters
enableA boolean value to enable (true) or disable (false) battery current detection.

Definition at line 576 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), GaugeAXP2602::GaugeData::currentMeasurementEnabled, data, REG_COMM_CONFIG, and SensorCommWrapper::setRegBit().

◆ setCurrentSenseResistor()

void GaugeAXP2602::setCurrentSenseResistor ( CurrentSenseResistor  resistorValue)
inline

Set the current sense resistor value.

Parameters
resistorValueThe desired current sense resistor value.

Definition at line 622 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, SensorCommWrapper::readReg(), REG_COMM_CONFIG, GaugeAXP2602::GaugeData::senseResistor, and SensorCommWrapper::writeReg().

◆ setLowBatterySOCThreshold()

void GaugeAXP2602::setLowBatterySOCThreshold ( uint8_t  threshold)
inline

Set the low battery SOC threshold.

Parameters
thresholdThe low battery SOC threshold (0% to 63%).

Definition at line 523 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::readReg(), REG_LOW_SOC_THLD, and SensorCommWrapper::writeReg().

◆ setOperatingMode()

void GaugeAXP2602::setOperatingMode ( OperatingMode  mode)
inline

◆ setOverTemperatureThreshold()

void GaugeAXP2602::setOverTemperatureThreshold ( uint8_t  threshold)
inline

Set the over-temperature threshold.

Parameters
thresholdThe over-temperature threshold (0°C to 127°C).

Definition at line 541 of file gauge/xpowers/GaugeAXP2602.hpp.

References REG_OT_THLD, and SensorCommWrapper::writeReg().

◆ setThermalDieMeasurement()

void GaugeAXP2602::setThermalDieMeasurement ( bool  enable)
inline

Enable or disable the thermal die measurement.

Parameters
enableA boolean value to enable (true) or disable (false) the thermal die measurement.

Definition at line 553 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), data, REG_COMM_CONFIG, SensorCommWrapper::setRegBit(), and GaugeAXP2602::GaugeData::thermalDieEnabled.

◆ sleep()

void GaugeAXP2602::sleep ( )
inline

Put the AXP2602 chip into sleep mode.

Definition at line 493 of file gauge/xpowers/GaugeAXP2602.hpp.

References data, REG_MODE, SensorCommWrapper::setRegBit(), and GaugeAXP2602::GaugeData::sleepModeEnabled.

◆ wakeup()

void GaugeAXP2602::wakeup ( )
inline

Wake up the AXP2602 chip.

Definition at line 512 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), data, REG_MODE, and GaugeAXP2602::GaugeData::sleepModeEnabled.

◆ writeGaugeData()

bool GaugeAXP2602::writeGaugeData ( uint8_t *  data,
uint8_t  len 
)
inline

Write Gauge Data.

Note
This function writes the provided gauge data to battery parameter.
Parameters
*dataPointer to the data buffer to compare.
lenLength of the data buffer (should be 128 bytes).
Return values
Trueif the data successfully wrote to ROM by comparing with the written data, false otherwise.

Definition at line 755 of file gauge/xpowers/GaugeAXP2602.hpp.

References SensorCommWrapper::clrRegBit(), compareGaugeData(), data, DeviceBeginCommon::hal, i, REG_BROM, REG_MODE, REG_PARA_CONFIG, SensorCommWrapper::setRegBit(), and SensorCommWrapper::writeReg().

Member Data Documentation

◆ AXP2602_CHIP_ID

constexpr uint8_t GaugeAXP2602::AXP2602_CHIP_ID = 0x1C
staticconstexprprotected

Definition at line 871 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ data

◆ REG_AXP2602_ID

constexpr uint8_t GaugeAXP2602::REG_AXP2602_ID = 0x00
staticconstexprprotected

Definition at line 839 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by getChipID().

◆ REG_BROM

constexpr uint8_t GaugeAXP2602::REG_BROM = 0x01
staticconstexprprotected

Definition at line 840 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by compareGaugeData(), and writeGaugeData().

◆ REG_COMM_CONFIG

constexpr uint8_t GaugeAXP2602::REG_COMM_CONFIG = 0x11
staticconstexprprotected

◆ REG_IBAT_ADC_HIGH

constexpr uint8_t GaugeAXP2602::REG_IBAT_ADC_HIGH = 0x14
staticconstexprprotected

Definition at line 857 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_IBAT_ADC_LOW

constexpr uint8_t GaugeAXP2602::REG_IBAT_ADC_LOW = 0x15
staticconstexprprotected

Definition at line 858 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_IRQ_ENABLE

constexpr uint8_t GaugeAXP2602::REG_IRQ_ENABLE = 0x21
staticconstexprprotected

Definition at line 865 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by disableAllIRQ(), and enableIRQ().

◆ REG_IRQ_STATUS

constexpr uint8_t GaugeAXP2602::REG_IRQ_STATUS = 0x20
staticconstexprprotected

Definition at line 864 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by clearIRQStatus(), and refresh().

◆ REG_LOW_SOC_THLD

constexpr uint8_t GaugeAXP2602::REG_LOW_SOC_THLD = 0x0E
staticconstexprprotected

◆ REG_MODE

constexpr uint8_t GaugeAXP2602::REG_MODE = 0x02
staticconstexprprotected

◆ REG_OPERATING_MODE

constexpr uint8_t GaugeAXP2602::REG_OPERATING_MODE = 0xC6
staticconstexprprotected

Definition at line 869 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by getOperatingMode(), and setOperatingMode().

◆ REG_OT_THLD

constexpr uint8_t GaugeAXP2602::REG_OT_THLD = 0x0F
staticconstexprprotected

◆ REG_PARA_CONFIG

constexpr uint8_t GaugeAXP2602::REG_PARA_CONFIG = 0x03
staticconstexprprotected

◆ REG_QMAX_CONFIG_HIGH

constexpr uint8_t GaugeAXP2602::REG_QMAX_CONFIG_HIGH = 0x1E
staticconstexprprotected

Definition at line 861 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ REG_QMAX_CONFIG_LOW

constexpr uint8_t GaugeAXP2602::REG_QMAX_CONFIG_LOW = 0x1F
staticconstexprprotected

Definition at line 862 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ REG_RDC25_CONFIG_HIGH

constexpr uint8_t GaugeAXP2602::REG_RDC25_CONFIG_HIGH = 0x1A
staticconstexprprotected

Definition at line 859 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ REG_RDC25_CONFIG_LOW

constexpr uint8_t GaugeAXP2602::REG_RDC25_CONFIG_LOW = 0x1B
staticconstexprprotected

Definition at line 860 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ REG_RDC25_QMAX_SEL

constexpr uint8_t GaugeAXP2602::REG_RDC25_QMAX_SEL = 0xC5
staticconstexprprotected

Definition at line 868 of file gauge/xpowers/GaugeAXP2602.hpp.

◆ REG_SOC

constexpr uint8_t GaugeAXP2602::REG_SOC = 0x08
staticconstexprprotected

Definition at line 847 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_SOH

constexpr uint8_t GaugeAXP2602::REG_SOH = 0x07
staticconstexprprotected

Definition at line 846 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TDIE_ADC_HIGH

constexpr uint8_t GaugeAXP2602::REG_TDIE_ADC_HIGH = 0xC2
staticconstexprprotected

Definition at line 866 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TDIE_ADC_LOW

constexpr uint8_t GaugeAXP2602::REG_TDIE_ADC_LOW = 0xC3
staticconstexprprotected

Definition at line 867 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TEMP_RESULT

constexpr uint8_t GaugeAXP2602::REG_TEMP_RESULT = 0x06
staticconstexprprotected

Definition at line 845 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TIME_TO_EMPTY_HIGH

constexpr uint8_t GaugeAXP2602::REG_TIME_TO_EMPTY_HIGH = 0x0A
staticconstexprprotected

Definition at line 849 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TIME_TO_EMPTY_LOW

constexpr uint8_t GaugeAXP2602::REG_TIME_TO_EMPTY_LOW = 0x0B
staticconstexprprotected

Definition at line 850 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TIME_TO_FULL_HIGH

constexpr uint8_t GaugeAXP2602::REG_TIME_TO_FULL_HIGH = 0x0C
staticconstexprprotected

Definition at line 851 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_TIME_TO_FULL_LOW

constexpr uint8_t GaugeAXP2602::REG_TIME_TO_FULL_LOW = 0x0D
staticconstexprprotected

Definition at line 852 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_VBAT_ADC_HIGH

constexpr uint8_t GaugeAXP2602::REG_VBAT_ADC_HIGH = 0x04
staticconstexprprotected

Definition at line 843 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().

◆ REG_VBAT_ADC_LOW

constexpr uint8_t GaugeAXP2602::REG_VBAT_ADC_LOW = 0x05
staticconstexprprotected

Definition at line 844 of file gauge/xpowers/GaugeAXP2602.hpp.

Referenced by refresh().


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