4.3.Human Interface Device Class
The HID class as the name suggests is commonly used for things like keyboards, mice and joysticks where a human’s action is causing the
need for communication. However this does not need to be the case. The HID class is suitable for any device where the communication can
be achieved by sending data in ‘reports‘ of a predefined size where the data transfer rate is not critical.
The HID class has been supported by Microsoft Windows 98 onwards. Support is both at kernel level and user level. When a HID type device
is plugged into a Windows PC it will be automatically recognised and Windows will load its own drivers for it, so there is no need to develop
a custom Windows driver or even a Windows ‘inf’ file.
This implementation of the HID class supports a single IN report and a single OUT report. Both Interrupt IN and Control IN (via Get_Report)
transfers are supported for sending a report to the host. Reports from the host must use Control OUT (via Set_Report).
Here are the functions that make up the USBHID API.
Name Description
USBHID_Init
Initialise the HID module. Register a callback functions to be called when a report is received from the host.
Provide the initial contents of a report to send to the host. Initialises the Core and HAL layers.
USBHID_ReportIN
Send a report to the host using Interrupt IN transfer.
The HID module consists of the following files:-
usb_hid.c
usb_hid.h.
usb_descriptors.c
usb_descriptors.h
usb_common.h
8