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:
- Compile and program the application.
- Connect the development kit to the host computer.
- The device will enumerate as a HID mouse class.
- Press the buttons on the development kit and observe results on the host computer and on the LEDs.