L4 HAL Drivers

Embed: (wiki syntax)

« Back to documentation index

Time Base configuration

Time Base configuration
[TIM Exported Functions]

Functions

__STATIC_INLINE void LL_TIM_EnableCounter (TIM_TypeDef *TIMx)
 Enable timer counter.
__STATIC_INLINE void LL_TIM_DisableCounter (TIM_TypeDef *TIMx)
 Disable timer counter.
__STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter (TIM_TypeDef *TIMx)
 Indicates whether the timer counter is enabled.
__STATIC_INLINE void LL_TIM_EnableUpdateEvent (TIM_TypeDef *TIMx)
 Enable update event generation.
__STATIC_INLINE void LL_TIM_DisableUpdateEvent (TIM_TypeDef *TIMx)
 Disable update event generation.
__STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent (TIM_TypeDef *TIMx)
 Indicates whether update event generation is enabled.
__STATIC_INLINE void LL_TIM_SetUpdateSource (TIM_TypeDef *TIMx, uint32_t UpdateSource)
 Set update event source.
__STATIC_INLINE uint32_t LL_TIM_GetUpdateSource (TIM_TypeDef *TIMx)
 Get actual event update source CR1 URS LL_TIM_GetUpdateSource.
__STATIC_INLINE void LL_TIM_SetOnePulseMode (TIM_TypeDef *TIMx, uint32_t OnePulseMode)
 Set one pulse mode (one shot v.s.
__STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode (TIM_TypeDef *TIMx)
 Get actual one pulse mode.
__STATIC_INLINE void LL_TIM_SetCounterMode (TIM_TypeDef *TIMx, uint32_t CounterMode)
 Set the timer counter counting mode.
__STATIC_INLINE uint32_t LL_TIM_GetCounterMode (TIM_TypeDef *TIMx)
 Get actual counter mode.
__STATIC_INLINE void LL_TIM_EnableARRPreload (TIM_TypeDef *TIMx)
 Enable auto-reload (ARR) preload.
__STATIC_INLINE void LL_TIM_DisableARRPreload (TIM_TypeDef *TIMx)
 Disable auto-reload (ARR) preload.
__STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload (TIM_TypeDef *TIMx)
 Indicates whether auto-reload (ARR) preload is enabled.
__STATIC_INLINE void LL_TIM_SetClockDivision (TIM_TypeDef *TIMx, uint32_t ClockDivision)
 Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
__STATIC_INLINE uint32_t LL_TIM_GetClockDivision (TIM_TypeDef *TIMx)
 Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
__STATIC_INLINE void LL_TIM_SetCounter (TIM_TypeDef *TIMx, uint32_t Counter)
 Set the counter value.
__STATIC_INLINE uint32_t LL_TIM_GetCounter (TIM_TypeDef *TIMx)
 Get the counter value.
__STATIC_INLINE uint32_t LL_TIM_GetDirection (TIM_TypeDef *TIMx)
 Get the current direction of the counter CR1 DIR LL_TIM_GetDirection.
__STATIC_INLINE void LL_TIM_SetPrescaler (TIM_TypeDef *TIMx, uint32_t Prescaler)
 Set the prescaler value.
__STATIC_INLINE uint32_t LL_TIM_GetPrescaler (TIM_TypeDef *TIMx)
 Get the prescaler value.
__STATIC_INLINE void LL_TIM_SetAutoReload (TIM_TypeDef *TIMx, uint32_t AutoReload)
 Set the auto-reload value.
__STATIC_INLINE uint32_t LL_TIM_GetAutoReload (TIM_TypeDef *TIMx)
 Get the auto-reload value.
__STATIC_INLINE void LL_TIM_SetRepetitionCounter (TIM_TypeDef *TIMx, uint32_t RepetitionCounter)
 Set the repetition counter value.
__STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter (TIM_TypeDef *TIMx)
 Get the repetition counter value.
__STATIC_INLINE void LL_TIM_EnableUIFRemap (TIM_TypeDef *TIMx)
 Force a continuous copy of the update interrupt flag (UIF) into the timer counter register (bit 31).
__STATIC_INLINE void LL_TIM_DisableUIFRemap (TIM_TypeDef *TIMx)
 Disable update interrupt flag (UIF) remapping.

Function Documentation

__STATIC_INLINE void LL_TIM_DisableARRPreload ( TIM_TypeDef *  TIMx )

Disable auto-reload (ARR) preload.

CR1 ARPE LL_TIM_DisableARRPreload

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1230 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_DisableCounter ( TIM_TypeDef *  TIMx )

Disable timer counter.

CR1 CEN LL_TIM_DisableCounter

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1063 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_DisableUIFRemap ( TIM_TypeDef *  TIMx )

Disable update interrupt flag (UIF) remapping.

CR1 UIFREMAP LL_TIM_DisableUIFRemap

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1422 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_DisableUpdateEvent ( TIM_TypeDef *  TIMx )

Disable update event generation.

CR1 UDIS LL_TIM_DisableUpdateEvent

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1096 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_EnableARRPreload ( TIM_TypeDef *  TIMx )

Enable auto-reload (ARR) preload.

CR1 ARPE LL_TIM_EnableARRPreload

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1219 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_EnableCounter ( TIM_TypeDef *  TIMx )

Enable timer counter.

CR1 CEN LL_TIM_EnableCounter

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1052 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_EnableUIFRemap ( TIM_TypeDef *  TIMx )

Force a continuous copy of the update interrupt flag (UIF) into the timer counter register (bit 31).

Note:
This allows both the counter value and a potential roll-over condition signalled by the UIFCPY flag to be read in an atomic way. CR1 UIFREMAP LL_TIM_EnableUIFRemap
Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1411 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_EnableUpdateEvent ( TIM_TypeDef *  TIMx )

Enable update event generation.

CR1 UDIS LL_TIM_EnableUpdateEvent

Parameters:
TIMxTimer instance
Return values:
None

Definition at line 1085 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetAutoReload ( TIM_TypeDef *  TIMx )

Get the auto-reload value.

ARR ARR LL_TIM_GetAutoReload

Note:
Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a 32 bits counter.
Parameters:
TIMxTimer instance
Return values:
Auto-reloadvalue

Definition at line 1371 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetClockDivision ( TIM_TypeDef *  TIMx )

Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.

Note:
Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check whether or not the clock division feature is supported by the a timer instance. CR1 CKD LL_TIM_GetClockDivision
Parameters:
TIMxTimer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_TIM_CLOCKDIVISION_DIV1
  • LL_TIM_CLOCKDIVISION_DIV2
  • LL_TIM_CLOCKDIVISION_DIV4

Definition at line 1276 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetCounter ( TIM_TypeDef *  TIMx )

Get the counter value.

Note:
Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a 32 bits counter. counter. CNT CNT LL_TIM_GetCounter
Parameters:
TIMxTimer instance
Return values:
Countervalue

Definition at line 1304 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetCounterMode ( TIM_TypeDef *  TIMx )

Get actual counter mode.

Note:
Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not the counter mode selection feature is supported by a timer instance. CR1 DIR LL_TIM_GetCounterMode
CR1 CMS LL_TIM_GetCounterMode
Parameters:
TIMxTimer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_TIM_COUNTERMODE_UP
  • LL_TIM_COUNTERMODE_DOWN
  • LL_TIM_COUNTERMODE_CENTER_UP
  • LL_TIM_COUNTERMODE_CENTER_DOWN
  • LL_TIM_COUNTERMODE_CENTER_UP_DOWN

Definition at line 1208 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetDirection ( TIM_TypeDef *  TIMx )

Get the current direction of the counter CR1 DIR LL_TIM_GetDirection.

Parameters:
TIMxTimer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_TIM_COUNTERDIRECTION_UP
  • LL_TIM_COUNTERDIRECTION_DOWN

Definition at line 1317 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode ( TIM_TypeDef *  TIMx )

Get actual one pulse mode.

CR1 OPM LL_TIM_GetOnePulseMode

Parameters:
TIMxTimer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_TIM_ONEPULSEMODE_SINGLE
  • LL_TIM_ONEPULSEMODE_REPETITIVE

Definition at line 1169 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetPrescaler ( TIM_TypeDef *  TIMx )

Get the prescaler value.

PSC PSC LL_TIM_GetPrescaler

Parameters:
TIMxTimer instance
Return values:
Prescalervalue

Definition at line 1343 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter ( TIM_TypeDef *  TIMx )

Get the repetition counter value.

Note:
Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a repetition counter. RCR REP LL_TIM_GetRepetitionCounter
Parameters:
TIMxTimer instance
Return values:
Repetitioncounter value

Definition at line 1399 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_GetUpdateSource ( TIM_TypeDef *  TIMx )

Get actual event update source CR1 URS LL_TIM_GetUpdateSource.

Parameters:
TIMxTimer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_TIM_UPDATESOURCE_REGULAR
  • LL_TIM_UPDATESOURCE_COUNTER

Definition at line 1142 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload ( TIM_TypeDef *  TIMx )

Indicates whether auto-reload (ARR) preload is enabled.

CR1 ARPE LL_TIM_IsEnabledARRPreload

Parameters:
TIMxTimer instance
Return values:
Stateof bit (1 or 0).

Definition at line 1241 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter ( TIM_TypeDef *  TIMx )

Indicates whether the timer counter is enabled.

CR1 CEN LL_TIM_IsEnabledCounter

Parameters:
TIMxTimer instance
Return values:
Stateof bit (1 or 0).

Definition at line 1074 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent ( TIM_TypeDef *  TIMx )

Indicates whether update event generation is enabled.

CR1 UDIS LL_TIM_IsEnabledUpdateEvent

Parameters:
TIMxTimer instance
Return values:
Stateof bit (1 or 0).

Definition at line 1107 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetAutoReload ( TIM_TypeDef *  TIMx,
uint32_t  AutoReload 
)

Set the auto-reload value.

Note:
The counter is blocked while the auto-reload value is null.
Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a 32 bits counter. ARR ARR LL_TIM_SetAutoReload
Parameters:
TIMxTimer instance
AutoReloadBetween 0 and 65535
Return values:
None

Definition at line 1358 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetClockDivision ( TIM_TypeDef *  TIMx,
uint32_t  ClockDivision 
)

Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.

Note:
Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check whether or not the clock division feature is supported by the a timer instance. CR1 CKD LL_TIM_SetClockDivision
Parameters:
TIMxTimer instance
ClockDivisionThis parameter can be one of the following values:

  • LL_TIM_CLOCKDIVISION_DIV1
  • LL_TIM_CLOCKDIVISION_DIV2
  • LL_TIM_CLOCKDIVISION_DIV4
Return values:
None

Definition at line 1259 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetCounter ( TIM_TypeDef *  TIMx,
uint32_t  Counter 
)

Set the counter value.

Note:
Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a 32 bits counter. CNT CNT LL_TIM_SetCounter
Parameters:
TIMxTimer instance
CounterCounter value
Return values:
None

Definition at line 1290 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetCounterMode ( TIM_TypeDef *  TIMx,
uint32_t  CounterMode 
)

Set the timer counter counting mode.

Note:
Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not the counter mode selection feature is supported by a timer instance. CR1 DIR LL_TIM_SetCounterMode
CR1 CMS LL_TIM_SetCounterMode
Parameters:
TIMxTimer instance
CounterModeThis parameter can be one of the following values:

  • LL_TIM_COUNTERMODE_UP
  • LL_TIM_COUNTERMODE_DOWN
  • LL_TIM_COUNTERMODE_CENTER_UP
  • LL_TIM_COUNTERMODE_CENTER_DOWN
  • LL_TIM_COUNTERMODE_CENTER_UP_DOWN
Return values:
None

Definition at line 1189 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetOnePulseMode ( TIM_TypeDef *  TIMx,
uint32_t  OnePulseMode 
)

Set one pulse mode (one shot v.s.

repetitive). CR1 OPM LL_TIM_GetUpdateSource

Parameters:
TIMxTimer instance
OnePulseModeThis parameter can be one of the following values:

  • LL_TIM_ONEPULSEMODE_SINGLE
  • LL_TIM_ONEPULSEMODE_REPETITIVE
Return values:
None

Definition at line 1156 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetPrescaler ( TIM_TypeDef *  TIMx,
uint32_t  Prescaler 
)

Set the prescaler value.

Note:
The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1).
The prescaler can be changed on the fly as this control register is buffered. The new prescaler ratio is taken into account at the next update event. PSC PSC LL_TIM_SetPrescaler
Parameters:
TIMxTimer instance
PrescalerBetween 0 and 65535
Return values:
None

Definition at line 1332 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetRepetitionCounter ( TIM_TypeDef *  TIMx,
uint32_t  RepetitionCounter 
)

Set the repetition counter value.

Note:
For advanced timer instances RepetitionCounter can be up to 65535.
Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check whether or not a timer instance supports a repetition counter. RCR REP LL_TIM_SetRepetitionCounter
Parameters:
TIMxTimer instance
RepetitionCounterBetween 0 and 255
Return values:
None

Definition at line 1386 of file stm32l4xx_ll_tim.h.

__STATIC_INLINE void LL_TIM_SetUpdateSource ( TIM_TypeDef *  TIMx,
uint32_t  UpdateSource 
)

Set update event source.

Note:
Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events generate an update interrupt or DMA request if enabled: Counter overflow/underflow Setting the UG bit Update generation through the slave mode controller Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter overflow/underflow generates an update interrupt or DMA request if enabled. CR1 URS LL_TIM_SetUpdateSource
Parameters:
TIMxTimer instance
UpdateSourceThis parameter can be one of the following values:

  • LL_TIM_UPDATESOURCE_REGULAR
  • LL_TIM_UPDATESOURCE_COUNTER
Return values:
None

Definition at line 1129 of file stm32l4xx_ll_tim.h.