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

#include <AXP2101Charger.hpp>

Inheritance diagram for AXP2101Charger:
[legend]

Public Member Functions

 AXP2101Charger (AXP2101Core &core)
 Construct AXP2101Charger with a reference to the AXP2101Core.
 
 ~AXP2101Charger ()=default
 
bool enableCharging (bool enable) override
 Enable or disable battery charging.
 
bool isCharging () override
 Check if the charger is actively charging.
 
bool setPreChargeCurrent (uint16_t mA) override
 Set the precharge current limit (REG 0x61, bits 3:0).
 
uint16_t getPreChargeCurrent () override
 Get the configured precharge current (REG 0x61, bits 3:0).
 
bool setFastChargeCurrent (uint16_t mA) override
 Set the fast-charge current limit (REG 0x62, bits 4:0).
 
uint16_t getFastChargeCurrent () override
 Get the configured fast-charge current (REG 0x62, bits 4:0).
 
bool setTerminationCurrent (uint16_t mA) override
 Set the charge termination current (REG 0x63, bits 3:0).
 
uint16_t getTerminationCurrent () override
 Get the configured termination current (REG 0x63, bits 3:0).
 
bool setChargeVoltage (uint16_t mV) override
 Set the charge voltage target (REG 0x64, bits 2:0).
 
uint16_t getChargeVoltage () override
 Get the configured charge voltage target (REG 0x64, bits 2:0).
 
Status getStatus () override
 Get the current charger status.
 
void enableChargeTermination ()
 Enable charge termination detection (REG 0x63, bit 4).
 
void disableChargeTermination ()
 Disable charge termination detection (REG 0x63, bit 4).
 
bool isChargeTerminationEnabled ()
 Check if charge termination detection is enabled (REG 0x63, bit 4).
 
void enableButtonBatteryCharge ()
 Enable button/coin-cell battery charging (REG 0x18, bit 2).
 
void disableButtonBatteryCharge ()
 Disable button/coin-cell battery charging (REG 0x18, bit 2).
 
bool isButtonBatteryChargeEnabled ()
 Check if button battery charging is enabled (REG 0x18, bit 2).
 
bool setButtonBatteryChargeVoltage (uint16_t millivolt)
 Set the button battery charge voltage (REG 0x6A, bits 2:0).
 
uint16_t getButtonBatteryChargeVoltage ()
 Get the configured button battery charge voltage (REG 0x6A, bits 2:0).
 
void enableBatteryDetection ()
 Enable battery detection (REG 0x68, bit 0).
 
void disableBatteryDetection ()
 Disable battery detection (REG 0x68, bit 0).
 
bool isBatteryDetectionEnabled ()
 Check if battery detection is enabled (REG 0x68, bit 0).
 
void setPreChargeSafetyTimer (uint8_t opt)
 Set the precharge safety timer (REG 0x67, bits 2:0).
 
void setChargeDoneSafetyTimer (uint8_t opt)
 Set the charge-done safety timer (REG 0x67, bits 6:4).
 
void setThermalRegulationThreshold (uint8_t opt)
 Set the thermal regulation threshold (REG 0x65, bits 1:0).
 
uint8_t getThermalRegulationThreshold ()
 Get the thermal regulation threshold (REG 0x65, bits 1:0).
 
bool enableJeita (bool enable)
 Enable or disable JEITA temperature standard.
 
bool isJeitaEnabled ()
 Check if JEITA temperature standard is enabled.
 
bool setChargeLowTempFaultThreshold (uint8_t val)
 Set charge low-temperature fault threshold (REG 54, VLTF_CHG).
 
uint8_t getChargeLowTempFaultThreshold ()
 Get charge low-temperature fault threshold (REG 54, VLTF_CHG).
 
bool setChargeHighTempFaultThreshold (uint8_t val)
 Set charge high-temperature fault threshold (REG 55, VHTF_CHG).
 
uint8_t getChargeHighTempFaultThreshold ()
 Get charge high-temperature fault threshold (REG 55, VHTF_CHG).
 
bool setWorkLowTempFaultThreshold (uint8_t val)
 Set work low-temperature fault threshold (REG 56, VLTF_WORK).
 
