STM32L4xx_HAL_Driver  1.14.0

Functions

__STATIC_INLINE void LL_CRS_EnableFreqErrorCounter (void)
 Enable Frequency error counter. More...
 
__STATIC_INLINE void LL_CRS_DisableFreqErrorCounter (void)
 Disable Frequency error counter CR CEN LL_CRS_DisableFreqErrorCounter. More...
 
__STATIC_INLINE uint32_t LL_CRS_IsEnabledFreqErrorCounter (void)
 Check if Frequency error counter is enabled or not CR CEN LL_CRS_IsEnabledFreqErrorCounter. More...
 
__STATIC_INLINE void LL_CRS_EnableAutoTrimming (void)
 Enable Automatic trimming counter CR AUTOTRIMEN LL_CRS_EnableAutoTrimming. More...
 
__STATIC_INLINE void LL_CRS_DisableAutoTrimming (void)
 Disable Automatic trimming counter CR AUTOTRIMEN LL_CRS_DisableAutoTrimming. More...
 
__STATIC_INLINE uint32_t LL_CRS_IsEnabledAutoTrimming (void)
 Check if Automatic trimming is enabled or not CR AUTOTRIMEN LL_CRS_IsEnabledAutoTrimming. More...
 
__STATIC_INLINE void LL_CRS_SetHSI48SmoothTrimming (uint32_t Value)
 Set HSI48 oscillator smooth trimming. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetHSI48SmoothTrimming (void)
 Get HSI48 oscillator smooth trimming CR TRIM LL_CRS_GetHSI48SmoothTrimming. More...
 
__STATIC_INLINE void LL_CRS_SetReloadCounter (uint32_t Value)
 Set counter reload value CFGR RELOAD LL_CRS_SetReloadCounter. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetReloadCounter (void)
 Get counter reload value CFGR RELOAD LL_CRS_GetReloadCounter. More...
 
__STATIC_INLINE void LL_CRS_SetFreqErrorLimit (uint32_t Value)
 Set frequency error limit CFGR FELIM LL_CRS_SetFreqErrorLimit. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetFreqErrorLimit (void)
 Get frequency error limit CFGR FELIM LL_CRS_GetFreqErrorLimit. More...
 
__STATIC_INLINE void LL_CRS_SetSyncDivider (uint32_t Divider)
 Set division factor for SYNC signal CFGR SYNCDIV LL_CRS_SetSyncDivider. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetSyncDivider (void)
 Get division factor for SYNC signal CFGR SYNCDIV LL_CRS_GetSyncDivider. More...
 
__STATIC_INLINE void LL_CRS_SetSyncSignalSource (uint32_t Source)
 Set SYNC signal source CFGR SYNCSRC LL_CRS_SetSyncSignalSource. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetSyncSignalSource (void)
 Get SYNC signal source CFGR SYNCSRC LL_CRS_GetSyncSignalSource. More...
 
__STATIC_INLINE void LL_CRS_SetSyncPolarity (uint32_t Polarity)
 Set input polarity for the SYNC signal source CFGR SYNCPOL LL_CRS_SetSyncPolarity. More...
 
__STATIC_INLINE uint32_t LL_CRS_GetSyncPolarity (void)
 Get input polarity for the SYNC signal source CFGR SYNCPOL LL_CRS_GetSyncPolarity. More...
 
__STATIC_INLINE void LL_CRS_ConfigSynchronization (uint32_t HSI48CalibrationValue, uint32_t ErrorLimitValue, uint32_t ReloadValue, uint32_t Settings)
 Configure CRS for the synchronization CR TRIM LL_CRS_ConfigSynchronization
CFGR RELOAD LL_CRS_ConfigSynchronization
CFGR FELIM LL_CRS_ConfigSynchronization
CFGR SYNCDIV LL_CRS_ConfigSynchronization
CFGR SYNCSRC LL_CRS_ConfigSynchronization
CFGR SYNCPOL LL_CRS_ConfigSynchronization. More...
 

Detailed Description

Function Documentation

◆ LL_CRS_ConfigSynchronization()

__STATIC_INLINE void LL_CRS_ConfigSynchronization ( uint32_t  HSI48CalibrationValue,
uint32_t  ErrorLimitValue,
uint32_t  ReloadValue,
uint32_t  Settings 
)

