HAL CRS Functions ¶
Initialization and DeInitialization functions ¶
- group CRS_Exported_Functions_Group1
-
This section provides a set of functions allowing to initialize and deinitialize the CRS peripheral:
-
Call the function HAL_CRS_Init() to initialize the selected CRS handle and associate an instance.
-
Call the function HAL_CRS_DeInit() to deinitialize the CRS.
Functions
-
hal_status_t
HAL_CRS_Init
(
hal_crs_handle_t
*
hcrs
,
hal_crs_t
instance
)
¶
-
Initialize the CRS according to the associated handle.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS.
-
instance – CRS instance.
-
- Return values :
-
-
HAL_INVALID_PARAM – When the handle is NULL.
-
HAL_OK – HAL CRS driver correctly initialized for the given CRS instance.
-
-
void
HAL_CRS_DeInit
(
hal_crs_handle_t
*
hcrs
)
¶
-
DeInitialize the CRS.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
- group CRS_Exported_Functions_Group1
-
This section provides a set of functions allowing to initialize and deinitialize the CRS peripheral:
-
Call the function HAL_CRS_Init() to initialize the selected CRS handle and associate an instance.
-
Call the function HAL_CRS_DeInit() to deinitialize the CRS.
Functions
-
hal_status_t
HAL_CRS_Init
(
hal_crs_handle_t
*
hcrs
,
hal_crs_t
instance
)
-
Initialize the CRS according to the associated handle.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS.
-
instance – CRS instance.
-
- Return values :
-
-
HAL_INVALID_PARAM – When the handle is NULL.
-
HAL_OK – HAL CRS driver correctly initialized for the given CRS instance.
-
-
void
HAL_CRS_DeInit
(
hal_crs_handle_t
*
hcrs
)
-
DeInitialize the CRS.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
- group CRS_Exported_Functions_Group1
-
This section provides a set of functions allowing to initialize and deinitialize the CRS peripheral:
-
Call the function HAL_CRS_Init() to initialize the selected CRS handle and associate an instance.
-
Call the function HAL_CRS_DeInit() to deinitialize the CRS.
Functions
-
hal_status_t
HAL_CRS_Init
(
hal_crs_handle_t
*
hcrs
,
hal_crs_t
instance
)
-
Initialize the CRS according to the associated handle.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS.
-
instance – CRS instance.
-
- Return values :
-
-
HAL_INVALID_PARAM – When the handle is NULL.
-
HAL_OK – HAL CRS driver correctly initialized for the given CRS instance.
-
-
void
HAL_CRS_DeInit
(
hal_crs_handle_t
*
hcrs
)
-
DeInitialize the CRS.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
Configuration functions ¶
- group CRS_Exported_Functions_Group2
-
This section provides a set of functions allowing to configure the CRS driver:
-
Call the function HAL_CRS_SetConfig() to set the different fields needed before starting the CRS driver.
-
Call the function HAL_CRS_GetConfig() to retrieve the configuration.
-
Call the function HAL_CRS_ResetConfig() to reset the configuration to its default values.
-
Call the function HAL_CRS_SetTrimming() to set the trimming value.
-
Call the function HAL_CRS_GetTrimming() to retrieve the trimming value.
-
Call the function HAL_CRS_GetFrequencyErrorInfo() to retrieve frequency error information.
Functions
-
hal_status_t
HAL_CRS_SetConfig
(
hal_crs_handle_t
*
hcrs
,
const
hal_crs_config_t
*
p_config
)
¶
-
Configure the CRS driver.
Note
This function is optional, the user can start the driver with the default configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
-
void
HAL_CRS_GetConfig
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_config_t
*
p_config
)
¶
-
Get the configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
-
void
HAL_CRS_ResetConfig
(
hal_crs_handle_t
*
hcrs
)
¶
-
Reset the following fields to their default values:
-
The divider is set to not divided.
-
The source is set to signal source 3.
-
The polarity is set to rising edge.
-
The reload is set to 0xBB7FU.
-
The felim is set to 0x22U.
-
The trimming is set to 0x40U.
-
The auto trimming is disabled.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
-
hal_status_t
HAL_CRS_SetTrimming
(
hal_crs_handle_t
*
hcrs
,
uint32_t
trimming
)
¶
-
Set the trimming value.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
trimming – Trimming value.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_ERROR – Auto trimming enabled, configuration not possible.
-
-
uint32_t
HAL_CRS_GetTrimming
(
const
hal_crs_handle_t
*
hcrs
)
¶
-
Get the trimming value.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
uint32_t – Trimming value.
-
void
HAL_CRS_GetFrequencyErrorInfo
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_frequency_error_info_t
*
p_frequency_error_info
)
¶
-
Get frequency error information (frequency error capture and direction).
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_frequency_error_info – Pointer on hal_crs_frequency_error_info_t structure.
-
-
- group CRS_Exported_Functions_Group2
-
This section provides a set of functions allowing to configure the CRS driver:
-
Call the function HAL_CRS_SetConfig() to set the different fields needed before starting the CRS driver.
-
Call the function HAL_CRS_GetConfig() to retrieve the configuration.
-
Call the function HAL_CRS_ResetConfig() to reset the configuration to its default values.
-
Call the function HAL_CRS_SetTrimming() to set the trimming value.
-
Call the function HAL_CRS_GetTrimming() to retrieve the trimming value.
-
Call the function HAL_CRS_GetFrequencyErrorInfo() to retrieve frequency error information.
Functions
-
hal_status_t
HAL_CRS_SetConfig
(
hal_crs_handle_t
*
hcrs
,
const
hal_crs_config_t
*
p_config
)
-
Configure the CRS driver.
Note
This function is optional, the user can start the driver with the default configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
-
void
HAL_CRS_GetConfig
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_config_t
*
p_config
)
-
Get the configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
-
void
HAL_CRS_ResetConfig
(
hal_crs_handle_t
*
hcrs
)
-
Reset the following fields to their default values:
-
The divider is set to not divided.
-
The source is set to signal source 3.
-
The polarity is set to rising edge.
-
The reload is set to 0xBB7FU.
-
The felim is set to 0x22U.
-
The trimming is set to 0x40U.
-
The auto trimming is disabled.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
-
hal_status_t
HAL_CRS_SetTrimming
(
hal_crs_handle_t
*
hcrs
,
uint32_t
trimming
)
-
Set the trimming value.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
trimming – Trimming value.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_ERROR – Auto trimming enabled, configuration not possible.
-
-
uint32_t
HAL_CRS_GetTrimming
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the trimming value.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
uint32_t – Trimming value.
-
void
HAL_CRS_GetFrequencyErrorInfo
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_frequency_error_info_t
*
p_frequency_error_info
)
-
Get frequency error information (frequency error capture and direction).
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_frequency_error_info – Pointer on hal_crs_frequency_error_info_t structure.
-
-
- group CRS_Exported_Functions_Group2
-
This section provides a set of functions allowing to configure the CRS driver:
-
Call the function HAL_CRS_SetConfig() to set the different fields needed before starting the CRS driver.
-
Call the function HAL_CRS_GetConfig() to retrieve the configuration.
-
Call the function HAL_CRS_ResetConfig() to reset the configuration to its default values.
-
Call the function HAL_CRS_SetTrimming() to set the trimming value.
-
Call the function HAL_CRS_GetTrimming() to retrieve the trimming value.
-
Call the function HAL_CRS_GetFrequencyErrorInfo() to retrieve frequency error information.
Functions
-
hal_status_t
HAL_CRS_SetConfig
(
hal_crs_handle_t
*
hcrs
,
const
hal_crs_config_t
*
p_config
)
-
Configure the CRS driver.
Note
This function is optional, the user can start the driver with the default configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
-
void
HAL_CRS_GetConfig
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_config_t
*
p_config
)
-
Get the configuration.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_config – Pointer on hal_crs_config_t structure.
-
-
void
HAL_CRS_ResetConfig
(
hal_crs_handle_t
*
hcrs
)
-
Reset the following fields to their default values:
-
The divider is set to not divided.
-
The source is set to signal source 3.
-
The polarity is set to rising edge.
-
The reload is set to 0xBB7FU.
-
The felim is set to 0x22U.
-
The trimming is set to 0x40U.
-
The auto trimming is disabled.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
-
hal_status_t
HAL_CRS_SetTrimming
(
hal_crs_handle_t
*
hcrs
,
uint32_t
trimming
)
-
Set the trimming value.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
trimming – Trimming value.
-
- Return values :
-
-
HAL_OK – CRS instance has been correctly configured.
-
HAL_ERROR – Auto trimming enabled, configuration not possible.
-
-
uint32_t
HAL_CRS_GetTrimming
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the trimming value.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
uint32_t – Trimming value.
-
void
HAL_CRS_GetFrequencyErrorInfo
(
const
hal_crs_handle_t
*
hcrs
,
hal_crs_frequency_error_info_t
*
p_frequency_error_info
)
-
Get frequency error information (frequency error capture and direction).
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
p_frequency_error_info – Pointer on hal_crs_frequency_error_info_t structure.
-
-
Control functions ¶
- group CRS_Exported_Functions_Group3
-
This section provides a set of functions allowing to start/stop the CRS driver and control the auto trimming:
-
Call the functions HAL_CRS_EnableAutoTrimming() , HAL_CRS_DisableAutoTrimming() and HAL_CRS_IsEnabledAutoTrimming() to enable, disable the auto trimming and check if it is enabled or not.
-
Call the function HAL_CRS_StartSync() to enable the frequency error counter.
-
Call the function HAL_CRS_StopSync() to disable the frequency error counter.
-
Call the function HAL_CRS_StartSync_IT() to enable the frequency error counter with interrupt sources.
-
Call the function HAL_CRS_StopSync_IT() to disable the frequency error counter with interrupt sources.
Functions
-
hal_status_t
HAL_CRS_EnableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
¶
-
Enable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly activated.
-
hal_status_t
HAL_CRS_DisableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
¶
-
Disable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly de-activated.
-
hal_crs_auto_trimming_status_t
HAL_CRS_IsEnabledAutoTrimming
(
const
hal_crs_handle_t
*
hcrs
)
¶
-
Get the auto trimming status.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
-
HAL_CRS_AUTO_TRIMMING_DISABLED –
-
HAL_CRS_AUTO_TRIMMING_ENABLED –
-
-
hal_status_t
HAL_CRS_StartSync
(
hal_crs_handle_t
*
hcrs
)
¶
-
Start the CRS in Polling mode.
Note
This function enables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync
(
hal_crs_handle_t
*
hcrs
)
¶
-
Stop the CRS in Polling mode.
Note
This function disables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StartSync_IT
(
hal_crs_handle_t
*
hcrs
)
¶
-
Start the CRS in Interrupt mode.
Note
This function enables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync_IT
(
hal_crs_handle_t
*
hcrs
)
¶
-
Stop the CRS in Interrupt mode.
Note
This function disables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
- group CRS_Exported_Functions_Group3
-
This section provides a set of functions allowing to start/stop the CRS driver and control the auto trimming:
-
Call the functions HAL_CRS_EnableAutoTrimming() , HAL_CRS_DisableAutoTrimming() and HAL_CRS_IsEnabledAutoTrimming() to enable, disable the auto trimming and check if it is enabled or not.
-
Call the function HAL_CRS_StartSync() to enable the frequency error counter.
-
Call the function HAL_CRS_StopSync() to disable the frequency error counter.
-
Call the function HAL_CRS_StartSync_IT() to enable the frequency error counter with interrupt sources.
-
Call the function HAL_CRS_StopSync_IT() to disable the frequency error counter with interrupt sources.
Functions
-
hal_status_t
HAL_CRS_EnableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
-
Enable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly activated.
-
hal_status_t
HAL_CRS_DisableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
-
Disable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly de-activated.
-
hal_crs_auto_trimming_status_t
HAL_CRS_IsEnabledAutoTrimming
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the auto trimming status.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
-
HAL_CRS_AUTO_TRIMMING_DISABLED –
-
HAL_CRS_AUTO_TRIMMING_ENABLED –
-
-
hal_status_t
HAL_CRS_StartSync
(
hal_crs_handle_t
*
hcrs
)
-
Start the CRS in Polling mode.
Note
This function enables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync
(
hal_crs_handle_t
*
hcrs
)
-
Stop the CRS in Polling mode.
Note
This function disables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StartSync_IT
(
hal_crs_handle_t
*
hcrs
)
-
Start the CRS in Interrupt mode.
Note
This function enables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync_IT
(
hal_crs_handle_t
*
hcrs
)
-
Stop the CRS in Interrupt mode.
Note
This function disables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
- group CRS_Exported_Functions_Group3
-
This section provides a set of functions allowing to start/stop the CRS driver and control the auto trimming:
-
Call the functions HAL_CRS_EnableAutoTrimming() , HAL_CRS_DisableAutoTrimming() and HAL_CRS_IsEnabledAutoTrimming() to enable, disable the auto trimming and check if it is enabled or not.
-
Call the function HAL_CRS_StartSync() to enable the frequency error counter.
-
Call the function HAL_CRS_StopSync() to disable the frequency error counter.
-
Call the function HAL_CRS_StartSync_IT() to enable the frequency error counter with interrupt sources.
-
Call the function HAL_CRS_StopSync_IT() to disable the frequency error counter with interrupt sources.
Functions
-
hal_status_t
HAL_CRS_EnableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
-
Enable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly activated.
-
hal_status_t
HAL_CRS_DisableAutoTrimming
(
hal_crs_handle_t
*
hcrs
)
-
Disable the auto trimming.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – CRS auto trimming has been correctly de-activated.
-
hal_crs_auto_trimming_status_t
HAL_CRS_IsEnabledAutoTrimming
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the auto trimming status.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
-
HAL_CRS_AUTO_TRIMMING_DISABLED –
-
HAL_CRS_AUTO_TRIMMING_ENABLED –
-
-
hal_status_t
HAL_CRS_StartSync
(
hal_crs_handle_t
*
hcrs
)
-
Start the CRS in Polling mode.
Note
This function enables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync
(
hal_crs_handle_t
*
hcrs
)
-
Stop the CRS in Polling mode.
Note
This function disables the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StartSync_IT
(
hal_crs_handle_t
*
hcrs
)
-
Start the CRS in Interrupt mode.
Note
This function enables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_StopSync_IT
(
hal_crs_handle_t
*
hcrs
)
-
Stop the CRS in Interrupt mode.
Note
This function disables the interrupt sources and the frequency error counter.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
Process functions ¶
- group CRS_Exported_Functions_Group4
-
This section provides a set of process functions:
-
Call the function HAL_CRS_GenerateSoftwareSync() to generate a software synchronization event.
-
Call the function HAL_CRS_PollForSync() to retrieve the status of synchronization event.
Functions
-
hal_status_t
HAL_CRS_GenerateSoftwareSync
(
hal_crs_handle_t
*
hcrs
)
¶
-
Generate the software synchronization event.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_PollForSync
(
hal_crs_handle_t
*
hcrs
,
uint32_t
timeout_ms
)
¶
-
Retrieve the status of synchronization.
Note
timeout_ms is based on the maximum time to receive a SYNC event based on synchronization frequency.
Warning
If timeout_ms set to HAL_MAX_DELAY, HAL_TIMEOUT is never returned.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
timeout_ms – Duration of the timeout in milliseconds.
-
- Return values :
-
-
HAL_OK – Synchronization event OK (SYNCOK).
-
HAL_ERROR – Synchronization error or warning (SYNCERR, TRIMOVF, SYNCMISS or SYNCWARN).
-
HAL_TIMEOUT – Timeout elapsed.
-
-
- group CRS_Exported_Functions_Group4
-
This section provides a set of process functions:
-
Call the function HAL_CRS_GenerateSoftwareSync() to generate a software synchronization event.
-
Call the function HAL_CRS_PollForSync() to retrieve the status of synchronization event.
Functions
-
hal_status_t
HAL_CRS_GenerateSoftwareSync
(
hal_crs_handle_t
*
hcrs
)
-
Generate the software synchronization event.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_PollForSync
(
hal_crs_handle_t
*
hcrs
,
uint32_t
timeout_ms
)
-
Retrieve the status of synchronization.
Note
timeout_ms is based on the maximum time to receive a SYNC event based on synchronization frequency.
Warning
If timeout_ms set to HAL_MAX_DELAY, HAL_TIMEOUT is never returned.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
timeout_ms – Duration of the timeout in milliseconds.
-
- Return values :
-
-
HAL_OK – Synchronization event OK (SYNCOK).
-
HAL_ERROR – Synchronization error or warning (SYNCERR, TRIMOVF, SYNCMISS or SYNCWARN).
-
HAL_TIMEOUT – Timeout elapsed.
-
-
- group CRS_Exported_Functions_Group4
-
This section provides a set of process functions:
-
Call the function HAL_CRS_GenerateSoftwareSync() to generate a software synchronization event.
-
Call the function HAL_CRS_PollForSync() to retrieve the status of synchronization event.
Functions
-
hal_status_t
HAL_CRS_GenerateSoftwareSync
(
hal_crs_handle_t
*
hcrs
)
-
Generate the software synchronization event.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CRS_PollForSync
(
hal_crs_handle_t
*
hcrs
,
uint32_t
timeout_ms
)
-
Retrieve the status of synchronization.
Note
timeout_ms is based on the maximum time to receive a SYNC event based on synchronization frequency.
Warning
If timeout_ms set to HAL_MAX_DELAY, HAL_TIMEOUT is never returned.
- Parameters :
-
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
timeout_ms – Duration of the timeout in milliseconds.
-
- Return values :
-
-
HAL_OK – Synchronization event OK (SYNCOK).
-
HAL_ERROR – Synchronization error or warning (SYNCERR, TRIMOVF, SYNCMISS or SYNCWARN).
-
HAL_TIMEOUT – Timeout elapsed.
-
-
IRQHandler and Callbacks functions ¶
- group CRS_Exported_Functions_Group5
-
This section provides functions allowing to:
-
Handle the CRS interrupt request with HAL_CRS_IRQHandler() . There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate :
-
When the CRS driver encounters an error ( HAL_CRS_ErrorCallback() or callback function registered with HAL_CRS_RegisterErrorCallback() ). The errors can be synchronization missed, synchronization error or trimming overflow or underflow.
-
When a synchronization event ok is triggered ( HAL_CRS_SyncOkCallback() or callback function registered with HAL_CRS_RegisterSyncOkCallback() ).
-
When a synchronization warning is triggered ( HAL_CRS_SyncWarnCallback() or callback function registered with HAL_CRS_RegisterSyncWarnCallback() ).
-
When an expected synchronization is triggered ( HAL_CRS_ExpectedSyncCallback() or callback function registered with HAL_CRS_RegisterExpectedSyncCallback() ).
Functions
-
void
HAL_CRS_IRQHandler
(
hal_crs_handle_t
*
hcrs
)
¶
-
Handle the Clock Recovery System interrupt request.
Note
This function must be called from CRS_IRQHandler().
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncOkCallback
(
hal_crs_handle_t
*
hcrs
)
¶
-
Clock Recovery System SYNCOK interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncWarnCallback
(
hal_crs_handle_t
*
hcrs
)
¶
-
Clock Recovery System SYNCWARN interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
)
¶
-
Clock Recovery System Expected SYNC interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ErrorCallback
(
hal_crs_handle_t
*
hcrs
)
¶
-
Clock Recovery System Error interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
hal_status_t
HAL_CRS_RegisterSyncOkCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
¶
-
Register a User CRS callback for synchronization ok.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization ok callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterSyncWarnCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
¶
-
Register a User CRS callback for synchronization warning.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization warning callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
¶
-
Register a User CRS callback for expected synchronization.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the expected synchronization callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterErrorCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
¶
-
Register a User CRS callback for error.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the error callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
- group CRS_Exported_Functions_Group5
-
This section provides functions allowing to:
-
Handle the CRS interrupt request with HAL_CRS_IRQHandler() . There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate :
-
When the CRS driver encounters an error ( HAL_CRS_ErrorCallback() or callback function registered with HAL_CRS_RegisterErrorCallback() ). The errors can be synchronization missed, synchronization error or trimming overflow or underflow.
-
When a synchronization event ok is triggered ( HAL_CRS_SyncOkCallback() or callback function registered with HAL_CRS_RegisterSyncOkCallback() ).
-
When a synchronization warning is triggered ( HAL_CRS_SyncWarnCallback() or callback function registered with HAL_CRS_RegisterSyncWarnCallback() ).
-
When an expected synchronization is triggered ( HAL_CRS_ExpectedSyncCallback() or callback function registered with HAL_CRS_RegisterExpectedSyncCallback() ).
Functions
-
void
HAL_CRS_IRQHandler
(
hal_crs_handle_t
*
hcrs
)
-
Handle the Clock Recovery System interrupt request.
Note
This function must be called from CRS_IRQHandler().
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncOkCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System SYNCOK interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncWarnCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System SYNCWARN interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System Expected SYNC interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ErrorCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System Error interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
hal_status_t
HAL_CRS_RegisterSyncOkCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for synchronization ok.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization ok callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterSyncWarnCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for synchronization warning.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization warning callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for expected synchronization.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the expected synchronization callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterErrorCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for error.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the error callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
- group CRS_Exported_Functions_Group5
-
This section provides functions allowing to:
-
Handle the CRS interrupt request with HAL_CRS_IRQHandler() . There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate :
-
When the CRS driver encounters an error ( HAL_CRS_ErrorCallback() or callback function registered with HAL_CRS_RegisterErrorCallback() ). The errors can be synchronization missed, synchronization error or trimming overflow or underflow.
-
When a synchronization event ok is triggered ( HAL_CRS_SyncOkCallback() or callback function registered with HAL_CRS_RegisterSyncOkCallback() ).
-
When a synchronization warning is triggered ( HAL_CRS_SyncWarnCallback() or callback function registered with HAL_CRS_RegisterSyncWarnCallback() ).
-
When an expected synchronization is triggered ( HAL_CRS_ExpectedSyncCallback() or callback function registered with HAL_CRS_RegisterExpectedSyncCallback() ).
Functions
-
void
HAL_CRS_IRQHandler
(
hal_crs_handle_t
*
hcrs
)
-
Handle the Clock Recovery System interrupt request.
Note
This function must be called from CRS_IRQHandler().
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncOkCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System SYNCOK interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_SyncWarnCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System SYNCWARN interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System Expected SYNC interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
void
HAL_CRS_ErrorCallback
(
hal_crs_handle_t
*
hcrs
)
-
Clock Recovery System Error interrupt callback.
Note
This function must not be modified in this file, but must preferably be implemented in the user file.
- Parameters :
-
hcrs – Pointer to a hal_crs_handle_t structure that contains the handle information for the specified CRS instance.
-
hal_status_t
HAL_CRS_RegisterSyncOkCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for synchronization ok.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization ok callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterSyncWarnCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for synchronization warning.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the synchronization warning callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterExpectedSyncCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for expected synchronization.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the expected synchronization callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
hal_status_t
HAL_CRS_RegisterErrorCallback
(
hal_crs_handle_t
*
hcrs
,
hal_crs_cb_t
p_callback
)
-
Register a User CRS callback for error.
- Parameters :
-
-
hcrs – Pointer to the CRS handle.
-
p_callback – Pointer to the error callback function.
-
- Return values :
-
-
HAL_OK – Register completed successfully.
-
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
-
State functions ¶
- group CRS_Exported_Functions_Group6
-
This section permits to get in runtime the state of the peripheral CRS with HAL_CRS_GetState() .
Functions
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
¶
-
Get the CRS state.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
hal_crs_state_t – HAL CRS state.
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
¶
- group CRS_Exported_Functions_Group6
-
This section permits to get in runtime the state of the peripheral CRS with HAL_CRS_GetState() .
Functions
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the CRS state.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
hal_crs_state_t – HAL CRS state.
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
- group CRS_Exported_Functions_Group6
-
This section permits to get in runtime the state of the peripheral CRS with HAL_CRS_GetState() .
Functions
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the CRS state.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
hal_crs_state_t – HAL CRS state.
-
hal_crs_state_t
HAL_CRS_GetState
(
const
hal_crs_handle_t
*
hcrs
)
Error functions ¶
- group CRS_Exported_Functions_Group7
-
This section permits to get in runtime the last error codes of the peripheral CRS with HAL_CRS_GetLastErrorCodes() .
Functions
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
¶
-
Get the CRS last error codes.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
¶
- group CRS_Exported_Functions_Group7
-
This section permits to get in runtime the last error codes of the peripheral CRS with HAL_CRS_GetLastErrorCodes() .
Functions
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the CRS last error codes.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
- group CRS_Exported_Functions_Group7
-
This section permits to get in runtime the last error codes of the peripheral CRS with HAL_CRS_GetLastErrorCodes() .
Functions
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
-
Get the CRS last error codes.
- Parameters :
-
hcrs – Pointer to the CRS handle.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CRS_GetLastErrorCodes
(
const
hal_crs_handle_t
*
hcrs
)
Set/Get user data functions ¶
- group CRS_Exported_Functions_Group8
-
This section provides functions allowing to Set and Get user data:
-
HAL_CRS_SetUserData() to store the user data into the CRS handle.
-
HAL_CRS_GetUserData() to retrieve the user data from the CRS handle.
Functions
-
void
HAL_CRS_SetUserData
(
hal_crs_handle_t
*
hcrs
,
const
void
*
p_user_data
)
¶
-
Store the user data into the CRS handle.
- Parameters :
-
-
hcrs – Pointer to CRS handle.
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_CRS_GetUserData
(
const
hal_crs_handle_t
*
hcrs
)
¶
-
Retrieve the user data from the CRS handle.
- Parameters :
-
hcrs – Pointer to CRS handle.
- Return values :
-
Pointer – to the user data.
-
- group CRS_Exported_Functions_Group8
-
This section provides functions allowing to Set and Get user data:
-
HAL_CRS_SetUserData() to store the user data into the CRS handle.
-
HAL_CRS_GetUserData() to retrieve the user data from the CRS handle.
Functions
-
void
HAL_CRS_SetUserData
(
hal_crs_handle_t
*
hcrs
,
const
void
*
p_user_data
)
-
Store the user data into the CRS handle.
- Parameters :
-
-
hcrs – Pointer to CRS handle.
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_CRS_GetUserData
(
const
hal_crs_handle_t
*
hcrs
)
-
Retrieve the user data from the CRS handle.
- Parameters :
-
hcrs – Pointer to CRS handle.
- Return values :
-
Pointer – to the user data.
-
- group CRS_Exported_Functions_Group8
-
This section provides functions allowing to Set and Get user data:
-
HAL_CRS_SetUserData() to store the user data into the CRS handle.
-
HAL_CRS_GetUserData() to retrieve the user data from the CRS handle.
Functions
-
void
HAL_CRS_SetUserData
(
hal_crs_handle_t
*
hcrs
,
const
void
*
p_user_data
)
-
Store the user data into the CRS handle.
- Parameters :
-
-
hcrs – Pointer to CRS handle.
-
p_user_data – Pointer to the user data.
-
-
const
void
*
HAL_CRS_GetUserData
(
const
hal_crs_handle_t
*
hcrs
)
-
Retrieve the user data from the CRS handle.
- Parameters :
-
hcrs – Pointer to CRS handle.
- Return values :
-
Pointer – to the user data.
-