33#include "../../PmicPowerBase.hpp"
39 static constexpr uint8_t
DCDC1 = 0;
40 static constexpr uint8_t
DCDC2 = 1;
41 static constexpr uint8_t
DCDC3 = 2;
42 static constexpr uint8_t
DCDC4 = 3;
43 static constexpr uint8_t
DCDC5 = 4;
Core I2C communication layer for the AXP2101 PMIC.
void enablePowerSequence()
Enable power-on sequencing (REG 0x25 bit 2).
void softShutdown()
Initiate a soft shutdown (REG 0x10 bit 0).
void setLowBatShutdownThreshold(uint8_t percentage)
Set the low-battery shutdown threshold (REG 0x1A bits 3:0).
static constexpr uint8_t DCDC4
void disableLongPressShutdown()
Disable long-press power-off (REG 0x22 bit 1).
bool setDCDCUVPDebounce(uint8_t opt)
Set DCDC UVP debounce time (REG 81 bits 1:0).
void enablePwrOk()
Enable PWROK output (REG 0x25 bit 4).
bool isFastPowerOnEnabled()
Check if fast power-on sequence is enabled (REG 2B bit 7).
void disablePwrOk()
Disable PWROK output (REG 0x25 bit 4).
void disableInternalDischarge()
Disable internal battery discharge resistor (REG 0x10 bit 5).
uint8_t getDCDCUVPDebounce()
Get DCDC UVP debounce time (REG 81 bits 1:0).
uint32_t getInputCurrentLimit() const override
Get the VBUS input current limit (REG 0x16 bits 2:0).
bool getFrequencySpreadRange()
Get the frequency spread range (REG 81 bit 6).
bool isFastWakeupEnabled()
Check if fast wakeup is enabled (REG 2B bit 6).
bool enableFastWakeup(bool enable)
Enable fast wakeup (REG 2B bit 6).
bool enableWakeup()
Enable wakeup function (REG 0x26 bit 1).
bool enableSleep()
Enable sleep mode (REG 0x26 bit 0).
bool isDCDCForcePWM(uint8_t dc_id)
Check if a DCDC converter is in forced-PWM mode (REG 81 bits 2-5).
uint16_t getSysPowerDownVoltage()
Get the VSYS power-off voltage threshold (REG 0x24 bits 2:0).
void setDCOverVoltageProtection(bool enable)
Enable or disable DC over-voltage protection (REG 0x23 bit 5).
bool compareGaugeData(uint8_t *data, uint8_t len)
Compare data against the fuel-gauge backup registers.
void setDCLowVoltageProtection(uint8_t dc_id, bool enable)
Enable or disable under-voltage protection for a DCDC (REG 0x23 bits 0-4).
void disablePowerSequence()
Disable power-on sequencing (REG 0x25 bit 2).
void enableOverTempShutdown()
Enable automatic shutdown on over-temperature (REG 0x22 bit 2).
bool isShipModeEnabled() const override
Check whether ship mode is currently active (REG 0x12 bit 3).
uint32_t getMinimumSystemVoltage() const override
Get the minimum VSYS system voltage (REG 0x14 bits 6:4).
bool setFrequencySpreadRange(bool wide)
Set frequency spread range (REG 81 bit 6).
bool enableDieTempDetection(bool enable)
Enable or disable die temperature detection.
bool setDieTempLevel1Threshold(uint8_t opt)
Set die over-temperature Level1 threshold (REG 13 bits 2:1).
static constexpr uint8_t DCDC2
void resetSoC()
Trigger a system-on-chip reset (REG 0x10 bit 1).
uint8_t getPwrOkDelay()
Get the PWROK delay time (REG 0x25 bits 1:0).
bool setInputCurrentLimit(uint32_t mA) override
Set the VBUS input current limit (REG 0x16 bits 2:0).
uint8_t getPowerOnStatus()
Read the power-on source status register (REG 0x20, read-only).
void setLowBatWarnThreshold(uint8_t percentage)
Set the low-battery warning threshold (REG 0x1A bits 7:4).
bool setDCDCForcePWM(uint8_t dc_id, bool force)
Force a DCDC converter to always-PWM mode (REG 81 bits 2-5).
void disableOverTempShutdown()
Disable automatic shutdown on over-temperature (REG 0x22 bit 2).
bool setSysPowerDownVoltage(uint16_t millivolt)
Set the VSYS power-off voltage threshold (REG 0x24 bits 2:0).
static constexpr uint8_t DCDC1
bool isFrequencySpreadEnabled()
Check if frequency spread spectrum is enabled (REG 81 bit 7).
bool writeGaugeData(uint8_t *data, uint8_t len)
Write user data to the fuel-gauge backup registers.
uint8_t getFastPowerOnSequence(uint8_t channel)
Get fast power-on start sequence for a channel (REG 28-2B).
uint32_t getInputVoltageLimit() const override
Get the VBUS input voltage limit (REG 0x15 bits 3:0).
static constexpr uint8_t DCDC5
bool disableWakeup()
Disable wakeup function (REG 0x26 bit 1).
bool isDCDCForceCCM()
Check if all DCDC1-4 are in forced CCM mode (REG 80 bit 6).
bool setDVMRampSlow(bool slow)
Set DVM voltage ramp rate (REG 80 bit 5).
bool isDVMRampSlow()
Check if DVM ramp is set to slow (REG 80 bit 5).
bool setInputVoltageLimit(uint32_t mv) override
Set the VBUS input voltage limit (REG 0x15 bits 3:0).
bool enableFastPowerOn(bool enable)
Enable fast power-on sequence (REG 2B bit 7).
bool isDieTempDetectionEnabled()
Check if die temperature detection is enabled.
bool setDCDCForceCCM(bool enable)
Force all DCDC1-4 to CCM (continuous conduction mode) (REG 80 bit 6).
uint8_t getLowBatShutdownThreshold()
Get the low-battery shutdown threshold (REG 0x1A bits 3:0).
bool disableSleep()
Disable sleep mode (REG 0x26 bit 0).
bool enableShipMode(bool enable) override
Enable or disable ship mode (REG 0x12 bit 3).
bool isDCLowVoltageProtectionEnabled(uint8_t dc_id)
Check if under-voltage protection is enabled for a DCDC (REG 0x23 bits 0-4).
bool setMinimumSystemVoltage(uint32_t mv) override
Set the minimum VSYS system voltage (REG 0x14 bits 6:4).
bool setFastPowerOnSequence(uint8_t channel, uint8_t seq)
Set fast power-on start sequence for a channel (REG 28-2B).
void enablePowerOffDelay()
Enable power-off delay (REG 0x25 bit 3).
void disablePowerOffDelay()
Disable power-off delay (REG 0x25 bit 3).
bool isDCOverVoltageProtectionEnabled()
Check if DC over-voltage protection is enabled (REG 0x23 bit 5).
uint8_t getDieTempLevel1Threshold()
Get die over-temperature Level1 threshold (REG 13 bits 2:1).
void enableLongPressShutdown()
Enable long-press power-off (REG 0x22 bit 1).
bool setFrequencySpreadEnable(bool enable)
Enable DCDC frequency spread spectrum (REG 81 bit 7).
uint8_t getLowBatWarnThreshold()
Get the low-battery warning threshold (REG 0x1A bits 7:4).
uint8_t getPowerOffStatus()
Read the power-off source status register (REG 0x21, read-only).
bool setPwrOkDelay(uint8_t opt)
Set the PWROK delay time (REG 0x25 bits 1:0).
void enableInternalDischarge()
Enable internal battery discharge resistor (REG 0x10 bit 5).
static constexpr uint8_t DCDC3
void setLongPressAction(bool restart)
Set the long-press power key action (REG 0x22 bit 0).