uint8_t getWorkLowTempFaultThreshold ()
 Get work low-temperature fault threshold (REG 56, VLTF_WORK).
 
bool setWorkHighTempFaultThreshold (uint8_t val)
 Set work high-temperature fault threshold (REG 57, VHTF_WORK).
 
uint8_t getWorkHighTempFaultThreshold ()
 Get work high-temperature fault threshold (REG 57, VHTF_WORK).
 
bool setLowTempHysteresis (uint8_t val)
 Set low-temperature hysteresis (REG 52, HYSL2H).
 
uint8_t getLowTempHysteresis ()
 Get low-temperature hysteresis (REG 52, HYSL2H).
 
bool setHighTempHysteresis (uint8_t val)
 Set high-temperature hysteresis (REG 53, HYSH2L).
 
uint8_t getHighTempHysteresis ()
 Get high-temperature hysteresis (REG 53, HYSH2L).
 
bool setJeitaWarmCurrentReduction (bool reduce)
 Set warm-zone current reduction in JEITA.
 
bool getJeitaWarmCurrentReduction ()
 Get warm-zone current reduction setting in JEITA (REG 0x59).
 
bool setJeitaCoolCurrentReduction (bool reduce)
 Set cool-zone current reduction in JEITA.
 
bool getJeitaCoolCurrentReduction ()
 Get cool-zone current reduction setting in JEITA (REG 0x59).
 
bool setJeitaWarmVoltageDrop (uint8_t levels)
 Set warm-zone voltage drop levels in JEITA.
 
uint8_t getJeitaWarmVoltageDrop ()
 Get warm-zone voltage drop levels in JEITA (REG 0x59).
 
bool setJeitaCoolVoltageDrop (uint8_t levels)
 Set cool-zone voltage drop levels in JEITA.
 
uint8_t getJeitaCoolVoltageDrop ()
 Get cool-zone voltage drop levels in JEITA (REG 0x59).
 
bool setJeitaCoolThreshold (uint8_t val)
 Set JEITA cool temperature threshold T2 (REG 5B low nibble).
 
uint8_t getJeitaCoolThreshold ()
 Get JEITA cool temperature threshold T2 (REG 5B low nibble).
 
bool setJeitaWarmThreshold (uint8_t val)
 Set JEITA warm temperature threshold T3 (REG 5B high nibble).
 
uint8_t getJeitaWarmThreshold ()
 Get JEITA warm temperature threshold T3 (REG 5B high nibble).
 
- Public Member Functions inherited from PmicChargerBase
virtual ~PmicChargerBase ()=default
 Virtual destructor.
 

Additional Inherited Members

- Public Types inherited from PmicChargerBase
enum class  ChargingStatus : uint8_t {
  NO_CHARGING = 0 , PRE_CHARGE = 1 , FAST_CHARGE = 2 , TERMINATION = 3 ,
  UNKNOWN = 0xFF
}
 Charging status enumeration. More...
 

Detailed Description

Definition at line 35 of file AXP2101Charger.hpp.

Constructor & Destructor Documentation

◆ AXP2101Charger()

AXP2101Charger::AXP2101Charger ( AXP2101Core core)
explicit

Construct AXP2101Charger with a reference to the AXP2101Core.

Parameters
coreReference to the AXP2101Core providing register access.

Definition at line 38 of file AXP2101Charger.cpp.

◆ ~AXP2101Charger()

AXP2101Charger::~AXP2101Charger ( )
default

Member Function Documentation

◆ disableBatteryDetection()

void AXP2101Charger::disableBatteryDetection ( )

Disable battery detection (REG 0x68, bit 0).

Definition at line 243 of file AXP2101Charger.cpp.

References axp2101_regs::chg::BAT_DETECT_CTRL, and SensorCommWrapper::clrRegBit().

◆ disableButtonBatteryCharge()

void AXP2101Charger::disableButtonBatteryCharge ( )

Disable button/coin-cell battery charging (REG 0x18, bit 2).

Definition at line 208 of file AXP2101Charger.cpp.

References SensorCommWrapper::clrRegBit(), and axp2101_regs::ctrl::MODULE_EN.

◆ disableChargeTermination()

void AXP2101Charger::disableChargeTermination ( )

