examples/device/hid_composite/README.md
A single USB HID interface that combines several HID functions using report IDs: keyboard, mouse, stylus pen, consumer control, and gamepad.
tud_hid_report_complete_cb):
A keycode; releasing sends an empty report.| Interface | Class driver |
|---|---|
| 0 | HID (keyboard + mouse + stylus pen + consumer control + gamepad, composite report IDs) |
Notable tusb_config.h settings:
#define CFG_TUD_HID 1
#define CFG_TUD_HID_EP_BUFSIZE 16
CMake:
mkdir build && cd build
cmake -DBOARD=raspberry_pi_pico ..
cmake --build .
Make:
make BOARD=raspberry_pi_pico all
A FreeRTOS build is in examples/device/hid_composite_freertos — the USB device and HID logic run as FreeRTOS tasks (LED via a software timer). It exposes four report types (keyboard, mouse, consumer control, gamepad) and, unlike this example, omits the stylus-pen report.
After flashing, the board enumerates as a single HID device that the host recognizes as a keyboard, mouse, consumer-control, gamepad, and stylus. Press and hold the button to type A, decrease the volume, press gamepad button A, and report stylus contact; the mouse pointer drifts toward the bottom-right continuously.