HAL UCPD Functions ¶
Initialization and de-initialization functions ¶
- group UCPD_Exported_Functions_Group1
-
A set of functions allowing to initialize and deinitialize the UCPDx peripheral:
-
HAL_UCPD_Init() to initialize the selected UCPDx handle and associate an instance.
-
HAL_UCPD_DeInit() to restore the default configuration of the selected UCPDx peripheral.
Functions
-
hal_status_t
HAL_UCPD_Init
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_t
instance
)
¶
-
Initialize the UCPD according to the associated handle.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
instance – UCPD instance.
-
- Return values :
-
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – UCPD instance is already initialized and cannot be modified or semaphore creation failed (USE_HAL_MUTEX is set to 1).
-
HAL_OK – UCPD instance has been correctly initialized.
-
-
void
HAL_UCPD_DeInit
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Deinitialize the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
- group UCPD_Exported_Functions_Group1
-
A set of functions allowing to initialize and deinitialize the UCPDx peripheral:
-
HAL_UCPD_Init() to initialize the selected UCPDx handle and associate an instance.
-
HAL_UCPD_DeInit() to restore the default configuration of the selected UCPDx peripheral.
Functions
-
hal_status_t
HAL_UCPD_Init
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_t
instance
)
-
Initialize the UCPD according to the associated handle.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
instance – UCPD instance.
-
- Return values :
-
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – UCPD instance is already initialized and cannot be modified or semaphore creation failed (USE_HAL_MUTEX is set to 1).
-
HAL_OK – UCPD instance has been correctly initialized.
-
-
void
HAL_UCPD_DeInit
(
hal_ucpd_handle_t
*
hucpd
)
-
Deinitialize the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
Configuration functions ¶
- group UCPD_Exported_Functions_Group2
-
A set of functions allowing to configure the UCPDx peripheral:
-
Global configuration
-
Rx ordered sets
-
Rx/Tx DMA management
-
Wake-up from Stop mode
-
Software trimming
-
Start/Stop
Functions
-
hal_status_t
HAL_UCPD_SetConfig
(
hal_ucpd_handle_t
*
hucpd
,
const
hal_ucpd_config_t
*
p_config
)
¶
-
Configure the UCPD according to the user parameters.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_config – Pointer to a hal_ucpd_config_t structure that contains the UCPD configuration.
-
- Return values :
-
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
void
HAL_UCPD_GetConfig
(
const
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_config_t
*
p_config
)
¶
-
Get the UCPD configuration.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_config – Pointer to a hal_ucpd_config_t structure that contains the UCPD configuration.
-
-
hal_status_t
HAL_UCPD_SetRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
rx_ordered_set
)
¶
-
Set the type(s) of ordered set(s) that the receiver must detect.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_ordered_set – Type(s) of ordered set(s) that the receiver must detect. This parameter can be any combination of the following values:
-
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
uint32_t
HAL_UCPD_GetRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the types of ordered sets that the receiver must detect.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
Enabled ordered sets. This can be any combination of the following values:
-
hal_status_t
HAL_UCPD_SetRxDMA
(
hal_ucpd_handle_t
*
hucpd
,
hal_dma_handle_t
*
hdma_rx
)
¶
-
Set DMA channel for reception.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
hdma_rx – Pointer to a hal_dma_handle_t structure which contains the DMA instance
-
- Return values :
-
-
HAL_OK – DMA channel has been correctly set.
-
HAL_INVALID_PARAM – hdma_rx is NULL.
-
-
hal_status_t
HAL_UCPD_SetTxDMA
(
hal_ucpd_handle_t
*
hucpd
,
hal_dma_handle_t
*
hdma_tx
)
¶
-
Set DMA channel for transmission.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
hdma_tx – Pointer to a hal_dma_handle_t structure which contains the DMA instance
-
- Return values :
-
-
HAL_OK – DMA channel has been correctly set.
-
HAL_INVALID_PARAM – hdma_tx is NULL.
-
-
hal_status_t
HAL_UCPD_EnableRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable the UCPD receiver hardware analog filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable the UCPD receiver hardware analog filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_analog_filter_status_t
HAL_UCPD_IsEnabledRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return the UCPD receiver hardware analog filter.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_analog_filter_status_t Receiver hardware analog filter status.
-
hal_status_t
HAL_UCPD_EnableWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable UCPD wake-up from Stop mode.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable UCPD wake-up from Stop mode.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_wakeup_mode_status_t
HAL_UCPD_IsEnabledWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return UCPD wake-up from Stop mode status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_wakeup_mode_status_t Wake-up from stop mode status.
-
hal_status_t
HAL_UCPD_EnableForceClock
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable UCPD ClkReq clock request forcing.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableForceClock
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable UCPD ClkReq clock request forcing.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_force_clk_status_t
HAL_UCPD_IsEnabledForceClock
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return UCPD ClkReq clock request forcing status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_force_clk_status_t ClkReq clock request forcing status.
-
hal_status_t
HAL_UCPD_SetRxPreFilterSampling
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rx_prefilter_samples_t
rx_prefilter_samples
)
¶
-
Set the BMC decoder Rx pre-filter sampling method.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_prefilter_samples – BMC decoder Rx pre-filter sampling method.
-
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_prefilter_samples_t
HAL_UCPD_GetRxPreFilterSampling
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the BMC decoder Rx pre-filter sampling method.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_prefilter_samples_t BMC decoder Rx pre-filter sampling method.
-
hal_status_t
HAL_UCPD_EnableRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable UCPD Rx pre-filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable UCPD Rx pre-filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_prefilter_status_t
HAL_UCPD_IsEnabledRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return UCPD Rx pre-filter status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_prefilter_status_t Rx pre-filter status.
-
hal_status_t
HAL_UCPD_ApplyTrimmingRp
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_trim_rp_value_t
trim_rp_value
)
¶
-
Apply the Rp current sources trimming on both CC lines.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
trim_rp_value – Rp value to apply trimming to.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_ApplyTrimmingRd
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Apply the Rd resistors trimming on both CC lines.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_Start
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Start the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_Stop
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Stop the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
- group UCPD_Exported_Functions_Group2
-
A set of functions allowing to configure the UCPDx peripheral:
-
Global configuration
-
Rx ordered sets
-
Rx/Tx DMA management
-
Wake-up from Stop mode
-
Software trimming
-
Start/Stop
Functions
-
hal_status_t
HAL_UCPD_SetConfig
(
hal_ucpd_handle_t
*
hucpd
,
const
hal_ucpd_config_t
*
p_config
)
-
Configure the UCPD according to the user parameters.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_config – Pointer to a hal_ucpd_config_t structure that contains the UCPD configuration.
-
- Return values :
-
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
void
HAL_UCPD_GetConfig
(
const
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_config_t
*
p_config
)
-
Get the UCPD configuration.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_config – Pointer to a hal_ucpd_config_t structure that contains the UCPD configuration.
-
-
hal_status_t
HAL_UCPD_SetRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
rx_ordered_set
)
-
Set the type(s) of ordered set(s) that the receiver must detect.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_ordered_set – Type(s) of ordered set(s) that the receiver must detect. This parameter can be any combination of the following values:
-
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
uint32_t
HAL_UCPD_GetRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the types of ordered sets that the receiver must detect.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
Enabled ordered sets. This can be any combination of the following values:
-
hal_status_t
HAL_UCPD_SetRxDMA
(
hal_ucpd_handle_t
*
hucpd
,
hal_dma_handle_t
*
hdma_rx
)
-
Set DMA channel for reception.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
hdma_rx – Pointer to a hal_dma_handle_t structure which contains the DMA instance
-
- Return values :
-
-
HAL_OK – DMA channel has been correctly set.
-
HAL_INVALID_PARAM – hdma_rx is NULL.
-
-
hal_status_t
HAL_UCPD_SetTxDMA
(
hal_ucpd_handle_t
*
hucpd
,
hal_dma_handle_t
*
hdma_tx
)
-
Set DMA channel for transmission.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
hdma_tx – Pointer to a hal_dma_handle_t structure which contains the DMA instance
-
- Return values :
-
-
HAL_OK – DMA channel has been correctly set.
-
HAL_INVALID_PARAM – hdma_tx is NULL.
-
-
hal_status_t
HAL_UCPD_EnableRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable the UCPD receiver hardware analog filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable the UCPD receiver hardware analog filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_analog_filter_status_t
HAL_UCPD_IsEnabledRxAnalogFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Return the UCPD receiver hardware analog filter.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_analog_filter_status_t Receiver hardware analog filter status.
-
hal_status_t
HAL_UCPD_EnableWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable UCPD wake-up from Stop mode.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable UCPD wake-up from Stop mode.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_wakeup_mode_status_t
HAL_UCPD_IsEnabledWakeupMode
(
hal_ucpd_handle_t
*
hucpd
)
-
Return UCPD wake-up from Stop mode status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_wakeup_mode_status_t Wake-up from stop mode status.
-
hal_status_t
HAL_UCPD_EnableForceClock
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable UCPD ClkReq clock request forcing.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableForceClock
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable UCPD ClkReq clock request forcing.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_force_clk_status_t
HAL_UCPD_IsEnabledForceClock
(
hal_ucpd_handle_t
*
hucpd
)
-
Return UCPD ClkReq clock request forcing status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_force_clk_status_t ClkReq clock request forcing status.
-
hal_status_t
HAL_UCPD_SetRxPreFilterSampling
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rx_prefilter_samples_t
rx_prefilter_samples
)
-
Set the BMC decoder Rx pre-filter sampling method.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_prefilter_samples – BMC decoder Rx pre-filter sampling method.
-
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_prefilter_samples_t
HAL_UCPD_GetRxPreFilterSampling
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the BMC decoder Rx pre-filter sampling method.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_prefilter_samples_t BMC decoder Rx pre-filter sampling method.
-
hal_status_t
HAL_UCPD_EnableRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable UCPD Rx pre-filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_status_t
HAL_UCPD_DisableRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable UCPD Rx pre-filter.
Warning
This function modifies a static configuration, and therefore must not be called after HAL_UCPD_Start() .
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_ERROR – UCPD instance is already configured and cannot be modified.
-
HAL_OK – UCPD instance has been correctly configured.
-
-
hal_ucpd_rx_prefilter_status_t
HAL_UCPD_IsEnabledRxPreFilter
(
hal_ucpd_handle_t
*
hucpd
)
-
Return UCPD Rx pre-filter status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_prefilter_status_t Rx pre-filter status.
-
hal_status_t
HAL_UCPD_ApplyTrimmingRp
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_trim_rp_value_t
trim_rp_value
)
-
Apply the Rp current sources trimming on both CC lines.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
trim_rp_value – Rp value to apply trimming to.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_ApplyTrimmingRd
(
hal_ucpd_handle_t
*
hucpd
)
-
Apply the Rd resistors trimming on both CC lines.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_Start
(
hal_ucpd_handle_t
*
hucpd
)
-
Start the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_Stop
(
hal_ucpd_handle_t
*
hucpd
)
-
Stop the UCPD peripheral.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
Control functions ¶
- group UCPD_Exported_Functions_Group3
-
A set of functions allowing to control the UCPDx peripheral:
-
Rx PHY enabling
-
Type-C detector
-
Vconn discharge
-
Tx ordered set
-
Rx/Tx modes
-
PHY operating role
-
Pull-ups (Rp) resistors
-
CC lines
-
Fast Role Swap
-
Cable reset
-
Hard reset
Functions
-
hal_status_t
HAL_UCPD_EnableRx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable the UCPD PHY receiver.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableRx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable the UCPD PHY receiver.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rx_phy_status_t
HAL_UCPD_IsEnabledRx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return the UCPD PHY receiver status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_phy_status_t UCPD PHY receiver status.
-
hal_status_t
HAL_UCPD_EnableTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Enable the UCPD Type-C detector of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to enable the Type-C detector.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Disable the UCPD Type-C detector of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to disable the Type-C detector.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_type_c_detector_status_t
HAL_UCPD_IsEnabledTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Return the UCPD Type-C detector status of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to check the status of the Type-C detector.
-
- Returns :
-
hal_ucpd_type_c_detector_status_t UCPD Type-C detector status.
-
hal_status_t
HAL_UCPD_EnableVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable the UCPD Vconn discharge.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable the UCPD Vconn discharge.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_vconn_discharge_status_t
HAL_UCPD_IsEnabledVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return the UCPD Vconn discharge status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_vconn_discharge_status_t UCPD Type-C detector status.
-
hal_status_t
HAL_UCPD_SetTxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_tx_ordered_set_t
tx_ordered_set
)
¶
-
Set the type of ordered set to transmit.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
tx_ordered_set – Ordered set type to transmit.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_tx_ordered_set_t
HAL_UCPD_GetTxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the type of ordered set to transmit.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_tx_ordered_set_t The ordered set type to transmit.
-
hal_status_t
HAL_UCPD_SetTxMode
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_tx_mode_t
tx_mode
)
¶
-
Set the transmission mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
tx_mode – Transmission mode.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_tx_mode_t
HAL_UCPD_GetTxMode
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the transmission mode.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_tx_mode_t Transmission mode.
-
hal_status_t
HAL_UCPD_SetRxMode
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rx_mode_t
rx_mode
)
¶
-
Set the reception mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_mode – Reception mode.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rx_mode_t
HAL_UCPD_GetRxMode
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the reception mode.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_mode_t Reception mode.
-
hal_status_t
HAL_UCPD_SetRole
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_role_t
role
)
¶
-
Set the analog PHY operating role.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
role – Source or sink role.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_role_t
HAL_UCPD_GetRole
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the analog PHY operating role.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_role_t Analog PHY operating role.
-
hal_status_t
HAL_UCPD_SetRp
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rp_value_t
rp_value
)
¶
-
Set Rp resistors to signal the device’s power requirements to the host.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rp_value – Rp value to set.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rp_value_t
HAL_UCPD_GetRp
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the Rp resistors value.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rp_value_t Rp value.
-
hal_status_t
HAL_UCPD_SetCCLines
(
hal_ucpd_handle_t
*
hucpd
,
const
hal_ucpd_cc_enable_t
cc_enable
)
¶
-
Set which CC line(s) is(are) enabled.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_enable – CC line(s) to enable.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_cc_enable_t
HAL_UCPD_GetCCLines
(
const
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get which CC line(s) is(are) enabled.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_cc_enable_t Enabled CC line(s).
-
hal_status_t
HAL_UCPD_SetActiveCC
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Set the active CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – Active CC line to set.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_cc_line_t
HAL_UCPD_GetActiveCC
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the active CC line.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_cc_line_t Active CC line.
-
hal_status_t
HAL_UCPD_EnableFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable the detection of Fast Role Swap reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Disable the detection of Fast Role Swap reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_frs_rx_status_t
HAL_UCPD_IsEnabledFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return the detection of Fast Role Swap reception status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_frs_rx_status_t Fast Role Swap reception status.
-
hal_status_t
HAL_UCPD_SendFRS
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Send a Fast Role Swap to the port partner.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD Fast Role Swap has been correctly initiated.
-
hal_status_t
HAL_UCPD_SendCableReset
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Send a cable reset to the cable.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD cable reset has been correctly initiated.
-
hal_status_t
HAL_UCPD_SendHardReset
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Send a hard reset to the port partner.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD hard reset has been correctly initiated.
-
hal_status_t
HAL_UCPD_EnableHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable hard reset reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Enable hard reset reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_hard_reset_rx_status_t
HAL_UCPD_IsEnabledHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Return hard reset reception status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_hard_reset_rx_status_t Hard reset reception status.
-
hal_status_t
HAL_UCPD_SendBIST
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Start sending a BIST test sequence (BIST Carrier Mode 2).
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_OK – UCPD test sequence has been correctly initiated.
-
-
hal_status_t
HAL_UCPD_StopBIST
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Stop BIST test sequence (BIST Carrier Mode 2) sending.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD test sequence has been correctly stopped.
-
- group UCPD_Exported_Functions_Group3
-
A set of functions allowing to control the UCPDx peripheral:
-
Rx PHY enabling
-
Type-C detector
-
Vconn discharge
-
Tx ordered set
-
Rx/Tx modes
-
PHY operating role
-
Pull-ups (Rp) resistors
-
CC lines
-
Fast Role Swap
-
Cable reset
-
Hard reset
Functions
-
hal_status_t
HAL_UCPD_EnableRx
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable the UCPD PHY receiver.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableRx
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable the UCPD PHY receiver.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rx_phy_status_t
HAL_UCPD_IsEnabledRx
(
hal_ucpd_handle_t
*
hucpd
)
-
Return the UCPD PHY receiver status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_phy_status_t UCPD PHY receiver status.
-
hal_status_t
HAL_UCPD_EnableTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Enable the UCPD Type-C detector of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to enable the Type-C detector.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Disable the UCPD Type-C detector of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to disable the Type-C detector.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_type_c_detector_status_t
HAL_UCPD_IsEnabledTypeCDetectorCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Return the UCPD Type-C detector status of the given CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line on which to check the status of the Type-C detector.
-
- Returns :
-
hal_ucpd_type_c_detector_status_t UCPD Type-C detector status.
-
hal_status_t
HAL_UCPD_EnableVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable the UCPD Vconn discharge.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable the UCPD Vconn discharge.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_vconn_discharge_status_t
HAL_UCPD_IsEnabledVconnDischarge
(
hal_ucpd_handle_t
*
hucpd
)
-
Return the UCPD Vconn discharge status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_vconn_discharge_status_t UCPD Type-C detector status.
-
hal_status_t
HAL_UCPD_SetTxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_tx_ordered_set_t
tx_ordered_set
)
-
Set the type of ordered set to transmit.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
tx_ordered_set – Ordered set type to transmit.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_tx_ordered_set_t
HAL_UCPD_GetTxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the type of ordered set to transmit.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_tx_ordered_set_t The ordered set type to transmit.
-
hal_status_t
HAL_UCPD_SetTxMode
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_tx_mode_t
tx_mode
)
-
Set the transmission mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
tx_mode – Transmission mode.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_tx_mode_t
HAL_UCPD_GetTxMode
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the transmission mode.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_tx_mode_t Transmission mode.
-
hal_status_t
HAL_UCPD_SetRxMode
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rx_mode_t
rx_mode
)
-
Set the reception mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rx_mode – Reception mode.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rx_mode_t
HAL_UCPD_GetRxMode
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the reception mode.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rx_mode_t Reception mode.
-
hal_status_t
HAL_UCPD_SetRole
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_role_t
role
)
-
Set the analog PHY operating role.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
role – Source or sink role.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_role_t
HAL_UCPD_GetRole
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the analog PHY operating role.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_role_t Analog PHY operating role.
-
hal_status_t
HAL_UCPD_SetRp
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_rp_value_t
rp_value
)
-
Set Rp resistors to signal the device’s power requirements to the host.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
rp_value – Rp value to set.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_rp_value_t
HAL_UCPD_GetRp
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the Rp resistors value.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_rp_value_t Rp value.
-
hal_status_t
HAL_UCPD_SetCCLines
(
hal_ucpd_handle_t
*
hucpd
,
const
hal_ucpd_cc_enable_t
cc_enable
)
-
Set which CC line(s) is(are) enabled.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_enable – CC line(s) to enable.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_cc_enable_t
HAL_UCPD_GetCCLines
(
const
hal_ucpd_handle_t
*
hucpd
)
-
Get which CC line(s) is(are) enabled.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_cc_enable_t Enabled CC line(s).
-
hal_status_t
HAL_UCPD_SetActiveCC
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Set the active CC line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – Active CC line to set.
-
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_cc_line_t
HAL_UCPD_GetActiveCC
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the active CC line.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_cc_line_t Active CC line.
-
hal_status_t
HAL_UCPD_EnableFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable the detection of Fast Role Swap reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Disable the detection of Fast Role Swap reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_frs_rx_status_t
HAL_UCPD_IsEnabledFRS_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Return the detection of Fast Role Swap reception status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_frs_rx_status_t Fast Role Swap reception status.
-
hal_status_t
HAL_UCPD_SendFRS
(
hal_ucpd_handle_t
*
hucpd
)
-
Send a Fast Role Swap to the port partner.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD Fast Role Swap has been correctly initiated.
-
hal_status_t
HAL_UCPD_SendCableReset
(
hal_ucpd_handle_t
*
hucpd
)
-
Send a cable reset to the cable.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD cable reset has been correctly initiated.
-
hal_status_t
HAL_UCPD_SendHardReset
(
hal_ucpd_handle_t
*
hucpd
)
-
Send a hard reset to the port partner.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD hard reset has been correctly initiated.
-
hal_status_t
HAL_UCPD_EnableHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable hard reset reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_status_t
HAL_UCPD_DisableHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Enable hard reset reception.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD instance has been correctly configured.
-
hal_ucpd_hard_reset_rx_status_t
HAL_UCPD_IsEnabledHardReset_Rx
(
hal_ucpd_handle_t
*
hucpd
)
-
Return hard reset reception status.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_hard_reset_rx_status_t Hard reset reception status.
-
hal_status_t
HAL_UCPD_SendBIST
(
hal_ucpd_handle_t
*
hucpd
)
-
Start sending a BIST test sequence (BIST Carrier Mode 2).
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_OK – UCPD test sequence has been correctly initiated.
-
-
hal_status_t
HAL_UCPD_StopBIST
(
hal_ucpd_handle_t
*
hucpd
)
-
Stop BIST test sequence (BIST Carrier Mode 2) sending.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – UCPD test sequence has been correctly stopped.
-
Status functions ¶
- group UCPD_Exported_Functions_Group4
-
A set of functions related to UCPDx peripheral status:
-
CC line voltage status
-
Detected Rx ordered set
Functions
-
hal_ucpd_vstate_t
HAL_UCPD_GetTypeCVoltageLevelCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Get the voltage state on CCx line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line of type hal_ucpd_cc_line_t structure.
-
- Returns :
-
hal_ucpd_vstate_t Voltage state on given CC line.
-
hal_ucpd_detected_rx_ordered_set_t
HAL_UCPD_GetDetectedRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the detected type of received ordered set.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_detected_rx_ordered_set_t The detected ordered set.
-
- group UCPD_Exported_Functions_Group4
-
A set of functions related to UCPDx peripheral status:
-
CC line voltage status
-
Detected Rx ordered set
Functions
-
hal_ucpd_vstate_t
HAL_UCPD_GetTypeCVoltageLevelCCx
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Get the voltage state on CCx line.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line of type hal_ucpd_cc_line_t structure.
-
- Returns :
-
hal_ucpd_vstate_t Voltage state on given CC line.
-
hal_ucpd_detected_rx_ordered_set_t
HAL_UCPD_GetDetectedRxOrderedSet
(
hal_ucpd_handle_t
*
hucpd
)
-
Get the detected type of received ordered set.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Returns :
-
hal_ucpd_detected_rx_ordered_set_t The detected ordered set.
-
IO operation functions ¶
- group UCPD_Exported_Functions_Group5
-
A set of functions allowing to manage data transfer:
-
DMA operations
-
Abort
-
GoodCRC preparation
Functions
-
hal_status_t
HAL_UCPD_Transmit_DMA
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_data
,
uint32_t
size_byte
)
¶
-
Send an amount of data in DMA mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_data – Pointer to data buffer.
-
size_byte – Amount of bytes to be sent (min 2).
-
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – Tx DMA handle not set.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_Receive_DMA
(
hal_ucpd_handle_t
*
hucpd
,
void
*
p_data
,
uint32_t
size_byte
)
¶
-
Receive an amount of data in DMA mode, and send GoodCRC message after end of reception.
Note
This procedure also configure the Tx DMA to be ready for GoodCRC transmission after the end of reception. At reception completion, HAL_UCPD_RxCpltCallback() is executed and users can add their own code by customization of function pointer HAL_UCPD_RxCpltCallback() . At this point user must prepare the GoodCRC data to send by calling HAL_UCPD_SetGoodCRCData() . After returning from HAL_UCPD_RxCpltCallback() , quick transmission of GoodCRC message will occur in the interrupt context. At GoodCRC transmission end of transfer, HAL_UCPD_TxGoodCRCCpltCallback() is executed and users can add their own code by customization of function pointer HAL_UCPD_TxGoodCRCCpltCallback() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_data – Pointer to data buffer.
-
size_byte – Amount of bytes to be received (min 2).
-
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – Rx DMA handle not set.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_Abort_IT
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Abort ongoing transfers (Interrupt mode).
Note
This procedure could be used for aborting any ongoing transfer started in DMA mode. This procedure performs following operations:
-
Disable UCPD interrupts (Tx and Rx)
-
Enable UCPD message sent interrupt (Tx)
-
Disable the DMA transfer in the peripheral register (if enabled)
-
Abort DMA transfer by calling HAL_DMA_Abort_IT() (in case of transfer in DMA mode)
Note
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Note
In case of Tx abort, the UCPD peripheral continues to send the remaining data but will ensure the CRC is incorrect, so that the receiver can end the reception and discard the message.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_SetGoodCRCData
(
hal_ucpd_handle_t
*
hucpd
,
uint16_t
goodcrc_data
)
¶
-
Set the GoodCRC buffer data to transmit after a reception.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
goodcrc_data – GoodCRC data to transmit (little-endian).
-
- Return values :
-
HAL_OK – buffer has been correctly set.
-
- group UCPD_Exported_Functions_Group5
-
A set of functions allowing to manage data transfer:
-
DMA operations
-
Abort
-
GoodCRC preparation
Functions
-
hal_status_t
HAL_UCPD_Transmit_DMA
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_data
,
uint32_t
size_byte
)
-
Send an amount of data in DMA mode.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_data – Pointer to data buffer.
-
size_byte – Amount of bytes to be sent (min 2).
-
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – Tx DMA handle not set.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_Receive_DMA
(
hal_ucpd_handle_t
*
hucpd
,
void
*
p_data
,
uint32_t
size_byte
)
-
Receive an amount of data in DMA mode, and send GoodCRC message after end of reception.
Note
This procedure also configure the Tx DMA to be ready for GoodCRC transmission after the end of reception. At reception completion, HAL_UCPD_RxCpltCallback() is executed and users can add their own code by customization of function pointer HAL_UCPD_RxCpltCallback() . At this point user must prepare the GoodCRC data to send by calling HAL_UCPD_SetGoodCRCData() . After returning from HAL_UCPD_RxCpltCallback() , quick transmission of GoodCRC message will occur in the interrupt context. At GoodCRC transmission end of transfer, HAL_UCPD_TxGoodCRCCpltCallback() is executed and users can add their own code by customization of function pointer HAL_UCPD_TxGoodCRCCpltCallback() .
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_data – Pointer to data buffer.
-
size_byte – Amount of bytes to be received (min 2).
-
- Return values :
-
-
HAL_BUSY – Concurrent process ongoing.
-
HAL_INVALID_PARAM – Invalid parameter.
-
HAL_ERROR – Rx DMA handle not set.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_Abort_IT
(
hal_ucpd_handle_t
*
hucpd
)
-
Abort ongoing transfers (Interrupt mode).
Note
This procedure could be used for aborting any ongoing transfer started in DMA mode. This procedure performs following operations:
-
Disable UCPD interrupts (Tx and Rx)
-
Enable UCPD message sent interrupt (Tx)
-
Disable the DMA transfer in the peripheral register (if enabled)
-
Abort DMA transfer by calling HAL_DMA_Abort_IT() (in case of transfer in DMA mode)
Note
This procedure is executed in Interrupt mode, meaning that abort procedure could be considered as completed only when user abort complete callback is executed (not when exiting function).
Note
In case of Tx abort, the UCPD peripheral continues to send the remaining data but will ensure the CRC is incorrect, so that the receiver can end the reception and discard the message.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_SetGoodCRCData
(
hal_ucpd_handle_t
*
hucpd
,
uint16_t
goodcrc_data
)
-
Set the GoodCRC buffer data to transmit after a reception.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure which contains the UCPD instance.
-
goodcrc_data – GoodCRC data to transmit (little-endian).
-
- Return values :
-
HAL_OK – buffer has been correctly set.
-
IRQHandler and Callbacks functions ¶
- group UCPD_Exported_Functions_Group6
-
A set of functions allowing interrupts request and callbacks management:
-
Interrupt requests
-
Callbacks
-
Callback registering
Functions
-
void
HAL_UCPD_IRQHandler
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Handler of the UCPD interrupt request.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Tx message sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxGoodCRCCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Tx GoodCRC message sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Tx message discarded.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxAbortCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Tx message aborted.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_RxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Rx message received.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_RxOrdDetCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Rx ordered set (4 K-codes) detected.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstSentCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for hard reset sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstRxCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Rx hard reset received.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for hard reset discarded.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TypeCEventCCxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
¶
-
Callback for Type-C event detection on CCx.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line of type hal_ucpd_cc_line_t structure.
-
-
void
HAL_UCPD_FRSEvtCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Callback for Fast Role Swap event detection.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_AbortCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Abort complete callback.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_ErrorCallback
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Error callback.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
hal_status_t
HAL_UCPD_RegisterTxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Tx message sent callback to be used instead of the weak HAL_UCPD_TxCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxGoodCRCCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Tx GoodCRC message sent callback to be used instead of the weak HAL_UCPD_TxGoodCRCCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Tx message discarded callback to be used instead of the weak HAL_UCPD_TxDiscardCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message discarded callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxAbortCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Tx message aborted callback to be used instead of the weak HAL_UCPD_TxAbortCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message aborted callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterRxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Rx complete callback to be used instead of the weak HAL_UCPD_RegisterRxCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Rx complete callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterRxOrdDetCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Rx ordered set detected callback to be used instead of the weak HAL_UCPD_RegisterRxOrdDetCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Rx ordered set detected callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstSentCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD hard reset sent callback to be used instead of the weak HAL_UCPD_HRstSentCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstRxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD hard reset received callback to be used instead of the weak HAL_UCPD_RegisterHRstRxCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset received callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD hard reset discarded callback to be used instead of the weak HAL_UCPD_HRstDiscardCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset discarded callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTypeCEventCCxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_event_cb_t
p_callback
)
¶
-
Register the UCPD Type-C event on CCx callback to be used instead of the weak HAL_UCPD_RegisterTypeCEventCCxCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Type-C event on CCx callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterFRSEvtCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Fast Role Swap event detected callback to be used instead of the weak HAL_UCPD_RegisterFRSEvtCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Fast Role Swap event detected callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterAbortCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD abort complete Callback to be used instead of the weak HAL_UCPD_AbortCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t abort complete Callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterErrorCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
¶
-
Register the UCPD Error Callback to be used instead of the weak HAL_UCPD_ErrorCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Error Callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
- group UCPD_Exported_Functions_Group6
-
A set of functions allowing interrupts request and callbacks management:
-
Interrupt requests
-
Callbacks
-
Callback registering
Functions
-
void
HAL_UCPD_IRQHandler
(
hal_ucpd_handle_t
*
hucpd
)
-
Handler of the UCPD interrupt request.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Tx message sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxGoodCRCCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Tx GoodCRC message sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Tx message discarded.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TxAbortCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Tx message aborted.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_RxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Rx message received.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_RxOrdDetCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Rx ordered set (4 K-codes) detected.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstSentCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for hard reset sent.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstRxCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Rx hard reset received.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_HRstDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for hard reset discarded.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_TypeCEventCCxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_line_t
cc_line
)
-
Callback for Type-C event detection on CCx.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
cc_line – CC line of type hal_ucpd_cc_line_t structure.
-
-
void
HAL_UCPD_FRSEvtCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Callback for Fast Role Swap event detection.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_AbortCpltCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Abort complete callback.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
void
HAL_UCPD_ErrorCallback
(
hal_ucpd_handle_t
*
hucpd
)
-
Error callback.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
hal_status_t
HAL_UCPD_RegisterTxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Tx message sent callback to be used instead of the weak HAL_UCPD_TxCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxGoodCRCCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Tx GoodCRC message sent callback to be used instead of the weak HAL_UCPD_TxGoodCRCCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Tx message discarded callback to be used instead of the weak HAL_UCPD_TxDiscardCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message discarded callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTxAbortCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Tx message aborted callback to be used instead of the weak HAL_UCPD_TxAbortCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Tx message aborted callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterRxCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Rx complete callback to be used instead of the weak HAL_UCPD_RegisterRxCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Rx complete callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterRxOrdDetCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Rx ordered set detected callback to be used instead of the weak HAL_UCPD_RegisterRxOrdDetCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Rx ordered set detected callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstSentCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD hard reset sent callback to be used instead of the weak HAL_UCPD_HRstSentCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset sent callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstRxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD hard reset received callback to be used instead of the weak HAL_UCPD_RegisterHRstRxCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset received callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterHRstDiscardCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD hard reset discarded callback to be used instead of the weak HAL_UCPD_HRstDiscardCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t hard reset discarded callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterTypeCEventCCxCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cc_event_cb_t
p_callback
)
-
Register the UCPD Type-C event on CCx callback to be used instead of the weak HAL_UCPD_RegisterTypeCEventCCxCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Type-C event on CCx callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterFRSEvtCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Fast Role Swap event detected callback to be used instead of the weak HAL_UCPD_RegisterFRSEvtCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Fast Role Swap event detected callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterAbortCpltCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD abort complete Callback to be used instead of the weak HAL_UCPD_AbortCpltCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t abort complete Callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
hal_status_t
HAL_UCPD_RegisterErrorCallback
(
hal_ucpd_handle_t
*
hucpd
,
hal_ucpd_cb_t
p_callback
)
-
Register the UCPD Error Callback to be used instead of the weak HAL_UCPD_ErrorCallback() predefined callback.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
-
p_callback – Pointer to the hal_ucpd_cb_t Error Callback function.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_callback is NULL.
-
HAL_OK – Register completed successfully.
-
-
Peripheral State, Error functions ¶
- group UCPD_Exported_Functions_Group7
-
A set of functions allowing to manage peripheral states and errors:
Functions
-
hal_ucpd_state_t
HAL_UCPD_GetState
(
const
hal_ucpd_handle_t
*
hucpd
)
¶
-
Retrieve the HAL UCPD global state.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
hal_ucpd_state_t – HAL UCPD global state
-
uint32_t
HAL_UCPD_GetLastErrorCodes
(
const
hal_ucpd_handle_t
*
hucpd
)
¶
-
Retrieve the HAL UCPD last error codes.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
uint32_t – HAL UCPD bit mapped last errors.
-
hal_ucpd_state_t
HAL_UCPD_GetState
(
const
hal_ucpd_handle_t
*
hucpd
)
¶
- group UCPD_Exported_Functions_Group7
-
A set of functions allowing to manage peripheral states and errors:
Functions
-
hal_ucpd_state_t
HAL_UCPD_GetState
(
const
hal_ucpd_handle_t
*
hucpd
)
-
Retrieve the HAL UCPD global state.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
hal_ucpd_state_t – HAL UCPD global state
-
uint32_t
HAL_UCPD_GetLastErrorCodes
(
const
hal_ucpd_handle_t
*
hucpd
)
-
Retrieve the HAL UCPD last error codes.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t structure.
- Return values :
-
uint32_t – HAL UCPD bit mapped last errors.
-
hal_ucpd_state_t
HAL_UCPD_GetState
(
const
hal_ucpd_handle_t
*
hucpd
)
Acquire/Release the bus ¶
- group UCPD_Exported_Functions_Group8
-
A set of functions allowing to Acquire/Release the bus based on the HAL OS abstraction layer (if USE_HAL_MUTEX == 1):
Functions
-
hal_status_t
HAL_UCPD_AcquireBus
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
timeout_ms
)
¶
-
Acquire the UCPD bus thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Warning
This function must be called from thread mode only (not from handler mode i.e from ISR).
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t .
-
timeout_ms – Timeout duration in millisecond.
-
- Return values :
-
-
HAL_ERROR – Operation completed with error.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_ReleaseBus
(
hal_ucpd_handle_t
*
hucpd
)
¶
-
Release the UCPD bus thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
This function can be called from thread mode or from handler mode i.e from ISR.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t .
- Return values :
-
-
HAL_ERROR – Operation completed with error.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_AcquireBus
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
timeout_ms
)
¶
- group UCPD_Exported_Functions_Group8
-
A set of functions allowing to Acquire/Release the bus based on the HAL OS abstraction layer (if USE_HAL_MUTEX == 1):
Functions
-
hal_status_t
HAL_UCPD_AcquireBus
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
timeout_ms
)
-
Acquire the UCPD bus thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Warning
This function must be called from thread mode only (not from handler mode i.e from ISR).
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t .
-
timeout_ms – Timeout duration in millisecond.
-
- Return values :
-
-
HAL_ERROR – Operation completed with error.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_ReleaseBus
(
hal_ucpd_handle_t
*
hucpd
)
-
Release the UCPD bus thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).
Note
This function can be called from thread mode or from handler mode i.e from ISR.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t .
- Return values :
-
-
HAL_ERROR – Operation completed with error.
-
HAL_OK – Operation completed successfully.
-
-
hal_status_t
HAL_UCPD_AcquireBus
(
hal_ucpd_handle_t
*
hucpd
,
uint32_t
timeout_ms
)
Set/Get user data ¶
- group UCPD_Exported_Functions_Group9
-
A set of functions allowing to manage a user data pointer stored to the UCPD handle:
Functions
-
void
HAL_UCPD_SetUserData
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_user_data
)
¶
-
Set the user data pointer into the handle.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t .
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_UCPD_GetUserData
(
const
hal_ucpd_handle_t
*
hucpd
)
¶
-
Get the user data pointer from the handle.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t .
- Return values :
-
Pointer – to the user data.
-
void
HAL_UCPD_SetUserData
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_user_data
)
¶
- group UCPD_Exported_Functions_Group9
-
A set of functions allowing to manage a user data pointer stored to the UCPD handle:
Functions
-
void
HAL_UCPD_SetUserData
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_user_data
)
-
Set the user data pointer into the handle.
- Parameters :
-
-
hucpd – Pointer to a hal_ucpd_handle_t .
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_UCPD_GetUserData
(
const
hal_ucpd_handle_t
*
hucpd
)
-
Get the user data pointer from the handle.
- Parameters :
-
hucpd – Pointer to a hal_ucpd_handle_t .
- Return values :
-
Pointer – to the user data.
-
void
HAL_UCPD_SetUserData
(
hal_ucpd_handle_t
*
hucpd
,
const
void
*
p_user_data
)