Disable charge termination detection (REG 0x63, bit 4).

Charging will not automatically stop based on termination current.

Definition at line 187 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ITERM_CTRL, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ enableBatteryDetection()

void AXP2101Charger::enableBatteryDetection ( )

Enable battery detection (REG 0x68, bit 0).

When enabled, the charger detects whether a battery is connected.

Definition at line 238 of file AXP2101Charger.cpp.

References axp2101_regs::chg::BAT_DETECT_CTRL, and SensorCommWrapper::setRegBit().

◆ enableButtonBatteryCharge()

void AXP2101Charger::enableButtonBatteryCharge ( )

Enable button/coin-cell battery charging (REG 0x18, bit 2).

Definition at line 203 of file AXP2101Charger.cpp.

References axp2101_regs::ctrl::MODULE_EN, and SensorCommWrapper::setRegBit().

◆ enableChargeTermination()

void AXP2101Charger::enableChargeTermination ( )

Enable charge termination detection (REG 0x63, bit 4).

When enabled, charging stops when current drops below the termination current threshold.

Definition at line 180 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ITERM_CTRL, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ enableCharging()

bool AXP2101Charger::enableCharging ( bool  enable)
overridevirtual

Enable or disable battery charging.

Controls the charge enable bit in REG 0x18.

Parameters
enabletrue to enable charging, false to disable.
Returns
true on success.

Implements PmicChargerBase.

Definition at line 42 of file AXP2101Charger.cpp.

References AXP2101Core::CELL_CHARGE, and AXP2101Core::enableModule().

◆ enableJeita()

bool AXP2101Charger::enableJeita ( bool  enable)

Enable or disable JEITA temperature standard.

Parameters
enabletrue to enable, false to disable.
Returns
true on success.

Definition at line 296 of file AXP2101Charger.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::jeita::EN_CTRL, and SensorCommWrapper::setRegBit().

◆ getButtonBatteryChargeVoltage()

uint16_t AXP2101Charger::getButtonBatteryChargeVoltage ( )

Get the configured button battery charge voltage (REG 0x6A, bits 2:0).

Returns
Charge voltage in millivolts (2600-3300).

Definition at line 229 of file AXP2101Charger.cpp.

References axp2101_regs::chg::BTN_BAT_CHG_VOL, and SensorCommWrapper::readReg().

◆ getChargeHighTempFaultThreshold()

uint8_t AXP2101Charger::getChargeHighTempFaultThreshold ( )

Get charge high-temperature fault threshold (REG 55, VHTF_CHG).

Returns
Raw register value. VHTF = val * 2 mV.

Definition at line 325 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::VHTF_CHG.

◆ getChargeLowTempFaultThreshold()

uint8_t AXP2101Charger::getChargeLowTempFaultThreshold ( )

Get charge low-temperature fault threshold (REG 54, VLTF_CHG).

Returns
Raw register value. VLTF = val * 32 mV.

Definition at line 314 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::VLTF_CHG.

◆ getChargeVoltage()

uint16_t AXP2101Charger::getChargeVoltage ( )
overridevirtual

Get the configured charge voltage target (REG 0x64, bits 2:0).

Returns
Charge voltage in millivolts (e.g. 4200, 4350, etc.).

Implements PmicChargerBase.

Definition at line 130 of file AXP2101Charger.cpp.

References axp2101_regs::chg::CV_CHG_VOLTAGE, and SensorCommWrapper::readReg().

◆ getFastChargeCurrent()

uint16_t AXP2101Charger::getFastChargeCurrent ( )
overridevirtual

Get the configured fast-charge current (REG 0x62, bits 4:0).

For N <= 8: current = 25 * N mA. For N > 8: current = 200 + 100 * (N - 8) mA.

Returns
Fast-charge current in milliamps (0-1000).

Implements PmicChargerBase.

Definition at line 84 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ICC_SETTING, and SensorCommWrapper::readReg().

◆ getHighTempHysteresis()

uint8_t AXP2101Charger::getHighTempHysteresis ( )

Get high-temperature hysteresis (REG 53, HYSH2L).

Returns
Raw register value. Hysteresis = val * 4 mV.

Definition at line 371 of file AXP2101Charger.cpp.

