HAL PCD Functions

Initialization and de-initialization functions

group PCD_Exported_Functions_Group1

Initialization and Configuration functions.

 ===============================================================================
            ##### Initialization and de-initialization functions #####
 ===============================================================================

Functions

hal_status_t HAL_PCD_Init ( hal_pcd_handle_t * hpcd , hal_pcd_t instance )

Initializes the PCD according to the specified parameters in the hal_pcd_handle_t and initialize the associated instance.

Parameters :
  • hpcd – PCD handler

  • instance – PCD instance

Return values :

HAL – status

hal_status_t HAL_PCD_SetConfig ( hal_pcd_handle_t * hpcd , const hal_pcd_config_t * p_config )

Configure the PCD according to the specified parameters in the hal_pcd_handle_t and initialize the associated handle.

Parameters :
  • hpcd – PCD handler

  • p_config – pointer to the peripheral configuration structure

Return values :

HAL – status

void HAL_PCD_DeInit ( hal_pcd_handle_t * hpcd )

DeInitializes the PCD peripheral.

Parameters :

hpcd – PCD handler

hal_status_t HAL_PCD_RegisterSofCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register USB PCD SOF callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the SOF callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterSetupCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Setup callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Setup callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterResetCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Reset callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Reset callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterSuspendCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Suspend callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Suspend callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterResumeCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Resume callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Resume callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterConnectCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Connect callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Connect callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDisconnectCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Disconnect callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Disconnect callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDataOutStageCallback ( hal_pcd_handle_t * hpcd , hal_pcd_data_cb_t p_callback )

Register USB PCD Data OUT Stage callback To be used instead of the weak HAL_PCD_DataOutStageCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Data OUT Stage callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDataInStageCallback ( hal_pcd_handle_t * hpcd , hal_pcd_data_cb_t p_callback )

Register USB PCD Data IN Stage callback To be used instead of the weak HAL_PCD_DataInStageCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Data IN Stage callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterIsoOutIncpltCallback ( hal_pcd_handle_t * hpcd , hal_pcd_iso_cb_t p_callback )

Register USB PCD Iso OUT incomplete callback To be used instead of the weak HAL_PCD_ISOOUTIncompleteCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Iso OUT incomplete callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterIsoInIncpltCallback ( hal_pcd_handle_t * hpcd , hal_pcd_iso_cb_t p_callback )

Register USB PCD Iso IN incomplete callback To be used instead of the weak HAL_PCD_ISOINIncompleteCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Iso IN incomplete callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterErrorCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register USB PCD Error callback To be used instead of the weak HAL_PCD_ErrorCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Error callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterBcdCallback ( hal_pcd_handle_t * hpcd , hal_pcd_bcd_cb_t p_callback )

Register USB PCD BCD callback To be used instead of the weak HAL_PCD_BcdCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD BCD callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterLpmCallback ( hal_pcd_handle_t * hpcd , hal_pcd_lpm_cb_t p_callback )

Register USB PCD LPM callback To be used instead of the weak HAL_PCD_LpmCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD LPM callback function

Return values :

HAL – status

Input and Output operation functions

group PCD_Exported_Functions_Group2

Data transfers functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the PCD data
    transfers.

Functions

hal_status_t HAL_PCD_Start ( hal_pcd_handle_t * hpcd )

Start the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_Stop ( hal_pcd_handle_t * hpcd )

Stop the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

void HAL_PCD_IRQHandler ( hal_pcd_handle_t * hpcd )

Handles PCD interrupt request.

Parameters :

hpcd – PCD handle

uint32_t HAL_PCD_GetLastErrorCodes ( const hal_pcd_handle_t * hpcd )

Get Last Error codes.

Parameters :

hpcd – Pointer to a hal_pcd_handle_t

Return values :

last – error code.

void HAL_PCD_OTG_IRQHandler ( hal_pcd_handle_t * hpcd )

Handles PCD interrupt request.

Parameters :

hpcd – PCD handle

hal_status_t HAL_PCD_SetTxFiFoSize ( const hal_pcd_handle_t * hpcd , uint8_t fifo , uint16_t size_words )

Set Tx FIFO Size.

Parameters :
  • hpcd – PCD handle

  • fifo – number of Tx fifo

  • size_words – FIFO size in words

Return values :

HAL – status

hal_status_t HAL_PCD_SetRxFiFoSize ( const hal_pcd_handle_t * hpcd , uint16_t size_words )

Set Rx FIFO Size.

Parameters :
  • hpcd – PCD handle

  • size_words – Size of Rx FIFO in words

Return values :

HAL – status

hal_status_t HAL_PCD_LPM_Start ( hal_pcd_handle_t * hpcd )

Start LPM feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_LPM_Stop ( hal_pcd_handle_t * hpcd )

Stop LPM feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_PortTypeDetection ( hal_pcd_handle_t * hpcd )

Port Type Detection Process.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_Start ( hal_pcd_handle_t * hpcd )

Start Battery Charging feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_Stop ( hal_pcd_handle_t * hpcd )

Stop Battery Charging feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

void HAL_PCD_LpmCallback ( hal_pcd_handle_t * hpcd , hal_pcd_lpm_active_status_t lpm_status )

Send LPM active status to user layer callback.

Parameters :
  • hpcd – PCD handle

  • lpm_status – LPM active status

void HAL_PCD_BcdCallback ( hal_pcd_handle_t * hpcd , hal_pcd_bcd_port_type_t port_type )

Send BatteryCharging port type to user layer callback.

Parameters :
  • hpcd – PCD handle

  • port_type – port type

void HAL_PCD_DataOutStageCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Data OUT stage callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_DataInStageCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Data IN stage callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_SetupStageCallback ( hal_pcd_handle_t * hpcd )

Setup stage callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_SofCallback ( hal_pcd_handle_t * hpcd )

USB Start Of Frame callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ResetCallback ( hal_pcd_handle_t * hpcd )

USB Reset callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_SuspendCallback ( hal_pcd_handle_t * hpcd )

Suspend event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ResumeCallback ( hal_pcd_handle_t * hpcd )

Resume event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ISOOUTIncompleteCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Incomplete ISO OUT callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_ISOINIncompleteCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Incomplete ISO IN callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_ConnectCallback ( hal_pcd_handle_t * hpcd )

Connection event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_DisconnectCallback ( hal_pcd_handle_t * hpcd )

Disconnection event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ErrorCallback ( hal_pcd_handle_t * hpcd )

PCD Error callback.

Parameters :

hpcd – PCD handle

hal_status_t HAL_PCD_SetConfig ( hal_pcd_handle_t * hpcd , const hal_pcd_config_t * p_config )

Configure the PCD according to the specified parameters in the hal_pcd_handle_t and initialize the associated handle.

Parameters :
  • hpcd – PCD handler

  • p_config – pointer to the peripheral configuration structure

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterSofCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register USB PCD SOF callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the SOF callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterSetupCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Setup callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Setup callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterResetCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Reset callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Reset callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterSuspendCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Suspend callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Suspend callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterResumeCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Resume callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Resume callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterConnectCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Connect callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Connect callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDisconnectCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register a USB PCD Disconnect callback To be used instead of the weak predefined callback.

Parameters :
  • hpcd – USB PCD handle

  • p_callback – pointer to the Disconnect callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDataOutStageCallback ( hal_pcd_handle_t * hpcd , hal_pcd_data_cb_t p_callback )

Register USB PCD Data OUT Stage callback To be used instead of the weak HAL_PCD_DataOutStageCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Data OUT Stage callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterDataInStageCallback ( hal_pcd_handle_t * hpcd , hal_pcd_data_cb_t p_callback )

Register USB PCD Data IN Stage callback To be used instead of the weak HAL_PCD_DataInStageCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Data IN Stage callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterIsoOutIncpltCallback ( hal_pcd_handle_t * hpcd , hal_pcd_iso_cb_t p_callback )

Register USB PCD Iso OUT incomplete callback To be used instead of the weak HAL_PCD_ISOOUTIncompleteCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Iso OUT incomplete callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterIsoInIncpltCallback ( hal_pcd_handle_t * hpcd , hal_pcd_iso_cb_t p_callback )

Register USB PCD Iso IN incomplete callback To be used instead of the weak HAL_PCD_ISOINIncompleteCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Iso IN incomplete callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterErrorCallback ( hal_pcd_handle_t * hpcd , hal_pcd_cb_t p_callback )

Register USB PCD Error callback To be used instead of the weak HAL_PCD_ErrorCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD Error callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterBcdCallback ( hal_pcd_handle_t * hpcd , hal_pcd_bcd_cb_t p_callback )

Register USB PCD BCD callback To be used instead of the weak HAL_PCD_BcdCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD BCD callback function

Return values :

HAL – status

hal_status_t HAL_PCD_RegisterLpmCallback ( hal_pcd_handle_t * hpcd , hal_pcd_lpm_cb_t p_callback )

Register USB PCD LPM callback To be used instead of the weak HAL_PCD_LpmCallback() predefined callback.

Parameters :
  • hpcd – PCD handle

  • p_callback – pointer to the USB PCD LPM callback function

Return values :

HAL – status

A set of functions allowing to manage a user data pointer stored to the PCD handle:

Functions

void HAL_PCD_SetUserData ( hal_pcd_handle_t * hpcd , const void * p_user_data )

Set the user data pointer into the handle.

Parameters :
const void * HAL_PCD_GetUserData ( const hal_pcd_handle_t * hpcd )

Get the user data pointer from the handle.