Configure CRS for the synchronization CR TRIM LL_CRS_ConfigSynchronization
CFGR RELOAD LL_CRS_ConfigSynchronization
CFGR FELIM LL_CRS_ConfigSynchronization
CFGR SYNCDIV LL_CRS_ConfigSynchronization
CFGR SYNCSRC LL_CRS_ConfigSynchronization
CFGR SYNCPOL LL_CRS_ConfigSynchronization.

Parameters
HSI48CalibrationValuea number between Min_Data = 0 and Max_Data = 63
ErrorLimitValuea number between Min_Data = 0 and Max_Data = 0xFFFF
ReloadValuea number between Min_Data = 0 and Max_Data = 255
SettingsThis parameter can be a combination of the following values:
  • LL_CRS_SYNC_DIV_1 or LL_CRS_SYNC_DIV_2 or LL_CRS_SYNC_DIV_4 or LL_CRS_SYNC_DIV_8 or LL_CRS_SYNC_DIV_16 or LL_CRS_SYNC_DIV_32 or LL_CRS_SYNC_DIV_64 or LL_CRS_SYNC_DIV_128
  • LL_CRS_SYNC_SOURCE_GPIO or LL_CRS_SYNC_SOURCE_LSE or LL_CRS_SYNC_SOURCE_USB
  • LL_CRS_SYNC_POLARITY_RISING or LL_CRS_SYNC_POLARITY_FALLING
Return values
None

Definition at line 456 of file stm32l4xx_ll_crs.h.

457 {
458  MODIFY_REG(CRS->CR, CRS_CR_TRIM, HSI48CalibrationValue);
459  MODIFY_REG(CRS->CFGR,
460  CRS_CFGR_RELOAD | CRS_CFGR_FELIM | CRS_CFGR_SYNCDIV | CRS_CFGR_SYNCSRC | CRS_CFGR_SYNCPOL,
461  ReloadValue | (ErrorLimitValue << CRS_CFGR_FELIM_Pos) | Settings);
462 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_DisableAutoTrimming()

__STATIC_INLINE void LL_CRS_DisableAutoTrimming ( void  )

Disable Automatic trimming counter CR AUTOTRIMEN LL_CRS_DisableAutoTrimming.

Return values
None

Definition at line 266 of file stm32l4xx_ll_crs.h.

267 {
268  CLEAR_BIT(CRS->CR, CRS_CR_AUTOTRIMEN);
269 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_CRS_DisableFreqErrorCounter()

__STATIC_INLINE void LL_CRS_DisableFreqErrorCounter ( void  )

Disable Frequency error counter CR CEN LL_CRS_DisableFreqErrorCounter.

Return values
None

Definition at line 236 of file stm32l4xx_ll_crs.h.

237 {
238  CLEAR_BIT(CRS->CR, CRS_CR_CEN);
239 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_CRS_EnableAutoTrimming()

__STATIC_INLINE void LL_CRS_EnableAutoTrimming ( void  )

Enable Automatic trimming counter CR AUTOTRIMEN LL_CRS_EnableAutoTrimming.

Return values
None

Definition at line 256 of file stm32l4xx_ll_crs.h.

257 {
258  SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN);
259 }

◆ LL_CRS_EnableFreqErrorCounter()

__STATIC_INLINE void LL_CRS_EnableFreqErrorCounter ( void  )

Enable Frequency error counter.

Note
When this bit is set, the CRS_CFGR register is write-protected and cannot be modified CR CEN LL_CRS_EnableFreqErrorCounter
Return values
None

Definition at line 226 of file stm32l4xx_ll_crs.h.

227 {
228  SET_BIT(CRS->CR, CRS_CR_CEN);
229 }

◆ LL_CRS_GetFreqErrorLimit()

__STATIC_INLINE uint32_t LL_CRS_GetFreqErrorLimit ( void  )

Get frequency error limit CFGR FELIM LL_CRS_GetFreqErrorLimit.

Return values
Anumber between Min_Data = 0 and Max_Data = 255

Definition at line 344 of file stm32l4xx_ll_crs.h.

345 {
346  return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_FELIM) >> CRS_CFGR_FELIM_Pos);
347 }