References axp2101_regs::ts::HYSH2L, and SensorCommWrapper::readReg().

◆ getJeitaCoolCurrentReduction()

bool AXP2101Charger::getJeitaCoolCurrentReduction ( )

Get cool-zone current reduction setting in JEITA (REG 0x59).

Returns
true if current is reduced to 50% in cool zone, false for 100%.

Definition at line 396 of file AXP2101Charger.cpp.

References SensorCommWrapper::getRegBit(), and axp2101_regs::jeita::SET0.

◆ getJeitaCoolThreshold()

uint8_t AXP2101Charger::getJeitaCoolThreshold ( )

Get JEITA cool temperature threshold T2 (REG 5B low nibble).

Returns
Raw register value. VHTF = val * 16 mV.

Definition at line 447 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::SET2.

◆ getJeitaCoolVoltageDrop()

uint8_t AXP2101Charger::getJeitaCoolVoltageDrop ( )

Get cool-zone voltage drop levels in JEITA (REG 0x59).

Returns
Voltage drop level (0=0mV, 1=1 level, 2=2 levels).

Definition at line 428 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::SET0.

◆ getJeitaWarmCurrentReduction()

bool AXP2101Charger::getJeitaWarmCurrentReduction ( )

Get warm-zone current reduction setting in JEITA (REG 0x59).

Returns
true if current is reduced to 50% in warm zone, false for 100%.

Definition at line 385 of file AXP2101Charger.cpp.

References SensorCommWrapper::getRegBit(), and axp2101_regs::jeita::SET0.

◆ getJeitaWarmThreshold()

uint8_t AXP2101Charger::getJeitaWarmThreshold ( )

Get JEITA warm temperature threshold T3 (REG 5B high nibble).

Returns
Raw register value. VHTF = val * 8 mV.

Definition at line 464 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::SET2.

◆ getJeitaWarmVoltageDrop()

uint8_t AXP2101Charger::getJeitaWarmVoltageDrop ( )

Get warm-zone voltage drop levels in JEITA (REG 0x59).

Returns
Voltage drop level (0=0mV, 1=1 level, 2=2 levels).

Definition at line 411 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::SET0.

◆ getLowTempHysteresis()

uint8_t AXP2101Charger::getLowTempHysteresis ( )

Get low-temperature hysteresis (REG 52, HYSL2H).

Returns
Raw register value. Hysteresis = val * 16 mV.

Definition at line 360 of file AXP2101Charger.cpp.

References axp2101_regs::ts::HYSL2H, and SensorCommWrapper::readReg().

◆ getPreChargeCurrent()

uint16_t AXP2101Charger::getPreChargeCurrent ( )
overridevirtual

Get the configured precharge current (REG 0x61, bits 3:0).

Current = 25 * N mA.

Returns
Precharge current in milliamps (0-200).

Implements PmicChargerBase.

Definition at line 62 of file AXP2101Charger.cpp.

References axp2101_regs::chg::IPRECHG_SET, and SensorCommWrapper::readReg().

◆ getStatus()

AXP2101Charger::Status AXP2101Charger::getStatus ( )
overridevirtual

Get the current charger status.

Reads STATUS1 (REG 0x00) and STATUS2 (REG 0x01). STATUS1 bit 5 = VBUS present, bit 3 = battery present. STATUS2 bits 2:0 = charge phase (0=no charging, 1=precharge, 2/3=CC, 4=done, 5+=no charging).

Returns
Status struct with vbusPresent, batteryPresent, and chargePhase fields.

Implements PmicChargerBase.

Definition at line 145 of file AXP2101Charger.cpp.

References PmicChargerBase::FAST_CHARGE, PmicChargerBase::NO_CHARGING, PmicChargerBase::PRE_CHARGE, SensorCommWrapper::readReg(), axp2101_regs::bmu::STATUS1, axp2101_regs::bmu::STATUS2, and PmicChargerBase::TERMINATION.

Referenced by isCharging().

◆ getTerminationCurrent()

uint16_t AXP2101Charger::getTerminationCurrent ( )
overridevirtual

Get the configured termination current (REG 0x63, bits 3:0).

Current = 25 * N mA.

Returns
Termination current in milliamps (0-200).

Implements PmicChargerBase.

