Crate axp192_dd

Source
Expand description

§AXP192 Power Management Chip Interface

This crate provides a bisync-based driver for the AXP192 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 AXP192.
  • defmt and log Integration: Optional support for logging and debugging.

§Getting Started

To use the driver, instantiate Axp192 (blocking) or Axp192Async (async) with your I2C bus implementation:

let i2c_bus = todo!();
let mut axp = Axp192::new(i2c_bus);

axp.set_dcdc_voltage(DcId::Dcdc1, 3300)?;

For async environments, use Axp192Async (re-exported from the asynchronous module):

let i2c_bus = todo!();
let mut axp = Axp192Async::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 AXP192 is found in various embedded devices, including but not limited to:

§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 AXP192 datasheet.

§Datasheet

AXP192 Datasheet v1.1 (English Draft)

Modules§

field_sets
Module containing the generated fieldsets of the registers and commands

Structs§

Axp192
Axp192Async
AxpInterface
AxpLowLevel
Root block of the AxpLowLevel driver

Enums§

AdcSampleRateValue
AxpError
AxpStartupMode
BackupChargeCurrentValue
BackupTargetVoltageValue
BatteryFlowDirection
ChargeCurrentValue
ChargeEndCurrentThresholdValue
ChargeTargetVoltageValue
ChgLedControlSourceSelect
ChgLedFunctionSetting
ConstantCurrentTimeoutValue
DcDcModeSelection
DcId
ExternalPathChargeCurrentValue
Gpio0FunctionSelect
Gpio1FunctionSelect
Gpio2FunctionSelect
Gpio3FunctionSetting
Gpio4FunctionSetting
Gpio5Direction
GpioAdcRange
LdoId
NoeShutdownDelayValue
NrstoPinFunction
PekLongPressTime
PekPowerOnTime
PekShutdownTime
PrechargeTimeoutValue
PwrokSignalDelay
TsPinCurrentValue
TsPinOutputMode
VbusCurrentLimitValue
VbusPathSelectionControl
VbusValidThresholdValue
VholdVoltageValue
VoffVoltageValue
VrcRiseSlope

Constants§

AXP192_I2C_ADDRESS