Peripheral State and Errors functions

USB control functions. More...

Functions

hal_usb_state_t hal_usb_get_state (usb_handle_t *p_usb)
 Return the USB handle state. More...
 
uint32_t hal_usb_get_error (usb_handle_t *p_usb)
 Return the USB error code. More...
 
hal_status_t hal_usb_suspend_reg (usb_handle_t *p_usb)
 Suspend some registers related to USB configuration before sleep. More...
 
hal_status_t hal_usb_resume_reg (usb_handle_t *p_usb)
 Restore some registers related to USB configuration after sleep. This function must be used in conjunction with the hal_usb_suspend_reg(). More...
 

Detailed Description

USB control functions.

 ===============================================================================
                      ##### Peripheral State and Errors functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to control the USB.
     (+) hal_usb_get_state() API can be helpful to check in run-time the state of the USB peripheral
     (+) hal_usb_get_error() check in run-time Errors occurring during communication
     (+) hal_usb_set_timeout() set the timeout during internal process

Function Documentation

◆ hal_usb_get_error()

uint32_t hal_usb_get_error ( usb_handle_t p_usb)

Return the USB error code.

Parameters
[in]p_usbPointer to an USB handle which contains the configuration information for the specified USB module.
Returns
USB error code in bitmap format

◆ hal_usb_get_state()

hal_usb_state_t hal_usb_get_state ( usb_handle_t p_usb)

Return the USB handle state.

Parameters
[in]p_usbPointer to an USB handle which contains the configuration information for the specified USB module.
Return values
HAL_USB_STATE_RESETPeripheral not initialized.
HAL_USB_STATE_READYPeripheral initialized and ready for use.
HAL_USB_STATE_BUSYAn internal process is ongoing.
HAL_USB_STATE_BUSY_HOST_RESTUSB in host rest state during enumeration
HAL_USB_STATE_BUSY_ADDRUSB in adress state during enumeration
HAL_USB_STATE_BUSY_CFGUSB in configure state during enumeration
HAL_USB_STATE_ABORTPeripheral with abort request ongoing.
HAL_USB_STATE_ERRORPeripheral in error.

◆ hal_usb_resume_reg()

hal_status_t hal_usb_resume_reg ( usb_handle_t p_usb)

Restore some registers related to USB configuration after sleep. This function must be used in conjunction with the hal_usb_suspend_reg().

Parameters
[in]p_usbPointer to a USB handle which contains the configuration information for the specified USB module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_usb_suspend_reg()

hal_status_t hal_usb_suspend_reg ( usb_handle_t p_usb)

Suspend some registers related to USB configuration before sleep.

Parameters
[in]p_usbPointer to a USB handle which contains the configuration information for the specified USB module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.