Definition at line 105 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ITERM_CTRL, and SensorCommWrapper::readReg().

◆ getThermalRegulationThreshold()

uint8_t AXP2101Charger::getThermalRegulationThreshold ( )

Get the thermal regulation threshold (REG 0x65, bits 1:0).

Returns
Threshold option (0=60°C, 1=80°C, 2=100°C, 3=120°C).

Definition at line 287 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::chg::THERMAL_REG_THRESH.

◆ getWorkHighTempFaultThreshold()

uint8_t AXP2101Charger::getWorkHighTempFaultThreshold ( )

Get work high-temperature fault threshold (REG 57, VHTF_WORK).

Returns
Raw register value. VHTF = val * 2 mV.

Definition at line 347 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::VHTF_WORK.

◆ getWorkLowTempFaultThreshold()

uint8_t AXP2101Charger::getWorkLowTempFaultThreshold ( )

Get work low-temperature fault threshold (REG 56, VLTF_WORK).

Returns
Raw register value. VLTF = val * 32 mV.

Definition at line 336 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), and axp2101_regs::jeita::VLTF_WORK.

◆ isBatteryDetectionEnabled()

bool AXP2101Charger::isBatteryDetectionEnabled ( )

Check if battery detection is enabled (REG 0x68, bit 0).

Returns
true if battery detection is enabled.

Definition at line 248 of file AXP2101Charger.cpp.

References axp2101_regs::chg::BAT_DETECT_CTRL, and SensorCommWrapper::getRegBit().

◆ isButtonBatteryChargeEnabled()

bool AXP2101Charger::isButtonBatteryChargeEnabled ( )

Check if button battery charging is enabled (REG 0x18, bit 2).

Returns
true if button battery charge is enabled.

Definition at line 213 of file AXP2101Charger.cpp.

References SensorCommWrapper::getRegBit(), and axp2101_regs::ctrl::MODULE_EN.

◆ isChargeTerminationEnabled()

bool AXP2101Charger::isChargeTerminationEnabled ( )

Check if charge termination detection is enabled (REG 0x63, bit 4).

Returns
true if charge termination is enabled.

Definition at line 194 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ITERM_CTRL, and SensorCommWrapper::readReg().

◆ isCharging()

bool AXP2101Charger::isCharging ( )
overridevirtual

Check if the charger is actively charging.

Reads STATUS2 (REG 0x01) bits 2:0 to determine charge phase.

Returns
true if charging is in progress (precharge, CC, or CV phase).

Implements PmicChargerBase.

Definition at line 47 of file AXP2101Charger.cpp.

References PmicChargerBase::Status::charging, and getStatus().

Referenced by PmicAXP2101::isCharging().

◆ isJeitaEnabled()

bool AXP2101Charger::isJeitaEnabled ( )

Check if JEITA temperature standard is enabled.

Returns
true if enabled.

Definition at line 302 of file AXP2101Charger.cpp.

References axp2101_regs::jeita::EN_CTRL, and SensorCommWrapper::getRegBit().

◆ setButtonBatteryChargeVoltage()

bool AXP2101Charger::setButtonBatteryChargeVoltage ( uint16_t  millivolt)

Set the button battery charge voltage (REG 0x6A, bits 2:0).

Valid range: 2600-3300 mV in 100 mV steps.

Parameters
millivoltDesired voltage in millivolts (2600-3300).
Returns
true on success.

Definition at line 218 of file AXP2101Charger.cpp.

References axp2101_regs::chg::BTN_BAT_CHG_VOL, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setChargeDoneSafetyTimer()

void AXP2101Charger::setChargeDoneSafetyTimer ( uint8_t  opt)

Set the charge-done safety timer (REG 0x67, bits 6:4).

bit 6 = timer enable. bits 5:4 select timeout: 0=5h, 1=8h, 2=12h, 3=20h.

Parameters
optTimer option value (bits 6:4). Bit 6 enables, bits 5:4 select duration.

Definition at line 265 of file AXP2101Charger.cpp.

References axp2101_regs::chg::CHG_TIMER_CFG, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setChargeHighTempFaultThreshold()

bool AXP2101Charger::setChargeHighTempFaultThreshold ( uint8_t  val)

