Expand description
§AXP2101 Power Management Chip Interface
This crate provides a bisync-based driver for the AXP2101 power management IC,
built upon the device-driver crate for robust, declarative register
definitions via a YAML manifest. It supports both asynchronous (async)
and blocking operation through a unified API, using the bisync crate
for seamless compatibility with both embedded-hal and embedded-hal-async traits.
§Features
- Declarative Register Map: Full device configuration defined in
device.yaml. - Unified Async/Blocking Support: Write your code once and use it in both async and blocking contexts via bisync.
- Type-Safe API: High-level functions for common operations (e.g., setting voltages)
and a generated low-level API (
ll) for direct register access. - Comprehensive Register Coverage: Aims to support the full feature set of the AXP2101.
defmtandlogIntegration: Optional support for logging and debugging.
§Getting Started
To use the driver, instantiate Axp2101 (blocking) or Axp2101Async (async) with your I2C bus implementation:
let i2c_bus = todo!();
let mut axp = Axp2101::new(i2c_bus);
axp.set_dcdc_voltage(DcId::Dcdc1, 3300)?;For async environments, use Axp2101Async (re-exported from the asynchronous module):
let i2c_bus = todo!();
let mut axp = Axp2101Async::new(i2c_bus);
axp.set_dcdc_voltage(DcId::Dcdc1, 3300).await?;For a detailed register map, please refer to the device.yaml file in the
repository.
§Supported Devices
The AXP2101 is found in various embedded devices and development boards.
§Warning!
Caution! This chip controls power to the microcontroller and other critical components. Incorrect configuration can potentially damage or brick your device. Proceed with care and always consult the AXP2101 datasheet.
Modules§
- field_
sets - Module containing the generated fieldsets of the registers and commands
Structs§
- Axp2101
- Axp2101
Async - AxpInterface
- AxpLow
Level - Root block of the AxpLowLevel driver
Enums§
- AdcChannel
- ADC channels available on AXP2101
- AxpError
- Battery
Current Direction - Button
Battery Charge Voltage - Charge
Done Safety Timer - Charge
Voltage Limit - Charging
Status - Chip
Version - DcId
- Dcdc1
OcThreshold - Dcdc2
OcThreshold - Dcdc3
OcThreshold - Dcdc
UvpDebounce - DieOver
Temp Threshold - Fast
Charge Current Limit - Input
Current Limit - IrqLevel
- LdoId
- MinSystem
Voltage - OffLevel
- OnLevel
- Precharge
Current Limit - Precharge
Safety Timer - Pwrok
Delay - Termination
Current Limit - Thermal
Regulation Threshold - TsCurrent
- TsSource
Enable - Vindpm
Voltage - Voff
Voltage - Watchdog
Reset Config - Watchdog
Timer