Metadata-Version: 2.0
Name: axp209
Version: 0.0.1
Summary: python-axp209 is a pure python library for getting information from AXP209 Power Management Unit
Home-page: https://github.com/artizirk/python-axp209
Author: Arti Zirk
Author-email: arti.zirk@gmail.com
License: MIT
Keywords: sunxi,cubietruck,cubieboard,axp209,python,i2c,CHIP,linux
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Requires-Dist: smbus2 (>=0.1.3)

A Python library for talking to the AXP209 power management unit
================================================================

It should run on python2 and python3
and uses patched smbus library https://github.com/artizirk/smbus2

Installation
------------

.. code::

    pip install smbus2
    pip install git+https://github.com/artizirk/python-axp209


Examples
--------



.. code::

    >>> 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

.. code:: python

    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

.. code:: python

    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)