Set charge high-temperature fault threshold (REG 55, VHTF_CHG).

Parameters
valRaw register value. VHTF = val * 2 mV. Default 0x58 (~45°C).
Returns
true on success.

Definition at line 320 of file AXP2101Charger.cpp.

References axp2101_regs::jeita::VHTF_CHG, and SensorCommWrapper::writeReg().

◆ setChargeLowTempFaultThreshold()

bool AXP2101Charger::setChargeLowTempFaultThreshold ( uint8_t  val)

Set charge low-temperature fault threshold (REG 54, VLTF_CHG).

Parameters
valRaw register value. VLTF = val * 32 mV. Default 0x29 (~0°C).
Returns
true on success.

Definition at line 309 of file AXP2101Charger.cpp.

References axp2101_regs::jeita::VLTF_CHG, and SensorCommWrapper::writeReg().

◆ setChargeVoltage()

bool AXP2101Charger::setChargeVoltage ( uint16_t  mV)
overridevirtual

Set the charge voltage target (REG 0x64, bits 2:0).

Valid values: 0=5.0V, 1=4.0V, 2=4.1V, 3=4.2V, 4=4.35V, 5=4.4V.

Parameters
mVDesired charge voltage in millivolts.
Returns
true on success.

Implements PmicChargerBase.

Definition at line 112 of file AXP2101Charger.cpp.

References axp2101_regs::chg::CV_CHG_VOLTAGE, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setFastChargeCurrent()

bool AXP2101Charger::setFastChargeCurrent ( uint16_t  mA)
overridevirtual

Set the fast-charge current limit (REG 0x62, bits 4:0).

For N <= 8: current = 25 * N mA. For N > 8: current = 200 + 100 * (N - 8) mA. Maximum 1000 mA.

Parameters
mADesired fast-charge current in milliamps (0-1000).
Returns
true on success.

Implements PmicChargerBase.

Definition at line 69 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ICC_SETTING, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setHighTempHysteresis()

bool AXP2101Charger::setHighTempHysteresis ( uint8_t  val)

Set high-temperature hysteresis (REG 53, HYSH2L).

Parameters
valRaw register value. Hysteresis = val * 4 mV. Default 0x01 (4mV).
Returns
true on success.

Definition at line 366 of file AXP2101Charger.cpp.

References axp2101_regs::ts::HYSH2L, and SensorCommWrapper::writeReg().

◆ setJeitaCoolCurrentReduction()

bool AXP2101Charger::setJeitaCoolCurrentReduction ( bool  reduce)

Set cool-zone current reduction in JEITA.

Parameters
reducetrue for 50%, false for 100%. Default true.
Returns
true on success.

Definition at line 390 of file AXP2101Charger.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::jeita::SET0, and SensorCommWrapper::setRegBit().

◆ setJeitaCoolThreshold()

bool AXP2101Charger::setJeitaCoolThreshold ( uint8_t  val)

Set JEITA cool temperature threshold T2 (REG 5B low nibble).

Parameters
valRaw register value. VHTF = val * 16 mV. Default 0x37 (~10°C).
Returns
true on success.

Definition at line 437 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::jeita::SET2, and SensorCommWrapper::writeReg().

◆ setJeitaCoolVoltageDrop()

bool AXP2101Charger::setJeitaCoolVoltageDrop ( uint8_t  levels)

Set cool-zone voltage drop levels in JEITA.

Parameters
levels0=0mV, 1=1 level, 2=2 levels. Default 0.
Returns
true on success.

Definition at line 418 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::jeita::SET0, and SensorCommWrapper::writeReg().

◆ setJeitaWarmCurrentReduction()

bool AXP2101Charger::setJeitaWarmCurrentReduction ( bool  reduce)

Set warm-zone current reduction in JEITA.

Parameters
reducetrue for 50%, false for 100%. Default false.
Returns
true on success.

Definition at line 379 of file AXP2101Charger.cpp.

References SensorCommWrapper::clrRegBit(), axp2101_regs::jeita::SET0, and SensorCommWrapper::setRegBit().

◆ setJeitaWarmThreshold()

bool AXP2101Charger::setJeitaWarmThreshold ( uint8_t  val)

