{"id":15912421,"url":"https://github.com/artizirk/python-axp209","last_synced_at":"2025-03-22T16:30:36.531Z","repository":{"id":57413460,"uuid":"65350022","full_name":"artizirk/python-axp209","owner":"artizirk","description":"A Python library for talking to the AXP209 Power Management Unit","archived":false,"fork":false,"pushed_at":"2019-06-25T17:04:23.000Z","size":13,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:31:56.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artizirk.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-10T04:16:36.000Z","updated_at":"2022-06-30T17:04:59.000Z","dependencies_parsed_at":"2022-08-28T00:11:20.220Z","dependency_job_id":null,"html_url":"https://github.com/artizirk/python-axp209","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artizirk%2Fpython-axp209","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artizirk%2Fpython-axp209/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artizirk%2Fpython-axp209/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artizirk%2Fpython-axp209/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artizirk","download_url":"https://codeload.github.com/artizirk/python-axp209/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244986217,"owners_count":20542974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T16:04:43.852Z","updated_at":"2025-03-22T16:30:36.213Z","avatar_url":"https://github.com/artizirk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Python library for talking to the AXP209 power management unit\n================================================================\n\nAXP209 is a pmu that is used on quite few Allwinner embeded boards, like C.H.I.P\nand Cubietruck.\n\nBecause currently the sysfs api for AXP209 is in flux I wrote\nthis library that bypasses the kernel and directly talks to the AXP209 over I2C\nbus using `smbus2 \u003chttps://github.com/kplindegaard/smbus2\u003e`_ library.\n\nThis library runs on both Python 2.7 and Python 3\n\nInstallation\n------------\n\n.. code::\n\n    pip install axp209\n\n\nSMBus bus number/object\n-----------------------\n\nThe default SMBus object set in this library is an integer 0. You might need to\nchange to another integer[like 1] depending on your system, or pass an object.\ne.g. axp = AXP209(1) for the Olimex A20-SOM204.\n\n\nExamples\n--------\n\n\n\n.. code::\n\n    \u003e\u003e\u003e from axp209 import AXP209\n    \u003e\u003e\u003e axp = AXP209()\n    \u003e\u003e\u003e axp.battery_voltage\n    4144.8\n    \u003e\u003e\u003e axp.battery_discharge_current\n    269.0\n    \u003e\u003e\u003e\n\n\nRead and print out all the battery status values\n\n.. code:: python\n\n    from axp209 import AXP209\n\n    axp = AXP209()\n    print(\"internal_temperature: %.2fC\" % axp.internal_temperature)\n    print(\"battery_exists: %s\" % axp.battery_exists)\n    print(\"battery_charging: %s\" % (\"charging\" if axp.battery_charging else \"done\"))\n    print(\"battery_current_direction: %s\" % (\"charging\" if axp.battery_current_direction else \"discharging\"))\n    print(\"battery_voltage: %.1fmV\" % axp.battery_voltage)\n    print(\"battery_discharge_current: %.1fmA\" % axp.battery_discharge_current)\n    print(\"battery_charge_current: %.1fmA\" % axp.battery_charge_current)\n    print(\"battery_gauge: %d%%\" % axp.battery_gauge)\n    axp.close()\n\n\nBlink CHIP status led\n\n.. code:: python\n\n    from time import sleep\n    from axp209 import AXP209\n\n    with AXP209() as axp:\n        while True:\n            axp.gpio2_output = False\n            sleep(1)\n            axp.gpio2_output = True\n            sleep(1)\n\nThere is also a commandline utility than you can use after installing it\n\n.. code::\n\n    root@sumochip1:~# axp209\n    internal_temperature: 67.00C\n    battery_exists: True\n    battery_charging: charging\n    battery_current_direction: discharging\n    battery_voltage: 3974.3mV\n    battery_discharge_current: 0.0mA\n    battery_charge_current: 0.0mA\n    battery_gauge: 76%\n    root@sumochip1:~#\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartizirk%2Fpython-axp209","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartizirk%2Fpython-axp209","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartizirk%2Fpython-axp209/lists"}