nRF5 SDK v17.1.0
USB HID Composite Example
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 two HID classes as one composite device. A development kit connected to the host computer will enumerate as two independent HID classes:

Note
You can reduce the functionality of this composite example to a single mouse or a single keyboard. To do that, modify the definitions of CONFIG_HAS_MOUSE and CONFIG_HAS_KBD.

Setup

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

LED assignments:

Button assignments:

Testing

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

  1. Compile and program the application.
  2. Connect the development kit to the host computer through the J-Link port.
  3. Connect the nRF USB to the host computer.
  4. The device will enumerate as a HID mouse and a HID keyboard class.
  5. Press the buttons on the development kit and observe the results on the host computer and on the LEDs.
  6. Press NUMLOCK and CAPSLOCK keys on the keyboard and observe the LEDs state change on the board.

Documentation feedback | Developer Zone | Subscribe | Updated