Home

Awesome

The AXP209 is a power management chip made by X-Powers for use mainly in Allwinner ARM system-on-a-chip reference designs. It can be found in quite a few systems, so if you've got a strange need to control it from a supported Rust target, this'll get you there.

The machines I know of so far using it:

The big challenge with interfacing with this chip is that because it controls power, the kernel has exclusive access to it. That's probably a good thing if you don't know what you're doing, and if you brick your little computer, that's on you. 😜

This driver doesn't try to implement every feature yet and only supports the following:

Here's the output from the example program which runs on the PocketChip:

Battery level: 100%
Voltage: 4184mV
Discharge Current: 0mA
Charge Current:    0mA
ACIN Voltage:      0mV
ACIN Current:      0mA
Vbus Voltage:      0mV
Vbus Current:      0mA
Temperature:       47°C
Temp Sensor Pin:   0mV
Ipsout?!:          4583mV

ADC Control Flags: BATTERY_VOLTAGE | BATTERY_CURRENT | ACIN_VOLTAGE | ACIN_CURRENT | APS_VOLTAGE | TS | TEMPERATURE
Power Control Flags: LDO3 | DCDC2 | LDO4 | LDO2 | DCDC3 | EXTEN
Power Status Flags:  VBUS_PRESENT | VBUS_USABLE | VBUS_ABOVE_HOLD | START_ON_POWER
Charge Status Flags: BATTERY_PRESENT

Timer:
	Expired: false
	Time (minutes): 0

If there's a feature you'd like to see implemented, either open an issue or create a pull request if you're feeling helpful. Also feel free to open an issue if you have general questions.

If you need some examples, check the examples folder. They won't work until if you have a kernel that is accessing to the chip so expect some difficulty there. Because I was using the chip on a single board computer, I had to re-compile my kernel with every AXP20X feature disabled.

License

This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.