30#include "../../../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_PMIC_AXP517
43 if (mv < 1000) mv = 1000;
44 if (mv > 3800) mv = 3800;
45 uint8_t code = (mv - 1000) / 100;
52 if (regVal < 0)
return 0;
53 uint8_t code = regVal & 0x1F;
54 return 1000 + code * 100;
59 if (mv < 3600) mv = 3600;
60 if (mv > 16200) mv = 16200;
61 uint8_t code = (mv - 3600) / 100 + 1;
68 if (regVal < 0)
return 0;
69 uint8_t code = regVal & 0x7F;
70 if (code == 0)
return 3600;
71 return 3600 + (code - 1) * 100;
76 if (mA < 100) mA = 100;
77 if (mA > 3250) mA = 3250;
78 uint8_t code = (mA - 100) / 50;
85 if (regVal < 0)
return 0;
86 uint8_t code = (regVal >> 2) & 0x3F;
87 return 100 + code * 50;
102 if (mv < 4550) mv = 4550;
103 if (mv > 5510) mv = 5510;
104 uint8_t n = ((mv - 4550) / 64);
107 if (regVal < 0)
return false;
114 if (regVal < 0)
return 0;
115 uint8_t n = (regVal >> 4) & 0x0F;
116 return 4550 + n * 64;
AXP517 low-level core driver.
uint32_t getInputCurrentLimit() const override
Get the input current limit.
bool isRBFETEnabled() const
Check if RBFET is enabled.
bool setBoostVoltage(uint16_t mv) override
Set the boost voltage.
bool enableBoost(bool enable) override
Enable boost functionality.
bool setInputCurrentLimit(uint32_t mA) override
Set the input current limit.
uint32_t getMinimumSystemVoltage() const override
Get the minimum system voltage.
bool isBoostEnabled() const override
Check if boost functionality is enabled.
uint32_t getInputVoltageLimit() const override
Get the input voltage limit.
bool setMinimumSystemVoltage(uint32_t mv) override
Set the minimum system voltage.
bool isShipModeEnabled() const override
Check if ship mode is enabled.
bool setInputVoltageLimit(uint32_t mv) override
Set the input voltage limit.
AXP517Power(AXP517Core &core)
Construct an AXP517 power-path driver.
uint16_t getBoostVoltage() const override
Get the boost voltage.
bool enableRBFET(bool enable) const
Enable or disable the RBFET.
bool enableShipMode(bool enable) override
Enter ship mode.
bool getRegBit(uint8_t reg, uint8_t bit)
int readReg(uint8_t reg) const
int updateBits(uint8_t reg, uint8_t mask, uint8_t value_shifted)
bool setRegBit(uint8_t reg, uint8_t bit)
static constexpr uint8_t STATUS0
BMU status0.
static constexpr uint8_t RBFET_CTRL
RBFET control.
static constexpr uint8_t INPUT_VOLT_LIMIT
Input voltage limit control.
static constexpr uint8_t MIN_SYS_VOLTAGE
Minimum system voltage control.
static constexpr uint8_t INPUT_CURR_LIMIT
Input current limit control.
static constexpr uint8_t MODULE_EN1
Module enable control1.
static constexpr uint8_t BOOST_CFG
Boost configure.
static constexpr uint8_t BATFET_CTRL
BATFET control.