Crate axp2101_dd

Crate axp2101_dd 

Source
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.
  • defmt and log Integration: 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
Axp2101Async
AxpInterface
AxpLowLevel
Root block of the AxpLowLevel driver

Enums§

AdcChannel
ADC channels available on AXP2101
AxpError
BatteryCurrentDirection
ButtonBatteryChargeVoltage
ChargeDoneSafetyTimer
ChargeVoltageLimit
ChargingStatus
ChipVersion
DcId
Dcdc1OcThreshold
Dcdc2OcThreshold
Dcdc3OcThreshold
DcdcUvpDebounce
DieOverTempThreshold
FastChargeCurrentLimit
InputCurrentLimit
IrqLevel
LdoId
MinSystemVoltage
OffLevel
OnLevel
PrechargeCurrentLimit
PrechargeSafetyTimer
PwrokDelay
TerminationCurrentLimit
ThermalRegulationThreshold
TsCurrent
TsSourceEnable
VindpmVoltage
VoffVoltage
WatchdogResetConfig
WatchdogTimer

Constants§

AXP2101_I2C_ADDRESS