Parameters :

hpcd – Pointer to a hal_pcd_handle_t

Return values :

Pointer – to the user data.

Peripheral Control functions

group PCD_Exported_Functions_Group3

management functions

 ===============================================================================
                      ##### Peripheral Control functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to control the PCD data
    transfers.

Functions

hal_status_t HAL_PCD_DeviceConnect ( const hal_pcd_handle_t * hpcd )

Connect the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_DeviceDisconnect ( const hal_pcd_handle_t * hpcd )

Disconnect the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_SetDeviceAddress ( hal_pcd_handle_t * hpcd , uint8_t address )

Set the USB Device address.

Parameters :
  • hpcd – PCD handle

  • address – new device address

Return values :

HAL – status

hal_pcd_device_speed_t HAL_PCD_GetDeviceSpeed ( const hal_pcd_handle_t * hpcd )

Get the USB Device speed.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_OpenEndpoint ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint16_t ep_mps , hal_pcd_ep_type_t ep_type )

Open and configure an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • ep_mps – endpoint max packet size

  • ep_type – endpoint type

Return values :

HAL – status

hal_status_t HAL_PCD_CloseEndpoint ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Deactivate an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_SetEndpointReceive ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint8_t * p_buffer , uint32_t size_byte )

Receive an amount of data.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • p_buffer – pointer to the reception buffer

  • size_byte – amount of data to be received

Return values :

HAL – status

uint32_t HAL_PCD_EP_GetRxCount ( const hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Get Received Data Size.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

Data – Size

hal_status_t HAL_PCD_SetEndpointTransmit ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint8_t * p_buffer , uint32_t size_byte )

Send an amount of data.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • p_buffer – pointer to the transmission buffer

  • size_byte – amount of data to be sent

Return values :

HAL – status

hal_status_t HAL_PCD_SetEndpointStall ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Set a STALL condition over an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_ClearEndpointStall ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Clear a STALL condition over in an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_AbortEndpointTransfer ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Abort an USB EP transaction.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_FlushEndpoint ( const hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Flush an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_RemoteWakeup_Start ( const hal_pcd_handle_t * hpcd )

Start remote wakeup signalling.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_RemoteWakeup_Stop ( const hal_pcd_handle_t * hpcd )

Stop remote wakeup signalling.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

void HAL_PCD_IRQHandler ( hal_pcd_handle_t * hpcd )

Handles PCD interrupt request.

Parameters :

hpcd – PCD handle

void HAL_PCD_OTG_IRQHandler ( hal_pcd_handle_t * hpcd )

Handles PCD interrupt request.

Parameters :

hpcd – PCD handle

hal_status_t HAL_PCD_SetTxFiFoSize ( const hal_pcd_handle_t * hpcd , uint8_t fifo , uint16_t size_words )

Set Tx FIFO Size.

Parameters :
  • hpcd – PCD handle

  • fifo – number of Tx fifo

  • size_words – FIFO size in words

Return values :

HAL – status

hal_status_t HAL_PCD_SetRxFiFoSize ( const hal_pcd_handle_t * hpcd , uint16_t size_words )

Set Rx FIFO Size.

Parameters :
  • hpcd – PCD handle

  • size_words – Size of Rx FIFO in words

Return values :

HAL – status

hal_status_t HAL_PCD_Start ( hal_pcd_handle_t * hpcd )

Start the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_Stop ( hal_pcd_handle_t * hpcd )

Stop the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

void HAL_PCD_SofCallback ( hal_pcd_handle_t * hpcd )

USB Start Of Frame callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_SetupStageCallback ( hal_pcd_handle_t * hpcd )

Setup stage callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ResetCallback ( hal_pcd_handle_t * hpcd )

USB Reset callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_SuspendCallback ( hal_pcd_handle_t * hpcd )

Suspend event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ResumeCallback ( hal_pcd_handle_t * hpcd )

Resume event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_ConnectCallback ( hal_pcd_handle_t * hpcd )

Connection event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_DisconnectCallback ( hal_pcd_handle_t * hpcd )

Disconnection event callback.

Parameters :

hpcd – PCD handle

void HAL_PCD_DataOutStageCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Data OUT stage callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_DataInStageCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Data IN stage callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_ISOOUTIncompleteCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Incomplete ISO OUT callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_ISOINIncompleteCallback ( hal_pcd_handle_t * hpcd , uint8_t ep_num )

Incomplete ISO IN callback.

Parameters :
  • hpcd – PCD handle

  • ep_num – endpoint number

void HAL_PCD_LpmCallback ( hal_pcd_handle_t * hpcd , hal_pcd_lpm_active_status_t lpm_status )

Send LPM active status to user layer callback.

Parameters :
  • hpcd – PCD handle

  • lpm_status – LPM active status

void HAL_PCD_BcdCallback ( hal_pcd_handle_t * hpcd , hal_pcd_bcd_port_type_t port_type )

Send BatteryCharging port type to user layer callback.

Parameters :
  • hpcd – PCD handle

  • port_type – port type

hal_status_t HAL_PCD_LPM_Start ( hal_pcd_handle_t * hpcd )

Start LPM feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_LPM_Stop ( hal_pcd_handle_t * hpcd )

Stop LPM feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_PortTypeDetection ( hal_pcd_handle_t * hpcd )

Port Type Detection Process.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_Start ( hal_pcd_handle_t * hpcd )

Start Battery Charging feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_BCD_Stop ( hal_pcd_handle_t * hpcd )

Stop Battery Charging feature.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

Peripheral State functions

group PCD_Exported_Functions_Group4

Peripheral State functions.

 ===============================================================================
                      ##### Peripheral State functions #####
 ===============================================================================
    [..]
    This subsection permits to get in run-time the status of the peripheral
    and the data flow.

Functions

hal_pcd_state_t HAL_PCD_GetState ( const hal_pcd_handle_t * hpcd )

Return the PCD handle state.

Parameters :

hpcd – PCD handle

Return values :

HAL – state

hal_status_t HAL_PCD_SetDeviceTestMode ( hal_pcd_handle_t * hpcd , hal_pcd_hset_t test_mode )

Set the USB Device high speed test mode.

Parameters :
  • hpcd – PCD handle

  • test_mode – USB Device high speed test mode

Return values :

HAL – status

hal_status_t HAL_PCD_DeviceConnect ( const hal_pcd_handle_t * hpcd )

Connect the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_DeviceDisconnect ( const hal_pcd_handle_t * hpcd )

Disconnect the USB device.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_pcd_device_speed_t HAL_PCD_GetDeviceSpeed ( const hal_pcd_handle_t * hpcd )

Get the USB Device speed.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_SetDeviceAddress ( hal_pcd_handle_t * hpcd , uint8_t address )

Set the USB Device address.

Parameters :
  • hpcd – PCD handle

  • address – new device address

Return values :

HAL – status

hal_status_t HAL_PCD_OpenEndpoint ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint16_t ep_mps , hal_pcd_ep_type_t ep_type )

