nRF5 SDK v17.0.0
USB HID class modules
This information applies to the following SoCs: nRF52820, nRF52833, and nRF52840.

The USB HID (Human Interface Device) class modules provided in this SDK implement the HID class and subclasses that have been defined in the following specification:

Device Class Definition for Human Interface Devices (HID)

The specification defines three protocols:

The modules that implement these HID protocols are organized in the same way. All HID protocol implementations use the same parent module in which the common functionality is implemented. The following figure shows how data structures are inherited in HID modules:

usb_classes.svg
USB data structures in HID modules

HID reports

For more detailed information on the reports for the keyboard and mouse protocol implementations, refer to the Device Class Definition for Human Interface Devices (HID) document.

For all USB HID classes, you must define one IN endpoint for the input reports. Defining an OUT endpoint is optional and if it is not set, output reports are sent through the control endpoint. The following figure shows a typical HID report flow between a USB host and the device:

usb_report_flow.svg
HID report flow between a USB host and the device

Mouse report

For the mouse protocol, one 4-byte input report is defined:

Keyboard reports

For the keyboard protocol, two reports are defined:

OUT LED state report:

Generic reports

The generic HID protocol implementation does not define any reports. Instead, it allows you to create and handle custom, user-defined report descriptors and reports. All information about the report flow is passed to the user event handler by the APP_USBD_HID_USER_EVT_IN_REPORT_DONE, APP_USBD_HID_USER_EVT_OUT_REPORT_READY and APP_USBD_HID_USER_EVT_FEATURE_REPORT_READY events.

For an example on how to use the USB HID mouse and keyboard classes, refer to the USB HID Composite Example.


Documentation feedback | Developer Zone | Subscribe | Updated