◆ LL_CRS_GetHSI48SmoothTrimming()

__STATIC_INLINE uint32_t LL_CRS_GetHSI48SmoothTrimming ( void  )

Get HSI48 oscillator smooth trimming CR TRIM LL_CRS_GetHSI48SmoothTrimming.

Return values
anumber between Min_Data = 0 and Max_Data = 127 for STM32L412xx/L422xx or 63 otherwise

Definition at line 299 of file stm32l4xx_ll_crs.h.

300 {
301  return (uint32_t)(READ_BIT(CRS->CR, CRS_CR_TRIM) >> CRS_CR_TRIM_Pos);
302 }

◆ LL_CRS_GetReloadCounter()

__STATIC_INLINE uint32_t LL_CRS_GetReloadCounter ( void  )

Get counter reload value CFGR RELOAD LL_CRS_GetReloadCounter.

Return values
anumber between Min_Data = 0 and Max_Data = 0xFFFF

Definition at line 322 of file stm32l4xx_ll_crs.h.

323 {
324  return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_RELOAD));
325 }

◆ LL_CRS_GetSyncDivider()

__STATIC_INLINE uint32_t LL_CRS_GetSyncDivider ( void  )

Get division factor for SYNC signal CFGR SYNCDIV LL_CRS_GetSyncDivider.

Return values
Returnedvalue can be one of the following values:
  • LL_CRS_SYNC_DIV_1
  • LL_CRS_SYNC_DIV_2
  • LL_CRS_SYNC_DIV_4
  • LL_CRS_SYNC_DIV_8
  • LL_CRS_SYNC_DIV_16
  • LL_CRS_SYNC_DIV_32
  • LL_CRS_SYNC_DIV_64
  • LL_CRS_SYNC_DIV_128

Definition at line 381 of file stm32l4xx_ll_crs.h.

382 {
383  return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCDIV));
384 }

◆ LL_CRS_GetSyncPolarity()

__STATIC_INLINE uint32_t LL_CRS_GetSyncPolarity ( void  )

Get input polarity for the SYNC signal source CFGR SYNCPOL LL_CRS_GetSyncPolarity.

Return values
Returnedvalue can be one of the following values:
  • LL_CRS_SYNC_POLARITY_RISING
  • LL_CRS_SYNC_POLARITY_FALLING

Definition at line 433 of file stm32l4xx_ll_crs.h.

434 {
435  return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCPOL));
436 }

◆ LL_CRS_GetSyncSignalSource()

__STATIC_INLINE uint32_t LL_CRS_GetSyncSignalSource ( void  )

Get SYNC signal source CFGR SYNCSRC LL_CRS_GetSyncSignalSource.

Return values
Returnedvalue can be one of the following values:
  • LL_CRS_SYNC_SOURCE_GPIO
  • LL_CRS_SYNC_SOURCE_LSE
  • LL_CRS_SYNC_SOURCE_USB

Definition at line 408 of file stm32l4xx_ll_crs.h.

409 {
410  return (uint32_t)(READ_BIT(CRS->CFGR, CRS_CFGR_SYNCSRC));
411 }

◆ LL_CRS_IsEnabledAutoTrimming()

__STATIC_INLINE uint32_t LL_CRS_IsEnabledAutoTrimming ( void  )

Check if Automatic trimming is enabled or not CR AUTOTRIMEN LL_CRS_IsEnabledAutoTrimming.

Return values
Stateof bit (1 or 0).

Definition at line 276 of file stm32l4xx_ll_crs.h.

277 {
278  return (READ_BIT(CRS->CR, CRS_CR_AUTOTRIMEN) == (CRS_CR_AUTOTRIMEN));
279 }

◆ LL_CRS_IsEnabledFreqErrorCounter()

__STATIC_INLINE uint32_t LL_CRS_IsEnabledFreqErrorCounter ( void  )

Check if Frequency error counter is enabled or not CR CEN LL_CRS_IsEnabledFreqErrorCounter.

Return values
Stateof bit (1 or 0).

Definition at line 246 of file stm32l4xx_ll_crs.h.

247 {
248  return (READ_BIT(CRS->CR, CRS_CR_CEN) == (CRS_CR_CEN));
249 }

◆ LL_CRS_SetFreqErrorLimit()

