py32f002b_ll_lptim.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. /**
  2. ******************************************************************************
  3. * @file py32f002b_ll_lptim.h
  4. * @author MCU Application Team
  5. * @brief Header file of LPTIM LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya 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. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef PY32F002B_LL_LPTIM_H
  32. #define PY32F002B_LL_LPTIM_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "py32f0xx.h"
  38. /** @addtogroup PY32F002B_LL_Driver
  39. * @{
  40. */
  41. #if defined (LPTIM)
  42. /** @defgroup LPTIM_LL LPTIM
  43. * @{
  44. */
  45. /* Private types -------------------------------------------------------------*/
  46. /* Private variables ---------------------------------------------------------*/
  47. /* Private constants ---------------------------------------------------------*/
  48. /* Private macros ------------------------------------------------------------*/
  49. #if defined(USE_FULL_LL_DRIVER)
  50. /** @defgroup LPTIM_LL_Private_Macros LPTIM Private Macros
  51. * @{
  52. */
  53. /**
  54. * @}
  55. */
  56. #endif /*USE_FULL_LL_DRIVER*/
  57. /* Exported types ------------------------------------------------------------*/
  58. #if defined(USE_FULL_LL_DRIVER)
  59. /** @defgroup LPTIM_LL_ES_INIT LPTIM Exported Init structure
  60. * @{
  61. */
  62. /**
  63. * @brief LPTIM Init structure definition
  64. */
  65. typedef struct
  66. {
  67. uint32_t Prescaler; /*!< Specifies the prescaler division ratio.
  68. This parameter can be a value of @ref LPTIM_LL_EC_PRESCALER.
  69. This feature can be modified afterwards using using unitary
  70. function @ref LL_LPTIM_SetPrescaler().*/
  71. uint32_t UpdateMode; /*!< Specifies whether to update immediately or after the end
  72. of current period.
  73. This parameter can be a value of @ref LPTIM_LL_EC_UPDATE_MODE
  74. This feature can be modified afterwards using using unitary
  75. function @ref LL_LPTIM_SetUpdateMode().*/
  76. } LL_LPTIM_InitTypeDef;
  77. /**
  78. * @}
  79. */
  80. #endif /* USE_FULL_LL_DRIVER */
  81. /* Exported constants --------------------------------------------------------*/
  82. /** @defgroup LPTIM_LL_Exported_Constants LPTIM Exported Constants
  83. * @{
  84. */
  85. /** @defgroup LPTIM_LL_EC_GET_FLAG Get Flags Defines
  86. * @brief Flags defines which can be used with LL_LPTIM_ReadReg function
  87. * @{
  88. */
  89. #define LL_LPTIM_ISR_ARRM LPTIM_ISR_ARRM /*!< Autoreload match */
  90. #define LL_LPTIM_ISR_ARROK LPTIM_ISR_ARROK /*!< Auto reload register update OK */
  91. /**
  92. * @}
  93. */
  94. /** @defgroup LPTIM_LL_EC_IT IT Defines
  95. * @brief IT defines which can be used with LL_LPTIM_ReadReg and LL_LPTIM_WriteReg functions
  96. * @{
  97. */
  98. #define LL_LPTIM_IER_ARRMIE LPTIM_IER_ARRMIE /*!< Autoreload match */
  99. #define LL_LPTIM_IER_ARROKIE LPTIM_IER_ARROKIE /*!< Auto reload register update OK interrupt enable */
  100. /**
  101. * @}
  102. */
  103. /** @defgroup LPTIM_LL_EC_OPERATING_MODE Operating Mode
  104. * @{
  105. */
  106. #define LL_LPTIM_OPERATING_MODE_ONESHOT LPTIM_CR_SNGSTRT /*!<LP Tilmer starts in single mode*/
  107. #define LL_LPTIM_OPERATING_MODE_CONTINUOUS LPTIM_CR_CNTSTRT /*!<LP Timer starts in continuous mode*/
  108. /**
  109. * @}
  110. */
  111. /** @defgroup LPTIM_LL_EC_UPDATE_MODE Update Mode
  112. * @{
  113. */
  114. #define LL_LPTIM_UPDATE_MODE_IMMEDIATE 0x00000000U /*!<Preload is disabled: registers are updated after each APB bus write access*/
  115. #define LL_LPTIM_UPDATE_MODE_ENDOFPERIOD LPTIM_CFGR_PRELOAD /*!<preload is enabled: registers are updated at the end of the current LPTIM period*/
  116. /**
  117. * @}
  118. */
  119. /** @defgroup LPTIM_LL_EC_PRESCALER Prescaler Value
  120. * @{
  121. */
  122. #define LL_LPTIM_PRESCALER_DIV1 0x00000000U /*!<Prescaler division factor is set to 1*/
  123. #define LL_LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 /*!<Prescaler division factor is set to 2*/
  124. #define LL_LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 /*!<Prescaler division factor is set to 4*/
  125. #define LL_LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 8*/
  126. #define LL_LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 /*!<Prescaler division factor is set to 16*/
  127. #define LL_LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_0) /*!<Prescaler division factor is set to 32*/
  128. #define LL_LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_2 | LPTIM_CFGR_PRESC_1) /*!<Prescaler division factor is set to 64*/
  129. #define LL_LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC /*!<Prescaler division factor is set to 128*/
  130. /**
  131. * @}
  132. */
  133. /**
  134. * @}
  135. */
  136. /* Exported macro ------------------------------------------------------------*/
  137. /** @defgroup LPTIM_LL_Exported_Macros LPTIM Exported Macros
  138. * @{
  139. */
  140. /** @defgroup LPTIM_LL_EM_WRITE_READ Common Write and read registers Macros
  141. * @{
  142. */
  143. /**
  144. * @brief Write a value in LPTIM register
  145. * @param __INSTANCE__ LPTIM Instance
  146. * @param __REG__ Register to be written
  147. * @param __VALUE__ Value to be written in the register
  148. * @retval None
  149. */
  150. #define LL_LPTIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
  151. /**
  152. * @brief Read a value in LPTIM register
  153. * @param __INSTANCE__ LPTIM Instance
  154. * @param __REG__ Register to be read
  155. * @retval Register value
  156. */
  157. #define LL_LPTIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
  158. /**
  159. * @}
  160. */
  161. /**
  162. * @}
  163. */
  164. /* Exported functions --------------------------------------------------------*/
  165. /** @defgroup LPTIM_LL_Exported_Functions LPTIM Exported Functions
  166. * @{
  167. */
  168. #if defined(USE_FULL_LL_DRIVER)
  169. /** @defgroup LPTIM_LL_EF_Init Initialisation and deinitialisation functions
  170. * @{
  171. */
  172. ErrorStatus LL_LPTIM_DeInit(LPTIM_TypeDef *LPTIMx);
  173. void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct);
  174. ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, LL_LPTIM_InitTypeDef *LPTIM_InitStruct);
  175. /**
  176. * @}
  177. */
  178. #endif /* USE_FULL_LL_DRIVER */
  179. /** @defgroup LPTIM_LL_EF_LPTIM_Configuration LPTIM Configuration
  180. * @{
  181. */
  182. /**
  183. * @brief Enable the LPTIM instance
  184. * @note After setting the ENABLE bit, a delay of two counter clock is needed
  185. * before the LPTIM instance is actually enabled.
  186. * @rmtoll CR ENABLE LL_LPTIM_Enable
  187. * @param LPTIMx Low-Power Timer instance
  188. * @retval None
  189. */
  190. __STATIC_INLINE void LL_LPTIM_Enable(LPTIM_TypeDef *LPTIMx)
  191. {
  192. SET_BIT(LPTIMx->CR, LPTIM_CR_ENABLE);
  193. }
  194. /**
  195. * @brief Disable the LPTIM instance
  196. * @rmtoll CR ENABLE LL_LPTIM_Disable
  197. * @param LPTIMx Low-Power Timer instance
  198. * @retval None
  199. */
  200. __STATIC_INLINE void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx)
  201. {
  202. CLEAR_BIT(LPTIMx->CR, LPTIM_CR_ENABLE);
  203. }
  204. /**
  205. * @brief Indicates whether the LPTIM instance is enabled.
  206. * @rmtoll CR ENABLE LL_LPTIM_IsEnabled
  207. * @param LPTIMx Low-Power Timer instance
  208. * @retval State of bit (1 or 0).
  209. */
  210. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabled(LPTIM_TypeDef *LPTIMx)
  211. {
  212. return (((READ_BIT(LPTIMx->CR, LPTIM_CR_ENABLE) == LPTIM_CR_ENABLE) ? 1UL : 0UL));
  213. }
  214. /**
  215. * @brief Starts the LPTIM counter in the desired mode.
  216. * @note LPTIM instance must be enabled before starting the counter.
  217. * @rmtoll CR SNGSTRT LL_LPTIM_StartCounter\n
  218. * CR CNTSTRT LL_LPTIM_StartCounter
  219. * @param LPTIMx Low-Power Timer instance
  220. * @param OperatingMode This parameter can be one of the following values:
  221. * @arg @ref LL_LPTIM_OPERATING_MODE_ONESHOT
  222. * @arg @ref LL_LPTIM_OPERATING_MODE_CONTINUOUS
  223. * @retval None
  224. */
  225. __STATIC_INLINE void LL_LPTIM_StartCounter(LPTIM_TypeDef *LPTIMx, uint32_t OperatingMode)
  226. {
  227. MODIFY_REG(LPTIMx->CR, LPTIM_CR_SNGSTRT | LPTIM_CR_CNTSTRT, OperatingMode);
  228. }
  229. /**
  230. * @brief Enable reset after read.
  231. * @note After calling this function any read access to LPTIM_CNT
  232. * register will asynchronously reset the LPTIM_CNT register content.
  233. * @rmtoll CR RSTARE LL_LPTIM_EnableResetAfterRead
  234. * @param LPTIMx Low-Power Timer instance
  235. * @retval None
  236. */
  237. __STATIC_INLINE void LL_LPTIM_EnableResetAfterRead(LPTIM_TypeDef *LPTIMx)
  238. {
  239. SET_BIT(LPTIMx->CR, LPTIM_CR_RSTARE);
  240. }
  241. /**
  242. * @brief Disable reset after read.
  243. * @rmtoll CR RSTARE LL_LPTIM_DisableResetAfterRead
  244. * @param LPTIMx Low-Power Timer instance
  245. * @retval None
  246. */
  247. __STATIC_INLINE void LL_LPTIM_DisableResetAfterRead(LPTIM_TypeDef *LPTIMx)
  248. {
  249. CLEAR_BIT(LPTIMx->CR, LPTIM_CR_RSTARE);
  250. }
  251. /**
  252. * @brief Indicate whether the reset after read feature is enabled.
  253. * @rmtoll CR RSTARE LL_LPTIM_IsEnabledResetAfterRead
  254. * @param LPTIMx Low-Power Timer instance
  255. * @retval State of bit (1 or 0).
  256. */
  257. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledResetAfterRead(LPTIM_TypeDef *LPTIMx)
  258. {
  259. return (((READ_BIT(LPTIMx->CR, LPTIM_CR_RSTARE) == LPTIM_CR_RSTARE) ? 1UL : 0UL));
  260. }
  261. /**
  262. * @brief Reset of the LPTIM_CNT counter register (synchronous).
  263. * @note Due to the synchronous nature of this reset, it only takes
  264. * place after a synchronization delay of 3 LPTIM core clock cycles
  265. * (LPTIM core clock may be different from APB clock).
  266. * @note COUNTRST is automatically cleared by hardware
  267. * @rmtoll CR COUNTRST LL_LPTIM_ResetCounter\n
  268. * @param LPTIMx Low-Power Timer instance
  269. * @retval None
  270. */
  271. __STATIC_INLINE void LL_LPTIM_ResetCounter(LPTIM_TypeDef *LPTIMx)
  272. {
  273. SET_BIT(LPTIMx->CR, LPTIM_CR_COUNTRST);
  274. }
  275. /**
  276. * @brief Set the LPTIM registers update mode (enable/disable register preload)
  277. * @note This function must be called when the LPTIM instance is disabled.
  278. * @rmtoll CFGR PRELOAD LL_LPTIM_SetUpdateMode
  279. * @param LPTIMx Low-Power Timer instance
  280. * @param UpdateMode This parameter can be one of the following values:
  281. * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE
  282. * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD
  283. * @retval None
  284. */
  285. __STATIC_INLINE void LL_LPTIM_SetUpdateMode(LPTIM_TypeDef *LPTIMx, uint32_t UpdateMode)
  286. {
  287. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD, UpdateMode);
  288. }
  289. /**
  290. * @brief Get the LPTIM registers update mode
  291. * @rmtoll CFGR PRELOAD LL_LPTIM_GetUpdateMode
  292. * @param LPTIMx Low-Power Timer instance
  293. * @retval Returned value can be one of the following values:
  294. * @arg @ref LL_LPTIM_UPDATE_MODE_IMMEDIATE
  295. * @arg @ref LL_LPTIM_UPDATE_MODE_ENDOFPERIOD
  296. */
  297. __STATIC_INLINE uint32_t LL_LPTIM_GetUpdateMode(LPTIM_TypeDef *LPTIMx)
  298. {
  299. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRELOAD));
  300. }
  301. /**
  302. * @brief Set the auto reload value
  303. * @note The LPTIMx_ARR register content must only be modified when the LPTIM is enabled
  304. * @note After a write to the LPTIMx_ARR register a new write operation to the
  305. * same register can only be performed when the previous write operation
  306. * is completed. Any successive write before the ARROK flag is set, will
  307. * lead to unpredictable results.
  308. * @note autoreload value be strictly greater than the compare value.
  309. * @rmtoll ARR ARR LL_LPTIM_SetAutoReload
  310. * @param LPTIMx Low-Power Timer instance
  311. * @param AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF
  312. * @retval None
  313. */
  314. __STATIC_INLINE void LL_LPTIM_SetAutoReload(LPTIM_TypeDef *LPTIMx, uint32_t AutoReload)
  315. {
  316. MODIFY_REG(LPTIMx->ARR, LPTIM_ARR_ARR, AutoReload);
  317. }
  318. /**
  319. * @brief Get actual auto reload value
  320. * @rmtoll ARR ARR LL_LPTIM_GetAutoReload
  321. * @param LPTIMx Low-Power Timer instance
  322. * @retval AutoReload Value between Min_Data=0x00 and Max_Data=0xFFFF
  323. */
  324. __STATIC_INLINE uint32_t LL_LPTIM_GetAutoReload(LPTIM_TypeDef *LPTIMx)
  325. {
  326. return (uint32_t)(READ_BIT(LPTIMx->ARR, LPTIM_ARR_ARR));
  327. }
  328. /**
  329. * @brief Get actual counter value
  330. * @note When the LPTIM instance is running with an asynchronous clock, reading
  331. * the LPTIMx_CNT register may return unreliable values. So in this case
  332. * it is necessary to perform two consecutive read accesses and verify
  333. * that the two returned values are identical.
  334. * @rmtoll CNT CNT LL_LPTIM_GetCounter
  335. * @param LPTIMx Low-Power Timer instance
  336. * @retval Counter value
  337. */
  338. __STATIC_INLINE uint32_t LL_LPTIM_GetCounter(LPTIM_TypeDef *LPTIMx)
  339. {
  340. return (uint32_t)(READ_BIT(LPTIMx->CNT, LPTIM_CNT_CNT));
  341. }
  342. /**
  343. * @brief Set actual prescaler division ratio.
  344. * @note This function must be called when the LPTIM instance is disabled.
  345. * @note When the LPTIM is configured to be clocked by an internal clock source
  346. * and the LPTIM counter is configured to be updated by active edges
  347. * detected on the LPTIM external Input1, the internal clock provided to
  348. * the LPTIM must be not be prescaled.
  349. * @rmtoll CFGR PRESC LL_LPTIM_SetPrescaler
  350. * @param LPTIMx Low-Power Timer instance
  351. * @param Prescaler This parameter can be one of the following values:
  352. * @arg @ref LL_LPTIM_PRESCALER_DIV1
  353. * @arg @ref LL_LPTIM_PRESCALER_DIV2
  354. * @arg @ref LL_LPTIM_PRESCALER_DIV4
  355. * @arg @ref LL_LPTIM_PRESCALER_DIV8
  356. * @arg @ref LL_LPTIM_PRESCALER_DIV16
  357. * @arg @ref LL_LPTIM_PRESCALER_DIV32
  358. * @arg @ref LL_LPTIM_PRESCALER_DIV64
  359. * @arg @ref LL_LPTIM_PRESCALER_DIV128
  360. * @retval None
  361. */
  362. __STATIC_INLINE void LL_LPTIM_SetPrescaler(LPTIM_TypeDef *LPTIMx, uint32_t Prescaler)
  363. {
  364. MODIFY_REG(LPTIMx->CFGR, LPTIM_CFGR_PRESC, Prescaler);
  365. }
  366. /**
  367. * @brief Get actual prescaler division ratio.
  368. * @rmtoll CFGR PRESC LL_LPTIM_GetPrescaler
  369. * @param LPTIMx Low-Power Timer instance
  370. * @retval Returned value can be one of the following values:
  371. * @arg @ref LL_LPTIM_PRESCALER_DIV1
  372. * @arg @ref LL_LPTIM_PRESCALER_DIV2
  373. * @arg @ref LL_LPTIM_PRESCALER_DIV4
  374. * @arg @ref LL_LPTIM_PRESCALER_DIV8
  375. * @arg @ref LL_LPTIM_PRESCALER_DIV16
  376. * @arg @ref LL_LPTIM_PRESCALER_DIV32
  377. * @arg @ref LL_LPTIM_PRESCALER_DIV64
  378. * @arg @ref LL_LPTIM_PRESCALER_DIV128
  379. */
  380. __STATIC_INLINE uint32_t LL_LPTIM_GetPrescaler(LPTIM_TypeDef *LPTIMx)
  381. {
  382. return (uint32_t)(READ_BIT(LPTIMx->CFGR, LPTIM_CFGR_PRESC));
  383. }
  384. /**
  385. * @}
  386. */
  387. /** @defgroup LPTIM_LL_EF_FLAG_Management FLAG Management
  388. * @{
  389. */
  390. /**
  391. * @brief Clear the autoreload match flag (ARRMCF)
  392. * @rmtoll ICR ARRMCF LL_LPTIM_ClearFLAG_ARRM
  393. * @param LPTIMx Low-Power Timer instance
  394. * @retval None
  395. */
  396. __STATIC_INLINE void LL_LPTIM_ClearFLAG_ARRM(LPTIM_TypeDef *LPTIMx)
  397. {
  398. SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARRMCF);
  399. }
  400. /**
  401. * @brief Clear the autoreload register update OK flag (ARROKCF)
  402. * @param LPTIMx Low-Power Timer instance
  403. * @retval None
  404. */
  405. __STATIC_INLINE void LL_LPTIM_ClearFLAG_ARROK(LPTIM_TypeDef *LPTIMx)
  406. {
  407. SET_BIT(LPTIMx->ICR, LPTIM_ICR_ARROKCF);
  408. }
  409. /**
  410. * @brief Inform application whether a autoreload match interrupt has occurred.
  411. * @rmtoll ISR ARRM LL_LPTIM_IsActiveFlag_ARRM
  412. * @param LPTIMx Low-Power Timer instance
  413. * @retval State of bit (1 or 0).
  414. */
  415. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARRM(LPTIM_TypeDef *LPTIMx)
  416. {
  417. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARRM) == LPTIM_ISR_ARRM) ? 1UL : 0UL));
  418. }
  419. /**
  420. * @brief Inform application whether a autoreload register update OK has occurred.
  421. * @param LPTIMx Low-Power Timer instance
  422. * @retval State of bit (1 or 0).
  423. */
  424. __STATIC_INLINE uint32_t LL_LPTIM_IsActiveFlag_ARROK(LPTIM_TypeDef *LPTIMx)
  425. {
  426. return (((READ_BIT(LPTIMx->ISR, LPTIM_ISR_ARROK) == LPTIM_ISR_ARROK) ? 1UL : 0UL));
  427. }
  428. /**
  429. * @}
  430. */
  431. /** @defgroup LPTIM_LL_EF_IT_Management Interrupt Management
  432. * @{
  433. */
  434. /**
  435. * @brief Enable autoreload match interrupt (ARRMIE).
  436. * @rmtoll IER ARRMIE LL_LPTIM_EnableIT_ARRM
  437. * @param LPTIMx Low-Power Timer instance
  438. * @retval None
  439. */
  440. __STATIC_INLINE void LL_LPTIM_EnableIT_ARRM(LPTIM_TypeDef *LPTIMx)
  441. {
  442. SET_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE);
  443. }
  444. /**
  445. * @brief Disable autoreload match interrupt (ARRMIE).
  446. * @rmtoll IER ARRMIE LL_LPTIM_DisableIT_ARRM
  447. * @param LPTIMx Low-Power Timer instance
  448. * @retval None
  449. */
  450. __STATIC_INLINE void LL_LPTIM_DisableIT_ARRM(LPTIM_TypeDef *LPTIMx)
  451. {
  452. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE);
  453. }
  454. /**
  455. * @brief Indicates whether the autoreload match interrupt (ARRMIE) is enabled.
  456. * @rmtoll IER ARRMIE LL_LPTIM_IsEnabledIT_ARRM
  457. * @param LPTIMx Low-Power Timer instance
  458. * @retval State of bit (1 or 0).
  459. */
  460. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARRM(LPTIM_TypeDef *LPTIMx)
  461. {
  462. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARRMIE) == LPTIM_IER_ARRMIE) ? 1UL : 0UL));
  463. }
  464. /**
  465. * @brief Enable autoreload register update OK interrupt (ARROKIE).
  466. * @param LPTIMx Low-Power Timer instance
  467. * @retval None
  468. */
  469. __STATIC_INLINE void LL_LPTIM_EnableIT_ARROK(LPTIM_TypeDef *LPTIMx)
  470. {
  471. SET_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE);
  472. }
  473. /**
  474. * @brief Disable autoreload register update OK interrupt (ARROKIE).
  475. * @param LPTIMx Low-Power Timer instance
  476. * @retval None
  477. */
  478. __STATIC_INLINE void LL_LPTIM_DisableIT_ARROK(LPTIM_TypeDef *LPTIMx)
  479. {
  480. CLEAR_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE);
  481. }
  482. /**
  483. * @brief Indicates whether the autoreload register update OK interrupt (ARROKIE) is enabled.
  484. * @param LPTIMx Low-Power Timer instance
  485. * @retval State of bit (1 or 0).
  486. */
  487. __STATIC_INLINE uint32_t LL_LPTIM_IsEnabledIT_ARROK(LPTIM_TypeDef *LPTIMx)
  488. {
  489. return (((READ_BIT(LPTIMx->IER, LPTIM_IER_ARROKIE) == LPTIM_IER_ARROKIE) ? 1UL : 0UL));
  490. }
  491. /**
  492. * @}
  493. */
  494. /**
  495. * @}
  496. */
  497. /**
  498. * @}
  499. */
  500. #endif /* LPTIM */
  501. /**
  502. * @}
  503. */
  504. #ifdef __cplusplus
  505. }
  506. #endif
  507. #endif /* PY32F002B_LL_LPTIM_H */
  508. /************************ (C) COPYRIGHT Puya *****END OF FILE****/