zephyr/samples/subsys/usb/hid-keyboard
Johann Fischer 7e123084e2 doc: usb: document USB message notifications
Add documentation about USB message notifications. Use literalinclude to
pull code snippets from the samples.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-18 19:56:54 -04:00
..
src doc: usb: document USB message notifications 2024-06-18 19:56:54 -04:00
app.overlay usb: device_next: rename the rate properties to use the correct unit 2024-06-13 08:03:49 -04:00
CMakeLists.txt samples: usb: add HID keyboard sample 2024-05-14 18:24:45 -04:00
Kconfig samples: usb: add HID keyboard sample 2024-05-14 18:24:45 -04:00
large_in_report.overlay usb: device_next: rename the rate properties to use the correct unit 2024-06-13 08:03:49 -04:00
large_out_report.overlay usb: device_next: rename the rate properties to use the correct unit 2024-06-13 08:03:49 -04:00
out_report.overlay usb: device_next: rename the rate properties to use the correct unit 2024-06-13 08:03:49 -04:00
prj.conf samples: usb: add HID keyboard sample 2024-05-14 18:24:45 -04:00
README.rst samples: usb: add HID keyboard sample 2024-05-14 18:24:45 -04:00
sample.yaml samples: usb: use new usbd test feature 2024-06-11 11:38:09 +01:00

.. zephyr:code-sample:: usb-hid-keyboard
   :name: USB HID keyboard
   :relevant-api: usbd_api usbd_hid_class input_interface

   Implement a basic HID keyboard device.

Overview
********

This sample application demonstrates the HID keyboard implementation using the
new experimental USB device stack.

Requirements
************

This project requires an experimental USB device driver (UDC API) and uses the
:ref:`input` API. There must be a :dtcompatible:`gpio-keys` group of buttons
or keys defined at the board level that can generate input events.
At least one key is required and up to four can be used. The first three keys
are used for Num Lock, Caps Lock and Scroll Lock. The fourth key is used to
report HID keys 1, 2, 3 and the right Alt modifier at once.

The example can use up to three LEDs, configured via the devicetree alias such
as ``led0``, to indicate the state of the keyboard LEDs.

Building and Running
********************

This sample can be built for multiple boards, in this example we will build it
for the nRF52840DK board:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/usb/hid-keyboard
   :board: nrf52840dk/nrf52840
   :goals: build flash
   :compact: