TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Embed: (wiki syntax)

« Back to documentation index

LPTIM Configuration

LPTIM Configuration
[LPTIM Exported Functions]

Functions

__STATIC_INLINE void LL_LPTIM_Enable (LPTIM_TypeDef *LPTIMx)
 Enable the LPTIM instance.
__STATIC_INLINE void LL_LPTIM_Disable (LPTIM_TypeDef *LPTIMx)
 Disable the LPTIM instance CR ENABLE LL_LPTIM_Disable.
__STATIC_INLINE uint32_t LL_LPTIM_IsEnabled (LPTIM_TypeDef *LPTIMx)
 Indicates whether the LPTIM instance is enabled.
__STATIC_INLINE void LL_LPTIM_StartCounter (LPTIM_TypeDef *LPTIMx, uint32_t OperatingMode)
 Starts the LPTIM counter in the desired mode.
__STATIC_INLINE void LL_LPTIM_SetUpdateMode (LPTIM_TypeDef *LPTIMx, uint32_t UpdateMode)
 Set the LPTIM registers update mode (enable/disable register preload)
__STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode (LPTIM_TypeDef *LPTIMx)
 Get the LPTIM registers update mode CFGR PRELOAD LL_LPTIM_GetUpdateMode.
__STATIC_INLINE void LL_LPTIM_SetAutoReload (LPTIM_TypeDef *LPTIMx, uint32_t AutoReload)
 Set the auto reload value.
__STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload (LPTIM_TypeDef *LPTIMx)
 Get actual auto reload value ARR ARR LL_LPTIM_GetAutoReload.
__STATIC_INLINE void LL_LPTIM_SetCompare (LPTIM_TypeDef *LPTIMx, uint32_t CompareValue)
 Set the compare value.
__STATIC_INLINE uint32_t LL_LPTIM_GetCompare (LPTIM_TypeDef *LPTIMx)
 Get actual compare value CMP CMP LL_LPTIM_GetCompare.
__STATIC_INLINE uint32_t LL_LPTIM_GetCounter (LPTIM_TypeDef *LPTIMx)
 Get actual counter value.
__STATIC_INLINE void LL_LPTIM_SetCounterMode (LPTIM_TypeDef *LPTIMx, uint32_t CounterMode)
 Set the counter mode (selection of the LPTIM counter clock source).
__STATIC_INLINE uint32_t LL_LPTIM_GetCounterMode (LPTIM_TypeDef *LPTIMx)
 Get the counter mode CFGR COUNTMODE LL_LPTIM_GetCounterMode.
__STATIC_INLINE void LL_LPTIM_ConfigOutput (LPTIM_TypeDef *LPTIMx, uint32_t Waveform, uint32_t Polarity)
 Configure the LPTIM instance output (LPTIMx_OUT)
__STATIC_INLINE void LL_LPTIM_SetWaveform (LPTIM_TypeDef *LPTIMx, uint32_t Waveform)
 Set waveform shape CFGR WAVE LL_LPTIM_SetWaveform.
__STATIC_INLINE uint32_t LL_LPTIM_GetWaveform (LPTIM_TypeDef *LPTIMx)
 Get actual waveform shape CFGR WAVE LL_LPTIM_GetWaveform.
__STATIC_INLINE void LL_LPTIM_SetPolarity (LPTIM_TypeDef *LPTIMx, uint32_t Polarity)
 Set output polarity CFGR WAVPOL LL_LPTIM_SetPolarity.
__STATIC_INLINE uint32_t LL_LPTIM_GetPolarity (LPTIM_TypeDef *LPTIMx)
 Get actual output polarity CFGR WAVPOL LL_LPTIM_GetPolarity.
__STATIC_INLINE void LL_LPTIM_SetPrescaler (LPTIM_TypeDef *LPTIMx, uint32_t Prescaler)
 Set actual prescaler division ratio.
__STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler (LPTIM_TypeDef *LPTIMx)
 Get actual prescaler division ratio.
__STATIC_INLINE void LL_LPTIM_SetInput1Src (LPTIM_TypeDef *LPTIMx, uint32_t Src)
 Set LPTIM input 1 source (default GPIO).
__STATIC_INLINE void LL_LPTIM_SetInput2Src (LPTIM_TypeDef *LPTIMx, uint32_t Src)
 Set LPTIM input 2 source (default GPIO).

Function Documentation

__STATIC_INLINE void LL_LPTIM_ConfigOutput ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Waveform,
uint32_t  Polarity 
)

Configure the LPTIM instance output (LPTIMx_OUT)

Note:
This function must be called when the LPTIM instance is disabled.
Regarding the LPTIM output polarity the change takes effect immediately, so the output default value will change immediately after the polarity is re-configured, even before the timer is enabled. CFGR WAVE LL_LPTIM_ConfigOutput
CFGR WAVPOL LL_LPTIM_ConfigOutput
Parameters:
LPTIMxLow-Power Timer instance
WaveformThis parameter can be one of the following values:

  • LL_LPTIM_OUTPUT_WAVEFORM_PWM
  • LL_LPTIM_OUTPUT_WAVEFORM_SETONCE
PolarityThis parameter can be one of the following values:

  • LL_LPTIM_OUTPUT_POLARITY_REGULAR
  • LL_LPTIM_OUTPUT_POLARITY_INVERSE
Return values:
None

Definition at line 548 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_Disable ( LPTIM_TypeDef *  LPTIMx )

Disable the LPTIM instance CR ENABLE LL_LPTIM_Disable.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
None

Definition at line 370 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_Enable ( LPTIM_TypeDef *  LPTIMx )

Enable the LPTIM instance.

Note:
After setting the ENABLE bit, a delay of two counter clock is needed before the LPTIM instance is actually enabled. CR ENABLE LL_LPTIM_Enable
Parameters:
LPTIMxLow-Power Timer instance
Return values:
None

Definition at line 359 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload ( LPTIM_TypeDef *  LPTIMx )

Get actual auto reload value ARR ARR LL_LPTIM_GetAutoReload.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
AutoReloadValue between Min_Data=0x00 and Max_Data=0xFFFF

Definition at line 456 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetCompare ( LPTIM_TypeDef *  LPTIMx )

Get actual compare value CMP CMP LL_LPTIM_GetCompare.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
CompareValueValue between Min_Data=0x00 and Max_Data=0xFFFF

Definition at line 483 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetCounter ( LPTIM_TypeDef *  LPTIMx )

Get actual counter value.

Note:
When the LPTIM instance is running with an asynchronous clock, reading the LPTIMx_CNT register may return unreliable values. So in this case it is necessary to perform two consecutive read accesses and verify that the two returned values are identical. CNT CNT LL_LPTIM_GetCounter
Parameters:
LPTIMxLow-Power Timer instance
Return values:
Countervalue

Definition at line 498 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetCounterMode ( LPTIM_TypeDef *  LPTIMx )

Get the counter mode CFGR COUNTMODE LL_LPTIM_GetCounterMode.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_LPTIM_COUNTER_MODE_INTERNAL
  • LL_LPTIM_COUNTER_MODE_EXTERNAL

Definition at line 526 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetPolarity ( LPTIM_TypeDef *  LPTIMx )

Get actual output polarity CFGR WAVPOL LL_LPTIM_GetPolarity.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_LPTIM_OUTPUT_POLARITY_REGULAR
  • LL_LPTIM_OUTPUT_POLARITY_INVERSE

Definition at line 602 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler ( LPTIM_TypeDef *  LPTIMx )

Get actual prescaler division ratio.

CFGR PRESC LL_LPTIM_GetPrescaler

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_LPTIM_PRESCALER_DIV1
  • LL_LPTIM_PRESCALER_DIV2
  • LL_LPTIM_PRESCALER_DIV4
  • LL_LPTIM_PRESCALER_DIV8
  • LL_LPTIM_PRESCALER_DIV16
  • LL_LPTIM_PRESCALER_DIV32
  • LL_LPTIM_PRESCALER_DIV64
  • LL_LPTIM_PRESCALER_DIV128

Definition at line 646 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode ( LPTIM_TypeDef *  LPTIMx )

Get the LPTIM registers update mode CFGR PRELOAD LL_LPTIM_GetUpdateMode.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_LPTIM_UPDATE_MODE_IMMEDIATE
  • LL_LPTIM_UPDATE_MODE_ENDOFPERIOD

Definition at line 427 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_GetWaveform ( LPTIM_TypeDef *  LPTIMx )

Get actual waveform shape CFGR WAVE LL_LPTIM_GetWaveform.

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Returnedvalue can be one of the following values:

  • LL_LPTIM_OUTPUT_WAVEFORM_PWM
  • LL_LPTIM_OUTPUT_WAVEFORM_SETONCE

Definition at line 575 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE uint32_t LL_LPTIM_IsEnabled ( LPTIM_TypeDef *  LPTIMx )

Indicates whether the LPTIM instance is enabled.

CR ENABLE LL_LPTIM_IsEnabled

Parameters:
LPTIMxLow-Power Timer instance
Return values:
Stateof bit (1 or 0).

Definition at line 381 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetAutoReload ( LPTIM_TypeDef *  LPTIMx,
uint32_t  AutoReload 
)

Set the auto reload value.

Note:
The LPTIMx_ARR register content must only be modified when the LPTIM is enabled
After a write to the LPTIMx_ARR register a new write operation to the same register can only be performed when the previous write operation is completed. Any successive write before the ARROK flag be set, will lead to unpredictable results.
autoreload value be strictly greater than the compare value. ARR ARR LL_LPTIM_SetAutoReload
Parameters:
LPTIMxLow-Power Timer instance
AutoReloadValue between Min_Data=0x00 and Max_Data=0xFFFF
Return values:
None

Definition at line 445 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetCompare ( LPTIM_TypeDef *  LPTIMx,
uint32_t  CompareValue 
)

Set the compare value.

Note:
After a write to the LPTIMx_CMP register a new write operation to the same register can only be performed when the previous write operation is completed. Any successive write before the CMPOK flag be set, will lead to unpredictable results. CMP CMP LL_LPTIM_SetCompare
Parameters:
LPTIMxLow-Power Timer instance
CompareValueValue between Min_Data=0x00 and Max_Data=0xFFFF
Return values:
None

Definition at line 472 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetCounterMode ( LPTIM_TypeDef *  LPTIMx,
uint32_t  CounterMode 
)

Set the counter mode (selection of the LPTIM counter clock source).

Note:
The counter mode can be set only when the LPTIM instance is disabled. CFGR COUNTMODE LL_LPTIM_SetCounterMode
Parameters:
LPTIMxLow-Power Timer instance
CounterModeThis parameter can be one of the following values:

  • LL_LPTIM_COUNTER_MODE_INTERNAL
  • LL_LPTIM_COUNTER_MODE_EXTERNAL
Return values:
None

Definition at line 513 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetInput1Src ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Src 
)

Set LPTIM input 1 source (default GPIO).

OR OR_0 LL_LPTIM_SetInput1Src OR OR_1 LL_LPTIM_SetInput1Src

Parameters:
LPTIMxLow-Power Timer instance
SrcThis parameter can be one of the following values:

  • LL_LPTIM_INPUT1_SRC_GPIO
  • LL_LPTIM_INPUT1_SRC_COMP1
  • LL_LPTIM_INPUT1_SRC_COMP2
  • LL_LPTIM_INPUT1_SRC_COMP1_COMP2
Return values:
None

Definition at line 663 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetInput2Src ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Src 
)

Set LPTIM input 2 source (default GPIO).

OR OR_0 LL_LPTIM_SetInput2Src

Parameters:
LPTIMxLow-Power Timer instance
SrcThis parameter can be one of the following values:

  • LL_LPTIM_INPUT2_SRC_GPIO
  • LL_LPTIM_INPUT2_SRC_COMP2
Return values:
None

Definition at line 677 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetPolarity ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Polarity 
)

Set output polarity CFGR WAVPOL LL_LPTIM_SetPolarity.

Parameters:
LPTIMxLow-Power Timer instance
PolarityThis parameter can be one of the following values:

  • LL_LPTIM_OUTPUT_POLARITY_REGULAR
  • LL_LPTIM_OUTPUT_POLARITY_INVERSE
Return values:
None

Definition at line 589 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetPrescaler ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Prescaler 
)

Set actual prescaler division ratio.

Note:
This function must be called when the LPTIM instance is disabled.
When the LPTIM is configured to be clocked by an internal clock source and the LPTIM counter is configured to be updated by active edges detected on the LPTIM external Input1, the internal clock provided to the LPTIM must be not be prescaled. CFGR PRESC LL_LPTIM_SetPrescaler
Parameters:
LPTIMxLow-Power Timer instance
PrescalerThis parameter can be one of the following values:

  • LL_LPTIM_PRESCALER_DIV1
  • LL_LPTIM_PRESCALER_DIV2
  • LL_LPTIM_PRESCALER_DIV4
  • LL_LPTIM_PRESCALER_DIV8
  • LL_LPTIM_PRESCALER_DIV16
  • LL_LPTIM_PRESCALER_DIV32
  • LL_LPTIM_PRESCALER_DIV64
  • LL_LPTIM_PRESCALER_DIV128
Return values:
None

Definition at line 627 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetUpdateMode ( LPTIM_TypeDef *  LPTIMx,
uint32_t  UpdateMode 
)

Set the LPTIM registers update mode (enable/disable register preload)

Note:
This function must be called when the LPTIM instance is disabled. CFGR PRELOAD LL_LPTIM_SetUpdateMode
Parameters:
LPTIMxLow-Power Timer instance
UpdateModeThis parameter can be one of the following values:

  • LL_LPTIM_UPDATE_MODE_IMMEDIATE
  • LL_LPTIM_UPDATE_MODE_ENDOFPERIOD
Return values:
None

Definition at line 414 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_SetWaveform ( LPTIM_TypeDef *  LPTIMx,
uint32_t  Waveform 
)

Set waveform shape CFGR WAVE LL_LPTIM_SetWaveform.

Parameters:
LPTIMxLow-Power Timer instance
WaveformThis parameter can be one of the following values:

  • LL_LPTIM_OUTPUT_WAVEFORM_PWM
  • LL_LPTIM_OUTPUT_WAVEFORM_SETONCE
Return values:
None

Definition at line 562 of file stm32l4xx_ll_lptim.h.

__STATIC_INLINE void LL_LPTIM_StartCounter ( LPTIM_TypeDef *  LPTIMx,
uint32_t  OperatingMode 
)

Starts the LPTIM counter in the desired mode.

Note:
LPTIM instance must be enabled before starting the counter.
It is possible to change on the fly from One Shot mode to Continuous mode. CR CNTSTRT LL_LPTIM_StartCounter
CR SNGSTRT LL_LPTIM_StartCounter
Parameters:
LPTIMxLow-Power Timer instance
OperatingModeThis parameter can be one of the following values:

  • LL_LPTIM_OPERATING_MODE_CONTINUOUS
  • LL_LPTIM_OPERATING_MODE_ONESHOT
Return values:
None

Definition at line 399 of file stm32l4xx_ll_lptim.h.