Functions | |
__STATIC_INLINE void | Cy_USB_Dev_RegisterEventsCallback (cy_cb_usb_dev_events_callback_t callback, cy_stc_usb_dev_context_t *context) |
Registers a callback function to notify number of events: Bus Reset detected, SET_CONFIGURATION request received and SET_INTERFACE request received. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_GetConfiguration (cy_stc_usb_dev_context_t const *context) |
Returns USB Device configuration. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_GetAlternateSettings (uint32_t interface, cy_stc_usb_dev_context_t const *context) |
Returns alternate setting for a certain interface. More... | |
__STATIC_INLINE bool | Cy_USB_Dev_IsConfigurationChanged (cy_stc_usb_dev_context_t *context) |
Returns configuration state that is cleared after read. More... | |
__STATIC_INLINE bool | Cy_USB_Dev_IsRemoteWakeupEnabled (cy_stc_usb_dev_context_t const *context) |
Returns Remote Wakeup status. More... | |
__STATIC_INLINE void | Cy_USB_Dev_SetPowerStatus (cy_en_usb_dev_power_status_t status, cy_stc_usb_dev_context_t *context) |
Sets Power status to report it when USB Host issues GET_STATUS standard requests. More... | |
__STATIC_INLINE uint8_t * | Cy_USB_Dev_GetSerialNumberString (cy_stc_usb_dev_context_t *context) |
Returns pointer to the serial number string generated from silicon ID. More... | |
__STATIC_INLINE void | Cy_USB_Dev_RegisterSerialNumStringCallback (cy_fn_usb_dev_sn_string_ptr_t callback, cy_stc_usb_dev_context_t *context) |
Registers a callback function that returns the serial string descriptor when it is requested by the USB Host. More... | |
__STATIC_INLINE cy_en_usb_dev_status_t | Cy_USB_Dev_SetupControlRead (cy_stc_usb_dev_control_transfer_t *transfer, uint8_t *ptr, uint32_t size) |
Setup control read (Host reads) transfer. More... | |
__STATIC_INLINE cy_en_usb_dev_status_t | Cy_USB_Dev_SetupControlWrite (cy_stc_usb_dev_control_transfer_t *transfer, uint32_t size) |
Setup control write transfer (Host writes) and sets CY_USB_DEV_SUCCESS status. More... | |
__STATIC_INLINE cy_en_usb_dev_status_t | Cy_USB_Dev_SetupControlWriteResult (cy_stc_usb_dev_control_transfer_t const *transfer, uint8_t *ptr) |
Copies data received from the Host into the specified memory location. More... | |
__STATIC_INLINE void Cy_USB_Dev_RegisterEventsCallback | ( | cy_cb_usb_dev_events_callback_t | callback, |
cy_stc_usb_dev_context_t * | context | ||
) |
Registers a callback function to notify number of events: Bus Reset detected, SET_CONFIGURATION request received and SET_INTERFACE request received.
To remove the callback function, pass NULL as the function pointer.
callback | The pointer to a callback function. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_GetConfiguration | ( | cy_stc_usb_dev_context_t const * | context | ) |
Returns USB Device configuration.
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_GetAlternateSettings | ( | uint32_t | interface, |
cy_stc_usb_dev_context_t const * | context | ||
) |
Returns alternate setting for a certain interface.
This function is useful to determine which alternate settings are active for a certain interface.
interface | Interface number. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE bool Cy_USB_Dev_IsConfigurationChanged | ( | cy_stc_usb_dev_context_t * | context | ) |
Returns configuration state that is cleared after read.
This function is useful to determine which configuration or alternate settings of the interface were changed. After configuration state has been changed, Data Transfer Functions functions should be used to start communication with the USB Host.
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE bool Cy_USB_Dev_IsRemoteWakeupEnabled | ( | cy_stc_usb_dev_context_t const * | context | ) |
Returns Remote Wakeup status.
This function is useful to determine whether Remote Wakeup was enabled by the USB Host when USB Device supports this option.
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE void Cy_USB_Dev_SetPowerStatus | ( | cy_en_usb_dev_power_status_t | status, |
cy_stc_usb_dev_context_t * | context | ||
) |
Sets Power status to report it when USB Host issues GET_STATUS standard requests.
Call this function any time when power source is changed from Self-Powered to Bus-Powered or vice versa.
status | Power status cy_en_usb_dev_power_status_t |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint8_t * Cy_USB_Dev_GetSerialNumberString | ( | cy_stc_usb_dev_context_t * | context | ) |
Returns pointer to the serial number string generated from silicon ID.
The string length is CY_USB_DEV_SN_STRING_LENGTH.
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE void Cy_USB_Dev_RegisterSerialNumStringCallback | ( | cy_fn_usb_dev_sn_string_ptr_t | callback, |
cy_stc_usb_dev_context_t * | context | ||
) |
Registers a callback function that returns the serial string descriptor when it is requested by the USB Host.
callback | The pointer to a callback function. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE cy_en_usb_dev_status_t Cy_USB_Dev_SetupControlRead | ( | cy_stc_usb_dev_control_transfer_t * | transfer, |
uint8_t * | ptr, | ||
uint32_t | size | ||
) |
Setup control read (Host reads) transfer.
transfer | Pointer to structure that holds SETUP packet and information for request processing. |
ptr | The pointer to the data which will be read by the Host. |
size | Number of bytes to read. |
__STATIC_INLINE cy_en_usb_dev_status_t Cy_USB_Dev_SetupControlWrite | ( | cy_stc_usb_dev_control_transfer_t * | transfer, |
uint32_t | size | ||
) |
Setup control write transfer (Host writes) and sets CY_USB_DEV_SUCCESS status.
transfer | Pointer to structure that holds SETUP packet and information for request processing. |
size | Number of bytes which Host is allowed to write. |
__STATIC_INLINE cy_en_usb_dev_status_t Cy_USB_Dev_SetupControlWriteResult | ( | cy_stc_usb_dev_control_transfer_t const * | transfer, |
uint8_t * | ptr | ||
) |
Copies data received from the Host into the specified memory location.
There must provide enough place to store number of bytes provided in Cy_USB_Dev_SetupControlWrite.
transfer | Pointer to structure that holds SETUP packet and information for request processing. |
ptr | The pointer to the memory location to copy to. |