python-axp209 is a pure python library for getting information from AXP209 Power Management Unit
Project description
It should run on python2 and python3 and uses patched smbus library https://github.com/artizirk/smbus2
Installation
pip install smbus2
pip install git+https://github.com/artizirk/python-axp209
Examples
>>> from axp209 import AXP209
>>> axp = AXP209()
>>> axp.battery_voltage
4144.8
>>> axp.battery_discharge_current
269.0
>>>
Read and print out all the battery status values
from axp209 import AXP209
axp = AXP209()
print("internal_temperature: %.2fC" % axp.internal_temperature)
print("battery_exists: %s" % axp.battery_exists)
print("battery_charging: %s" % ("charging" if axp.battery_charging else "done"))
print("battery_current_direction: %s" % ("charging" if axp.battery_current_direction else "discharging"))
print("battery_voltage: %.1fmV" % axp.battery_voltage)
print("battery_discharge_current: %.1fmA" % axp.battery_discharge_current)
print("battery_charge_current: %.1fmA" % axp.battery_charge_current)
print("battery_gauge: %d%%" % axp.battery_gauge)
axp.close()
Blink CHIP status led
from time import sleep
from axp209 import AXP209
with AXP209() as axp:
while True:
axp.gpio2_output = False
sleep(1)
axp.gpio2_output = True
sleep(1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
axp209-0.0.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for axp209-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c897c5e37c04bfdbca71875eee763ad3b117064f2cec82b3f2c65c355fed103e |
|
MD5 | 4b4e54e33443f31a08b162c0d9331f94 |
|
BLAKE2b-256 | f2efb65093a9bec92866ce2d01213e174722b7a4767b49c052ce70f44e23eaf3 |