18 #if defined(USE_FULL_LL_DRIVER)
26 #ifdef USE_FULL_ASSERT
27 #include "stm32_assert.h"
29 #define assert_param(expr) ((void)0U)
49 #define IS_LL_LPTIM_CLOCK_SOURCE(__VALUE__) (((__VALUE__) == LL_LPTIM_CLK_SOURCE_INTERNAL) \
50 || ((__VALUE__) == LL_LPTIM_CLK_SOURCE_EXTERNAL))
52 #define IS_LL_LPTIM_CLOCK_PRESCALER(__VALUE__) (((__VALUE__) == LL_LPTIM_PRESCALER_DIV1) \
53 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV2) \
54 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV4) \
55 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV8) \
56 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV16) \
57 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV32) \
58 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV64) \
59 || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV128))
61 #define IS_LL_LPTIM_WAVEFORM(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_PWM) \
62 || ((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_SETONCE))
64 #define IS_LL_LPTIM_OUTPUT_POLARITY(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_REGULAR) \
65 || ((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_INVERSE))
97 ErrorStatus result = SUCCESS;
100 assert_param(IS_LPTIM_INSTANCE(LPTIMx));
102 if (LPTIMx == LPTIM1)
124 LPTIM_InitStruct->
ClockSource = LL_LPTIM_CLK_SOURCE_INTERNAL;
125 LPTIM_InitStruct->
Prescaler = LL_LPTIM_PRESCALER_DIV1;
126 LPTIM_InitStruct->
Waveform = LL_LPTIM_OUTPUT_WAVEFORM_PWM;
127 LPTIM_InitStruct->
Polarity = LL_LPTIM_OUTPUT_POLARITY_REGULAR;
142 ErrorStatus result = SUCCESS;
144 assert_param(IS_LPTIM_INSTANCE(LPTIMx));
145 assert_param(IS_LL_LPTIM_CLOCK_SOURCE(LPTIM_InitStruct->
ClockSource));
146 assert_param(IS_LL_LPTIM_CLOCK_PRESCALER(LPTIM_InitStruct->
Prescaler));
147 assert_param(IS_LL_LPTIM_WAVEFORM(LPTIM_InitStruct->
Waveform));
148 assert_param(IS_LL_LPTIM_OUTPUT_POLARITY(LPTIM_InitStruct->
Polarity));
163 MODIFY_REG(LPTIMx->CFGR,
164 (LPTIM_CFGR_CKSEL | LPTIM_CFGR_PRESC | LPTIM_CFGR_WAVE | LPTIM_CFGR_WAVPOL),
186 uint32_t tmpclksource = 0;
191 uint32_t primask_bit;
195 assert_param(IS_LPTIM_INSTANCE(LPTIMx));
198 primask_bit = __get_PRIMASK();
203 switch ((uint32_t)LPTIMx)
213 tmpIER = LPTIMx->IER;
214 tmpCFGR = LPTIMx->CFGR;
215 tmpCMP = LPTIMx->CMP;
216 tmpARR = LPTIMx->ARR;
225 if ((tmpCMP != 0UL) || (tmpARR != 0UL))
228 switch ((uint32_t)LPTIMx)
240 LPTIMx->CR |= LPTIM_CR_ENABLE;
241 LPTIMx->CMP = tmpCMP;
254 LPTIMx->CR |= LPTIM_CR_ENABLE;
255 LPTIMx->ARR = tmpARR;
273 LPTIMx->CR &= ~(LPTIM_CR_ENABLE);
274 LPTIMx->IER = tmpIER;
275 LPTIMx->CFGR = tmpCFGR;
279 __set_PRIMASK(primask_bit);
__STATIC_INLINE void LL_APB1_GRP1_ForceReset(uint32_t Periphs)
Force APB1 peripherals reset. @rmtoll APB1RSTR TIM2RST LL_APB1_GRP1_ForceReset APB1RSTR TIM3RST LL_A...
__STATIC_INLINE void LL_APB1_GRP1_ReleaseReset(uint32_t Periphs)
Release APB1 peripherals reset. @rmtoll APB1RSTR TIM2RST LL_APB1_GRP1_ReleaseReset APB1RSTR TIM3RST ...
uint32_t SYSCLK_Frequency
RCC Clocks Frequency Structure.
__STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARROK(const LPTIM_TypeDef *LPTIMx)
Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfu...
__STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPOK(const LPTIM_TypeDef *LPTIMx)
Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfu...
__STATIC_INLINE void LL_LPTIM_ClearFlag_ARROK(LPTIM_TypeDef *LPTIMx)
Clear the autoreload register update interrupt flag (ARROKCF). @rmtoll ICR ARROKCF LL_LPTIM_ClearFlag...
__STATIC_INLINE void LL_LPTIM_ClearFlag_CMPOK(LPTIM_TypeDef *LPTIMx)
Clear the compare register update interrupt flag (CMPOKCF). @rmtoll ICR CMPOKCF LL_LPTIM_ClearFlag_CM...
ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, const LL_LPTIM_InitTypeDef *LPTIM_InitStruct)
Configure the LPTIMx peripheral according to the specified parameters.
void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx)
Disable the LPTIM instance @rmtoll CR ENABLE LL_LPTIM_Disable.
void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct)
Set each fields of the LPTIM_InitStruct structure to its default value.
ErrorStatus LL_LPTIM_DeInit(const LPTIM_TypeDef *LPTIMx)
Set LPTIMx registers to their reset values.
__STATIC_INLINE uint32_t LL_LPTIM_IsEnabled(const LPTIM_TypeDef *LPTIMx)
Indicates whether the LPTIM instance is enabled. @rmtoll CR ENABLE LL_LPTIM_IsEnabled.
LPTIM Init structure definition.
void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks)
Return the frequencies of different on chip clocks; System, AHB, APB1 and APB2 buses clocks.
__STATIC_INLINE void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource)
Configure LPTIMx clock source @rmtoll DCKCFGR2 LPTIM1SEL LL_RCC_SetLPTIMClockSource.
__STATIC_INLINE uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx)
Get LPTIMx clock source @rmtoll DCKCFGR2 LPTIM1SEL LL_RCC_GetLPTIMClockSource.
Header file of BUS LL module.
Header file of LPTIM LL module.
Header file of RCC LL module.