stm32f4xx_ll_lptim.h 52 KB

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