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