__STATIC_INLINE void LL_CRS_SetFreqErrorLimit ( uint32_t  Value)

Set frequency error limit CFGR FELIM LL_CRS_SetFreqErrorLimit.

Parameters
Valuea number between Min_Data = 0 and Max_Data = 255
Note
Default value can be set thanks to LL_CRS_ERRORLIMIT_DEFAULT
Return values
None

Definition at line 334 of file stm32l4xx_ll_crs.h.

335 {
336  MODIFY_REG(CRS->CFGR, CRS_CFGR_FELIM, Value << CRS_CFGR_FELIM_Pos);
337 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_SetHSI48SmoothTrimming()

__STATIC_INLINE void LL_CRS_SetHSI48SmoothTrimming ( uint32_t  Value)

Set HSI48 oscillator smooth trimming.

Note
When the AUTOTRIMEN bit is set, this field is controlled by hardware and is read-only CR TRIM LL_CRS_SetHSI48SmoothTrimming
Parameters
Valuea number between Min_Data = 0 and Max_Data = 127 for STM32L412xx/L422xx or 63 otherwise
Note
Default value can be set thanks to LL_CRS_HSI48CALIBRATION_DEFAULT
Return values
None

Definition at line 289 of file stm32l4xx_ll_crs.h.

290 {
291  MODIFY_REG(CRS->CR, CRS_CR_TRIM, Value << CRS_CR_TRIM_Pos);
292 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_SetReloadCounter()

__STATIC_INLINE void LL_CRS_SetReloadCounter ( uint32_t  Value)

Set counter reload value CFGR RELOAD LL_CRS_SetReloadCounter.

Parameters
Valuea number between Min_Data = 0 and Max_Data = 0xFFFF
Note
Default value can be set thanks to LL_CRS_RELOADVALUE_DEFAULT Otherwise it can be calculated in using macro __LL_CRS_CALC_CALCULATE_RELOADVALUE (FTARGET, FSYNC)
Return values
None

Definition at line 312 of file stm32l4xx_ll_crs.h.

313 {
314  MODIFY_REG(CRS->CFGR, CRS_CFGR_RELOAD, Value);
315 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_SetSyncDivider()

__STATIC_INLINE void LL_CRS_SetSyncDivider ( uint32_t  Divider)

Set division factor for SYNC signal CFGR SYNCDIV LL_CRS_SetSyncDivider.

Parameters
DividerThis parameter can be one of the following values:
  • LL_CRS_SYNC_DIV_1
  • LL_CRS_SYNC_DIV_2
  • LL_CRS_SYNC_DIV_4
  • LL_CRS_SYNC_DIV_8
  • LL_CRS_SYNC_DIV_16
  • LL_CRS_SYNC_DIV_32
  • LL_CRS_SYNC_DIV_64
  • LL_CRS_SYNC_DIV_128
Return values
None

Definition at line 363 of file stm32l4xx_ll_crs.h.

364 {
365  MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCDIV, Divider);
366 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_SetSyncPolarity()

__STATIC_INLINE void LL_CRS_SetSyncPolarity ( uint32_t  Polarity)

Set input polarity for the SYNC signal source CFGR SYNCPOL LL_CRS_SetSyncPolarity.

Parameters
PolarityThis parameter can be one of the following values:
  • LL_CRS_SYNC_POLARITY_RISING
  • LL_CRS_SYNC_POLARITY_FALLING
Return values
None

Definition at line 421 of file stm32l4xx_ll_crs.h.

422 {
423  MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCPOL, Polarity);
424 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ LL_CRS_SetSyncSignalSource()

__STATIC_INLINE void LL_CRS_SetSyncSignalSource ( uint32_t  Source)

Set SYNC signal source CFGR SYNCSRC LL_CRS_SetSyncSignalSource.

Parameters
SourceThis parameter can be one of the following values:
  • LL_CRS_SYNC_SOURCE_GPIO
  • LL_CRS_SYNC_SOURCE_LSE
  • LL_CRS_SYNC_SOURCE_USB
Return values
None

Definition at line 395 of file stm32l4xx_ll_crs.h.

396 {
397  MODIFY_REG(CRS->CFGR, CRS_CFGR_SYNCSRC, Source);
398 }
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)