Initialization Functions

group group_usb_dev_functions_common

Functions

cy_en_usb_dev_status_t Cy_USB_Dev_Init(USBFS_Type *base, struct cy_stc_usbfs_dev_drv_config const *drvConfig, struct cy_stc_usbfs_dev_drv_context *drvContext, cy_stc_usb_dev_device_t const *device, cy_stc_usb_dev_config_t const *config, cy_stc_usb_dev_context_t *context)

Initialize the USB Device stack and underneath USBFS hardware driver.

note

The configuration of USB clocks, pins, and interrupts is not handled by this function and must be done on the application level.

Return

Status code of the function execution cy_en_usb_dev_status_t.

Parameters
  • base: The pointer to the USBFS instance.

  • drvConfig: The pointer to the USBFS driver configuration structure.

  • drvContext: The pointer to the USBFS driver context structure allocated by the user. The structure is used during the USBFS driver operation for internal configuration and data retention. The user must not modify anything in this structure.

  • device: The pointer to the device structure cy_stc_usb_dev_device_t.

  • config: The pointer to the driver configuration structure cy_stc_usb_dev_config_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.

void Cy_USB_Dev_DeInit(cy_stc_usb_dev_context_t *context)

De-initialize the USB Device stack and underneath hardware driver.

Parameters
  • 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.

cy_en_usb_dev_status_t Cy_USB_Dev_Connect(bool blocking, int32_t timeout, cy_stc_usb_dev_context_t *context)

Enables pull-up on D+ (hardware supports only full-speed device) line to signal USB Device connection on USB Bus.

Parameters
  • blocking: Wait until device is configured.

  • timeout: Defines in milliseconds the time for which this function can block. If that time expires, the USB Device is disconnected and the function returns. To wait forever, pass CY_USB_DEV_WAIT_FOREVER.

  • 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.

void Cy_USB_Dev_Disconnect(cy_stc_usb_dev_context_t *context)

Disables pull-up on D+ (hardware supports only full-speed device) line to signal USB Device disconnection on USB Bus.

Parameters
  • 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.