Open and configure an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • ep_mps – endpoint max packet size

  • ep_type – endpoint type

Return values :

HAL – status

hal_status_t HAL_PCD_CloseEndpoint ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Deactivate an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_FlushEndpoint ( const hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Flush an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_SetEndpointReceive ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint8_t * p_buffer , uint32_t size_byte )

Receive an amount of data.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • p_buffer – pointer to the reception buffer

  • size_byte – amount of data to be received

Return values :

HAL – status

hal_status_t HAL_PCD_SetEndpointTransmit ( hal_pcd_handle_t * hpcd , uint8_t ep_addr , uint8_t * p_buffer , uint32_t size_byte )

Send an amount of data.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

  • p_buffer – pointer to the transmission buffer

  • size_byte – amount of data to be sent

Return values :

HAL – status

hal_status_t HAL_PCD_SetEndpointStall ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Set a STALL condition over an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_ClearEndpointStall ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Clear a STALL condition over in an endpoint.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_AbortEndpointTransfer ( hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Abort an USB EP transaction.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

HAL – status

hal_status_t HAL_PCD_RemoteWakeup_Start ( const hal_pcd_handle_t * hpcd )

Start remote wakeup signalling.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

hal_status_t HAL_PCD_RemoteWakeup_Stop ( const hal_pcd_handle_t * hpcd )

Stop remote wakeup signalling.

Parameters :

hpcd – PCD handle

Return values :

HAL – status

uint32_t HAL_PCD_EP_GetRxCount ( const hal_pcd_handle_t * hpcd , uint8_t ep_addr )

Get Received Data Size.

Parameters :
  • hpcd – PCD handle

  • ep_addr – endpoint address

Return values :

Data – Size

Peripheral State functions

group PCD_Exported_Functions_Group5

Functions

hal_pcd_state_t HAL_PCD_GetState ( const hal_pcd_handle_t * hpcd )

Return the PCD handle state.

Parameters :

hpcd – PCD handle

Return values :

HAL – state

void HAL_PCD_ErrorCallback ( hal_pcd_handle_t * hpcd )

PCD Error callback.

Parameters :

hpcd – PCD handle

Set/Get user data

group PCD_Exported_Functions_Group6

Functions

void HAL_PCD_SetUserData ( hal_pcd_handle_t * hpcd , const void * p_user_data )

Set the user data pointer into the handle.

Parameters :
const void * HAL_PCD_GetUserData ( const hal_pcd_handle_t * hpcd )

Get the user data pointer from the handle.

Parameters :

hpcd – Pointer to a hal_pcd_handle_t

Return values :

Pointer – to the user data.