USB HID Generic Example

nRF5 SDK v15.2.0

This information applies to the nRF52840 SoC only.

This example uses the USB HID class modules . See the documentation of these modules for links to relevant specification documents.

This example shows how to use the HID generic class. Generic protocol is used when user-defined reports are exchanged between the USB host and the device. The example shows how to handle a HID mouse like device using the HID generic protocol.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\usbd_hid_generic

LED assignments:

  • LED 1 shows the USB bus state:
    • ON: State RESUME
    • OFF: State SUSPEND
  • LED 2 shows the USB device library status:
    • ON: USB library STARTED
    • OFF: USB library STOPPED
  • LED 3 shows that a USB HID report IN has been sent:
    • TOGGLE - Report sent

Button assignments:

  • Button 1 moves the HID generic mouse cursor in the x-axis.
  • Button 2 moves the HID generic mouse cursor in the y-axis.
  • Button 3 presses the HID generic mouse left button.
  • Button 4 presses the HID generic mouse right button.

Testing

Test the USB HID Generic Example application by performing the following steps:

  1. Compile and program the application.
  2. Connect the development kit to the host computer.
  3. The device will enumerate as a HID mouse class.
  4. Press the buttons on the development kit and observe results on the host computer and on the LEDs.