{"id":15938540,"url":"https://github.com/ticky/circuitpython_stusb4500","last_synced_at":"2025-05-08T04:51:57.166Z","repository":{"id":145549307,"uuid":"298957412","full_name":"ticky/CircuitPython_STUSB4500","owner":"ticky","description":"CircuitPython driver for STUSB4500 USB Power Delivery board","archived":false,"fork":false,"pushed_at":"2020-10-01T04:58:41.000Z","size":95,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-08T04:51:51.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://circuitpython-stusb4500.readthedocs.io/","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/ticky.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-27T05:06:58.000Z","updated_at":"2024-06-14T03:22:27.000Z","dependencies_parsed_at":"2023-04-03T18:32:35.469Z","dependency_job_id":null,"html_url":"https://github.com/ticky/CircuitPython_STUSB4500","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticky%2FCircuitPython_STUSB4500","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticky%2FCircuitPython_STUSB4500/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticky%2FCircuitPython_STUSB4500/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticky%2FCircuitPython_STUSB4500/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ticky","download_url":"https://codeload.github.com/ticky/CircuitPython_STUSB4500/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253002841,"owners_count":21838637,"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-07T05:40:40.953Z","updated_at":"2025-05-08T04:51:57.147Z","avatar_url":"https://github.com/ticky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n============\n\n.. image:: https://readthedocs.org/projects/circuitpython-stusb4500/badge/?version=latest\n    :target: https://circuitpython-stusb4500.readthedocs.io/\n    :alt: Documentation Status\n\n.. image:: https://github.com/ticky/CircuitPython_STUSB4500/workflows/Build%20CI/badge.svg\n    :target: https://github.com/ticky/CircuitPython_STUSB4500/actions\n    :alt: Build Status\n\nCircuitPython driver for STUSB4500 USB Power Delivery board.\n\nImplementation Notes\n--------------------\n\nBased on `SparkFun's Arduino library\n\u003chttps://github.com/sparkfun/SparkFun_STUSB4500_Arduino_Library\u003e`_.\nFurther information and notes from `the ST reference implementation\n\u003chttps://github.com/usb-c/STUSB4500\u003e`_.\nPython library and project structure inspired by\n`Adafruit's VEML7700 library\n\u003chttps://github.com/adafruit/Adafruit_CircuitPython_VEML7700\u003e`_,\nand Adafruit's other such libraries.\n\nHardware\n--------\n\n* `SparkFun STUSB4500 \u003chttps://www.sparkfun.com/products/15801\u003e`_\n\nWhile this was developed for and tested with the SparkFun breakout, it likely works with any STUSB4500-based board which exposes I2C, including:\n\n* `USB C PD Sink by ketszim \u003chttps://www.tindie.com/products/ketszim/usb-c-pd-sink-stusb4500/\u003e`_\n* `STMicroelectronics EVAL-SCS001V1 \u003chttps://www.st.com/en/evaluation-tools/eval-scs001v1.html\u003e`_\n\nDependencies\n============\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\u003e`_\n* `Bus Device \u003chttps://github.com/adafruit/Adafruit_CircuitPython_BusDevice\u003e`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle \u003chttps://circuitpython.org/libraries\u003e`_.\n\nUsage Example\n=============\n\n.. code-block:: python\n\n    import board\n    import busio\n    import stusb4500\n\n    i2c = busio.I2C(board.SCL, board.SDA)\n    pd_board = stusb4500.STUSB4500(i2c)\n\n    print(\"Current PD Configuration:\")\n    print(\"PDO Number: {}\".format(pd_board.pdo_number))\n\n    for i in range(1, 4):\n        print(\n            \"PDO{}: {}V (+{}%/-{}%), {}A\".format(\n                i,\n                pd_board.get_voltage(i),\n                pd_board.get_upper_voltage_limit(i),\n                pd_board.get_lower_voltage_limit(i),\n                pd_board.get_current(i)\n            )\n        )\n\n    print(\"Flex Current: {}\".format(pd_board.flex_current))\n    print(\"External Power: {}\".format(pd_board.external_power))\n    print(\"USB Communication Capable: {}\".format(pd_board.usb_comm_capable))\n    print(\"Configuration OK GPIO: {}\".format(pd_board.config_ok_gpio))\n    print(\"GPIO Control: {}\".format(pd_board.gpio_ctrl))\n    print(\"Enable Power Only Above 5V: {}\".format(pd_board.power_above_5v_only))\n    print(\"Request Source Current: {}\".format(pd_board.req_src_current))\n    print(\"Factory Default: {}\".format(pd_board.is_factory_defaults))\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/ticky/CircuitPython_STUSB4500/blob/master/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n\nBuilding\n========\n\nThis library, along with dependencies and user code, can be too large to be useful on M0 boards like the Trinket M0. Built versions should show up once CI is configured and I've tagged a version, but for both your and my own development purposes I'm documenting how to just get an mpy file here.\n\nYou will need to install Adafruit's mpy-cross compiler, either `Adafruit's built version \u003chttps://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library#mpy-2982472-11\u003e`_ or on macOS you can install via `Homebrew \u003chttps://brew.sh\u003e`_ by running ``brew install ticky/utilities/circuitpython``.\n\nDocumentation\n=============\n\nFor information on building library documentation, please check out `this guide \u003chttps://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fticky%2Fcircuitpython_stusb4500","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fticky%2Fcircuitpython_stusb4500","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fticky%2Fcircuitpython_stusb4500/lists"}