Expand description
§AXP2101 Power Management IC Driver
This crate provides a complete embedded driver for the AXP2101 Power Management IC (PMIC). It supports all features including:
- Status monitoring (VBUS, battery, charging state)
- DCDC1-5 voltage regulators
- ALDO1-4, BLDO1-2, DLDO1-2, CPUSLDO voltage regulators
- Battery charging control
- ADC measurements
- Interrupt handling
- Watchdog timer
- Power sequencing
§Example
use axp2101::{Axp2101, Error};
let mut pmic = Axp2101::new(i2c);
// Initialize and verify chip
pmic.init()?;
// Enable DC1 at 3.3V
pmic.enable_dc1()?;
pmic.set_dc1_voltage(3300)?;
// Check battery status
if pmic.is_battery_connected()? {
let voltage = pmic.get_battery_voltage()?;
// ... use battery voltage
}§Async Support
When the async feature is enabled, the crate provides AsyncAxp2101
with the same API but async/await support:
use axp2101::AsyncAxp2101;
let mut pmic = AsyncAxp2101::new(i2c);
pmic.init().await?;
pmic.enable_dc1().await?;Structs§
- Axp2101
- AXP2101 PMIC driver
- Interrupt
Flags - Interrupt flags for AXP2101
Enums§
- Charge
LedMode - Charge LED modes
- Charge
Status - Charge status
- Charge
Termination Current - Charge termination current
- DvmRamp
- DVM ramp speed
- Error
- Error types for AXP2101 operations
- Fast
Power OnChannel - Fast power-on options
- IrqTime
- IRQ timing configuration
- Power
Channel - Power channel identifiers
- Power
OffSource - Power-off sources
- Power
OnSource - Power-on sources
- Precharge
Current - Precharge current settings
- PwrOk
Delay - PWROK delay options
- Sequence
Level - Start sequence level
- Thermal
Threshold - Thermal regulation threshold
- Vsys
DpmVoltage - VSYS DPM voltage levels
- Wakeup
Source - Wakeup configuration
- Watchdog
Config - Watchdog configuration
- Watchdog
Timeout - Watchdog timeout
Constants§
- AXP2101_
ADC_ CHANNEL_ CTRL - ADC control
- AXP2101_
ADC_ DATA_ RELUS T0 - AXP2101_
ADC_ DATA_ RELUS T1 - AXP2101_
ADC_ DATA_ RELUS T2 - AXP2101_
ADC_ DATA_ RELUS T3 - AXP2101_
ADC_ DATA_ RELUS T4 - AXP2101_
ADC_ DATA_ RELUS T5 - AXP2101_
ADC_ DATA_ RELUS T6 - AXP2101_
ADC_ DATA_ RELUS T7 - AXP2101_
ADC_ DATA_ RELUS T8 - AXP2101_
ADC_ DATA_ RELUS T9 - AXP2101_
BATFET_ CTRL - BATFET control register - Manages battery FET enable/disable and discharge control
- AXP2101_
BAT_ DET_ CTRL - Battery detection
- AXP2101_
BAT_ PARAMS - Battery parameters register - Stores or reads 128-byte fuel gauge configuration data
- AXP2101_
BAT_ PERCENT_ DATA - Battery percentage
- AXP2101_
BTN_ BAT_ CHG_ VOL_ SET - Button battery charge
- AXP2101_
CHARGE_ GAUGE_ WDT_ CTRL - Watchdog and gauge control
- AXP2101_
CHGLED_ SET_ CTRL - Charging control
- AXP2101_
CHIP_ ID - Expected chip ID value for AXP2101
- AXP2101_
COMMON_ CONFIG - Common configuration register - Controls internal discharge, PWROK pin, PWRON shutdown, reset, and system shutdown
- AXP2101_
CV_ CHG_ VOL_ SET - AXP2101_
DATA_ BUFFE R1 - Data buffer register 1 - First of 6 bytes for user data storage
- AXP2101_
DATA_ BUFFER_ SIZE - Size of the data buffer in bytes (6 bytes total)
- AXP2101_
DC_ FORCE_ PWM_ CTRL - DC force PWM control
- AXP2101_
DC_ ONOFF_ DVM_ CTRL - DCDC on/off and DVM control - Enables/disables DC1-5, CCM mode, and DVM ramp speed
- AXP2101_
DC_ OVP_ UVP_ CTRL - AXP2101_
DC_ VOL0_ CTRL - DCDC1 voltage control register - Sets output voltage for DC1 (1500-3400mV in 100mV steps)
- AXP2101_
DC_ VOL1_ CTRL - DCDC2 voltage control register - Sets output voltage for DC2 (500-1540mV)
- AXP2101_
DC_ VOL2_ CTRL - DCDC3 voltage control register - Sets output voltage for DC3 (500-3400mV)
- AXP2101_
DC_ VOL3_ CTRL - DCDC4 voltage control register - Sets output voltage for DC4 (500-1840mV)
- AXP2101_
DC_ VOL4_ CTRL - DCDC5 voltage control register - Sets output voltage for DC5 (1400-3700mV or 1200mV)
- AXP2101_
DIE_ TEMP_ CTRL - Die temperature control register - Configuration for internal temperature monitoring
- AXP2101_
FAST_ PWRON_ CTRL - AXP2101_
FAST_ PWRON_ SET0 - Fast power on control
- AXP2101_
FAST_ PWRON_ SET1 - AXP2101_
FAST_ PWRON_ SET2 - AXP2101_
FUEL_ GAUGE_ CTRL - Fuel gauge control register - Controls fuel gauge ROM access and data interface
- AXP2101_
ICC_ CHG_ SET - AXP2101_
IC_ TYPE - AXP2101 Register Addresses Based on AXP2101 datasheet Device type/ID register - Contains chip identification
- AXP2101_
INPUT_ CUR_ LIMIT_ CTRL - Input current limit control - Configures maximum input current from VBUS
- AXP2101_
INPUT_ VOL_ LIMIT_ CTRL - Input voltage limit control - Sets VBUS voltage limit thresholds
- AXP2101_
INTE N1 - Interrupt control
- AXP2101_
INTE N2 - AXP2101_
INTE N3 - AXP2101_
INTST S1 - AXP2101_
INTST S2 - AXP2101_
INTST S3 - AXP2101_
INTSTS_ CNT - AXP2101_
IPRECHG_ SET - AXP2101_
IRQ_ OFF_ ON_ LEVEL_ CTRL - AXP2101_
ITERM_ CHG_ SET_ CTRL - AXP2101_
LDO_ ONOFF_ CTRL0 - LDO control
- AXP2101_
LDO_ ONOFF_ CTRL1 - AXP2101_
LDO_ VOL0_ CTRL - AXP2101_
LDO_ VOL1_ CTRL - AXP2101_
LDO_ VOL2_ CTRL - AXP2101_
LDO_ VOL3_ CTRL - AXP2101_
LDO_ VOL4_ CTRL - AXP2101_
LDO_ VOL5_ CTRL - AXP2101_
LDO_ VOL6_ CTRL - AXP2101_
LDO_ VOL7_ CTRL - AXP2101_
LDO_ VOL8_ CTRL - AXP2101_
LOW_ BAT_ WARN_ SET - AXP2101_
MIN_ SYS_ VOL_ CTRL - Minimum system voltage control - Sets the minimum voltage threshold for system operation
- AXP2101_
PWROFF_ EN - AXP2101_
PWROFF_ STATUS - AXP2101_
PWROK_ SEQU_ CTRL - AXP2101_
PWRON_ STATUS - Power on/off control
- AXP2101_
RESET_ FUEL_ GAUGE - Reset fuel gauge register - Triggers reset of battery percentage tracking
- AXP2101_
SLAVE_ ADDRESS - I2C Address
- AXP2101_
SLEEP_ WAKEUP_ CTRL - AXP2101_
STATU S1 - Status register 1 - Contains VBUS good, BATFET state, battery connection/active status, thermal regulation, and current limit status
- AXP2101_
STATU S2 - Status register 2 - Contains power-on status, charging state (tri-charge, pre-charge, CC, CV, done), and charger status
- AXP2101_
THE_ REGU_ THRES_ SET - AXP2101_
TS_ PIN_ CTRL - TS pin control
- AXP2101_
VOFF_ SET - AXP2101_
WDT_ CTRL - IRQ_
BATFET_ OVER_ CURR - IRQ_
BAT_ CHG_ DONE - IRQ_
BAT_ CHG_ OVER_ TEMP - IRQ_
BAT_ CHG_ START - IRQ_
BAT_ CHG_ UNDER_ TEMP - IRQ_
BAT_ INSERT - IRQ_
BAT_ OVER_ VOL - IRQ_
BAT_ REMOVE - IRQ_
BAT_ WORK_ OVER_ TEMP - IRQ_
BAT_ WORK_ UNDER_ TEMP - IRQ_
CHARGER_ TIMER - IRQ_
DIE_ OVER_ TEMP - IRQ_
GAUGE_ NEW_ SOC - IRQ_
LDO_ OVER_ CURR - IRQ_
PKEY_ LONG - IRQ_
PKEY_ NEGATIVE - IRQ_
PKEY_ POSITIVE - IRQ_
PKEY_ SHORT - IRQ_
VBUS_ INSERT - IRQ_
VBUS_ REMOVE - IRQ_
WARNING_ LEVE L1 - IRQ_
WARNING_ LEVE L2 - IRQ_
WDT_ EXPIRE - IRQ_
WDT_ TIMEOUT - XPOWERS_
AXP2101_ ALDO1_ VOL_ MAX - XPOWERS_
AXP2101_ ALDO1_ VOL_ MIN - XPOWERS_
AXP2101_ ALDO1_ VOL_ STEPS - XPOWERS_
AXP2101_ ALDO2_ VOL_ MAX - XPOWERS_
AXP2101_ ALDO2_ VOL_ MIN - XPOWERS_
AXP2101_ ALDO2_ VOL_ STEPS - XPOWERS_
AXP2101_ ALDO3_ VOL_ MAX - XPOWERS_
AXP2101_ ALDO3_ VOL_ MIN - XPOWERS_
AXP2101_ ALDO3_ VOL_ STEPS - XPOWERS_
AXP2101_ ALDO4_ VOL_ MAX - XPOWERS_
AXP2101_ ALDO4_ VOL_ MIN - XPOWERS_
AXP2101_ ALDO4_ VOL_ STEPS - XPOWERS_
AXP2101_ BLDO1_ VOL_ MAX - XPOWERS_
AXP2101_ BLDO1_ VOL_ MIN - XPOWERS_
AXP2101_ BLDO1_ VOL_ STEPS - XPOWERS_
AXP2101_ BLDO2_ VOL_ MAX - XPOWERS_
AXP2101_ BLDO2_ VOL_ MIN - XPOWERS_
AXP2101_ BLDO2_ VOL_ STEPS - XPOWERS_
AXP2101_ BTN_ VOL_ MAX - XPOWERS_
AXP2101_ BTN_ VOL_ MIN - XPOWERS_
AXP2101_ BTN_ VOL_ STEPS - XPOWERS_
AXP2101_ CONVERSION_ FACTOR - XPOWERS_
AXP2101_ CPUSLDO_ VOL_ MAX - XPOWERS_
AXP2101_ CPUSLDO_ VOL_ MIN - XPOWERS_
AXP2101_ CPUSLDO_ VOL_ STEPS - XPOWERS_
AXP2101_ DCDC1_ VOL_ MAX - XPOWERS_
AXP2101_ DCDC1_ VOL_ MIN - XPOWERS_
AXP2101_ DCDC1_ VOL_ STEPS - XPOWERS_
AXP2101_ DCDC2_ VOL1_ MAX - XPOWERS_
AXP2101_ DCDC2_ VOL1_ MIN - XPOWERS_
AXP2101_ DCDC2_ VOL2_ MAX - XPOWERS_
AXP2101_ DCDC2_ VOL2_ MIN - XPOWERS_
AXP2101_ DCDC2_ VOL_ STEP S1 - XPOWERS_
AXP2101_ DCDC2_ VOL_ STEP S2 - XPOWERS_
AXP2101_ DCDC2_ VOL_ STEP S2_ BASE - XPOWERS_
AXP2101_ DCDC3_ VOL1_ MAX - XPOWERS_
AXP2101_ DCDC3_ VOL1_ MIN - XPOWERS_
AXP2101_ DCDC3_ VOL2_ MAX - XPOWERS_
AXP2101_ DCDC3_ VOL2_ MIN - XPOWERS_
AXP2101_ DCDC3_ VOL3_ MAX - XPOWERS_
AXP2101_ DCDC3_ VOL3_ MIN - XPOWERS_
AXP2101_ DCDC3_ VOL_ MIN - XPOWERS_
AXP2101_ DCDC3_ VOL_ STEP S1 - XPOWERS_
AXP2101_ DCDC3_ VOL_ STEP S2 - XPOWERS_
AXP2101_ DCDC3_ VOL_ STEP S3 - XPOWERS_
AXP2101_ DCDC3_ VOL_ STEP S2_ BASE - XPOWERS_
AXP2101_ DCDC3_ VOL_ STEP S3_ BASE - XPOWERS_
AXP2101_ DCDC4_ VOL1_ MAX - XPOWERS_
AXP2101_ DCDC4_ VOL1_ MIN - XPOWERS_
AXP2101_ DCDC4_ VOL2_ MAX - XPOWERS_
AXP2101_ DCDC4_ VOL2_ MIN - XPOWERS_
AXP2101_ DCDC4_ VOL_ STEP S1 - XPOWERS_
AXP2101_ DCDC4_ VOL_ STEP S2 - XPOWERS_
AXP2101_ DCDC4_ VOL_ STEP S2_ BASE - XPOWERS_
AXP2101_ DCDC5_ VOL_ 1200MV - XPOWERS_
AXP2101_ DCDC5_ VOL_ MAX - XPOWERS_
AXP2101_ DCDC5_ VOL_ MIN - XPOWERS_
AXP2101_ DCDC5_ VOL_ STEPS - XPOWERS_
AXP2101_ DCDC5_ VOL_ VAL - XPOWERS_
AXP2101_ DLDO1_ VOL_ MAX - XPOWERS_
AXP2101_ DLDO1_ VOL_ MIN - XPOWERS_
AXP2101_ DLDO1_ VOL_ STEPS - XPOWERS_
AXP2101_ DLDO2_ VOL_ MAX - XPOWERS_
AXP2101_ DLDO2_ VOL_ MIN - XPOWERS_
AXP2101_ DLDO2_ VOL_ STEPS - XPOWERS_
AXP2101_ VSYS_ VOL_ THRESHOLD_ MAX - XPOWERS_
AXP2101_ VSYS_ VOL_ THRESHOLD_ MIN - XPOWERS_
AXP2101_ VSYS_ VOL_ THRESHOLD_ STEPS