STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_ll_lptim.h 00004 * @author MCD Application Team 00005 * @brief Header file of LPTIM LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_LL_LPTIM_H 00021 #define STM32L4xx_LL_LPTIM_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx.h" 00029 00030 /** @addtogroup STM32L4xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined (LPTIM1) || defined (LPTIM2) 00035 00036 /** @defgroup LPTIM_LL LPTIM 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 00043 /* Private constants ---------------------------------------------------------*/ 00044 00045 /* Private macros ------------------------------------------------------------*/ 00046 #if defined(USE_FULL_LL_DRIVER) 00047 /** @defgroup LPTIM_LL_Private_Macros LPTIM Private Macros 00048 * @{ 00049 */ 00050 /** 00051 * @} 00052 */ 00053 #endif /*USE_FULL_LL_DRIVER*/ 00054 00055 /* Exported types ------------------------------------------------------------*/ 00056 #if defined(USE_FULL_LL_DRIVER) 00057 /** @defgroup LPTIM_LL_ES_INIT LPTIM Exported Init structure 00058 * @{ 00059 */ 00060 00061 /** 00062 * @brief LPTIM Init structure definition 00063 */ 00064 typedef struct 00065 { 00066 uint32_t ClockSource; /*!< Specifies the source of the clock used by the LPTIM instance. 00067 This parameter can be a value of @ref LPTIM_LL_EC_CLK_SOURCE. 00068 00069 This feature can be modified afterwards using unitary 00070 function @ref LL_LPTIM_SetClockSource().*/ 00071 00072 uint32_t Prescaler; /*!< Specifies the prescaler division ratio. 00073 This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER. 00074 00075 This feature can be modified afterwards using using unitary 00076 function @ref LL_LPTIM_SetPrescaler().*/ 00077 00078 uint32_t Waveform; /*!< Specifies the waveform shape. 00079 This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_WAVEFORM. 00080 00081 This feature can be modified afterwards using unitary 00082 function @ref LL_LPTIM_ConfigOutput().*/ 00083 00084 uint32_t Polarity; /*!< Specifies waveform polarity. 00085 This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_POLARITY. 00086 00087 This feature can be modified afterwards using unitary 00088 function @ref LL_LPTIM_ConfigOutput().*/ 00089 } LL_LPTIM_InitTypeDef; 00090 00091 /** 00092 * @} 00093 */ 00094 #endif /* USE_FULL_LL_DRIVER */ 00095 00096 /* Exported constants --------------------------------------------------------*/ 00097 /** @defgroup LPTIM_LL_Exported_Constants LPTIM Exported Constants 00098 * @{ 00099 */ 00100 00101 /** @defgroup LPTIM_LL_EC_GET_FLAG Get Flags Defines 00102 * @brief Flags defines which can be used with LL_LPTIM_ReadReg function 00103 * @{ 00104 */ 00105 #define LL_LPTIM_ISR_CMPM LPTIM_ISR_CMPM /*!< Compare match */ 00106 #define LL_LPTIM_ISR_CMPOK LPTIM_ISR_CMPOK /*!< Compare register update OK */ 00107 #define LL_LPTIM_ISR_ARRM LPTIM_ISR_ARRM /*!< Autoreload match */ 00108 #define LL_LPTIM_ISR_EXTTRIG LPTIM_ISR_EXTTRIG /*!< External trigger edge event */ 00109 #define LL_LPTIM_ISR_ARROK LPTIM_ISR_ARROK /*!< Autoreload register update OK */ 00110 #define LL_LPTIM_ISR_UP LPTIM_ISR_UP /*!< Counter direction change down to up */ 00111 #define LL_LPTIM_ISR_DOWN LPTIM_ISR_DOWN /*!< Counter direction change up to down */ 00112 #if defined(LPTIM_RCR_REP) 00113 #define LL_LPTIM_ISR_UE LPTIM_ISR_UE /*!< Update event */ 00114 #define LL_LPTIM_ISR_REPOK LPTIM_ISR_REPOK /*!< Repetition register update OK */ 00115 #endif 00116 /** 00117 * @} 00118 */ 00119 00120 /** @defgroup LPTIM_LL_EC_IT IT Defines 00121 * @brief IT defines which can be used with LL_LPTIM_ReadReg and LL_LPTIM_WriteReg functions 00122 * @{ 00123 */ 00124 #define LL_LPTIM_IER_CMPMIE LPTIM_IER_CMPMIE /*!< Compare match */ 00125 #define LL_LPTIM_IER_CMPOKIE LPTIM_IER_CMPOKIE /*!< Compare register update OK */ 00126 #define LL_LPTIM_IER_ARRMIE LPTIM_IER_ARRMIE /*!< Autoreload match */ 00127 #define LL_LPTIM_IER_EXTTRIGIE LPTIM_IER_EXTTRIGIE /*!< External trigger edge event */ 00128 #define LL_LPTIM_IER_ARROKIE LPTIM_IER_ARROKIE /*!< Autoreload register update OK */ 00129 #define LL_LPTIM_IER_UPIE LPTIM_IER_UPIE /*!< Counter direction change down to up */ 00130 #define LL_LPTIM_IER_DOWNIE LPTIM_IER_DOWNIE /*!< Counter direction change up to down */ 00131 #if defined(LPTIM_RCR_REP) 00132 #define LL_LPTIM_IER_UEIE LPTIM_IER_UEIE /*!< Update event */ 00133 #define LL_LPTIM_IER_REPOKIE LPTIM_IER_REPOKIE /*!< Repetition register update OK */ 00134 #endif 00135 /** 00136 * @} 00137 */ 00138 00139 /** @defgroup LPTIM_LL_EC_OPERATING_MODE Operating Mode 00140 * @{ 00141 */ 00142 #define LL_LPTIM_OPERATING_MODE_CONTINUOUS LPTIM_CR_CNTSTRT /*!<LP Timer starts in continuous mode*/ 00143 #define LL_LPTIM_OPERATING_MODE_ONESHOT LPTIM_CR_SNGSTRT /*!<LP Tilmer starts in single mode*/ 00144 /** 00145 * @} 00146 */ 00147 00148 /** @defgroup LPTIM_LL_EC_UPDATE_MODE Update Mode 00149 * @{ 00150 */ 00151 #define LL_LPTIM_UPDATE_MODE_IMMEDIATE 0x00000000U /*!<Preload is disabled: registers are updated after each APB bus write access*/ 00152 #define LL_LPTIM_UPDATE_MODE_ENDOFPERIOD LPTIM_CFGR_PRELOAD /*!<preload is enabled: registers are updated at the end of the current LPTIM period*/ 00153 /** 00154 * @} 00155 */ 00156 00157 /** @defgroup LPTIM_LL_EC_COUNTER_MODE Counter Mode 00158 * @{ 00159 */ 00160 #define LL_LPTIM_COUNTER_MODE_INTERNAL 0x00000000U /*!<The counter is incremented following each internal clock pulse*/ 00161 #define LL_LPTIM_COUNTER_MODE_EXTERNAL LPTIM_CFGR_COUNTMODE /*!<The counter is incremented following each valid clock pulse on the LPTIM external Input1*/ 00162 /** 00163 * @} 00164 */ 00165 00166 /** @defgroup LPTIM_LL_EC_OUTPUT_WAVEFORM Output Waveform Type 00167 * @{ 00168 */ 00169 #define LL_LPTIM_OUTPUT_WAVEFORM_PWM 0x00000000U /*!<LPTIM generates either a PWM waveform or a One pulse waveform depending on chosen operating mode CONTINUOUS or SINGLE*/ 00170 #define LL_LPTIM_OUTPUT_WAVEFORM_SETONCE LPTIM_CFGR_WAVE /*!<LPTIM generates a Set Once waveform*/ 00171 /** 00172 * @} 00173 */ 00174 00175 /** @defgroup LPTIM_LL_EC_OUTPUT_POLARITY Output Polarity 00176 * @{ 00177 */ 00178 #define LL_LPTIM_OUTPUT_POLARITY_REGULAR 0x00000000U /*!<The LPTIM output reflects the compare results between LPTIMx_ARR and LPTIMx_CMP registers*/ 00179 #define LL_LPTIM_OUTPUT_POLARITY_INVERSE LPTIM_CFGR_WAVPOL /*!<The LPTIM output reflects the inverse of the compare results between LPTIMx_ARR and LPTIMx_CMP registers*/ 00180 /** 00181 * @} 00182 */ 00183 00184 /** @defgroup LPTIM_LL_EC_PRESCALER Prescaler Value 00185 * @{ 00186 */ 00187 #define LL_LPTIM_PRESCALER_DIV1 0x00000000U /*!<Prescaler division factor is set to 1*/ 00188 #define LL_LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 /*!<Prescaler division factor is set to 2*/ 00189 #define LL_LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 /*!<Prescaler division factor is set to 4*/ 00190 #define LL_LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 8*/ 00191 #define LL_LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 /*!<Prescaler division factor is set to 16*/ 00192 #define LL_LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 32*/ 00193 #define LL_LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_1) /*!<Prescaler division factor is set to 64*/ 00194 #define LL_LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC /*!<Prescaler division factor is set to 128*/ 00195 /** 00196 * @} 00197 */ 00198 00199 /** @defgroup LPTIM_LL_EC_TRIG_SOURCE Trigger Source 00200 * @{ 00201 */ 00202 #define LL_LPTIM_TRIG_SOURCE_GPIO 0x00000000U /*!<External input trigger is connected to TIMx_ETR input*/ 00203 #define LL_LPTIM_TRIG_SOURCE_RTCALARMA LPTIM_CFGR_TRIGSEL_0 /*!<External input trigger is connected to RTC Alarm A*/ 00204 #define LL_LPTIM_TRIG_SOURCE_RTCALARMB LPTIM_CFGR_TRIGSEL_1 /*!<External input trigger is connected to RTC Alarm B*/ 00205 #define LL_LPTIM_TRIG_SOURCE_RTCTAMP1 (LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to RTC Tamper 1*/ 00206 #define LL_LPTIM_TRIG_SOURCE_RTCTAMP2 LPTIM_CFGR_TRIGSEL_2 /*!<External input trigger is connected to RTC Tamper 2*/ 00207 #define LL_LPTIM_TRIG_SOURCE_RTCTAMP3 (LPTIM_CFGR_TRIGSEL_2 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to RTC Tamper 3*/ 00208 #define LL_LPTIM_TRIG_SOURCE_COMP1 (LPTIM_CFGR_TRIGSEL_2 | LPTIM_CFGR_TRIGSEL_1) /*!<External input trigger is connected to COMP1 output*/ 00209 #define LL_LPTIM_TRIG_SOURCE_COMP2 LPTIM_CFGR_TRIGSEL /*!<External input trigger is connected to COMP2 output*/ 00210 /** 00211 * @} 00212 */ 00213 00214 /** @defgroup LPTIM_LL_EC_TRIG_FILTER Trigger Filter 00215 * @{ 00216 */ 00217 #define LL_LPTIM_TRIG_FILTER_NONE 0x00000000U /*!<Any trigger active level change is considered as a valid trigger*/ 00218 #define LL_LPTIM_TRIG_FILTER_2 LPTIM_CFGR_TRGFLT_0 /*!<Trigger active level change must be stable for at least 2 clock periods before it is considered as valid trigger*/ 00219 #define LL_LPTIM_TRIG_FILTER_4 LPTIM_CFGR_TRGFLT_1 /*!<Trigger active level change must be stable for at least 4 clock periods before it is considered as valid trigger*/ 00220 #define LL_LPTIM_TRIG_FILTER_8 LPTIM_CFGR_TRGFLT /*!<Trigger active level change must be stable for at least 8 clock periods before it is considered as valid trigger*/ 00221 /** 00222 * @} 00223 */ 00224 00225 /** @defgroup LPTIM_LL_EC_TRIG_POLARITY Trigger Polarity 00226 * @{ 00227 */ 00228 #define LL_LPTIM_TRIG_POLARITY_RISING LPTIM_CFGR_TRIGEN_0 /*!<LPTIM counter starts when a rising edge is detected*/ 00229 #define LL_LPTIM_TRIG_POLARITY_FALLING LPTIM_CFGR_TRIGEN_1 /*!<LPTIM counter starts when a falling edge is detected*/ 00230 #define LL_LPTIM_TRIG_POLARITY_RISING_FALLING LPTIM_CFGR_TRIGEN /*!<LPTIM counter starts when a rising or a falling edge is detected*/ 00231 /** 00232 * @} 00233 */ 00234 00235 /** @defgroup LPTIM_LL_EC_CLK_SOURCE Clock Source 00236 * @{ 00237 */ 00238 #define LL_LPTIM_CLK_SOURCE_INTERNAL 0x00000000U /*!<LPTIM is clocked by internal clock source (APB clock or any of the embedded oscillators)*/ 00239 #define LL_LPTIM_CLK_SOURCE_EXTERNAL LPTIM_CFGR_CKSEL /*!<LPTIM is clocked by an external clock source through the LPTIM external Input1*/ 00240 /** 00241 * @} 00242 */ 00243 00244 /** @defgroup LPTIM_LL_EC_CLK_FILTER Clock Filter 00245 * @{ 00246 */ 00247 #define LL_LPTIM_CLK_FILTER_NONE 0x00000000U /*!<Any external clock signal level change is considered as a valid transition*/ 00248 #define LL_LPTIM_CLK_FILTER_2 LPTIM_CFGR_CKFLT_0 /*!<External clock signal level change must be stable for at least 2 clock periods before it is considered as valid transition*/ 00249 #define LL_LPTIM_CLK_FILTER_4 LPTIM_CFGR_CKFLT_1 /*!<External clock signal level change must be stable for at least 4 clock periods before it is considered as valid transition*/ 00250 #define LL_LPTIM_CLK_FILTER_8 LPTIM_CFGR_CKFLT /*!<External clock signal level change must be stable for at least 8 clock periods before it is considered as valid transition*/ 00251 /** 00252 * @} 00253 */ 00254 00255 /** @defgroup LPTIM_LL_EC_CLK_POLARITY Clock Polarity 00256 * @{ 00257 */ 00258 #define LL_LPTIM_CLK_POLARITY_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/ 00259 #define LL_LPTIM_CLK_POLARITY_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/ 00260 #define LL_LPTIM_CLK_POLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/ 00261 /** 00262 * @} 00263 */ 00264 00265 /** @defgroup LPTIM_LL_EC_ENCODER_MODE Encoder Mode 00266 * @{ 00267 */ 00268 #define LL_LPTIM_ENCODER_MODE_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/ 00269 #define LL_LPTIM_ENCODER_MODE_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/ 00270 #define LL_LPTIM_ENCODER_MODE_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/ 00271 /** 00272 * @} 00273 */ 00274 00275 /** @defgroup LPTIM_EC_INPUT1_SRC Input1 Source 00276 * @{ 00277 */ 00278 #define LL_LPTIM_INPUT1_SRC_GPIO 0x00000000U /*!< For LPTIM1 and LPTIM2 */ 00279 #define LL_LPTIM_INPUT1_SRC_COMP1 LPTIM_OR_OR_0 /*!< For LPTIM1 and LPTIM2 */ 00280 #define LL_LPTIM_INPUT1_SRC_COMP2 LPTIM_OR_OR_1 /*!< For LPTIM2 */ 00281 #define LL_LPTIM_INPUT1_SRC_COMP1_COMP2 LPTIM_OR_OR /*!< For LPTIM2 */ 00282 /** 00283 * @} 00284 */ 00285 00286 /** @defgroup LPTIM_EC_INPUT2_SRC Input2 Source 00287 * @{ 00288 */ 00289 #define LL_LPTIM_INPUT2_SRC_GPIO 0x00000000U /*!< For LPTIM1 */ 00290 #define LL_LPTIM_INPUT2_SRC_COMP2 LPTIM_OR_OR_1 /*!< For LPTIM1 */ 00291 /** 00292 * @} 00293 */ 00294 00295 /** 00296 * @} 00297 */ 00298 00299 /* Exported macro ------------------------------------------------------------*/ 00300 /** @defgroup LPTIM_LL_Exported_Macros LPTIM Exported Macros 00301 * @{ 00302 */ 00303 00304 /** @defgroup LPTIM_LL_EM_WRITE_READ Common Write and read registers Macros 00305 * @{ 00306 */ 00307 00308 /** 00309 * @brief Write a value in LPTIM register 00310 * @param __INSTANCE__ LPTIM Instance 00311 * @param __REG__ Register to be written 00312 * @param __VALUE__ Value to be written in the register 00313 * @retval None 00314 */ 00315 #define LL_LPTIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__)) 00316 00317 /** 00318 * @brief Read a value in LPTIM register 00319 * @param __INSTANCE__ LPTIM Instance 00320 * @param __REG__ Register to be read 00321 * @retval Register value 00322 */ 00323 #define LL_LPTIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__) 00324 /** 00325 * @} 00326 */ 00327 00328 /** 00329 * @} 00330 */ 00331 00332 /* Exported functions --------------------------------------------------------*/ 00333 /** @defgroup LPTIM_LL_Exported_Functions LPTIM Exported Functions 00334 * @{ 00335 */ 00336 00337 #if defined(USE_FULL_LL_DRIVER) 00338 /** @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions 00339 * @{ 00340 */ 00341 00342 ErrorStatus LL_LPTIM_DeInit(LPTIM_TypeDef *LPTIMx); 00343 void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct); 00344 ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, LL_LPTIM_InitTypeDef *LPTIM_InitStruct); 00345 void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx); 00346 /** 00347 * @} 00348 */ 00349 #endif /* USE_FULL_LL_DRIVER */ 00350 00351 /** @defgroup LPTIM_LL_EF_LPTIM_Configuration LPTIM Configuration 00352 * @{ 00353 */ 00354 00355 /** 00356 * @brief Enable the LPTIM instance 00357 * @note After setting the ENABLE bit, a delay of two counter clock is needed 00358 * before the LPTIM instance is actually enabled. 00359 * @rmtoll CR ENABLE LL_LPTIM_Enable 00360 * @param LPTIMx Low-Power Timer instance 00361 * @retval None 00362 */ 00363 __STATIC_INLINE void LL_LPTIM_Enable(LPTIM_TypeDef *LPTIMx) 00364 { 00365 SET_BIT(LPTIMx->CR, LPTIM_CR_ENABLE); 00366 } 00367 00368 /** 00369 * @brief Indicates whether the LPTIM instance is enabled. 00370 * @rmtoll CR ENABLE LL_LPTIM_IsEnabled 00371 * @param LPTIMx Low-Power Timer instance 00372 * @retval State of bit (1 or 0). 00373 */ 00374 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabled(LPTIM_TypeDef *LPTIMx) 00375 { 00376 return (((READ_BIT(LPTIMx->CR, LPTIM_CR_ENABLE) == LPTIM_CR_ENABLE) ? 1UL : 0UL)); 00377 } 00378 00379 /** 00380 * @brief Starts the LPTIM counter in the desired mode. 00381 * @note LPTIM instance must be enabled before starting the counter. 00382 * @note It is possible to change on the fly from One Shot mode to 00383 * Continuous mode. 00384 * @rmtoll CR CNTSTRT LL_LPTIM_StartCounter\n 00385 * CR SNGSTRT LL_LPTIM_StartCounter 00386 * @param LPTIMx Low-Power Timer instance 00387 * @param OperatingMode This parameter can be one of the following values: 00388 * @arg @ref LL_LPTIM_OPERATING_MODE_CONTINUOUS 00389 * @arg @ref LL_LPTIM_OPERATING_MODE_ONESHOT 00390 * @retval None 00391 */ 00392 __STATIC_INLINE void LL_LPTIM_StartCounter(LPTIM_TypeDef *LPTIMx, uint32_t OperatingMode) 00393 { 00394 MODIFY_REG(LPTIMx->CR, LPTIM_CR_CNTSTRT | LPTIM_CR_SNGSTRT, OperatingMode); 00395 } 00396 00397 #if defined(LPTIM_CR_RSTARE) 00398 /** 00399 * @brief Enable reset after read. 00400 * @note After calling this function any read access to LPTIM_CNT 00401 * register will asynchronously reset the LPTIM_CNT register content. 00402 * @rmtoll CR RSTARE LL_LPTIM_EnableResetAfterRead 00403 * @param LPTIMx Low-Power Timer instance 00404 * @retval None 00405 */ 00406 __STATIC_INLINE void LL_LPTIM_EnableResetAfterRead(LPTIM_TypeDef *LPTIMx) 00407 { 00408 SET_BIT(LPTIMx->CR, LPTIM_CR_RSTARE); 00409 } 00410 00411 /** 00412 * @brief Disable reset after read. 00413 * @rmtoll CR RSTARE LL_LPTIM_DisableResetAfterRead 00414 * @param LPTIMx Low-Power Timer instance 00415 * @retval None 00416 */ 00417 __STATIC_INLINE void LL_LPTIM_DisableResetAfterRead(LPTIM_TypeDef *LPTIMx) 00418 { 00419 CLEAR_BIT(LPTIMx->CR, LPTIM_CR_RSTARE); 00420 } 00421 00422 /** 00423 * @brief Indicate whether the reset after read feature is enabled. 00424 * @rmtoll CR RSTARE LL_LPTIM_IsEnabledResetAfterRead 00425 * @param LPTIMx Low-Power Timer instance 00426 * @retval State of bit (1 or 0). 00427 */ 00428 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledResetAfterRead(LPTIM_TypeDef *LPTIMx) 00429 { 00430 return (((READ_BIT(LPTIMx->CR, LPTIM_CR_RSTARE) == LPTIM_CR_RSTARE) ? 1UL : 0UL)); 00431 } 00432 #endif 00433 00434 #if defined(LPTIM_CR_COUNTRST) 00435 /** 00436 * @brief Reset of the LPTIM_CNT counter register (synchronous). 00437 * @note Due to the synchronous nature of this reset, it only takes 00438 * place after a synchronization delay of 3 LPTIM core clock cycles 00439 * (LPTIM core clock may be different from APB clock). 00440 * @note COUNTRST is automatically cleared by hardware 00441 * @rmtoll CR COUNTRST LL_LPTIM_ResetCounter\n 00442 * @param LPTIMx Low-Power Timer instance 00443 * @retval None 00444 */ 00445 __STATIC_INLINE void LL_LPTIM_ResetCounter(LPTIM_TypeDef *LPTIMx) 00446 { 00447 SET_BIT(LPTIMx->CR, LPTIM_CR_COUNTRST); 00448 } 00449 #endif 00450 00451 /** 00452 * @brief Set the LPTIM registers update mode (enable/disable register preload) 00453 * @note This function must be called when the LPTIM instance is disabled. 00454 * @rmtoll CFGR PRELOAD LL_LPTIM_SetUpdateMode 00455 * @param LPTIMx Low-Power Timer instance 00456 * @param UpdateMode This parameter can be one of the following values: 00457 * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE 00458 * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD 00459 * @retval None 00460 */ 00461 __STATIC_INLINE void LL_LPTIM_SetUpdateMode(LPTIM_TypeDef *LPTIMx, uint32_t UpdateMode) 00462 { 00463 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD, UpdateMode); 00464 } 00465 00466 /** 00467 * @brief Get the LPTIM registers update mode 00468 * @rmtoll CFGR PRELOAD LL_LPTIM_GetUpdateMode 00469 * @param LPTIMx Low-Power Timer instance 00470 * @retval Returned value can be one of the following values: 00471 * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE 00472 * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD 00473 */ 00474 __STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode(LPTIM_TypeDef *LPTIMx) 00475 { 00476 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD)); 00477 } 00478 00479 /** 00480 * @brief Set the auto reload value 00481 * @note The LPTIMx_ARR register content must only be modified when the LPTIM is enabled 00482 * @note After a write to the LPTIMx_ARR register a new write operation to the 00483 * same register can only be performed when the previous write operation 00484 * is completed. Any successive write before the ARROK flag is set, will 00485 * lead to unpredictable results. 00486 * @note autoreload value be strictly greater than the compare value. 00487 * @rmtoll ARR ARR LL_LPTIM_SetAutoReload 00488 * @param LPTIMx Low-Power Timer instance 00489 * @param AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF 00490 * @retval None 00491 */ 00492 __STATIC_INLINE void LL_LPTIM_SetAutoReload(LPTIM_TypeDef *LPTIMx, uint32_t AutoReload) 00493 { 00494 MODIFY_REG(LPTIMx->ARR, LPTIM_ARR_ARR, AutoReload); 00495 } 00496 00497 /** 00498 * @brief Get actual auto reload value 00499 * @rmtoll ARR ARR LL_LPTIM_GetAutoReload 00500 * @param LPTIMx Low-Power Timer instance 00501 * @retval AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF 00502 */ 00503 __STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload(LPTIM_TypeDef *LPTIMx) 00504 { 00505 return (uint32_t)(READ_BIT(LPTIMx->ARR, LPTIM_ARR_ARR)); 00506 } 00507 00508 #if defined(LPTIM_RCR_REP) 00509 /** 00510 * @brief Set the repetition value 00511 * @note The LPTIMx_RCR register content must only be modified when the LPTIM is enabled 00512 * @rmtoll RCR REP LL_LPTIM_SetRepetition 00513 * @param LPTIMx Low-Power Timer instance 00514 * @param Repetition Value between Min_Data=0x00 and Max_Data=0xFF 00515 * @retval None 00516 */ 00517 __STATIC_INLINE void LL_LPTIM_SetRepetition(LPTIM_TypeDef *LPTIMx, uint32_t Repetition) 00518 { 00519 MODIFY_REG(LPTIMx->RCR, LPTIM_RCR_REP, Repetition); 00520 } 00521 00522 /** 00523 * @brief Get the repetition value 00524 * @rmtoll RCR REP LL_LPTIM_GetRepetition 00525 * @param LPTIMx Low-Power Timer instance 00526 * @retval Repetition Value between Min_Data=0x00 and Max_Data=0xFF 00527 */ 00528 __STATIC_INLINE uint32_t LL_LPTIM_GetRepetition(LPTIM_TypeDef *LPTIMx) 00529 { 00530 return (uint32_t)(READ_BIT(LPTIMx->RCR, LPTIM_RCR_REP)); 00531 } 00532 #endif 00533 00534 /** 00535 * @brief Set the compare value 00536 * @note After a write to the LPTIMx_CMP register a new write operation to the 00537 * same register can only be performed when the previous write operation 00538 * is completed. Any successive write before the CMPOK flag is set, will 00539 * lead to unpredictable results. 00540 * @rmtoll CMP CMP LL_LPTIM_SetCompare 00541 * @param LPTIMx Low-Power Timer instance 00542 * @param CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF 00543 * @retval None 00544 */ 00545 __STATIC_INLINE void LL_LPTIM_SetCompare(LPTIM_TypeDef *LPTIMx, uint32_t CompareValue) 00546 { 00547 MODIFY_REG(LPTIMx->CMP, LPTIM_CMP_CMP, CompareValue); 00548 } 00549 00550 /** 00551 * @brief Get actual compare value 00552 * @rmtoll CMP CMP LL_LPTIM_GetCompare 00553 * @param LPTIMx Low-Power Timer instance 00554 * @retval CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF 00555 */ 00556 __STATIC_INLINE uint32_t LL_LPTIM_GetCompare(LPTIM_TypeDef *LPTIMx) 00557 { 00558 return (uint32_t)(READ_BIT(LPTIMx->CMP, LPTIM_CMP_CMP)); 00559 } 00560 00561 /** 00562 * @brief Get actual counter value 00563 * @note When the LPTIM instance is running with an asynchronous clock, reading 00564 * the LPTIMx_CNT register may return unreliable values. So in this case 00565 * it is necessary to perform two consecutive read accesses and verify 00566 * that the two returned values are identical. 00567 * @rmtoll CNT CNT LL_LPTIM_GetCounter 00568 * @param LPTIMx Low-Power Timer instance 00569 * @retval Counter value 00570 */ 00571 __STATIC_INLINE uint32_t LL_LPTIM_GetCounter(LPTIM_TypeDef *LPTIMx) 00572 { 00573 return (uint32_t)(READ_BIT(LPTIMx->CNT, LPTIM_CNT_CNT)); 00574 } 00575 00576 /** 00577 * @brief Set the counter mode (selection of the LPTIM counter clock source). 00578 * @note The counter mode can be set only when the LPTIM instance is disabled. 00579 * @rmtoll CFGR COUNTMODE LL_LPTIM_SetCounterMode 00580 * @param LPTIMx Low-Power Timer instance 00581 * @param CounterMode This parameter can be one of the following values: 00582 * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL 00583 * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL 00584 * @retval None 00585 */ 00586 __STATIC_INLINE void LL_LPTIM_SetCounterMode(LPTIM_TypeDef *LPTIMx, uint32_t CounterMode) 00587 { 00588 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE, CounterMode); 00589 } 00590 00591 /** 00592 * @brief Get the counter mode 00593 * @rmtoll CFGR COUNTMODE LL_LPTIM_GetCounterMode 00594 * @param LPTIMx Low-Power Timer instance 00595 * @retval Returned value can be one of the following values: 00596 * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL 00597 * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL 00598 */ 00599 __STATIC_INLINE uint32_t LL_LPTIM_GetCounterMode(LPTIM_TypeDef *LPTIMx) 00600 { 00601 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE)); 00602 } 00603 00604 /** 00605 * @brief Configure the LPTIM instance output (LPTIMx_OUT) 00606 * @note This function must be called when the LPTIM instance is disabled. 00607 * @note Regarding the LPTIM output polarity the change takes effect 00608 * immediately, so the output default value will change immediately after 00609 * the polarity is re-configured, even before the timer is enabled. 00610 * @rmtoll CFGR WAVE LL_LPTIM_ConfigOutput\n 00611 * CFGR WAVPOL LL_LPTIM_ConfigOutput 00612 * @param LPTIMx Low-Power Timer instance 00613 * @param Waveform This parameter can be one of the following values: 00614 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM 00615 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE 00616 * @param Polarity This parameter can be one of the following values: 00617 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR 00618 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE 00619 * @retval None 00620 */ 00621 __STATIC_INLINE void LL_LPTIM_ConfigOutput(LPTIM_TypeDef *LPTIMx, uint32_t Waveform, uint32_t Polarity) 00622 { 00623 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE | LPTIM_CFGR_WAVPOL, Waveform | Polarity); 00624 } 00625 00626 /** 00627 * @brief Set waveform shape 00628 * @rmtoll CFGR WAVE LL_LPTIM_SetWaveform 00629 * @param LPTIMx Low-Power Timer instance 00630 * @param Waveform This parameter can be one of the following values: 00631 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM 00632 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE 00633 * @retval None 00634 */ 00635 __STATIC_INLINE void LL_LPTIM_SetWaveform(LPTIM_TypeDef *LPTIMx, uint32_t Waveform) 00636 { 00637 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE, Waveform); 00638 } 00639 00640 /** 00641 * @brief Get actual waveform shape 00642 * @rmtoll CFGR WAVE LL_LPTIM_GetWaveform 00643 * @param LPTIMx Low-Power Timer instance 00644 * @retval Returned value can be one of the following values: 00645 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM 00646 * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE 00647 */ 00648 __STATIC_INLINE uint32_t LL_LPTIM_GetWaveform(LPTIM_TypeDef *LPTIMx) 00649 { 00650 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVE)); 00651 } 00652 00653 /** 00654 * @brief Set output polarity 00655 * @rmtoll CFGR WAVPOL LL_LPTIM_SetPolarity 00656 * @param LPTIMx Low-Power Timer instance 00657 * @param Polarity This parameter can be one of the following values: 00658 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR 00659 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE 00660 * @retval None 00661 */ 00662 __STATIC_INLINE void LL_LPTIM_SetPolarity(LPTIM_TypeDef *LPTIMx, uint32_t Polarity) 00663 { 00664 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL, Polarity); 00665 } 00666 00667 /** 00668 * @brief Get actual output polarity 00669 * @rmtoll CFGR WAVPOL LL_LPTIM_GetPolarity 00670 * @param LPTIMx Low-Power Timer instance 00671 * @retval Returned value can be one of the following values: 00672 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR 00673 * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE 00674 */ 00675 __STATIC_INLINE uint32_t LL_LPTIM_GetPolarity(LPTIM_TypeDef *LPTIMx) 00676 { 00677 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL)); 00678 } 00679 00680 /** 00681 * @brief Set actual prescaler division ratio. 00682 * @note This function must be called when the LPTIM instance is disabled. 00683 * @note When the LPTIM is configured to be clocked by an internal clock source 00684 * and the LPTIM counter is configured to be updated by active edges 00685 * detected on the LPTIM external Input1, the internal clock provided to 00686 * the LPTIM must be not be prescaled. 00687 * @rmtoll CFGR PRESC LL_LPTIM_SetPrescaler 00688 * @param LPTIMx Low-Power Timer instance 00689 * @param Prescaler This parameter can be one of the following values: 00690 * @arg @ref LL_LPTIM_PRESCALER_DIV1 00691 * @arg @ref LL_LPTIM_PRESCALER_DIV2 00692 * @arg @ref LL_LPTIM_PRESCALER_DIV4 00693 * @arg @ref LL_LPTIM_PRESCALER_DIV8 00694 * @arg @ref LL_LPTIM_PRESCALER_DIV16 00695 * @arg @ref LL_LPTIM_PRESCALER_DIV32 00696 * @arg @ref LL_LPTIM_PRESCALER_DIV64 00697 * @arg @ref LL_LPTIM_PRESCALER_DIV128 00698 * @retval None 00699 */ 00700 __STATIC_INLINE void LL_LPTIM_SetPrescaler(LPTIM_TypeDef *LPTIMx, uint32_t Prescaler) 00701 { 00702 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRESC, Prescaler); 00703 } 00704 00705 /** 00706 * @brief Get actual prescaler division ratio. 00707 * @rmtoll CFGR PRESC LL_LPTIM_GetPrescaler 00708 * @param LPTIMx Low-Power Timer instance 00709 * @retval Returned value can be one of the following values: 00710 * @arg @ref LL_LPTIM_PRESCALER_DIV1 00711 * @arg @ref LL_LPTIM_PRESCALER_DIV2 00712 * @arg @ref LL_LPTIM_PRESCALER_DIV4 00713 * @arg @ref LL_LPTIM_PRESCALER_DIV8 00714 * @arg @ref LL_LPTIM_PRESCALER_DIV16 00715 * @arg @ref LL_LPTIM_PRESCALER_DIV32 00716 * @arg @ref LL_LPTIM_PRESCALER_DIV64 00717 * @arg @ref LL_LPTIM_PRESCALER_DIV128 00718 */ 00719 __STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler(LPTIM_TypeDef *LPTIMx) 00720 { 00721 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRESC)); 00722 } 00723 00724 /** 00725 * @brief Set LPTIM input 1 source (default GPIO). 00726 * @rmtoll OR OR LL_LPTIM_SetInput1Src 00727 * @param LPTIMx Low-Power Timer instance 00728 * @param Src This parameter can be one of the following values: 00729 * @arg @ref LL_LPTIM_INPUT1_SRC_GPIO 00730 * @arg @ref LL_LPTIM_INPUT1_SRC_COMP1 00731 * @arg @ref LL_LPTIM_INPUT1_SRC_COMP2 00732 * @arg @ref LL_LPTIM_INPUT1_SRC_COMP1_COMP2 00733 * @retval None 00734 */ 00735 __STATIC_INLINE void LL_LPTIM_SetInput1Src(LPTIM_TypeDef *LPTIMx, uint32_t Src) 00736 { 00737 MODIFY_REG(LPTIMx->OR, LPTIM_OR_OR, Src); 00738 } 00739 00740 /** 00741 * @brief Set LPTIM input 2 source (default GPIO). 00742 * @rmtoll OR OR LL_LPTIM_SetInput2Src 00743 * @param LPTIMx Low-Power Timer instance 00744 * @param Src This parameter can be one of the following values: 00745 * @arg @ref LL_LPTIM_INPUT2_SRC_GPIO 00746 * @arg @ref LL_LPTIM_INPUT2_SRC_COMP2 00747 * @retval None 00748 */ 00749 __STATIC_INLINE void LL_LPTIM_SetInput2Src(LPTIM_TypeDef *LPTIMx, uint32_t Src) 00750 { 00751 MODIFY_REG(LPTIMx->OR, LPTIM_OR_OR, Src); 00752 } 00753 00754 /** 00755 * @} 00756 */ 00757 00758 /** @defgroup LPTIM_LL_EF_Trigger_Configuration Trigger Configuration 00759 * @{ 00760 */ 00761 00762 /** 00763 * @brief Enable the timeout function 00764 * @note This function must be called when the LPTIM instance is disabled. 00765 * @note The first trigger event will start the timer, any successive trigger 00766 * event will reset the counter and the timer will restart. 00767 * @note The timeout value corresponds to the compare value; if no trigger 00768 * occurs within the expected time frame, the MCU is waked-up by the 00769 * compare match event. 00770 * @rmtoll CFGR TIMOUT LL_LPTIM_EnableTimeout 00771 * @param LPTIMx Low-Power Timer instance 00772 * @retval None 00773 */ 00774 __STATIC_INLINE void LL_LPTIM_EnableTimeout(LPTIM_TypeDef *LPTIMx) 00775 { 00776 SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT); 00777 } 00778 00779 /** 00780 * @brief Disable the timeout function 00781 * @note This function must be called when the LPTIM instance is disabled. 00782 * @note A trigger event arriving when the timer is already started will be 00783 * ignored. 00784 * @rmtoll CFGR TIMOUT LL_LPTIM_DisableTimeout 00785 * @param LPTIMx Low-Power Timer instance 00786 * @retval None 00787 */ 00788 __STATIC_INLINE void LL_LPTIM_DisableTimeout(LPTIM_TypeDef *LPTIMx) 00789 { 00790 CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT); 00791 } 00792 00793 /** 00794 * @brief Indicate whether the timeout function is enabled. 00795 * @rmtoll CFGR TIMOUT LL_LPTIM_IsEnabledTimeout 00796 * @param LPTIMx Low-Power Timer instance 00797 * @retval State of bit (1 or 0). 00798 */ 00799 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledTimeout(LPTIM_TypeDef *LPTIMx) 00800 { 00801 return (((READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT) == LPTIM_CFGR_TIMOUT) ? 1UL : 0UL)); 00802 } 00803 00804 /** 00805 * @brief Start the LPTIM counter 00806 * @note This function must be called when the LPTIM instance is disabled. 00807 * @rmtoll CFGR TRIGEN LL_LPTIM_TrigSw 00808 * @param LPTIMx Low-Power Timer instance 00809 * @retval None 00810 */ 00811 __STATIC_INLINE void LL_LPTIM_TrigSw(LPTIM_TypeDef *LPTIMx) 00812 { 00813 CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN); 00814 } 00815 00816 /** 00817 * @brief Configure the external trigger used as a trigger event for the LPTIM. 00818 * @note This function must be called when the LPTIM instance is disabled. 00819 * @note An internal clock source must be present when a digital filter is 00820 * required for the trigger. 00821 * @rmtoll CFGR TRIGSEL LL_LPTIM_ConfigTrigger\n 00822 * CFGR TRGFLT LL_LPTIM_ConfigTrigger\n 00823 * CFGR TRIGEN LL_LPTIM_ConfigTrigger 00824 * @param LPTIMx Low-Power Timer instance 00825 * @param Source This parameter can be one of the following values: 00826 * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO 00827 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA 00828 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB 00829 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1 00830 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP2 00831 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP3 00832 * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP1 00833 * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP2 00834 * @param Filter This parameter can be one of the following values: 00835 * @arg @ref LL_LPTIM_TRIG_FILTER_NONE 00836 * @arg @ref LL_LPTIM_TRIG_FILTER_2 00837 * @arg @ref LL_LPTIM_TRIG_FILTER_4 00838 * @arg @ref LL_LPTIM_TRIG_FILTER_8 00839 * @param Polarity This parameter can be one of the following values: 00840 * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING 00841 * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING 00842 * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING 00843 * @retval None 00844 */ 00845 __STATIC_INLINE void LL_LPTIM_ConfigTrigger(LPTIM_TypeDef *LPTIMx, uint32_t Source, uint32_t Filter, uint32_t Polarity) 00846 { 00847 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL | LPTIM_CFGR_TRGFLT | LPTIM_CFGR_TRIGEN, Source | Filter | Polarity); 00848 } 00849 00850 /** 00851 * @brief Get actual external trigger source. 00852 * @rmtoll CFGR TRIGSEL LL_LPTIM_GetTriggerSource 00853 * @param LPTIMx Low-Power Timer instance 00854 * @retval Returned value can be one of the following values: 00855 * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO 00856 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA 00857 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB 00858 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1 00859 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP2 00860 * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP3 00861 * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP1 00862 * @arg @ref LL_LPTIM_TRIG_SOURCE_COMP2 00863 */ 00864 __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerSource(LPTIM_TypeDef *LPTIMx) 00865 { 00866 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL)); 00867 } 00868 00869 /** 00870 * @brief Get actual external trigger filter. 00871 * @rmtoll CFGR TRGFLT LL_LPTIM_GetTriggerFilter 00872 * @param LPTIMx Low-Power Timer instance 00873 * @retval Returned value can be one of the following values: 00874 * @arg @ref LL_LPTIM_TRIG_FILTER_NONE 00875 * @arg @ref LL_LPTIM_TRIG_FILTER_2 00876 * @arg @ref LL_LPTIM_TRIG_FILTER_4 00877 * @arg @ref LL_LPTIM_TRIG_FILTER_8 00878 */ 00879 __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerFilter(LPTIM_TypeDef *LPTIMx) 00880 { 00881 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRGFLT)); 00882 } 00883 00884 /** 00885 * @brief Get actual external trigger polarity. 00886 * @rmtoll CFGR TRIGEN LL_LPTIM_GetTriggerPolarity 00887 * @param LPTIMx Low-Power Timer instance 00888 * @retval Returned value can be one of the following values: 00889 * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING 00890 * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING 00891 * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING 00892 */ 00893 __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerPolarity(LPTIM_TypeDef *LPTIMx) 00894 { 00895 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN)); 00896 } 00897 00898 /** 00899 * @} 00900 */ 00901 00902 /** @defgroup LPTIM_LL_EF_Clock_Configuration Clock Configuration 00903 * @{ 00904 */ 00905 00906 /** 00907 * @brief Set the source of the clock used by the LPTIM instance. 00908 * @note This function must be called when the LPTIM instance is disabled. 00909 * @rmtoll CFGR CKSEL LL_LPTIM_SetClockSource 00910 * @param LPTIMx Low-Power Timer instance 00911 * @param ClockSource This parameter can be one of the following values: 00912 * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL 00913 * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL 00914 * @retval None 00915 */ 00916 __STATIC_INLINE void LL_LPTIM_SetClockSource(LPTIM_TypeDef *LPTIMx, uint32_t ClockSource) 00917 { 00918 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKSEL, ClockSource); 00919 } 00920 00921 /** 00922 * @brief Get actual LPTIM instance clock source. 00923 * @rmtoll CFGR CKSEL LL_LPTIM_GetClockSource 00924 * @param LPTIMx Low-Power Timer instance 00925 * @retval Returned value can be one of the following values: 00926 * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL 00927 * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL 00928 */ 00929 __STATIC_INLINE uint32_t LL_LPTIM_GetClockSource(LPTIM_TypeDef *LPTIMx) 00930 { 00931 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKSEL)); 00932 } 00933 00934 /** 00935 * @brief Configure the active edge or edges used by the counter when 00936 the LPTIM is clocked by an external clock source. 00937 * @note This function must be called when the LPTIM instance is disabled. 00938 * @note When both external clock signal edges are considered active ones, 00939 * the LPTIM must also be clocked by an internal clock source with a 00940 * frequency equal to at least four times the external clock frequency. 00941 * @note An internal clock source must be present when a digital filter is 00942 * required for external clock. 00943 * @rmtoll CFGR CKFLT LL_LPTIM_ConfigClock\n 00944 * CFGR CKPOL LL_LPTIM_ConfigClock 00945 * @param LPTIMx Low-Power Timer instance 00946 * @param ClockFilter This parameter can be one of the following values: 00947 * @arg @ref LL_LPTIM_CLK_FILTER_NONE 00948 * @arg @ref LL_LPTIM_CLK_FILTER_2 00949 * @arg @ref LL_LPTIM_CLK_FILTER_4 00950 * @arg @ref LL_LPTIM_CLK_FILTER_8 00951 * @param ClockPolarity This parameter can be one of the following values: 00952 * @arg @ref LL_LPTIM_CLK_POLARITY_RISING 00953 * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING 00954 * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING 00955 * @retval None 00956 */ 00957 __STATIC_INLINE void LL_LPTIM_ConfigClock(LPTIM_TypeDef *LPTIMx, uint32_t ClockFilter, uint32_t ClockPolarity) 00958 { 00959 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKFLT | LPTIM_CFGR_CKPOL, ClockFilter | ClockPolarity); 00960 } 00961 00962 /** 00963 * @brief Get actual clock polarity 00964 * @rmtoll CFGR CKPOL LL_LPTIM_GetClockPolarity 00965 * @param LPTIMx Low-Power Timer instance 00966 * @retval Returned value can be one of the following values: 00967 * @arg @ref LL_LPTIM_CLK_POLARITY_RISING 00968 * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING 00969 * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING 00970 */ 00971 __STATIC_INLINE uint32_t LL_LPTIM_GetClockPolarity(LPTIM_TypeDef *LPTIMx) 00972 { 00973 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL)); 00974 } 00975 00976 /** 00977 * @brief Get actual clock digital filter 00978 * @rmtoll CFGR CKFLT LL_LPTIM_GetClockFilter 00979 * @param LPTIMx Low-Power Timer instance 00980 * @retval Returned value can be one of the following values: 00981 * @arg @ref LL_LPTIM_CLK_FILTER_NONE 00982 * @arg @ref LL_LPTIM_CLK_FILTER_2 00983 * @arg @ref LL_LPTIM_CLK_FILTER_4 00984 * @arg @ref LL_LPTIM_CLK_FILTER_8 00985 */ 00986 __STATIC_INLINE uint32_t LL_LPTIM_GetClockFilter(LPTIM_TypeDef *LPTIMx) 00987 { 00988 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKFLT)); 00989 } 00990 00991 /** 00992 * @} 00993 */ 00994 00995 /** @defgroup LPTIM_LL_EF_Encoder_Mode Encoder Mode 00996 * @{ 00997 */ 00998 00999 /** 01000 * @brief Configure the encoder mode. 01001 * @note This function must be called when the LPTIM instance is disabled. 01002 * @rmtoll CFGR CKPOL LL_LPTIM_SetEncoderMode 01003 * @param LPTIMx Low-Power Timer instance 01004 * @param EncoderMode This parameter can be one of the following values: 01005 * @arg @ref LL_LPTIM_ENCODER_MODE_RISING 01006 * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING 01007 * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING 01008 * @retval None 01009 */ 01010 __STATIC_INLINE void LL_LPTIM_SetEncoderMode(LPTIM_TypeDef *LPTIMx, uint32_t EncoderMode) 01011 { 01012 MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKPOL, EncoderMode); 01013 } 01014 01015 /** 01016 * @brief Get actual encoder mode. 01017 * @rmtoll CFGR CKPOL LL_LPTIM_GetEncoderMode 01018 * @param LPTIMx Low-Power Timer instance 01019 * @retval Returned value can be one of the following values: 01020 * @arg @ref LL_LPTIM_ENCODER_MODE_RISING 01021 * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING 01022 * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING 01023 */ 01024 __STATIC_INLINE uint32_t LL_LPTIM_GetEncoderMode(LPTIM_TypeDef *LPTIMx) 01025 { 01026 return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL)); 01027 } 01028 01029 /** 01030 * @brief Enable the encoder mode 01031 * @note This function must be called when the LPTIM instance is disabled. 01032 * @note In this mode the LPTIM instance must be clocked by an internal clock 01033 * source. Also, the prescaler division ratio must be equal to 1. 01034 * @note LPTIM instance must be configured in continuous mode prior enabling 01035 * the encoder mode. 01036 * @rmtoll CFGR ENC LL_LPTIM_EnableEncoderMode 01037 * @param LPTIMx Low-Power Timer instance 01038 * @retval None 01039 */ 01040 __STATIC_INLINE void LL_LPTIM_EnableEncoderMode(LPTIM_TypeDef *LPTIMx) 01041 { 01042 SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC); 01043 } 01044 01045 /** 01046 * @brief Disable the encoder mode 01047 * @note This function must be called when the LPTIM instance is disabled. 01048 * @rmtoll CFGR ENC LL_LPTIM_DisableEncoderMode 01049 * @param LPTIMx Low-Power Timer instance 01050 * @retval None 01051 */ 01052 __STATIC_INLINE void LL_LPTIM_DisableEncoderMode(LPTIM_TypeDef *LPTIMx) 01053 { 01054 CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC); 01055 } 01056 01057 /** 01058 * @brief Indicates whether the LPTIM operates in encoder mode. 01059 * @rmtoll CFGR ENC LL_LPTIM_IsEnabledEncoderMode 01060 * @param LPTIMx Low-Power Timer instance 01061 * @retval State of bit (1 or 0). 01062 */ 01063 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledEncoderMode(LPTIM_TypeDef *LPTIMx) 01064 { 01065 return (((READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC) == LPTIM_CFGR_ENC) ? 1UL : 0UL)); 01066 } 01067 01068 /** 01069 * @} 01070 */ 01071 01072 /** @defgroup LPTIM_LL_EF_FLAG_Management FLAG Management 01073 * @{ 01074 */ 01075 01076 /** 01077 * @brief Clear the compare match flag (CMPMCF) 01078 * @rmtoll ICR CMPMCF LL_LPTIM_ClearFLAG_CMPM 01079 * @param LPTIMx Low-Power Timer instance 01080 * @retval None 01081 */ 01082 __STATIC_INLINE void LL_LPTIM_ClearFLAG_CMPM(LPTIM_TypeDef *LPTIMx) 01083 { 01084 SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPMCF); 01085 } 01086 01087 /** 01088 * @brief Inform application whether a compare match interrupt has occurred. 01089 * @rmtoll ISR CMPM LL_LPTIM_IsActiveFlag_CMPM 01090 * @param LPTIMx Low-Power Timer instance 01091 * @retval State of bit (1 or 0). 01092 */ 01093 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPM(LPTIM_TypeDef *LPTIMx) 01094 { 01095 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPM) == LPTIM_ISR_CMPM) ? 1UL : 0UL)); 01096 } 01097 01098 /** 01099 * @brief Clear the autoreload match flag (ARRMCF) 01100 * @rmtoll ICR ARRMCF LL_LPTIM_ClearFLAG_ARRM 01101 * @param LPTIMx Low-Power Timer instance 01102 * @retval None 01103 */ 01104 __STATIC_INLINE void LL_LPTIM_ClearFLAG_ARRM(LPTIM_TypeDef *LPTIMx) 01105 { 01106 SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARRMCF); 01107 } 01108 01109 /** 01110 * @brief Inform application whether a autoreload match interrupt has occurred. 01111 * @rmtoll ISR ARRM LL_LPTIM_IsActiveFlag_ARRM 01112 * @param LPTIMx Low-Power Timer instance 01113 * @retval State of bit (1 or 0). 01114 */ 01115 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARRM(LPTIM_TypeDef *LPTIMx) 01116 { 01117 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARRM) == LPTIM_ISR_ARRM) ? 1UL : 0UL)); 01118 } 01119 01120 /** 01121 * @brief Clear the external trigger valid edge flag(EXTTRIGCF). 01122 * @rmtoll ICR EXTTRIGCF LL_LPTIM_ClearFlag_EXTTRIG 01123 * @param LPTIMx Low-Power Timer instance 01124 * @retval None 01125 */ 01126 __STATIC_INLINE void LL_LPTIM_ClearFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx) 01127 { 01128 SET_BIT(LPTIMx->ICR, LPTIM_ICR_EXTTRIGCF); 01129 } 01130 01131 /** 01132 * @brief Inform application whether a valid edge on the selected external trigger input has occurred. 01133 * @rmtoll ISR EXTTRIG LL_LPTIM_IsActiveFlag_EXTTRIG 01134 * @param LPTIMx Low-Power Timer instance 01135 * @retval State of bit (1 or 0). 01136 */ 01137 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx) 01138 { 01139 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_EXTTRIG) == LPTIM_ISR_EXTTRIG) ? 1UL : 0UL)); 01140 } 01141 01142 /** 01143 * @brief Clear the compare register update interrupt flag (CMPOKCF). 01144 * @rmtoll ICR CMPOKCF LL_LPTIM_ClearFlag_CMPOK 01145 * @param LPTIMx Low-Power Timer instance 01146 * @retval None 01147 */ 01148 __STATIC_INLINE void LL_LPTIM_ClearFlag_CMPOK(LPTIM_TypeDef *LPTIMx) 01149 { 01150 SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPOKCF); 01151 } 01152 01153 /** 01154 * @brief Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfully 01155 completed. If so, a new one can be initiated. 01156 * @rmtoll ISR CMPOK LL_LPTIM_IsActiveFlag_CMPOK 01157 * @param LPTIMx Low-Power Timer instance 01158 * @retval State of bit (1 or 0). 01159 */ 01160 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPOK(LPTIM_TypeDef *LPTIMx) 01161 { 01162 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPOK) == LPTIM_ISR_CMPOK) ? 1UL : 0UL)); 01163 } 01164 01165 /** 01166 * @brief Clear the autoreload register update interrupt flag (ARROKCF). 01167 * @rmtoll ICR ARROKCF LL_LPTIM_ClearFlag_ARROK 01168 * @param LPTIMx Low-Power Timer instance 01169 * @retval None 01170 */ 01171 __STATIC_INLINE void LL_LPTIM_ClearFlag_ARROK(LPTIM_TypeDef *LPTIMx) 01172 { 01173 SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARROKCF); 01174 } 01175 01176 /** 01177 * @brief Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfully 01178 completed. If so, a new one can be initiated. 01179 * @rmtoll ISR ARROK LL_LPTIM_IsActiveFlag_ARROK 01180 * @param LPTIMx Low-Power Timer instance 01181 * @retval State of bit (1 or 0). 01182 */ 01183 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARROK(LPTIM_TypeDef *LPTIMx) 01184 { 01185 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARROK) == LPTIM_ISR_ARROK) ? 1UL : 0UL)); 01186 } 01187 01188 /** 01189 * @brief Clear the counter direction change to up interrupt flag (UPCF). 01190 * @rmtoll ICR UPCF LL_LPTIM_ClearFlag_UP 01191 * @param LPTIMx Low-Power Timer instance 01192 * @retval None 01193 */ 01194 __STATIC_INLINE void LL_LPTIM_ClearFlag_UP(LPTIM_TypeDef *LPTIMx) 01195 { 01196 SET_BIT(LPTIMx->ICR, LPTIM_ICR_UPCF); 01197 } 01198 01199 /** 01200 * @brief Informs the application whether the counter direction has changed from down to up (when the LPTIM instance 01201 operates in encoder mode). 01202 * @rmtoll ISR UP LL_LPTIM_IsActiveFlag_UP 01203 * @param LPTIMx Low-Power Timer instance 01204 * @retval State of bit (1 or 0). 01205 */ 01206 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_UP(LPTIM_TypeDef *LPTIMx) 01207 { 01208 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_UP) == LPTIM_ISR_UP) ? 1UL : 0UL)); 01209 } 01210 01211 /** 01212 * @brief Clear the counter direction change to down interrupt flag (DOWNCF). 01213 * @rmtoll ICR DOWNCF LL_LPTIM_ClearFlag_DOWN 01214 * @param LPTIMx Low-Power Timer instance 01215 * @retval None 01216 */ 01217 __STATIC_INLINE void LL_LPTIM_ClearFlag_DOWN(LPTIM_TypeDef *LPTIMx) 01218 { 01219 SET_BIT(LPTIMx->ICR, LPTIM_ICR_DOWNCF); 01220 } 01221 01222 /** 01223 * @brief Informs the application whether the counter direction has changed from up to down (when the LPTIM instance 01224 operates in encoder mode). 01225 * @rmtoll ISR DOWN LL_LPTIM_IsActiveFlag_DOWN 01226 * @param LPTIMx Low-Power Timer instance 01227 * @retval State of bit (1 or 0). 01228 */ 01229 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_DOWN(LPTIM_TypeDef *LPTIMx) 01230 { 01231 return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_DOWN) == LPTIM_ISR_DOWN) ? 1UL : 0UL)); 01232 } 01233 01234 #if defined(LPTIM_RCR_REP) 01235 /** 01236 * @brief Clear the repetition register update interrupt flag (REPOKCF). 01237 * @rmtoll ICR REPOKCF LL_LPTIM_ClearFlag_REPOK 01238 * @param LPTIMx Low-Power Timer instance 01239 * @retval None 01240 */ 01241 __STATIC_INLINE void LL_LPTIM_ClearFlag_REPOK(LPTIM_TypeDef *LPTIMx) 01242 { 01243 SET_BIT(LPTIMx->ICR, LPTIM_ICR_REPOKCF); 01244 } 01245 01246 /** 01247 * @brief Informs application whether the APB bus write operation to the LPTIMx_RCR register has been successfully 01248 completed; If so, a new one can be initiated. 01249 * @rmtoll ISR REPOK LL_LPTIM_IsActiveFlag_REPOK 01250 * @param LPTIMx Low-Power Timer instance 01251 * @retval State of bit (1 or 0). 01252 */ 01253 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_REPOK(LPTIM_TypeDef *LPTIMx) 01254 { 01255 return ((READ_BIT(LPTIMx->ISR, LPTIM_ISR_REPOK) == (LPTIM_ISR_REPOK)) ? 1UL : 0UL); 01256 } 01257 01258 /** 01259 * @brief Clear the update event flag (UECF). 01260 * @rmtoll ICR UECF LL_LPTIM_ClearFlag_UE 01261 * @param LPTIMx Low-Power Timer instance 01262 * @retval None 01263 */ 01264 __STATIC_INLINE void LL_LPTIM_ClearFlag_UE(LPTIM_TypeDef *LPTIMx) 01265 { 01266 SET_BIT(LPTIMx->ICR, LPTIM_ICR_UECF); 01267 } 01268 01269 /** 01270 * @brief Informs application whether the LPTIMx update event has occurred. 01271 * @rmtoll ISR UE LL_LPTIM_IsActiveFlag_UE 01272 * @param LPTIMx Low-Power Timer instance 01273 * @retval State of bit (1 or 0). 01274 */ 01275 __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_UE(LPTIM_TypeDef *LPTIMx) 01276 { 01277 return ((READ_BIT(LPTIMx->ISR, LPTIM_ISR_UE) == (LPTIM_ISR_UE)) ? 1UL : 0UL); 01278 } 01279 #endif 01280 01281 /** 01282 * @} 01283 */ 01284 01285 /** @defgroup LPTIM_LL_EF_IT_Management Interrupt Management 01286 * @{ 01287 */ 01288 01289 /** 01290 * @brief Enable compare match interrupt (CMPMIE). 01291 * @rmtoll IER CMPMIE LL_LPTIM_EnableIT_CMPM 01292 * @param LPTIMx Low-Power Timer instance 01293 * @retval None 01294 */ 01295 __STATIC_INLINE void LL_LPTIM_EnableIT_CMPM(LPTIM_TypeDef *LPTIMx) 01296 { 01297 SET_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE); 01298 } 01299 01300 /** 01301 * @brief Disable compare match interrupt (CMPMIE). 01302 * @rmtoll IER CMPMIE LL_LPTIM_DisableIT_CMPM 01303 * @param LPTIMx Low-Power Timer instance 01304 * @retval None 01305 */ 01306 __STATIC_INLINE void LL_LPTIM_DisableIT_CMPM(LPTIM_TypeDef *LPTIMx) 01307 { 01308 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE); 01309 } 01310 01311 /** 01312 * @brief Indicates whether the compare match interrupt (CMPMIE) is enabled. 01313 * @rmtoll IER CMPMIE LL_LPTIM_IsEnabledIT_CMPM 01314 * @param LPTIMx Low-Power Timer instance 01315 * @retval State of bit (1 or 0). 01316 */ 01317 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPM(LPTIM_TypeDef *LPTIMx) 01318 { 01319 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE) == LPTIM_IER_CMPMIE) ? 1UL : 0UL)); 01320 } 01321 01322 /** 01323 * @brief Enable autoreload match interrupt (ARRMIE). 01324 * @rmtoll IER ARRMIE LL_LPTIM_EnableIT_ARRM 01325 * @param LPTIMx Low-Power Timer instance 01326 * @retval None 01327 */ 01328 __STATIC_INLINE void LL_LPTIM_EnableIT_ARRM(LPTIM_TypeDef *LPTIMx) 01329 { 01330 SET_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE); 01331 } 01332 01333 /** 01334 * @brief Disable autoreload match interrupt (ARRMIE). 01335 * @rmtoll IER ARRMIE LL_LPTIM_DisableIT_ARRM 01336 * @param LPTIMx Low-Power Timer instance 01337 * @retval None 01338 */ 01339 __STATIC_INLINE void LL_LPTIM_DisableIT_ARRM(LPTIM_TypeDef *LPTIMx) 01340 { 01341 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE); 01342 } 01343 01344 /** 01345 * @brief Indicates whether the autoreload match interrupt (ARRMIE) is enabled. 01346 * @rmtoll IER ARRMIE LL_LPTIM_IsEnabledIT_ARRM 01347 * @param LPTIMx Low-Power Timer instance 01348 * @retval State of bit (1 or 0). 01349 */ 01350 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARRM(LPTIM_TypeDef *LPTIMx) 01351 { 01352 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE) == LPTIM_IER_ARRMIE) ? 1UL : 0UL)); 01353 } 01354 01355 /** 01356 * @brief Enable external trigger valid edge interrupt (EXTTRIGIE). 01357 * @rmtoll IER EXTTRIGIE LL_LPTIM_EnableIT_EXTTRIG 01358 * @param LPTIMx Low-Power Timer instance 01359 * @retval None 01360 */ 01361 __STATIC_INLINE void LL_LPTIM_EnableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) 01362 { 01363 SET_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE); 01364 } 01365 01366 /** 01367 * @brief Disable external trigger valid edge interrupt (EXTTRIGIE). 01368 * @rmtoll IER EXTTRIGIE LL_LPTIM_DisableIT_EXTTRIG 01369 * @param LPTIMx Low-Power Timer instance 01370 * @retval None 01371 */ 01372 __STATIC_INLINE void LL_LPTIM_DisableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) 01373 { 01374 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE); 01375 } 01376 01377 /** 01378 * @brief Indicates external trigger valid edge interrupt (EXTTRIGIE) is enabled. 01379 * @rmtoll IER EXTTRIGIE LL_LPTIM_IsEnabledIT_EXTTRIG 01380 * @param LPTIMx Low-Power Timer instance 01381 * @retval State of bit (1 or 0). 01382 */ 01383 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_EXTTRIG(LPTIM_TypeDef *LPTIMx) 01384 { 01385 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE) == LPTIM_IER_EXTTRIGIE) ? 1UL : 0UL)); 01386 } 01387 01388 /** 01389 * @brief Enable compare register write completed interrupt (CMPOKIE). 01390 * @rmtoll IER CMPOKIE LL_LPTIM_EnableIT_CMPOK 01391 * @param LPTIMx Low-Power Timer instance 01392 * @retval None 01393 */ 01394 __STATIC_INLINE void LL_LPTIM_EnableIT_CMPOK(LPTIM_TypeDef *LPTIMx) 01395 { 01396 SET_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE); 01397 } 01398 01399 /** 01400 * @brief Disable compare register write completed interrupt (CMPOKIE). 01401 * @rmtoll IER CMPOKIE LL_LPTIM_DisableIT_CMPOK 01402 * @param LPTIMx Low-Power Timer instance 01403 * @retval None 01404 */ 01405 __STATIC_INLINE void LL_LPTIM_DisableIT_CMPOK(LPTIM_TypeDef *LPTIMx) 01406 { 01407 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE); 01408 } 01409 01410 /** 01411 * @brief Indicates whether the compare register write completed interrupt (CMPOKIE) is enabled. 01412 * @rmtoll IER CMPOKIE LL_LPTIM_IsEnabledIT_CMPOK 01413 * @param LPTIMx Low-Power Timer instance 01414 * @retval State of bit (1 or 0). 01415 */ 01416 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPOK(LPTIM_TypeDef *LPTIMx) 01417 { 01418 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE) == LPTIM_IER_CMPOKIE) ? 1UL : 0UL)); 01419 } 01420 01421 /** 01422 * @brief Enable autoreload register write completed interrupt (ARROKIE). 01423 * @rmtoll IER ARROKIE LL_LPTIM_EnableIT_ARROK 01424 * @param LPTIMx Low-Power Timer instance 01425 * @retval None 01426 */ 01427 __STATIC_INLINE void LL_LPTIM_EnableIT_ARROK(LPTIM_TypeDef *LPTIMx) 01428 { 01429 SET_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE); 01430 } 01431 01432 /** 01433 * @brief Disable autoreload register write completed interrupt (ARROKIE). 01434 * @rmtoll IER ARROKIE LL_LPTIM_DisableIT_ARROK 01435 * @param LPTIMx Low-Power Timer instance 01436 * @retval None 01437 */ 01438 __STATIC_INLINE void LL_LPTIM_DisableIT_ARROK(LPTIM_TypeDef *LPTIMx) 01439 { 01440 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE); 01441 } 01442 01443 /** 01444 * @brief Indicates whether the autoreload register write completed interrupt (ARROKIE) is enabled. 01445 * @rmtoll IER ARROKIE LL_LPTIM_IsEnabledIT_ARROK 01446 * @param LPTIMx Low-Power Timer instance 01447 * @retval State of bit(1 or 0). 01448 */ 01449 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARROK(LPTIM_TypeDef *LPTIMx) 01450 { 01451 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE) == LPTIM_IER_ARROKIE) ? 1UL : 0UL)); 01452 } 01453 01454 /** 01455 * @brief Enable direction change to up interrupt (UPIE). 01456 * @rmtoll IER UPIE LL_LPTIM_EnableIT_UP 01457 * @param LPTIMx Low-Power Timer instance 01458 * @retval None 01459 */ 01460 __STATIC_INLINE void LL_LPTIM_EnableIT_UP(LPTIM_TypeDef *LPTIMx) 01461 { 01462 SET_BIT(LPTIMx->IER, LPTIM_IER_UPIE); 01463 } 01464 01465 /** 01466 * @brief Disable direction change to up interrupt (UPIE). 01467 * @rmtoll IER UPIE LL_LPTIM_DisableIT_UP 01468 * @param LPTIMx Low-Power Timer instance 01469 * @retval None 01470 */ 01471 __STATIC_INLINE void LL_LPTIM_DisableIT_UP(LPTIM_TypeDef *LPTIMx) 01472 { 01473 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_UPIE); 01474 } 01475 01476 /** 01477 * @brief Indicates whether the direction change to up interrupt (UPIE) is enabled. 01478 * @rmtoll IER UPIE LL_LPTIM_IsEnabledIT_UP 01479 * @param LPTIMx Low-Power Timer instance 01480 * @retval State of bit(1 or 0). 01481 */ 01482 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_UP(LPTIM_TypeDef *LPTIMx) 01483 { 01484 return (((READ_BIT(LPTIMx->IER, LPTIM_IER_UPIE) == LPTIM_IER_UPIE) ? 1UL : 0UL)); 01485 } 01486 01487 /** 01488 * @brief Enable direction change to down interrupt (DOWNIE). 01489 * @rmtoll IER DOWNIE LL_LPTIM_EnableIT_DOWN 01490 * @param LPTIMx Low-Power Timer instance 01491 * @retval None 01492 */ 01493 __STATIC_INLINE void LL_LPTIM_EnableIT_DOWN(LPTIM_TypeDef *LPTIMx) 01494 { 01495 SET_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE); 01496 } 01497 01498 /** 01499 * @brief Disable direction change to down interrupt (DOWNIE). 01500 * @rmtoll IER DOWNIE LL_LPTIM_DisableIT_DOWN 01501 * @param LPTIMx Low-Power Timer instance 01502 * @retval None 01503 */ 01504 __STATIC_INLINE void LL_LPTIM_DisableIT_DOWN(LPTIM_TypeDef *LPTIMx) 01505 { 01506 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE); 01507 } 01508 01509 /** 01510 * @brief Indicates whether the direction change to down interrupt (DOWNIE) is enabled. 01511 * @rmtoll IER DOWNIE LL_LPTIM_IsEnabledIT_DOWN 01512 * @param LPTIMx Low-Power Timer instance 01513 * @retval State of bit(1 or 0). 01514 */ 01515 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_DOWN(LPTIM_TypeDef *LPTIMx) 01516 { 01517 return ((READ_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE) == LPTIM_IER_DOWNIE) ? 1UL : 0UL); 01518 } 01519 01520 #if defined(LPTIM_RCR_REP) 01521 /** 01522 * @brief Enable repetition register update successfully completed interrupt (REPOKIE). 01523 * @rmtoll IER REPOKIE LL_LPTIM_EnableIT_REPOK 01524 * @param LPTIMx Low-Power Timer instance 01525 * @retval None 01526 */ 01527 __STATIC_INLINE void LL_LPTIM_EnableIT_REPOK(LPTIM_TypeDef *LPTIMx) 01528 { 01529 SET_BIT(LPTIMx->IER, LPTIM_IER_REPOKIE); 01530 } 01531 01532 /** 01533 * @brief Disable repetition register update successfully completed interrupt (REPOKIE). 01534 * @rmtoll IER REPOKIE LL_LPTIM_DisableIT_REPOK 01535 * @param LPTIMx Low-Power Timer instance 01536 * @retval None 01537 */ 01538 __STATIC_INLINE void LL_LPTIM_DisableIT_REPOK(LPTIM_TypeDef *LPTIMx) 01539 { 01540 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_REPOKIE); 01541 } 01542 01543 /** 01544 * @brief Indicates whether the repetition register update successfully completed interrupt (REPOKIE) is enabled. 01545 * @rmtoll IER REPOKIE LL_LPTIM_IsEnabledIT_REPOK 01546 * @param LPTIMx Low-Power Timer instance 01547 * @retval State of bit(1 or 0). 01548 */ 01549 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_REPOK(LPTIM_TypeDef *LPTIMx) 01550 { 01551 return ((READ_BIT(LPTIMx->IER, LPTIM_IER_REPOKIE) == (LPTIM_IER_REPOKIE)) ? 1UL : 0UL); 01552 } 01553 01554 /** 01555 * @brief Enable update event interrupt (UEIE). 01556 * @rmtoll IER UEIE LL_LPTIM_EnableIT_UE 01557 * @param LPTIMx Low-Power Timer instance 01558 * @retval None 01559 */ 01560 __STATIC_INLINE void LL_LPTIM_EnableIT_UE(LPTIM_TypeDef *LPTIMx) 01561 { 01562 SET_BIT(LPTIMx->IER, LPTIM_IER_UEIE); 01563 } 01564 01565 /** 01566 * @brief Disable update event interrupt (UEIE). 01567 * @rmtoll IER UEIE LL_LPTIM_DisableIT_UE 01568 * @param LPTIMx Low-Power Timer instance 01569 * @retval None 01570 */ 01571 __STATIC_INLINE void LL_LPTIM_DisableIT_UE(LPTIM_TypeDef *LPTIMx) 01572 { 01573 CLEAR_BIT(LPTIMx->IER, LPTIM_IER_UEIE); 01574 } 01575 01576 /** 01577 * @brief Indicates whether the update event interrupt (UEIE) is enabled. 01578 * @rmtoll IER UEIE LL_LPTIM_IsEnabledIT_UE 01579 * @param LPTIMx Low-Power Timer instance 01580 *@ retval State of bit(1 or 0). 01581 */ 01582 __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_UE(LPTIM_TypeDef *LPTIMx) 01583 { 01584 return ((READ_BIT(LPTIMx->IER, LPTIM_IER_UEIE) == (LPTIM_IER_UEIE)) ? 1UL : 0UL); 01585 } 01586 #endif 01587 /** 01588 * @} 01589 */ 01590 01591 /** 01592 * @} 01593 */ 01594 01595 /** 01596 * @} 01597 */ 01598 01599 #endif /* LPTIM1 || LPTIM2 */ 01600 01601 /** 01602 * @} 01603 */ 01604 01605 #ifdef __cplusplus 01606 } 01607 #endif 01608 01609 #endif /* STM32L4xx_LL_LPTIM_H */