This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

axp209 is a pure python library for getting information from AXP209 Power Management Unit

Project Description

AXP209 is a pmu that is used on quite few Allwinner embeded boards, like C.H.I.P and Cubietruck.

Because currently the sysfs api for AXP209 is in flux I wrote this library that bypasses the kernel and directly talks to the AXP209 over I2C bus using smbus2 library.

This library runs on both Python 2.7 and Python 3

Installation

pip install smbus2
pip install 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)
Release History

Release History

This version
History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
axp209-0.0.2-py2.py3-none-any.whl (5.8 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Aug 17, 2016
axp209-0.0.2.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Aug 17, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting