![]() |
USB Component
Version 5.1
MDK-Professional Middleware for USB Device and Host
|
Enable the USB Host to support USB Human Interface Devices. More...
Functions | |
usbStatus | USBH_HID_GetDeviceStatus (int8_t instance) |
Get status of Human Interface Device. | |
int32_t | USBH_HID_Read (int8_t instance, uint8_t *buf, int32_t len) |
Read data received from Human Interface Device. | |
int32_t | USBH_HID_Write (int8_t instance, const uint8_t *buf, int32_t len) |
Write data to Human Interface Device. | |
int | USBH_HID_GetKeyboardKey (int8_t instance) |
Retrieve first pending pressed keyboard key on HID Keyboard. | |
usbStatus | USBH_HID_GetMouseState (int8_t instance, usbHID_MouseState *state) |
Retrieve state change since last call of this function. | |
Enable the USB Host to support USB Human Interface Devices.
The HID class in the USB Component is used for attaching input devices to your system.
Refer to:
To create an USB Host with support for the HID class:
Configuration File USBH_Config_HID.h
The USB Host Component has one configuration file for the HID Device class: USBH_Config_HID.h. This configuration file defines the maximum number of concurrent HID Devices that may be attached to the system.
Code Example
usbStatus USBH_HID_GetDeviceStatus | ( | int8_t | instance | ) |
Get status of Human Interface Device.
[in] | instance | instance of HID Device. |
The function USBH_HID_GetDeviceStatus checks whether the human interface device is connected and initialized.
The argument instance is specifying the device instance.
Code Example
int32_t USBH_HID_GetKeyboardKey | ( | int8_t | instance | ) |
Retrieve first pending pressed keyboard key on HID Keyboard.
[in] | instance | instance of HID Device. |
The function USBH_HID_GetKeyboardKey enables programmers to handle signals from an USB keyboard. Implementing this function in user code overrides the library function that handles boot protocol device keyboard input.
The argument instance is specifying the device instance.
Code Example
bool USBH_HID_GetMouseState | ( | int8_t | instance, |
usbHID_MouseState * | state | ||
) |
Retrieve state change since last call of this function.
[in] | instance | instance of HID Device. |
[out] | state | pointer to mouse state usbHID_MouseState structure. |
The function USBH_HID_GetMouseState enables programmers to handle signals from an USB mouse. Implementing this function in user code overrides the library function that handles boot protocol device mouse input.
The argument instance is specifying the device instance.
The argument state is a pointer to the mouse state structure (usbHID_MouseState).
Code Example
int32_t USBH_HID_Read | ( | int8_t | instance, |
uint8_t * | buf, | ||
int32_t | len | ||
) |
Read data received from Human Interface Device.
[in] | instance | instance of HID Device. |
[out] | buf | buffer that receives data. |
[in] | len | maximum number of bytes to read. |
The function USBH_HID_Read retrieves the data sent by an USB HID device and stores it in a buffer.
The argument instance is specifying the device instance.
The argument buf is pointing to the location where the data will be returned.
The argument len specifies the number of bytes to be read.
Code Example
int32_t USBH_HID_Write | ( | int8_t | instance, |
const uint8_t * | buf, | ||
int32_t | len | ||
) |
Write data to Human Interface Device.
[in] | instance | instance of HID Device. |
[in] | buf | data buffer containing data to write. |
[in] | len | number of data bytes to write. |
The function USBH_HID_Write writes data from a buffer to an USB HID device.
The argument instance is specifying the device instance.
The argument buf is pointing to the location where the data will be written.
The argument len specifies the number of data bytes to be written.
Code Example