AN050
GD32 USBFS&USBHS Firmware Library User Guide
45
5.7.5.
HID
HID device class is implement human-machine interaction interface, HID device has a wide
usage range, not only include mouse, keyboard and touch device, but also include customed
HID device.
HID descriptor introduction
Device descriptor include HID device VID(0x28e9) and PID(0x0380). In HID configuration
descriptor set, include HID descriptor item and report descriptor, corresponding descriptor is
shown as
Table 5-19. HID relevant descriptors
Table 5-19
. HID relevant descriptors
Descriptor name
Functional description
hid_vendor
HID descriptor
hid_report_desc
report descriptor
HID device class interface
HID device class interface is shown in below structure, and structure function is shown in
below
Table 5-20. HID device class interface functions
usb_class_core usbd_hid_cb
=
{
.
command
=
NO_CMD
,
.
alter_set
=
0U
,
.
init
=
hid_init
,
.
deinit
=
hid_deinit
,
.
req_proc
=
hid_req
,
.
data_in
=
hid_data_in
};
Table 5-20
. HID device class interface functions
Function name
Functional description
hid_init
Initialize HID device
hid_deinit
Deinitialize HID device
hid_req
HID device class request function
hid_data_in
IN data transfer callback
HID device class request
HID include device class request is shown in
Table 5-21. HID device class request
Table 5-21
. HID device class request
Request name
value
Functional description
GET_REPORT
0x01
Get report
GET_IDLE
0x02
Get idle