stm32f4xx_ll_lptim.h 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_ll_lptim.h
  4. * @author MCD Application Team
  5. * @brief Header file of LPTIM LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32F4xx_LL_LPTIM_H
  21. #define STM32F4xx_LL_LPTIM_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f4xx.h"
  27. /** @addtogroup STM32F4xx_LL_Driver
  28. * @{
  29. */
  30. #if defined (LPTIM1)
  31. /** @defgroup LPTIM_LL LPTIM
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. #if defined(USE_FULL_LL_DRIVER)
  39. /** @defgroup LPTIM_LL_Private_Macros LPTIM Private Macros
  40. * @{
  41. */
  42. /**
  43. * @}
  44. */
  45. #endif /*USE_FULL_LL_DRIVER*/
  46. /* Exported types ------------------------------------------------------------*/
  47. #if defined(USE_FULL_LL_DRIVER)
  48. /** @defgroup LPTIM_LL_ES_INIT LPTIM Exported Init structure
  49. * @{
  50. */
  51. /**
  52. * @brief LPTIM Init structure definition
  53. */
  54. typedef struct
  55. {
  56. uint32_t ClockSource; /*!< Specifies the source of the clock used by the LPTIM instance.
  57. This parameter can be a value of @ref LPTIM_LL_EC_CLK_SOURCE.
  58. This feature can be modified afterwards using unitary function @ref LL_LPTIM_SetClockSource().*/
  59. uint32_t Prescaler; /*!< Specifies the prescaler division ratio.
  60. This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER.
  61. This feature can be modified afterwards using using unitary function @ref LL_LPTIM_SetPrescaler().*/
  62. uint32_t Waveform; /*!< Specifies the waveform shape.
  63. This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_WAVEFORM.
  64. This feature can be modified afterwards using unitary function @ref LL_LPTIM_ConfigOutput().*/
  65. uint32_t Polarity; /*!< Specifies waveform polarity.
  66. This parameter can be a value of @ref LPTIM_LL_EC_OUTPUT_POLARITY.
  67. This feature can be modified afterwards using unitary function @ref LL_LPTIM_ConfigOutput().*/
  68. } LL_LPTIM_InitTypeDef;
  69. /**
  70. * @}
  71. */
  72. #endif /* USE_FULL_LL_DRIVER */
  73. /* Exported constants --------------------------------------------------------*/
  74. /** @defgroup LPTIM_LL_Exported_Constants LPTIM Exported Constants
  75. * @{
  76. */
  77. /** @defgroup LPTIM_LL_EC_GET_FLAG Get Flags Defines
  78. * @brief Flags defines which can be used with LL_LPTIM_ReadReg function
  79. * @{
  80. */
  81. #define LL_LPTIM_ISR_CMPM LPTIM_ISR_CMPM /*!< Compare match */
  82. #define LL_LPTIM_ISR_ARRM LPTIM_ISR_ARRM /*!< Autoreload match */
  83. #define LL_LPTIM_ISR_EXTTRIG LPTIM_ISR_EXTTRIG /*!< External trigger edge event */
  84. #define LL_LPTIM_ISR_CMPOK LPTIM_ISR_CMPOK /*!< Compare register update OK */
  85. #define LL_LPTIM_ISR_ARROK LPTIM_ISR_ARROK /*!< Autoreload register update OK */
  86. #define LL_LPTIM_ISR_UP LPTIM_ISR_UP /*!< Counter direction change down to up */
  87. #define LL_LPTIM_ISR_DOWN LPTIM_ISR_DOWN /*!< Counter direction change up to down */
  88. /**
  89. * @}
  90. */
  91. /** @defgroup LPTIM_LL_EC_IT IT Defines
  92. * @brief IT defines which can be used with LL_LPTIM_ReadReg and LL_LPTIM_WriteReg functions
  93. * @{
  94. */
  95. #define LL_LPTIM_IER_CMPMIE LPTIM_IER_CMPMIE /*!< Compare match Interrupt Enable */
  96. #define LL_LPTIM_IER_ARRMIE LPTIM_IER_ARRMIE /*!< Autoreload match Interrupt Enable */
  97. #define LL_LPTIM_IER_EXTTRIGIE LPTIM_IER_EXTTRIGIE /*!< External trigger valid edge Interrupt Enable */
  98. #define LL_LPTIM_IER_CMPOKIE LPTIM_IER_CMPOKIE /*!< Compare register update OK Interrupt Enable */
  99. #define LL_LPTIM_IER_ARROKIE LPTIM_IER_ARROKIE /*!< Autoreload register update OK Interrupt Enable */
  100. #define LL_LPTIM_IER_UPIE LPTIM_IER_UPIE /*!< Direction change to UP Interrupt Enable */
  101. #define LL_LPTIM_IER_DOWNIE LPTIM_IER_DOWNIE /*!< Direction change to down Interrupt Enable */
  102. /**
  103. * @}
  104. */
  105. /** @defgroup LPTIM_LL_EC_OPERATING_MODE Operating Mode
  106. * @{
  107. */
  108. #define LL_LPTIM_OPERATING_MODE_CONTINUOUS LPTIM_CR_CNTSTRT /*!<LP Timer starts in continuous mode*/
  109. #define LL_LPTIM_OPERATING_MODE_ONESHOT LPTIM_CR_SNGSTRT /*!<LP Tilmer starts in single mode*/
  110. /**
  111. * @}
  112. */
  113. /** @defgroup LPTIM_LL_EC_UPDATE_MODE Update Mode
  114. * @{
  115. */
  116. #define LL_LPTIM_UPDATE_MODE_IMMEDIATE 0x00000000U /*!<Preload is disabled: registers are updated after each APB bus write access*/
  117. #define LL_LPTIM_UPDATE_MODE_ENDOFPERIOD LPTIM_CFGR_PRELOAD /*!<preload is enabled: registers are updated at the end of the current LPTIM period*/
  118. /**
  119. * @}
  120. */
  121. /** @defgroup LPTIM_LL_EC_COUNTER_MODE Counter Mode
  122. * @{
  123. */
  124. #define LL_LPTIM_COUNTER_MODE_INTERNAL 0x00000000U /*!<The counter is incremented following each internal clock pulse*/
  125. #define LL_LPTIM_COUNTER_MODE_EXTERNAL LPTIM_CFGR_COUNTMODE /*!<The counter is incremented following each valid clock pulse on the LPTIM external Input1*/
  126. /**
  127. * @}
  128. */
  129. /** @defgroup LPTIM_LL_EC_OUTPUT_WAVEFORM Output Waveform Type
  130. * @{
  131. */
  132. #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*/
  133. #define LL_LPTIM_OUTPUT_WAVEFORM_SETONCE LPTIM_CFGR_WAVE /*!<LPTIM generates a Set Once waveform*/
  134. /**
  135. * @}
  136. */
  137. /** @defgroup LPTIM_LL_EC_OUTPUT_POLARITY Output Polarity
  138. * @{
  139. */
  140. #define LL_LPTIM_OUTPUT_POLARITY_REGULAR 0x00000000U /*!<The LPTIM output reflects the compare results between LPTIMx_ARR and LPTIMx_CMP registers*/
  141. #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*/
  142. /**
  143. * @}
  144. */
  145. /** @defgroup LPTIM_LL_EC_PRESCALER Prescaler Value
  146. * @{
  147. */
  148. #define LL_LPTIM_PRESCALER_DIV1 0x00000000U /*!<Prescaler division factor is set to 1*/
  149. #define LL_LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 /*!<Prescaler division factor is set to 2*/
  150. #define LL_LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 /*!<Prescaler division factor is set to 4*/
  151. #define LL_LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 8*/
  152. #define LL_LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 /*!<Prescaler division factor is set to 16*/
  153. #define LL_LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 32*/
  154. #define LL_LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_1) /*!<Prescaler division factor is set to 64*/
  155. #define LL_LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC /*!<Prescaler division factor is set to 128*/
  156. /**
  157. * @}
  158. */
  159. /** @defgroup LPTIM_LL_EC_TRIG_SOURCE Trigger Source
  160. * @{
  161. */
  162. #define LL_LPTIM_TRIG_SOURCE_GPIO 0x00000000U /*!<External input trigger is connected to TIMx_ETR input*/
  163. #define LL_LPTIM_TRIG_SOURCE_RTCALARMA LPTIM_CFGR_TRIGSEL_0 /*!<External input trigger is connected to RTC Alarm A*/
  164. #define LL_LPTIM_TRIG_SOURCE_RTCALARMB LPTIM_CFGR_TRIGSEL_1 /*!<External input trigger is connected to RTC Alarm B*/
  165. #define LL_LPTIM_TRIG_SOURCE_RTCTAMP1 (LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to RTC Tamper 1*/
  166. #define LL_LPTIM_TRIG_SOURCE_TIM1_TRGO LPTIM_CFGR_TRIGSEL_2 /*!<External input trigger is connected to TIM1*/
  167. #define LL_LPTIM_TRIG_SOURCE_TIM5_TRGO (LPTIM_CFGR_TRIGSEL_2 | LPTIM_CFGR_TRIGSEL_0) /*!<External input trigger is connected to TIM5*/
  168. /**
  169. * @}
  170. */
  171. /** @defgroup LPTIM_LL_EC_TRIG_FILTER Trigger Filter
  172. * @{
  173. */
  174. #define LL_LPTIM_TRIG_FILTER_NONE 0x00000000U /*!<Any trigger active level change is considered as a valid trigger*/
  175. #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*/
  176. #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*/
  177. #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*/
  178. /**
  179. * @}
  180. */
  181. /** @defgroup LPTIM_LL_EC_TRIG_POLARITY Trigger Polarity
  182. * @{
  183. */
  184. #define LL_LPTIM_TRIG_POLARITY_RISING LPTIM_CFGR_TRIGEN_0 /*!<LPTIM counter starts when a rising edge is detected*/
  185. #define LL_LPTIM_TRIG_POLARITY_FALLING LPTIM_CFGR_TRIGEN_1 /*!<LPTIM counter starts when a falling edge is detected*/
  186. #define LL_LPTIM_TRIG_POLARITY_RISING_FALLING LPTIM_CFGR_TRIGEN /*!<LPTIM counter starts when a rising or a falling edge is detected*/
  187. /**
  188. * @}
  189. */
  190. /** @defgroup LPTIM_LL_EC_CLK_SOURCE Clock Source
  191. * @{
  192. */
  193. #define LL_LPTIM_CLK_SOURCE_INTERNAL 0x00000000U /*!<LPTIM is clocked by internal clock source (APB clock or any of the embedded oscillators)*/
  194. #define LL_LPTIM_CLK_SOURCE_EXTERNAL LPTIM_CFGR_CKSEL /*!<LPTIM is clocked by an external clock source through the LPTIM external Input1*/
  195. /**
  196. * @}
  197. */
  198. /** @defgroup LPTIM_LL_EC_CLK_FILTER Clock Filter
  199. * @{
  200. */
  201. #define LL_LPTIM_CLK_FILTER_NONE 0x00000000U /*!<Any external clock signal level change is considered as a valid transition*/
  202. #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*/
  203. #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*/
  204. #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*/
  205. /**
  206. * @}
  207. */
  208. /** @defgroup LPTIM_LL_EC_CLK_POLARITY Clock Polarity
  209. * @{
  210. */
  211. #define LL_LPTIM_CLK_POLARITY_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/
  212. #define LL_LPTIM_CLK_POLARITY_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/
  213. #define LL_LPTIM_CLK_POLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/
  214. /**
  215. * @}
  216. */
  217. /** @defgroup LPTIM_LL_EC_ENCODER_MODE Encoder Mode
  218. * @{
  219. */
  220. #define LL_LPTIM_ENCODER_MODE_RISING 0x00000000U /*!< The rising edge is the active edge used for counting*/
  221. #define LL_LPTIM_ENCODER_MODE_FALLING LPTIM_CFGR_CKPOL_0 /*!< The falling edge is the active edge used for counting*/
  222. #define LL_LPTIM_ENCODER_MODE_RISING_FALLING LPTIM_CFGR_CKPOL_1 /*!< Both edges are active edges*/
  223. /**
  224. * @}
  225. */
  226. /** @defgroup LPTIM_EC_INPUT1_SRC Input1 Source
  227. * @{
  228. */
  229. #define LL_LPTIM_INPUT1_SRC_PAD_AF 0x00000000U
  230. #define LL_LPTIM_INPUT1_SRC_PAD_PA4 LPTIM_OR_OR_0
  231. #define LL_LPTIM_INPUT1_SRC_PAD_PB9 LPTIM_OR_OR_1
  232. #define LL_LPTIM_INPUT1_SRC_TIM_DAC LPTIM_OR_OR
  233. /**
  234. * @}
  235. */
  236. /**
  237. * @}
  238. */
  239. /* Exported macro ------------------------------------------------------------*/
  240. /** @defgroup LPTIM_LL_Exported_Macros LPTIM Exported Macros
  241. * @{
  242. */
  243. /** @defgroup LPTIM_LL_EM_WRITE_READ Common Write and read registers Macros
  244. * @{
  245. */
  246. /**
  247. * @brief Write a value in LPTIM register
  248. * @param __INSTANCE__ LPTIM Instance
  249. * @param __REG__ Register to be written
  250. * @param __VALUE__ Value to be written in the register
  251. * @retval None
  252. */
  253. #define LL_LPTIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
  254. /**
  255. * @brief Read a value in LPTIM register
  256. * @param __INSTANCE__ LPTIM Instance
  257. * @param __REG__ Register to be read
  258. * @retval Register value
  259. */
  260. #define LL_LPTIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
  261. /**
  262. * @}
  263. */
  264. /**
  265. * @}
  266. */
  267. /* Exported functions --------------------------------------------------------*/
  268. /** @defgroup LPTIM_LL_Exported_Functions LPTIM Exported Functions
  269. * @{
  270. */
  271. #if defined(USE_FULL_LL_DRIVER)
  272. /** @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions
  273. * @{
  274. */
  275. ErrorStatus LL_LPTIM_DeInit(LPTIM_TypeDef *LPTIMx);
  276. void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct);
  277. ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, LL_LPTIM_InitTypeDef *LPTIM_InitStruct);
  278. void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx);
  279. /**
  280. * @}
  281. */
  282. #endif /* USE_FULL_LL_DRIVER */
  283. /** @defgroup LPTIM_LL_EF_LPTIM_Configuration LPTIM Configuration
  284. * @{
  285. */
  286. /**
  287. * @brief Enable the LPTIM instance
  288. * @note After setting the ENABLE bit, a delay of two counter clock is needed
  289. * before the LPTIM instance is actually enabled.
  290. * @rmtoll CR ENABLE LL_LPTIM_Enable
  291. * @param LPTIMx Low-Power Timer instance
  292. * @retval None
  293. */
  294. __STATIC_INLINE void LL_LPTIM_Enable(LPTIM_TypeDef *LPTIMx)
  295. {
  296. SET_BIT(LPTIMx->CR, LPTIM_CR_ENABLE);
  297. }
  298. /**
  299. * @brief Indicates whether the LPTIM instance is enabled.
  300. * @rmtoll CR ENABLE LL_LPTIM_IsEnabled
  301. * @param LPTIMx Low-Power Timer instance
  302. * @retval State of bit (1 or 0).
  303. */
  304. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabled(LPTIM_TypeDef *LPTIMx)
  305. {
  306. return (((READ_BIT(LPTIMx->CR, LPTIM_CR_ENABLE) == LPTIM_CR_ENABLE) ? 1UL : 0UL));
  307. }
  308. /**
  309. * @brief Starts the LPTIM counter in the desired mode.
  310. * @note LPTIM instance must be enabled before starting the counter.
  311. * @note It is possible to change on the fly from One Shot mode to
  312. * Continuous mode.
  313. * @rmtoll CR CNTSTRT LL_LPTIM_StartCounter\n
  314. * CR SNGSTRT LL_LPTIM_StartCounter
  315. * @param LPTIMx Low-Power Timer instance
  316. * @param OperatingMode This parameter can be one of the following values:
  317. * @arg @ref LL_LPTIM_OPERATING_MODE_CONTINUOUS
  318. * @arg @ref LL_LPTIM_OPERATING_MODE_ONESHOT
  319. * @retval None
  320. */
  321. __STATIC_INLINE void LL_LPTIM_StartCounter(LPTIM_TypeDef *LPTIMx, uint32_t OperatingMode)
  322. {
  323. MODIFY_REG(LPTIMx->CR, LPTIM_CR_CNTSTRT | LPTIM_CR_SNGSTRT, OperatingMode);
  324. }
  325. /**
  326. * @brief Set the LPTIM registers update mode (enable/disable register preload)
  327. * @note This function must be called when the LPTIM instance is disabled.
  328. * @rmtoll CFGR PRELOAD LL_LPTIM_SetUpdateMode
  329. * @param LPTIMx Low-Power Timer instance
  330. * @param UpdateMode This parameter can be one of the following values:
  331. * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE
  332. * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD
  333. * @retval None
  334. */
  335. __STATIC_INLINE void LL_LPTIM_SetUpdateMode(LPTIM_TypeDef *LPTIMx, uint32_t UpdateMode)
  336. {
  337. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD, UpdateMode);
  338. }
  339. /**
  340. * @brief Get the LPTIM registers update mode
  341. * @rmtoll CFGR PRELOAD LL_LPTIM_GetUpdateMode
  342. * @param LPTIMx Low-Power Timer instance
  343. * @retval Returned value can be one of the following values:
  344. * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE
  345. * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD
  346. */
  347. __STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode(LPTIM_TypeDef *LPTIMx)
  348. {
  349. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD));
  350. }
  351. /**
  352. * @brief Set the auto reload value
  353. * @note The LPTIMx_ARR register content must only be modified when the LPTIM is enabled
  354. * @note After a write to the LPTIMx_ARR register a new write operation to the
  355. * same register can only be performed when the previous write operation
  356. * is completed. Any successive write before the ARROK flag is set, will
  357. * lead to unpredictable results.
  358. * @note autoreload value be strictly greater than the compare value.
  359. * @rmtoll ARR ARR LL_LPTIM_SetAutoReload
  360. * @param LPTIMx Low-Power Timer instance
  361. * @param AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF
  362. * @retval None
  363. */
  364. __STATIC_INLINE void LL_LPTIM_SetAutoReload(LPTIM_TypeDef *LPTIMx, uint32_t AutoReload)
  365. {
  366. MODIFY_REG(LPTIMx->ARR, LPTIM_ARR_ARR, AutoReload);
  367. }
  368. /**
  369. * @brief Get actual auto reload value
  370. * @rmtoll ARR ARR LL_LPTIM_GetAutoReload
  371. * @param LPTIMx Low-Power Timer instance
  372. * @retval AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF
  373. */
  374. __STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload(LPTIM_TypeDef *LPTIMx)
  375. {
  376. return (uint32_t)(READ_BIT(LPTIMx->ARR, LPTIM_ARR_ARR));
  377. }
  378. /**
  379. * @brief Set the compare value
  380. * @note After a write to the LPTIMx_CMP register a new write operation to the
  381. * same register can only be performed when the previous write operation
  382. * is completed. Any successive write before the CMPOK flag is set, will
  383. * lead to unpredictable results.
  384. * @rmtoll CMP CMP LL_LPTIM_SetCompare
  385. * @param LPTIMx Low-Power Timer instance
  386. * @param CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF
  387. * @retval None
  388. */
  389. __STATIC_INLINE void LL_LPTIM_SetCompare(LPTIM_TypeDef *LPTIMx, uint32_t CompareValue)
  390. {
  391. MODIFY_REG(LPTIMx->CMP, LPTIM_CMP_CMP, CompareValue);
  392. }
  393. /**
  394. * @brief Get actual compare value
  395. * @rmtoll CMP CMP LL_LPTIM_GetCompare
  396. * @param LPTIMx Low-Power Timer instance
  397. * @retval CompareValue Value between Min_Data=0x00 and Max_Data=0xFFFF
  398. */
  399. __STATIC_INLINE uint32_t LL_LPTIM_GetCompare(LPTIM_TypeDef *LPTIMx)
  400. {
  401. return (uint32_t)(READ_BIT(LPTIMx->CMP, LPTIM_CMP_CMP));
  402. }
  403. /**
  404. * @brief Get actual counter value
  405. * @note When the LPTIM instance is running with an asynchronous clock, reading
  406. * the LPTIMx_CNT register may return unreliable values. So in this case
  407. * it is necessary to perform two consecutive read accesses and verify
  408. * that the two returned values are identical.
  409. * @rmtoll CNT CNT LL_LPTIM_GetCounter
  410. * @param LPTIMx Low-Power Timer instance
  411. * @retval Counter value
  412. */
  413. __STATIC_INLINE uint32_t LL_LPTIM_GetCounter(LPTIM_TypeDef *LPTIMx)
  414. {
  415. return (uint32_t)(READ_BIT(LPTIMx->CNT, LPTIM_CNT_CNT));
  416. }
  417. /**
  418. * @brief Set the counter mode (selection of the LPTIM counter clock source).
  419. * @note The counter mode can be set only when the LPTIM instance is disabled.
  420. * @rmtoll CFGR COUNTMODE LL_LPTIM_SetCounterMode
  421. * @param LPTIMx Low-Power Timer instance
  422. * @param CounterMode This parameter can be one of the following values:
  423. * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL
  424. * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL
  425. * @retval None
  426. */
  427. __STATIC_INLINE void LL_LPTIM_SetCounterMode(LPTIM_TypeDef *LPTIMx, uint32_t CounterMode)
  428. {
  429. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE, CounterMode);
  430. }
  431. /**
  432. * @brief Get the counter mode
  433. * @rmtoll CFGR COUNTMODE LL_LPTIM_GetCounterMode
  434. * @param LPTIMx Low-Power Timer instance
  435. * @retval Returned value can be one of the following values:
  436. * @arg @ref LL_LPTIM_COUNTER_MODE_INTERNAL
  437. * @arg @ref LL_LPTIM_COUNTER_MODE_EXTERNAL
  438. */
  439. __STATIC_INLINE uint32_t LL_LPTIM_GetCounterMode(LPTIM_TypeDef *LPTIMx)
  440. {
  441. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_COUNTMODE));
  442. }
  443. /**
  444. * @brief Configure the LPTIM instance output (LPTIMx_OUT)
  445. * @note This function must be called when the LPTIM instance is disabled.
  446. * @note Regarding the LPTIM output polarity the change takes effect
  447. * immediately, so the output default value will change immediately after
  448. * the polarity is re-configured, even before the timer is enabled.
  449. * @rmtoll CFGR WAVE LL_LPTIM_ConfigOutput\n
  450. * CFGR WAVPOL LL_LPTIM_ConfigOutput
  451. * @param LPTIMx Low-Power Timer instance
  452. * @param Waveform This parameter can be one of the following values:
  453. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM
  454. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE
  455. * @param Polarity This parameter can be one of the following values:
  456. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR
  457. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE
  458. * @retval None
  459. */
  460. __STATIC_INLINE void LL_LPTIM_ConfigOutput(LPTIM_TypeDef *LPTIMx, uint32_t Waveform, uint32_t Polarity)
  461. {
  462. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE | LPTIM_CFGR_WAVPOL, Waveform | Polarity);
  463. }
  464. /**
  465. * @brief Set waveform shape
  466. * @rmtoll CFGR WAVE LL_LPTIM_SetWaveform
  467. * @param LPTIMx Low-Power Timer instance
  468. * @param Waveform This parameter can be one of the following values:
  469. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM
  470. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE
  471. * @retval None
  472. */
  473. __STATIC_INLINE void LL_LPTIM_SetWaveform(LPTIM_TypeDef *LPTIMx, uint32_t Waveform)
  474. {
  475. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVE, Waveform);
  476. }
  477. /**
  478. * @brief Get actual waveform shape
  479. * @rmtoll CFGR WAVE LL_LPTIM_GetWaveform
  480. * @param LPTIMx Low-Power Timer instance
  481. * @retval Returned value can be one of the following values:
  482. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_PWM
  483. * @arg @ref LL_LPTIM_OUTPUT_WAVEFORM_SETONCE
  484. */
  485. __STATIC_INLINE uint32_t LL_LPTIM_GetWaveform(LPTIM_TypeDef *LPTIMx)
  486. {
  487. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVE));
  488. }
  489. /**
  490. * @brief Set output polarity
  491. * @rmtoll CFGR WAVPOL LL_LPTIM_SetPolarity
  492. * @param LPTIMx Low-Power Timer instance
  493. * @param Polarity This parameter can be one of the following values:
  494. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR
  495. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE
  496. * @retval None
  497. */
  498. __STATIC_INLINE void LL_LPTIM_SetPolarity(LPTIM_TypeDef *LPTIMx, uint32_t Polarity)
  499. {
  500. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL, Polarity);
  501. }
  502. /**
  503. * @brief Get actual output polarity
  504. * @rmtoll CFGR WAVPOL LL_LPTIM_GetPolarity
  505. * @param LPTIMx Low-Power Timer instance
  506. * @retval Returned value can be one of the following values:
  507. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_REGULAR
  508. * @arg @ref LL_LPTIM_OUTPUT_POLARITY_INVERSE
  509. */
  510. __STATIC_INLINE uint32_t LL_LPTIM_GetPolarity(LPTIM_TypeDef *LPTIMx)
  511. {
  512. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_WAVPOL));
  513. }
  514. /**
  515. * @brief Set actual prescaler division ratio.
  516. * @note This function must be called when the LPTIM instance is disabled.
  517. * @note When the LPTIM is configured to be clocked by an internal clock source
  518. * and the LPTIM counter is configured to be updated by active edges
  519. * detected on the LPTIM external Input1, the internal clock provided to
  520. * the LPTIM must be not be prescaled.
  521. * @rmtoll CFGR PRESC LL_LPTIM_SetPrescaler
  522. * @param LPTIMx Low-Power Timer instance
  523. * @param Prescaler This parameter can be one of the following values:
  524. * @arg @ref LL_LPTIM_PRESCALER_DIV1
  525. * @arg @ref LL_LPTIM_PRESCALER_DIV2
  526. * @arg @ref LL_LPTIM_PRESCALER_DIV4
  527. * @arg @ref LL_LPTIM_PRESCALER_DIV8
  528. * @arg @ref LL_LPTIM_PRESCALER_DIV16
  529. * @arg @ref LL_LPTIM_PRESCALER_DIV32
  530. * @arg @ref LL_LPTIM_PRESCALER_DIV64
  531. * @arg @ref LL_LPTIM_PRESCALER_DIV128
  532. * @retval None
  533. */
  534. __STATIC_INLINE void LL_LPTIM_SetPrescaler(LPTIM_TypeDef *LPTIMx, uint32_t Prescaler)
  535. {
  536. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRESC, Prescaler);
  537. }
  538. /**
  539. * @brief Get actual prescaler division ratio.
  540. * @rmtoll CFGR PRESC LL_LPTIM_GetPrescaler
  541. * @param LPTIMx Low-Power Timer instance
  542. * @retval Returned value can be one of the following values:
  543. * @arg @ref LL_LPTIM_PRESCALER_DIV1
  544. * @arg @ref LL_LPTIM_PRESCALER_DIV2
  545. * @arg @ref LL_LPTIM_PRESCALER_DIV4
  546. * @arg @ref LL_LPTIM_PRESCALER_DIV8
  547. * @arg @ref LL_LPTIM_PRESCALER_DIV16
  548. * @arg @ref LL_LPTIM_PRESCALER_DIV32
  549. * @arg @ref LL_LPTIM_PRESCALER_DIV64
  550. * @arg @ref LL_LPTIM_PRESCALER_DIV128
  551. */
  552. __STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler(LPTIM_TypeDef *LPTIMx)
  553. {
  554. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRESC));
  555. }
  556. /**
  557. * @brief Set LPTIM input 1 source (default GPIO).
  558. * @rmtoll OR OR LL_LPTIM_SetInput1Src
  559. * @param LPTIMx Low-Power Timer instance
  560. * @param Src This parameter can be one of the following values:
  561. * @arg @ref LL_LPTIM_INPUT1_SRC_PAD_AF
  562. * @arg @ref LL_LPTIM_INPUT1_SRC_PAD_PA4
  563. * @arg @ref LL_LPTIM_INPUT1_SRC_PAD_PB9
  564. * @arg @ref LL_LPTIM_INPUT1_SRC_TIM_DAC
  565. * @retval None
  566. */
  567. __STATIC_INLINE void LL_LPTIM_SetInput1Src(LPTIM_TypeDef *LPTIMx, uint32_t Src)
  568. {
  569. MODIFY_REG(LPTIMx->OR, LPTIM_OR_OR, Src);
  570. }
  571. /**
  572. * @}
  573. */
  574. /** @defgroup LPTIM_LL_EF_Trigger_Configuration Trigger Configuration
  575. * @{
  576. */
  577. /**
  578. * @brief Enable the timeout function
  579. * @note This function must be called when the LPTIM instance is disabled.
  580. * @note The first trigger event will start the timer, any successive trigger
  581. * event will reset the counter and the timer will restart.
  582. * @note The timeout value corresponds to the compare value; if no trigger
  583. * occurs within the expected time frame, the MCU is waked-up by the
  584. * compare match event.
  585. * @rmtoll CFGR TIMOUT LL_LPTIM_EnableTimeout
  586. * @param LPTIMx Low-Power Timer instance
  587. * @retval None
  588. */
  589. __STATIC_INLINE void LL_LPTIM_EnableTimeout(LPTIM_TypeDef *LPTIMx)
  590. {
  591. SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT);
  592. }
  593. /**
  594. * @brief Disable the timeout function
  595. * @note This function must be called when the LPTIM instance is disabled.
  596. * @note A trigger event arriving when the timer is already started will be
  597. * ignored.
  598. * @rmtoll CFGR TIMOUT LL_LPTIM_DisableTimeout
  599. * @param LPTIMx Low-Power Timer instance
  600. * @retval None
  601. */
  602. __STATIC_INLINE void LL_LPTIM_DisableTimeout(LPTIM_TypeDef *LPTIMx)
  603. {
  604. CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT);
  605. }
  606. /**
  607. * @brief Indicate whether the timeout function is enabled.
  608. * @rmtoll CFGR TIMOUT LL_LPTIM_IsEnabledTimeout
  609. * @param LPTIMx Low-Power Timer instance
  610. * @retval State of bit (1 or 0).
  611. */
  612. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledTimeout(LPTIM_TypeDef *LPTIMx)
  613. {
  614. return (((READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TIMOUT) == LPTIM_CFGR_TIMOUT) ? 1UL : 0UL));
  615. }
  616. /**
  617. * @brief Start the LPTIM counter
  618. * @note This function must be called when the LPTIM instance is disabled.
  619. * @rmtoll CFGR TRIGEN LL_LPTIM_TrigSw
  620. * @param LPTIMx Low-Power Timer instance
  621. * @retval None
  622. */
  623. __STATIC_INLINE void LL_LPTIM_TrigSw(LPTIM_TypeDef *LPTIMx)
  624. {
  625. CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN);
  626. }
  627. /**
  628. * @brief Configure the external trigger used as a trigger event for the LPTIM.
  629. * @note This function must be called when the LPTIM instance is disabled.
  630. * @note An internal clock source must be present when a digital filter is
  631. * required for the trigger.
  632. * @rmtoll CFGR TRIGSEL LL_LPTIM_ConfigTrigger\n
  633. * CFGR TRGFLT LL_LPTIM_ConfigTrigger\n
  634. * CFGR TRIGEN LL_LPTIM_ConfigTrigger
  635. * @param LPTIMx Low-Power Timer instance
  636. * @param Source This parameter can be one of the following values:
  637. * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO
  638. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA
  639. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB
  640. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1
  641. * @arg @ref LL_LPTIM_TRIG_SOURCE_TIM1_TRGO
  642. * @arg @ref LL_LPTIM_TRIG_SOURCE_TIM5_TRGO
  643. * @param Filter This parameter can be one of the following values:
  644. * @arg @ref LL_LPTIM_TRIG_FILTER_NONE
  645. * @arg @ref LL_LPTIM_TRIG_FILTER_2
  646. * @arg @ref LL_LPTIM_TRIG_FILTER_4
  647. * @arg @ref LL_LPTIM_TRIG_FILTER_8
  648. * @param Polarity This parameter can be one of the following values:
  649. * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING
  650. * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING
  651. * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING
  652. * @retval None
  653. */
  654. __STATIC_INLINE void LL_LPTIM_ConfigTrigger(LPTIM_TypeDef *LPTIMx, uint32_t Source, uint32_t Filter, uint32_t Polarity)
  655. {
  656. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL | LPTIM_CFGR_TRGFLT | LPTIM_CFGR_TRIGEN, Source | Filter | Polarity);
  657. }
  658. /**
  659. * @brief Get actual external trigger source.
  660. * @rmtoll CFGR TRIGSEL LL_LPTIM_GetTriggerSource
  661. * @param LPTIMx Low-Power Timer instance
  662. * @retval Returned value can be one of the following values:
  663. * @arg @ref LL_LPTIM_TRIG_SOURCE_GPIO
  664. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMA
  665. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCALARMB
  666. * @arg @ref LL_LPTIM_TRIG_SOURCE_RTCTAMP1
  667. * @arg @ref LL_LPTIM_TRIG_SOURCE_TIM1_TRGO
  668. * @arg @ref LL_LPTIM_TRIG_SOURCE_TIM5_TRGO
  669. */
  670. __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerSource(LPTIM_TypeDef *LPTIMx)
  671. {
  672. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGSEL));
  673. }
  674. /**
  675. * @brief Get actual external trigger filter.
  676. * @rmtoll CFGR TRGFLT LL_LPTIM_GetTriggerFilter
  677. * @param LPTIMx Low-Power Timer instance
  678. * @retval Returned value can be one of the following values:
  679. * @arg @ref LL_LPTIM_TRIG_FILTER_NONE
  680. * @arg @ref LL_LPTIM_TRIG_FILTER_2
  681. * @arg @ref LL_LPTIM_TRIG_FILTER_4
  682. * @arg @ref LL_LPTIM_TRIG_FILTER_8
  683. */
  684. __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerFilter(LPTIM_TypeDef *LPTIMx)
  685. {
  686. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRGFLT));
  687. }
  688. /**
  689. * @brief Get actual external trigger polarity.
  690. * @rmtoll CFGR TRIGEN LL_LPTIM_GetTriggerPolarity
  691. * @param LPTIMx Low-Power Timer instance
  692. * @retval Returned value can be one of the following values:
  693. * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING
  694. * @arg @ref LL_LPTIM_TRIG_POLARITY_FALLING
  695. * @arg @ref LL_LPTIM_TRIG_POLARITY_RISING_FALLING
  696. */
  697. __STATIC_INLINE uint32_t LL_LPTIM_GetTriggerPolarity(LPTIM_TypeDef *LPTIMx)
  698. {
  699. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_TRIGEN));
  700. }
  701. /**
  702. * @}
  703. */
  704. /** @defgroup LPTIM_LL_EF_Clock_Configuration Clock Configuration
  705. * @{
  706. */
  707. /**
  708. * @brief Set the source of the clock used by the LPTIM instance.
  709. * @note This function must be called when the LPTIM instance is disabled.
  710. * @rmtoll CFGR CKSEL LL_LPTIM_SetClockSource
  711. * @param LPTIMx Low-Power Timer instance
  712. * @param ClockSource This parameter can be one of the following values:
  713. * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL
  714. * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL
  715. * @retval None
  716. */
  717. __STATIC_INLINE void LL_LPTIM_SetClockSource(LPTIM_TypeDef *LPTIMx, uint32_t ClockSource)
  718. {
  719. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKSEL, ClockSource);
  720. }
  721. /**
  722. * @brief Get actual LPTIM instance clock source.
  723. * @rmtoll CFGR CKSEL LL_LPTIM_GetClockSource
  724. * @param LPTIMx Low-Power Timer instance
  725. * @retval Returned value can be one of the following values:
  726. * @arg @ref LL_LPTIM_CLK_SOURCE_INTERNAL
  727. * @arg @ref LL_LPTIM_CLK_SOURCE_EXTERNAL
  728. */
  729. __STATIC_INLINE uint32_t LL_LPTIM_GetClockSource(LPTIM_TypeDef *LPTIMx)
  730. {
  731. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKSEL));
  732. }
  733. /**
  734. * @brief Configure the active edge or edges used by the counter when the LPTIM is clocked by an external clock source.
  735. * @note This function must be called when the LPTIM instance is disabled.
  736. * @note When both external clock signal edges are considered active ones,
  737. * the LPTIM must also be clocked by an internal clock source with a
  738. * frequency equal to at least four times the external clock frequency.
  739. * @note An internal clock source must be present when a digital filter is
  740. * required for external clock.
  741. * @rmtoll CFGR CKFLT LL_LPTIM_ConfigClock\n
  742. * CFGR CKPOL LL_LPTIM_ConfigClock
  743. * @param LPTIMx Low-Power Timer instance
  744. * @param ClockFilter This parameter can be one of the following values:
  745. * @arg @ref LL_LPTIM_CLK_FILTER_NONE
  746. * @arg @ref LL_LPTIM_CLK_FILTER_2
  747. * @arg @ref LL_LPTIM_CLK_FILTER_4
  748. * @arg @ref LL_LPTIM_CLK_FILTER_8
  749. * @param ClockPolarity This parameter can be one of the following values:
  750. * @arg @ref LL_LPTIM_CLK_POLARITY_RISING
  751. * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING
  752. * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING
  753. * @retval None
  754. */
  755. __STATIC_INLINE void LL_LPTIM_ConfigClock(LPTIM_TypeDef *LPTIMx, uint32_t ClockFilter, uint32_t ClockPolarity)
  756. {
  757. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKFLT | LPTIM_CFGR_CKPOL, ClockFilter | ClockPolarity);
  758. }
  759. /**
  760. * @brief Get actual clock polarity
  761. * @rmtoll CFGR CKPOL LL_LPTIM_GetClockPolarity
  762. * @param LPTIMx Low-Power Timer instance
  763. * @retval Returned value can be one of the following values:
  764. * @arg @ref LL_LPTIM_CLK_POLARITY_RISING
  765. * @arg @ref LL_LPTIM_CLK_POLARITY_FALLING
  766. * @arg @ref LL_LPTIM_CLK_POLARITY_RISING_FALLING
  767. */
  768. __STATIC_INLINE uint32_t LL_LPTIM_GetClockPolarity(LPTIM_TypeDef *LPTIMx)
  769. {
  770. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL));
  771. }
  772. /**
  773. * @brief Get actual clock digital filter
  774. * @rmtoll CFGR CKFLT LL_LPTIM_GetClockFilter
  775. * @param LPTIMx Low-Power Timer instance
  776. * @retval Returned value can be one of the following values:
  777. * @arg @ref LL_LPTIM_CLK_FILTER_NONE
  778. * @arg @ref LL_LPTIM_CLK_FILTER_2
  779. * @arg @ref LL_LPTIM_CLK_FILTER_4
  780. * @arg @ref LL_LPTIM_CLK_FILTER_8
  781. */
  782. __STATIC_INLINE uint32_t LL_LPTIM_GetClockFilter(LPTIM_TypeDef *LPTIMx)
  783. {
  784. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKFLT));
  785. }
  786. /**
  787. * @}
  788. */
  789. /** @defgroup LPTIM_LL_EF_Encoder_Mode Encoder Mode
  790. * @{
  791. */
  792. /**
  793. * @brief Configure the encoder mode.
  794. * @note This function must be called when the LPTIM instance is disabled.
  795. * @rmtoll CFGR CKPOL LL_LPTIM_SetEncoderMode
  796. * @param LPTIMx Low-Power Timer instance
  797. * @param EncoderMode This parameter can be one of the following values:
  798. * @arg @ref LL_LPTIM_ENCODER_MODE_RISING
  799. * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING
  800. * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING
  801. * @retval None
  802. */
  803. __STATIC_INLINE void LL_LPTIM_SetEncoderMode(LPTIM_TypeDef *LPTIMx, uint32_t EncoderMode)
  804. {
  805. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_CKPOL, EncoderMode);
  806. }
  807. /**
  808. * @brief Get actual encoder mode.
  809. * @rmtoll CFGR CKPOL LL_LPTIM_GetEncoderMode
  810. * @param LPTIMx Low-Power Timer instance
  811. * @retval Returned value can be one of the following values:
  812. * @arg @ref LL_LPTIM_ENCODER_MODE_RISING
  813. * @arg @ref LL_LPTIM_ENCODER_MODE_FALLING
  814. * @arg @ref LL_LPTIM_ENCODER_MODE_RISING_FALLING
  815. */
  816. __STATIC_INLINE uint32_t LL_LPTIM_GetEncoderMode(LPTIM_TypeDef *LPTIMx)
  817. {
  818. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_CKPOL));
  819. }
  820. /**
  821. * @brief Enable the encoder mode
  822. * @note This function must be called when the LPTIM instance is disabled.
  823. * @note In this mode the LPTIM instance must be clocked by an internal clock
  824. * source. Also, the prescaler division ratio must be equal to 1.
  825. * @note LPTIM instance must be configured in continuous mode prior enabling
  826. * the encoder mode.
  827. * @rmtoll CFGR ENC LL_LPTIM_EnableEncoderMode
  828. * @param LPTIMx Low-Power Timer instance
  829. * @retval None
  830. */
  831. __STATIC_INLINE void LL_LPTIM_EnableEncoderMode(LPTIM_TypeDef *LPTIMx)
  832. {
  833. SET_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC);
  834. }
  835. /**
  836. * @brief Disable the encoder mode
  837. * @note This function must be called when the LPTIM instance is disabled.
  838. * @rmtoll CFGR ENC LL_LPTIM_DisableEncoderMode
  839. * @param LPTIMx Low-Power Timer instance
  840. * @retval None
  841. */
  842. __STATIC_INLINE void LL_LPTIM_DisableEncoderMode(LPTIM_TypeDef *LPTIMx)
  843. {
  844. CLEAR_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC);
  845. }
  846. /**
  847. * @brief Indicates whether the LPTIM operates in encoder mode.
  848. * @rmtoll CFGR ENC LL_LPTIM_IsEnabledEncoderMode
  849. * @param LPTIMx Low-Power Timer instance
  850. * @retval State of bit (1 or 0).
  851. */
  852. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledEncoderMode(LPTIM_TypeDef *LPTIMx)
  853. {
  854. return (((READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_ENC) == LPTIM_CFGR_ENC) ? 1UL : 0UL));
  855. }
  856. /**
  857. * @}
  858. */
  859. /** @defgroup LPTIM_LL_EF_FLAG_Management FLAG Management
  860. * @{
  861. */
  862. /**
  863. * @brief Clear the compare match flag (CMPMCF)
  864. * @rmtoll ICR CMPMCF LL_LPTIM_ClearFLAG_CMPM
  865. * @param LPTIMx Low-Power Timer instance
  866. * @retval None
  867. */
  868. __STATIC_INLINE void LL_LPTIM_ClearFLAG_CMPM(LPTIM_TypeDef *LPTIMx)
  869. {
  870. SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPMCF);
  871. }
  872. /**
  873. * @brief Inform application whether a compare match interrupt has occurred.
  874. * @rmtoll ISR CMPM LL_LPTIM_IsActiveFlag_CMPM
  875. * @param LPTIMx Low-Power Timer instance
  876. * @retval State of bit (1 or 0).
  877. */
  878. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPM(LPTIM_TypeDef *LPTIMx)
  879. {
  880. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPM) == LPTIM_ISR_CMPM) ? 1UL : 0UL));
  881. }
  882. /**
  883. * @brief Clear the autoreload match flag (ARRMCF)
  884. * @rmtoll ICR ARRMCF LL_LPTIM_ClearFLAG_ARRM
  885. * @param LPTIMx Low-Power Timer instance
  886. * @retval None
  887. */
  888. __STATIC_INLINE void LL_LPTIM_ClearFLAG_ARRM(LPTIM_TypeDef *LPTIMx)
  889. {
  890. SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARRMCF);
  891. }
  892. /**
  893. * @brief Inform application whether a autoreload match interrupt has occurred.
  894. * @rmtoll ISR ARRM LL_LPTIM_IsActiveFlag_ARRM
  895. * @param LPTIMx Low-Power Timer instance
  896. * @retval State of bit (1 or 0).
  897. */
  898. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARRM(LPTIM_TypeDef *LPTIMx)
  899. {
  900. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARRM) == LPTIM_ISR_ARRM) ? 1UL : 0UL));
  901. }
  902. /**
  903. * @brief Clear the external trigger valid edge flag(EXTTRIGCF).
  904. * @rmtoll ICR EXTTRIGCF LL_LPTIM_ClearFlag_EXTTRIG
  905. * @param LPTIMx Low-Power Timer instance
  906. * @retval None
  907. */
  908. __STATIC_INLINE void LL_LPTIM_ClearFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx)
  909. {
  910. SET_BIT(LPTIMx->ICR, LPTIM_ICR_EXTTRIGCF);
  911. }
  912. /**
  913. * @brief Inform application whether a valid edge on the selected external trigger input has occurred.
  914. * @rmtoll ISR EXTTRIG LL_LPTIM_IsActiveFlag_EXTTRIG
  915. * @param LPTIMx Low-Power Timer instance
  916. * @retval State of bit (1 or 0).
  917. */
  918. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_EXTTRIG(LPTIM_TypeDef *LPTIMx)
  919. {
  920. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_EXTTRIG) == LPTIM_ISR_EXTTRIG) ? 1UL : 0UL));
  921. }
  922. /**
  923. * @brief Clear the compare register update interrupt flag (CMPOKCF).
  924. * @rmtoll ICR CMPOKCF LL_LPTIM_ClearFlag_CMPOK
  925. * @param LPTIMx Low-Power Timer instance
  926. * @retval None
  927. */
  928. __STATIC_INLINE void LL_LPTIM_ClearFlag_CMPOK(LPTIM_TypeDef *LPTIMx)
  929. {
  930. SET_BIT(LPTIMx->ICR, LPTIM_ICR_CMPOKCF);
  931. }
  932. /**
  933. * @brief Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfully completed. If so, a new one can be initiated.
  934. * @rmtoll ISR CMPOK LL_LPTIM_IsActiveFlag_CMPOK
  935. * @param LPTIMx Low-Power Timer instance
  936. * @retval State of bit (1 or 0).
  937. */
  938. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_CMPOK(LPTIM_TypeDef *LPTIMx)
  939. {
  940. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_CMPOK) == LPTIM_ISR_CMPOK) ? 1UL : 0UL));
  941. }
  942. /**
  943. * @brief Clear the autoreload register update interrupt flag (ARROKCF).
  944. * @rmtoll ICR ARROKCF LL_LPTIM_ClearFlag_ARROK
  945. * @param LPTIMx Low-Power Timer instance
  946. * @retval None
  947. */
  948. __STATIC_INLINE void LL_LPTIM_ClearFlag_ARROK(LPTIM_TypeDef *LPTIMx)
  949. {
  950. SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARROKCF);
  951. }
  952. /**
  953. * @brief Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfully completed. If so, a new one can be initiated.
  954. * @rmtoll ISR ARROK LL_LPTIM_IsActiveFlag_ARROK
  955. * @param LPTIMx Low-Power Timer instance
  956. * @retval State of bit (1 or 0).
  957. */
  958. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARROK(LPTIM_TypeDef *LPTIMx)
  959. {
  960. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARROK) == LPTIM_ISR_ARROK) ? 1UL : 0UL));
  961. }
  962. /**
  963. * @brief Clear the counter direction change to up interrupt flag (UPCF).
  964. * @rmtoll ICR UPCF LL_LPTIM_ClearFlag_UP
  965. * @param LPTIMx Low-Power Timer instance
  966. * @retval None
  967. */
  968. __STATIC_INLINE void LL_LPTIM_ClearFlag_UP(LPTIM_TypeDef *LPTIMx)
  969. {
  970. SET_BIT(LPTIMx->ICR, LPTIM_ICR_UPCF);
  971. }
  972. /**
  973. * @brief Informs the application whether the counter direction has changed from down to up (when the LPTIM instance operates in encoder mode).
  974. * @rmtoll ISR UP LL_LPTIM_IsActiveFlag_UP
  975. * @param LPTIMx Low-Power Timer instance
  976. * @retval State of bit (1 or 0).
  977. */
  978. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_UP(LPTIM_TypeDef *LPTIMx)
  979. {
  980. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_UP) == LPTIM_ISR_UP) ? 1UL : 0UL));
  981. }
  982. /**
  983. * @brief Clear the counter direction change to down interrupt flag (DOWNCF).
  984. * @rmtoll ICR DOWNCF LL_LPTIM_ClearFlag_DOWN
  985. * @param LPTIMx Low-Power Timer instance
  986. * @retval None
  987. */
  988. __STATIC_INLINE void LL_LPTIM_ClearFlag_DOWN(LPTIM_TypeDef *LPTIMx)
  989. {
  990. SET_BIT(LPTIMx->ICR, LPTIM_ICR_DOWNCF);
  991. }
  992. /**
  993. * @brief Informs the application whether the counter direction has changed from up to down (when the LPTIM instance operates in encoder mode).
  994. * @rmtoll ISR DOWN LL_LPTIM_IsActiveFlag_DOWN
  995. * @param LPTIMx Low-Power Timer instance
  996. * @retval State of bit (1 or 0).
  997. */
  998. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_DOWN(LPTIM_TypeDef *LPTIMx)
  999. {
  1000. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_DOWN) == LPTIM_ISR_DOWN) ? 1UL : 0UL));
  1001. }
  1002. /**
  1003. * @}
  1004. */
  1005. /** @defgroup LPTIM_LL_EF_IT_Management Interrupt Management
  1006. * @{
  1007. */
  1008. /**
  1009. * @brief Enable compare match interrupt (CMPMIE).
  1010. * @rmtoll IER CMPMIE LL_LPTIM_EnableIT_CMPM
  1011. * @param LPTIMx Low-Power Timer instance
  1012. * @retval None
  1013. */
  1014. __STATIC_INLINE void LL_LPTIM_EnableIT_CMPM(LPTIM_TypeDef *LPTIMx)
  1015. {
  1016. SET_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE);
  1017. }
  1018. /**
  1019. * @brief Disable compare match interrupt (CMPMIE).
  1020. * @rmtoll IER CMPMIE LL_LPTIM_DisableIT_CMPM
  1021. * @param LPTIMx Low-Power Timer instance
  1022. * @retval None
  1023. */
  1024. __STATIC_INLINE void LL_LPTIM_DisableIT_CMPM(LPTIM_TypeDef *LPTIMx)
  1025. {
  1026. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE);
  1027. }
  1028. /**
  1029. * @brief Indicates whether the compare match interrupt (CMPMIE) is enabled.
  1030. * @rmtoll IER CMPMIE LL_LPTIM_IsEnabledIT_CMPM
  1031. * @param LPTIMx Low-Power Timer instance
  1032. * @retval State of bit (1 or 0).
  1033. */
  1034. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPM(LPTIM_TypeDef *LPTIMx)
  1035. {
  1036. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_CMPMIE) == LPTIM_IER_CMPMIE) ? 1UL : 0UL));
  1037. }
  1038. /**
  1039. * @brief Enable autoreload match interrupt (ARRMIE).
  1040. * @rmtoll IER ARRMIE LL_LPTIM_EnableIT_ARRM
  1041. * @param LPTIMx Low-Power Timer instance
  1042. * @retval None
  1043. */
  1044. __STATIC_INLINE void LL_LPTIM_EnableIT_ARRM(LPTIM_TypeDef *LPTIMx)
  1045. {
  1046. SET_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE);
  1047. }
  1048. /**
  1049. * @brief Disable autoreload match interrupt (ARRMIE).
  1050. * @rmtoll IER ARRMIE LL_LPTIM_DisableIT_ARRM
  1051. * @param LPTIMx Low-Power Timer instance
  1052. * @retval None
  1053. */
  1054. __STATIC_INLINE void LL_LPTIM_DisableIT_ARRM(LPTIM_TypeDef *LPTIMx)
  1055. {
  1056. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE);
  1057. }
  1058. /**
  1059. * @brief Indicates whether the autoreload match interrupt (ARRMIE) is enabled.
  1060. * @rmtoll IER ARRMIE LL_LPTIM_IsEnabledIT_ARRM
  1061. * @param LPTIMx Low-Power Timer instance
  1062. * @retval State of bit (1 or 0).
  1063. */
  1064. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARRM(LPTIM_TypeDef *LPTIMx)
  1065. {
  1066. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE) == LPTIM_IER_ARRMIE) ? 1UL : 0UL));
  1067. }
  1068. /**
  1069. * @brief Enable external trigger valid edge interrupt (EXTTRIGIE).
  1070. * @rmtoll IER EXTTRIGIE LL_LPTIM_EnableIT_EXTTRIG
  1071. * @param LPTIMx Low-Power Timer instance
  1072. * @retval None
  1073. */
  1074. __STATIC_INLINE void LL_LPTIM_EnableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx)
  1075. {
  1076. SET_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE);
  1077. }
  1078. /**
  1079. * @brief Disable external trigger valid edge interrupt (EXTTRIGIE).
  1080. * @rmtoll IER EXTTRIGIE LL_LPTIM_DisableIT_EXTTRIG
  1081. * @param LPTIMx Low-Power Timer instance
  1082. * @retval None
  1083. */
  1084. __STATIC_INLINE void LL_LPTIM_DisableIT_EXTTRIG(LPTIM_TypeDef *LPTIMx)
  1085. {
  1086. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE);
  1087. }
  1088. /**
  1089. * @brief Indicates external trigger valid edge interrupt (EXTTRIGIE) is enabled.
  1090. * @rmtoll IER EXTTRIGIE LL_LPTIM_IsEnabledIT_EXTTRIG
  1091. * @param LPTIMx Low-Power Timer instance
  1092. * @retval State of bit (1 or 0).
  1093. */
  1094. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_EXTTRIG(LPTIM_TypeDef *LPTIMx)
  1095. {
  1096. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_EXTTRIGIE) == LPTIM_IER_EXTTRIGIE) ? 1UL : 0UL));
  1097. }
  1098. /**
  1099. * @brief Enable compare register write completed interrupt (CMPOKIE).
  1100. * @rmtoll IER CMPOKIE LL_LPTIM_EnableIT_CMPOK
  1101. * @param LPTIMx Low-Power Timer instance
  1102. * @retval None
  1103. */
  1104. __STATIC_INLINE void LL_LPTIM_EnableIT_CMPOK(LPTIM_TypeDef *LPTIMx)
  1105. {
  1106. SET_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE);
  1107. }
  1108. /**
  1109. * @brief Disable compare register write completed interrupt (CMPOKIE).
  1110. * @rmtoll IER CMPOKIE LL_LPTIM_DisableIT_CMPOK
  1111. * @param LPTIMx Low-Power Timer instance
  1112. * @retval None
  1113. */
  1114. __STATIC_INLINE void LL_LPTIM_DisableIT_CMPOK(LPTIM_TypeDef *LPTIMx)
  1115. {
  1116. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE);
  1117. }
  1118. /**
  1119. * @brief Indicates whether the compare register write completed interrupt (CMPOKIE) is enabled.
  1120. * @rmtoll IER CMPOKIE LL_LPTIM_IsEnabledIT_CMPOK
  1121. * @param LPTIMx Low-Power Timer instance
  1122. * @retval State of bit (1 or 0).
  1123. */
  1124. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_CMPOK(LPTIM_TypeDef *LPTIMx)
  1125. {
  1126. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_CMPOKIE) == LPTIM_IER_CMPOKIE) ? 1UL : 0UL));
  1127. }
  1128. /**
  1129. * @brief Enable autoreload register write completed interrupt (ARROKIE).
  1130. * @rmtoll IER ARROKIE LL_LPTIM_EnableIT_ARROK
  1131. * @param LPTIMx Low-Power Timer instance
  1132. * @retval None
  1133. */
  1134. __STATIC_INLINE void LL_LPTIM_EnableIT_ARROK(LPTIM_TypeDef *LPTIMx)
  1135. {
  1136. SET_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE);
  1137. }
  1138. /**
  1139. * @brief Disable autoreload register write completed interrupt (ARROKIE).
  1140. * @rmtoll IER ARROKIE LL_LPTIM_DisableIT_ARROK
  1141. * @param LPTIMx Low-Power Timer instance
  1142. * @retval None
  1143. */
  1144. __STATIC_INLINE void LL_LPTIM_DisableIT_ARROK(LPTIM_TypeDef *LPTIMx)
  1145. {
  1146. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE);
  1147. }
  1148. /**
  1149. * @brief Indicates whether the autoreload register write completed interrupt (ARROKIE) is enabled.
  1150. * @rmtoll IER ARROKIE LL_LPTIM_IsEnabledIT_ARROK
  1151. * @param LPTIMx Low-Power Timer instance
  1152. * @retval State of bit(1 or 0).
  1153. */
  1154. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARROK(LPTIM_TypeDef *LPTIMx)
  1155. {
  1156. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE) == LPTIM_IER_ARROKIE) ? 1UL : 0UL));
  1157. }
  1158. /**
  1159. * @brief Enable direction change to up interrupt (UPIE).
  1160. * @rmtoll IER UPIE LL_LPTIM_EnableIT_UP
  1161. * @param LPTIMx Low-Power Timer instance
  1162. * @retval None
  1163. */
  1164. __STATIC_INLINE void LL_LPTIM_EnableIT_UP(LPTIM_TypeDef *LPTIMx)
  1165. {
  1166. SET_BIT(LPTIMx->IER, LPTIM_IER_UPIE);
  1167. }
  1168. /**
  1169. * @brief Disable direction change to up interrupt (UPIE).
  1170. * @rmtoll IER UPIE LL_LPTIM_DisableIT_UP
  1171. * @param LPTIMx Low-Power Timer instance
  1172. * @retval None
  1173. */
  1174. __STATIC_INLINE void LL_LPTIM_DisableIT_UP(LPTIM_TypeDef *LPTIMx)
  1175. {
  1176. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_UPIE);
  1177. }
  1178. /**
  1179. * @brief Indicates whether the direction change to up interrupt (UPIE) is enabled.
  1180. * @rmtoll IER UPIE LL_LPTIM_IsEnabledIT_UP
  1181. * @param LPTIMx Low-Power Timer instance
  1182. * @retval State of bit(1 or 0).
  1183. */
  1184. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_UP(LPTIM_TypeDef *LPTIMx)
  1185. {
  1186. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_UPIE) == LPTIM_IER_UPIE) ? 1UL : 0UL));
  1187. }
  1188. /**
  1189. * @brief Enable direction change to down interrupt (DOWNIE).
  1190. * @rmtoll IER DOWNIE LL_LPTIM_EnableIT_DOWN
  1191. * @param LPTIMx Low-Power Timer instance
  1192. * @retval None
  1193. */
  1194. __STATIC_INLINE void LL_LPTIM_EnableIT_DOWN(LPTIM_TypeDef *LPTIMx)
  1195. {
  1196. SET_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE);
  1197. }
  1198. /**
  1199. * @brief Disable direction change to down interrupt (DOWNIE).
  1200. * @rmtoll IER DOWNIE LL_LPTIM_DisableIT_DOWN
  1201. * @param LPTIMx Low-Power Timer instance
  1202. * @retval None
  1203. */
  1204. __STATIC_INLINE void LL_LPTIM_DisableIT_DOWN(LPTIM_TypeDef *LPTIMx)
  1205. {
  1206. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE);
  1207. }
  1208. /**
  1209. * @brief Indicates whether the direction change to down interrupt (DOWNIE) is enabled.
  1210. * @rmtoll IER DOWNIE LL_LPTIM_IsEnabledIT_DOWN
  1211. * @param LPTIMx Low-Power Timer instance
  1212. * @retval State of bit(1 or 0).
  1213. */
  1214. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_DOWN(LPTIM_TypeDef *LPTIMx)
  1215. {
  1216. return ((READ_BIT(LPTIMx->IER, LPTIM_IER_DOWNIE) == LPTIM_IER_DOWNIE) ? 1UL : 0UL);
  1217. }
  1218. /**
  1219. * @}
  1220. */
  1221. /**
  1222. * @}
  1223. */
  1224. /**
  1225. * @}
  1226. */
  1227. #endif /* LPTIM1 */
  1228. /**
  1229. * @}
  1230. */
  1231. #ifdef __cplusplus
  1232. }
  1233. #endif
  1234. #endif /* STM32F4xx_LL_LPTIM_H */
  1235. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/