Cypress USB Device Middleware Library 2.0
Functions

General Description

Functions

cy_en_usb_dev_status_t Cy_USB_Dev_HID_Init (cy_stc_usb_dev_hid_config_t const *config, cy_stc_usb_dev_hid_context_t *context, cy_stc_usb_dev_context_t *devContext)
 Initializes the HID class. More...
 
cy_en_usb_dev_hid_timer_state_t Cy_USB_Dev_HID_UpdateTimer (uint32_t interface, uint32_t reportId, cy_stc_usb_dev_hid_context_t *context)
 Updates the HID Report idle timer and returns the status of the timer. More...
 
__STATIC_INLINE uint32_t Cy_USB_Dev_HID_GetProtocol (uint32_t interface, cy_stc_usb_dev_hid_context_t const *context)
 Returns the HID protocol value for a certain interface. More...
 
__STATIC_INLINE void Cy_USB_Dev_HID_RegisterGetReportCallback (cy_cb_usbfs_dev_hid_get_report_t callback, cy_stc_usb_dev_hid_context_t *context)
 Registers a callback function that handles a GET_REPORT request. More...
 
__STATIC_INLINE void Cy_USB_Dev_HID_RegisterSetReportCallback (cy_cb_usbfs_dev_hid_set_report_t callback, cy_stc_usb_dev_hid_context_t *context)
 Registers a callback function that handles SET_REPORT request. More...
 
__STATIC_INLINE cy_stc_usb_dev_class_tCy_USB_Dev_HID_GetClass (cy_stc_usb_dev_hid_context_t *context)
 Returns pointer to the HID class structure. More...
 

Function Documentation

◆ Cy_USB_Dev_HID_Init()

cy_en_usb_dev_status_t Cy_USB_Dev_HID_Init ( cy_stc_usb_dev_hid_config_t const *  config,
cy_stc_usb_dev_hid_context_t context,
cy_stc_usb_dev_context_t devContext 
)

Initializes the HID class.

This function must be called to enable USB Device HID functionality.

Parameters
configThe pointer to the HID configuration structure cy_stc_usb_dev_hid_config_t.
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.
devContextThe pointer to the USB Device context structure cy_stc_usb_dev_context_t.
Returns
Status code of the function execution cy_en_usb_dev_status_t.

◆ Cy_USB_Dev_HID_UpdateTimer()

cy_en_usb_dev_hid_timer_state_t Cy_USB_Dev_HID_UpdateTimer ( uint32_t  interface,
uint32_t  reportId,
cy_stc_usb_dev_hid_context_t context 
)

Updates the HID Report idle timer and returns the status of the timer.

This function also reloads the timer if it expires.

Parameters
interfaceContains the interface number that contains the HID descriptor whose HID timer needs to be updated.
reportIdReport ID whose HID timer needs to be updated. Pass 0 if report ID is not used.
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The state of the HID timer cy_en_usb_dev_hid_timer_state_t

◆ Cy_USB_Dev_HID_GetProtocol()

__STATIC_INLINE uint32_t Cy_USB_Dev_HID_GetProtocol ( uint32_t  interface,
cy_stc_usb_dev_hid_context_t const *  context 
)

Returns the HID protocol value for a certain interface.

Parameters
interfaceInterface number.
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Supported protocol: CY_USB_DEV_HID_PROTOCOL_BOOT or CY_USB_DEV_HID_PROTOCOL_REPORT.

◆ Cy_USB_Dev_HID_RegisterGetReportCallback()

__STATIC_INLINE void Cy_USB_Dev_HID_RegisterGetReportCallback ( cy_cb_usbfs_dev_hid_get_report_t  callback,
cy_stc_usb_dev_hid_context_t context 
)

Registers a callback function that handles a GET_REPORT request.

The GET_REPORT request is STALLed if the callback function is not registered or returns an error. To remove the callback function, pass NULL as the function pointer.

Parameters
callbackThe pointer to a callback function.
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USB_Dev_HID_RegisterSetReportCallback()

__STATIC_INLINE void Cy_USB_Dev_HID_RegisterSetReportCallback ( cy_cb_usbfs_dev_hid_set_report_t  callback,
cy_stc_usb_dev_hid_context_t context 
)

Registers a callback function that handles SET_REPORT request.

This function is called when data stage of control transfer was completed (USB Device received report data from the USB Host). The SET_REPORT request is STALLed if the callback function is not registered or returns an error. To remove handler, set the handle parameter to NULL and call this function.

Parameters
callbackThe pointer to a callback function.
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_USB_Dev_HID_GetClass()

__STATIC_INLINE cy_stc_usb_dev_class_t * Cy_USB_Dev_HID_GetClass ( cy_stc_usb_dev_hid_context_t context)

Returns pointer to the HID class structure.

This function is useful to override class event handlers using Class Support Functions.

Parameters
contextThe pointer to the context structure cy_stc_usb_dev_hid_context_t allocated by the user. The structure is used during the HID Class operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The pointer to the HID class structure.