{"id":15018602,"url":"https://github.com/adafruit/adafruit_circuitpython_hid","last_synced_at":"2025-05-14T19:09:29.697Z","repository":{"id":46044939,"uuid":"83309920","full_name":"adafruit/Adafruit_CircuitPython_HID","owner":"adafruit","description":"USB Human Interface Device drivers.","archived":false,"fork":false,"pushed_at":"2025-01-16T19:47:30.000Z","size":251,"stargazers_count":414,"open_issues_count":8,"forks_count":110,"subscribers_count":31,"default_branch":"main","last_synced_at":"2025-05-08T02:56:10.586Z","etag":null,"topics":["accessibility","circuitpython","hacktoberfest","usb","usb-hid"],"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/adafruit.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-02-27T12:51:36.000Z","updated_at":"2025-04-28T04:56:15.000Z","dependencies_parsed_at":"2023-01-22T09:15:48.076Z","dependency_job_id":"a34c4f33-c6c3-4b30-b788-2fba4fc8903d","html_url":"https://github.com/adafruit/Adafruit_CircuitPython_HID","commit_stats":{"total_commits":156,"total_committers":29,"mean_commits":5.379310344827586,"dds":0.8076923076923077,"last_synced_commit":"12889429e0f16f5c8be9cb0ba6991a834f913c5e"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_HID","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_HID/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_HID/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_HID/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adafruit","download_url":"https://codeload.github.com/adafruit/Adafruit_CircuitPython_HID/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["accessibility","circuitpython","hacktoberfest","usb","usb-hid"],"created_at":"2024-09-24T19:52:10.353Z","updated_at":"2025-05-14T19:09:28.712Z","avatar_url":"https://github.com/adafruit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nIntroduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-hid/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/hid/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_HID/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_HID/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\n\nThis driver simulates USB HID devices. Currently keyboard and mouse are implemented.\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\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://github.com/adafruit/Adafruit_CircuitPython_Bundle\u003e`_.\n\nAdditional Layouts\n====================\nThis library has an en-US layout. Please check out and expand `the library from Neradoc \u003chttps://github.com/Neradoc/Circuitpython_Keyboard_Layouts\u003e`_ for additional layouts.\n\nUsage Example\n=============\n\nThe ``Keyboard`` class sends keypress reports for a USB keyboard device to the host.\n\nThe ``Keycode`` class defines USB HID keycodes to send using ``Keyboard``.\n\n.. code-block:: python\n\n    import usb_hid\n    from adafruit_hid.keyboard import Keyboard\n    from adafruit_hid.keycode import Keycode\n\n    # Set up a keyboard device.\n    kbd = Keyboard(usb_hid.devices)\n\n    # Type lowercase 'a'. Presses the 'a' key and releases it.\n    kbd.send(Keycode.A)\n\n    # Type capital 'A'.\n    kbd.send(Keycode.SHIFT, Keycode.A)\n\n    # Type control-x.\n    kbd.send(Keycode.CONTROL, Keycode.X)\n\n    # You can also control press and release actions separately.\n    kbd.press(Keycode.CONTROL, Keycode.X)\n    kbd.release_all()\n\n    # Press and hold the shifted '1' key to get '!' (exclamation mark).\n    kbd.press(Keycode.SHIFT, Keycode.ONE)\n    # Release the ONE key and send another report.\n    kbd.release(Keycode.ONE)\n    # Press shifted '2' to get '@'.\n    kbd.press(Keycode.TWO)\n    # Release all keys.\n    kbd.release_all()\n\nThe ``KeyboardLayoutUS`` sends ASCII characters using keypresses. It assumes\nthe host is set to accept keypresses from a US keyboard.\n\nIf the host is expecting a non-US keyboard, the character to key mapping provided by\n``KeyboardLayoutUS`` will not always be correct.\nDifferent keypresses will be needed in some cases. For instance, to type an ``'A'`` on\na French keyboard (AZERTY instead of QWERTY), ``Keycode.Q`` should be pressed.\n\nCurrently this package provides only ``KeyboardLayoutUS``. More ``KeyboardLayout``\nclasses could be added to handle non-US keyboards and the different input methods provided\nby various operating systems.\n\n.. code-block:: python\n\n    import usb_hid\n    from adafruit_hid.keyboard import Keyboard\n    from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS\n\n    kbd = Keyboard(usb_hid.devices)\n    layout = KeyboardLayoutUS(kbd)\n\n    # Type 'abc' followed by Enter (a newline).\n    layout.write('abc\\n')\n\n    # Get the keycodes needed to type a '$'.\n    # The method will return (Keycode.SHIFT, Keycode.FOUR).\n    keycodes = layout.keycodes('$')\n\nThe ``Mouse`` class simulates a three-button mouse with a scroll wheel.\n\n.. code-block:: python\n\n    import usb_hid\n    from adafruit_hid.mouse import Mouse\n\n    m = Mouse(usb_hid.devices)\n\n    # Click the left mouse button.\n    m.click(Mouse.LEFT_BUTTON)\n\n    # Move the mouse diagonally to the upper left.\n    m.move(-100, -100, 0)\n\n    # Roll the mouse wheel away from the user one unit.\n    # Amount scrolled depends on the host.\n    m.move(0, 0, -1)\n\n    # Keyword arguments may also be used. Omitted arguments default to 0.\n    m.move(x=-100, y=-100)\n    m.move(wheel=-1)\n\n    # Move the mouse while holding down the left button. (click-drag).\n    m.press(Mouse.LEFT_BUTTON)\n    m.move(x=50, y=20)\n    m.release_all()       # or m.release(Mouse.LEFT_BUTTON)\n\nThe ``ConsumerControl`` class emulates consumer control devices such as\nremote controls, or the multimedia keys on certain keyboards.\n\n.. code-block:: python\n\n    import usb_hid\n    from adafruit_hid.consumer_control import ConsumerControl\n    from adafruit_hid.consumer_control_code import ConsumerControlCode\n\n    cc = ConsumerControl(usb_hid.devices)\n\n    # Raise volume.\n    cc.send(ConsumerControlCode.VOLUME_INCREMENT)\n\n    # Pause or resume playback.\n    cc.send(ConsumerControlCode.PLAY_PAUSE)\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs \u003chttps://docs.circuitpython.org/projects/hid/en/latest/\u003e`_.\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\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/adafruit/Adafruit_CircuitPython_hid/blob/main/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_hid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_hid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_hid/lists"}