Set JEITA warm temperature threshold T3 (REG 5B high nibble).

Parameters
valRaw register value. VHTF = val * 8 mV. Default 0x1E (~45°C).
Returns
true on success.

Definition at line 454 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::jeita::SET2, and SensorCommWrapper::writeReg().

◆ setJeitaWarmVoltageDrop()

bool AXP2101Charger::setJeitaWarmVoltageDrop ( uint8_t  levels)

Set warm-zone voltage drop levels in JEITA.

Parameters
levels0=0mV, 1=1 level, 2=2 levels. Default 1.
Returns
true on success.

Definition at line 401 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::jeita::SET0, and SensorCommWrapper::writeReg().

◆ setLowTempHysteresis()

bool AXP2101Charger::setLowTempHysteresis ( uint8_t  val)

Set low-temperature hysteresis (REG 52, HYSL2H).

Parameters
valRaw register value. Hysteresis = val * 16 mV. Default 0x02 (32mV).
Returns
true on success.

Definition at line 355 of file AXP2101Charger.cpp.

References axp2101_regs::ts::HYSL2H, and SensorCommWrapper::writeReg().

◆ setPreChargeCurrent()

bool AXP2101Charger::setPreChargeCurrent ( uint16_t  mA)
overridevirtual

Set the precharge current limit (REG 0x61, bits 3:0).

Current = 25 * N mA, where N is clamped to 0-8 (0-200 mA).

Parameters
mADesired precharge current in milliamps (0-200).
Returns
true on success.

Implements PmicChargerBase.

Definition at line 52 of file AXP2101Charger.cpp.

References axp2101_regs::chg::IPRECHG_SET, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setPreChargeSafetyTimer()

void AXP2101Charger::setPreChargeSafetyTimer ( uint8_t  opt)

Set the precharge safety timer (REG 0x67, bits 2:0).

bit 2 = timer enable. bits 1:0 select timeout: 0=40min, 1=50min, 2=60min, 3=70min.

Parameters
optTimer option value (bits 2:0). Bit 2 enables, bits 1:0 select duration.

Definition at line 255 of file AXP2101Charger.cpp.

References axp2101_regs::chg::CHG_TIMER_CFG, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setTerminationCurrent()

bool AXP2101Charger::setTerminationCurrent ( uint16_t  mA)
overridevirtual

Set the charge termination current (REG 0x63, bits 3:0).

Current = 25 * N mA, where N is clamped to 0-8 (0-200 mA).

Parameters
mADesired termination current in milliamps (0-200).
Returns
true on success.

Implements PmicChargerBase.

Definition at line 95 of file AXP2101Charger.cpp.

References axp2101_regs::chg::ITERM_CTRL, SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setThermalRegulationThreshold()

void AXP2101Charger::setThermalRegulationThreshold ( uint8_t  opt)

Set the thermal regulation threshold (REG 0x65, bits 1:0).

Valid values: 0=60°C, 1=80°C, 2=100°C, 3=120°C.

Parameters
optThreshold option (0-3).

Definition at line 277 of file AXP2101Charger.cpp.

References SensorCommWrapper::readReg(), axp2101_regs::chg::THERMAL_REG_THRESH, and SensorCommWrapper::writeReg().

◆ setWorkHighTempFaultThreshold()

bool AXP2101Charger::setWorkHighTempFaultThreshold ( uint8_t  val)

Set work high-temperature fault threshold (REG 57, VHTF_WORK).

Parameters
valRaw register value. VHTF = val * 2 mV. Default 0x4C (~55°C).
Returns
true on success.

Definition at line 342 of file AXP2101Charger.cpp.

References axp2101_regs::jeita::VHTF_WORK, and SensorCommWrapper::writeReg().

◆ setWorkLowTempFaultThreshold()

bool AXP2101Charger::setWorkLowTempFaultThreshold ( uint8_t  val)

Set work low-temperature fault threshold (REG 56, VLTF_WORK).

Parameters
valRaw register value. VLTF = val * 32 mV. Default 0x3E (~-10°C).
Returns
true on success.

Definition at line 331 of file AXP2101Charger.cpp.

References axp2101_regs::jeita::VLTF_WORK, and SensorCommWrapper::writeReg().


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