stm32f1xx_ll_exti.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_exti.h
  4. * @author MCD Application Team
  5. * @brief Header file of EXTI LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32F1xx_LL_EXTI_H
  20. #define STM32F1xx_LL_EXTI_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f1xx.h"
  26. /** @addtogroup STM32F1xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (EXTI)
  30. /** @defgroup EXTI_LL EXTI
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /* Private constants ---------------------------------------------------------*/
  36. /* Private Macros ------------------------------------------------------------*/
  37. #if defined(USE_FULL_LL_DRIVER)
  38. /** @defgroup EXTI_LL_Private_Macros EXTI Private Macros
  39. * @{
  40. */
  41. /**
  42. * @}
  43. */
  44. #endif /*USE_FULL_LL_DRIVER*/
  45. /* Exported types ------------------------------------------------------------*/
  46. #if defined(USE_FULL_LL_DRIVER)
  47. /** @defgroup EXTI_LL_ES_INIT EXTI Exported Init structure
  48. * @{
  49. */
  50. typedef struct
  51. {
  52. uint32_t Line_0_31; /*!< Specifies the EXTI lines to be enabled or disabled for Lines in range 0 to 31
  53. This parameter can be any combination of @ref EXTI_LL_EC_LINE */
  54. FunctionalState LineCommand; /*!< Specifies the new state of the selected EXTI lines.
  55. This parameter can be set either to ENABLE or DISABLE */
  56. uint8_t Mode; /*!< Specifies the mode for the EXTI lines.
  57. This parameter can be a value of @ref EXTI_LL_EC_MODE. */
  58. uint8_t Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
  59. This parameter can be a value of @ref EXTI_LL_EC_TRIGGER. */
  60. } LL_EXTI_InitTypeDef;
  61. /**
  62. * @}
  63. */
  64. #endif /*USE_FULL_LL_DRIVER*/
  65. /* Exported constants --------------------------------------------------------*/
  66. /** @defgroup EXTI_LL_Exported_Constants EXTI Exported Constants
  67. * @{
  68. */
  69. /** @defgroup EXTI_LL_EC_LINE LINE
  70. * @{
  71. */
  72. #define LL_EXTI_LINE_0 EXTI_IMR_IM0 /*!< Extended line 0 */
  73. #define LL_EXTI_LINE_1 EXTI_IMR_IM1 /*!< Extended line 1 */
  74. #define LL_EXTI_LINE_2 EXTI_IMR_IM2 /*!< Extended line 2 */
  75. #define LL_EXTI_LINE_3 EXTI_IMR_IM3 /*!< Extended line 3 */
  76. #define LL_EXTI_LINE_4 EXTI_IMR_IM4 /*!< Extended line 4 */
  77. #define LL_EXTI_LINE_5 EXTI_IMR_IM5 /*!< Extended line 5 */
  78. #define LL_EXTI_LINE_6 EXTI_IMR_IM6 /*!< Extended line 6 */
  79. #define LL_EXTI_LINE_7 EXTI_IMR_IM7 /*!< Extended line 7 */
  80. #define LL_EXTI_LINE_8 EXTI_IMR_IM8 /*!< Extended line 8 */
  81. #define LL_EXTI_LINE_9 EXTI_IMR_IM9 /*!< Extended line 9 */
  82. #define LL_EXTI_LINE_10 EXTI_IMR_IM10 /*!< Extended line 10 */
  83. #define LL_EXTI_LINE_11 EXTI_IMR_IM11 /*!< Extended line 11 */
  84. #define LL_EXTI_LINE_12 EXTI_IMR_IM12 /*!< Extended line 12 */
  85. #define LL_EXTI_LINE_13 EXTI_IMR_IM13 /*!< Extended line 13 */
  86. #define LL_EXTI_LINE_14 EXTI_IMR_IM14 /*!< Extended line 14 */
  87. #define LL_EXTI_LINE_15 EXTI_IMR_IM15 /*!< Extended line 15 */
  88. #if defined(EXTI_IMR_IM16)
  89. #define LL_EXTI_LINE_16 EXTI_IMR_IM16 /*!< Extended line 16 */
  90. #endif
  91. #define LL_EXTI_LINE_17 EXTI_IMR_IM17 /*!< Extended line 17 */
  92. #if defined(EXTI_IMR_IM18)
  93. #define LL_EXTI_LINE_18 EXTI_IMR_IM18 /*!< Extended line 18 */
  94. #endif
  95. #if defined(EXTI_IMR_IM19)
  96. #define LL_EXTI_LINE_19 EXTI_IMR_IM19 /*!< Extended line 19 */
  97. #endif
  98. #if defined(EXTI_IMR_IM20)
  99. #define LL_EXTI_LINE_20 EXTI_IMR_IM20 /*!< Extended line 20 */
  100. #endif
  101. #if defined(EXTI_IMR_IM21)
  102. #define LL_EXTI_LINE_21 EXTI_IMR_IM21 /*!< Extended line 21 */
  103. #endif
  104. #if defined(EXTI_IMR_IM22)
  105. #define LL_EXTI_LINE_22 EXTI_IMR_IM22 /*!< Extended line 22 */
  106. #endif
  107. #if defined(EXTI_IMR_IM23)
  108. #define LL_EXTI_LINE_23 EXTI_IMR_IM23 /*!< Extended line 23 */
  109. #endif
  110. #if defined(EXTI_IMR_IM24)
  111. #define LL_EXTI_LINE_24 EXTI_IMR_IM24 /*!< Extended line 24 */
  112. #endif
  113. #if defined(EXTI_IMR_IM25)
  114. #define LL_EXTI_LINE_25 EXTI_IMR_IM25 /*!< Extended line 25 */
  115. #endif
  116. #if defined(EXTI_IMR_IM26)
  117. #define LL_EXTI_LINE_26 EXTI_IMR_IM26 /*!< Extended line 26 */
  118. #endif
  119. #if defined(EXTI_IMR_IM27)
  120. #define LL_EXTI_LINE_27 EXTI_IMR_IM27 /*!< Extended line 27 */
  121. #endif
  122. #if defined(EXTI_IMR_IM28)
  123. #define LL_EXTI_LINE_28 EXTI_IMR_IM28 /*!< Extended line 28 */
  124. #endif
  125. #if defined(EXTI_IMR_IM29)
  126. #define LL_EXTI_LINE_29 EXTI_IMR_IM29 /*!< Extended line 29 */
  127. #endif
  128. #if defined(EXTI_IMR_IM30)
  129. #define LL_EXTI_LINE_30 EXTI_IMR_IM30 /*!< Extended line 30 */
  130. #endif
  131. #if defined(EXTI_IMR_IM31)
  132. #define LL_EXTI_LINE_31 EXTI_IMR_IM31 /*!< Extended line 31 */
  133. #endif
  134. #define LL_EXTI_LINE_ALL_0_31 EXTI_IMR_IM /*!< All Extended line not reserved*/
  135. #define LL_EXTI_LINE_ALL (0xFFFFFFFFU) /*!< All Extended line */
  136. #if defined(USE_FULL_LL_DRIVER)
  137. #define LL_EXTI_LINE_NONE (0x00000000U) /*!< None Extended line */
  138. #endif /*USE_FULL_LL_DRIVER*/
  139. /**
  140. * @}
  141. */
  142. #if defined(USE_FULL_LL_DRIVER)
  143. /** @defgroup EXTI_LL_EC_MODE Mode
  144. * @{
  145. */
  146. #define LL_EXTI_MODE_IT ((uint8_t)0x00) /*!< Interrupt Mode */
  147. #define LL_EXTI_MODE_EVENT ((uint8_t)0x01) /*!< Event Mode */
  148. #define LL_EXTI_MODE_IT_EVENT ((uint8_t)0x02) /*!< Interrupt & Event Mode */
  149. /**
  150. * @}
  151. */
  152. /** @defgroup EXTI_LL_EC_TRIGGER Edge Trigger
  153. * @{
  154. */
  155. #define LL_EXTI_TRIGGER_NONE ((uint8_t)0x00) /*!< No Trigger Mode */
  156. #define LL_EXTI_TRIGGER_RISING ((uint8_t)0x01) /*!< Trigger Rising Mode */
  157. #define LL_EXTI_TRIGGER_FALLING ((uint8_t)0x02) /*!< Trigger Falling Mode */
  158. #define LL_EXTI_TRIGGER_RISING_FALLING ((uint8_t)0x03) /*!< Trigger Rising & Falling Mode */
  159. /**
  160. * @}
  161. */
  162. #endif /*USE_FULL_LL_DRIVER*/
  163. /**
  164. * @}
  165. */
  166. /* Exported macro ------------------------------------------------------------*/
  167. /** @defgroup EXTI_LL_Exported_Macros EXTI Exported Macros
  168. * @{
  169. */
  170. /** @defgroup EXTI_LL_EM_WRITE_READ Common Write and read registers Macros
  171. * @{
  172. */
  173. /**
  174. * @brief Write a value in EXTI register
  175. * @param __REG__ Register to be written
  176. * @param __VALUE__ Value to be written in the register
  177. * @retval None
  178. */
  179. #define LL_EXTI_WriteReg(__REG__, __VALUE__) WRITE_REG(EXTI->__REG__, (__VALUE__))
  180. /**
  181. * @brief Read a value in EXTI register
  182. * @param __REG__ Register to be read
  183. * @retval Register value
  184. */
  185. #define LL_EXTI_ReadReg(__REG__) READ_REG(EXTI->__REG__)
  186. /**
  187. * @}
  188. */
  189. /**
  190. * @}
  191. */
  192. /* Exported functions --------------------------------------------------------*/
  193. /** @defgroup EXTI_LL_Exported_Functions EXTI Exported Functions
  194. * @{
  195. */
  196. /** @defgroup EXTI_LL_EF_IT_Management IT_Management
  197. * @{
  198. */
  199. /**
  200. * @brief Enable ExtiLine Interrupt request for Lines in range 0 to 31
  201. * @note The reset value for the direct or internal lines (see RM)
  202. * is set to 1 in order to enable the interrupt by default.
  203. * Bits are set automatically at Power on.
  204. * @rmtoll IMR IMx LL_EXTI_EnableIT_0_31
  205. * @param ExtiLine This parameter can be one of the following values:
  206. * @arg @ref LL_EXTI_LINE_0
  207. * @arg @ref LL_EXTI_LINE_1
  208. * @arg @ref LL_EXTI_LINE_2
  209. * @arg @ref LL_EXTI_LINE_3
  210. * @arg @ref LL_EXTI_LINE_4
  211. * @arg @ref LL_EXTI_LINE_5
  212. * @arg @ref LL_EXTI_LINE_6
  213. * @arg @ref LL_EXTI_LINE_7
  214. * @arg @ref LL_EXTI_LINE_8
  215. * @arg @ref LL_EXTI_LINE_9
  216. * @arg @ref LL_EXTI_LINE_10
  217. * @arg @ref LL_EXTI_LINE_11
  218. * @arg @ref LL_EXTI_LINE_12
  219. * @arg @ref LL_EXTI_LINE_13
  220. * @arg @ref LL_EXTI_LINE_14
  221. * @arg @ref LL_EXTI_LINE_15
  222. * @arg @ref LL_EXTI_LINE_16
  223. * @arg @ref LL_EXTI_LINE_17
  224. * @arg @ref LL_EXTI_LINE_18
  225. * @arg @ref LL_EXTI_LINE_19
  226. * @arg @ref LL_EXTI_LINE_ALL_0_31
  227. * @note Please check each device line mapping for EXTI Line availability
  228. * @retval None
  229. */
  230. __STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine)
  231. {
  232. SET_BIT(EXTI->IMR, ExtiLine);
  233. }
  234. /**
  235. * @brief Disable ExtiLine Interrupt request for Lines in range 0 to 31
  236. * @note The reset value for the direct or internal lines (see RM)
  237. * is set to 1 in order to enable the interrupt by default.
  238. * Bits are set automatically at Power on.
  239. * @rmtoll IMR IMx LL_EXTI_DisableIT_0_31
  240. * @param ExtiLine This parameter can be one of the following values:
  241. * @arg @ref LL_EXTI_LINE_0
  242. * @arg @ref LL_EXTI_LINE_1
  243. * @arg @ref LL_EXTI_LINE_2
  244. * @arg @ref LL_EXTI_LINE_3
  245. * @arg @ref LL_EXTI_LINE_4
  246. * @arg @ref LL_EXTI_LINE_5
  247. * @arg @ref LL_EXTI_LINE_6
  248. * @arg @ref LL_EXTI_LINE_7
  249. * @arg @ref LL_EXTI_LINE_8
  250. * @arg @ref LL_EXTI_LINE_9
  251. * @arg @ref LL_EXTI_LINE_10
  252. * @arg @ref LL_EXTI_LINE_11
  253. * @arg @ref LL_EXTI_LINE_12
  254. * @arg @ref LL_EXTI_LINE_13
  255. * @arg @ref LL_EXTI_LINE_14
  256. * @arg @ref LL_EXTI_LINE_15
  257. * @arg @ref LL_EXTI_LINE_16
  258. * @arg @ref LL_EXTI_LINE_17
  259. * @arg @ref LL_EXTI_LINE_18
  260. * @arg @ref LL_EXTI_LINE_19
  261. * @arg @ref LL_EXTI_LINE_ALL_0_31
  262. * @note Please check each device line mapping for EXTI Line availability
  263. * @retval None
  264. */
  265. __STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine)
  266. {
  267. CLEAR_BIT(EXTI->IMR, ExtiLine);
  268. }
  269. /**
  270. * @brief Indicate if ExtiLine Interrupt request is enabled for Lines in range 0 to 31
  271. * @note The reset value for the direct or internal lines (see RM)
  272. * is set to 1 in order to enable the interrupt by default.
  273. * Bits are set automatically at Power on.
  274. * @rmtoll IMR IMx LL_EXTI_IsEnabledIT_0_31
  275. * @param ExtiLine This parameter can be one of the following values:
  276. * @arg @ref LL_EXTI_LINE_0
  277. * @arg @ref LL_EXTI_LINE_1
  278. * @arg @ref LL_EXTI_LINE_2
  279. * @arg @ref LL_EXTI_LINE_3
  280. * @arg @ref LL_EXTI_LINE_4
  281. * @arg @ref LL_EXTI_LINE_5
  282. * @arg @ref LL_EXTI_LINE_6
  283. * @arg @ref LL_EXTI_LINE_7
  284. * @arg @ref LL_EXTI_LINE_8
  285. * @arg @ref LL_EXTI_LINE_9
  286. * @arg @ref LL_EXTI_LINE_10
  287. * @arg @ref LL_EXTI_LINE_11
  288. * @arg @ref LL_EXTI_LINE_12
  289. * @arg @ref LL_EXTI_LINE_13
  290. * @arg @ref LL_EXTI_LINE_14
  291. * @arg @ref LL_EXTI_LINE_15
  292. * @arg @ref LL_EXTI_LINE_16
  293. * @arg @ref LL_EXTI_LINE_17
  294. * @arg @ref LL_EXTI_LINE_18
  295. * @arg @ref LL_EXTI_LINE_19
  296. * @arg @ref LL_EXTI_LINE_ALL_0_31
  297. * @note Please check each device line mapping for EXTI Line availability
  298. * @retval State of bit (1 or 0).
  299. */
  300. __STATIC_INLINE uint32_t LL_EXTI_IsEnabledIT_0_31(uint32_t ExtiLine)
  301. {
  302. return (READ_BIT(EXTI->IMR, ExtiLine) == (ExtiLine));
  303. }
  304. /**
  305. * @}
  306. */
  307. /** @defgroup EXTI_LL_EF_Event_Management Event_Management
  308. * @{
  309. */
  310. /**
  311. * @brief Enable ExtiLine Event request for Lines in range 0 to 31
  312. * @rmtoll EMR EMx LL_EXTI_EnableEvent_0_31
  313. * @param ExtiLine This parameter can be one of the following values:
  314. * @arg @ref LL_EXTI_LINE_0
  315. * @arg @ref LL_EXTI_LINE_1
  316. * @arg @ref LL_EXTI_LINE_2
  317. * @arg @ref LL_EXTI_LINE_3
  318. * @arg @ref LL_EXTI_LINE_4
  319. * @arg @ref LL_EXTI_LINE_5
  320. * @arg @ref LL_EXTI_LINE_6
  321. * @arg @ref LL_EXTI_LINE_7
  322. * @arg @ref LL_EXTI_LINE_8
  323. * @arg @ref LL_EXTI_LINE_9
  324. * @arg @ref LL_EXTI_LINE_10
  325. * @arg @ref LL_EXTI_LINE_11
  326. * @arg @ref LL_EXTI_LINE_12
  327. * @arg @ref LL_EXTI_LINE_13
  328. * @arg @ref LL_EXTI_LINE_14
  329. * @arg @ref LL_EXTI_LINE_15
  330. * @arg @ref LL_EXTI_LINE_16
  331. * @arg @ref LL_EXTI_LINE_17
  332. * @arg @ref LL_EXTI_LINE_18
  333. * @arg @ref LL_EXTI_LINE_19
  334. * @arg @ref LL_EXTI_LINE_ALL_0_31
  335. * @note Please check each device line mapping for EXTI Line availability
  336. * @retval None
  337. */
  338. __STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine)
  339. {
  340. SET_BIT(EXTI->EMR, ExtiLine);
  341. }
  342. /**
  343. * @brief Disable ExtiLine Event request for Lines in range 0 to 31
  344. * @rmtoll EMR EMx LL_EXTI_DisableEvent_0_31
  345. * @param ExtiLine This parameter can be one of the following values:
  346. * @arg @ref LL_EXTI_LINE_0
  347. * @arg @ref LL_EXTI_LINE_1
  348. * @arg @ref LL_EXTI_LINE_2
  349. * @arg @ref LL_EXTI_LINE_3
  350. * @arg @ref LL_EXTI_LINE_4
  351. * @arg @ref LL_EXTI_LINE_5
  352. * @arg @ref LL_EXTI_LINE_6
  353. * @arg @ref LL_EXTI_LINE_7
  354. * @arg @ref LL_EXTI_LINE_8
  355. * @arg @ref LL_EXTI_LINE_9
  356. * @arg @ref LL_EXTI_LINE_10
  357. * @arg @ref LL_EXTI_LINE_11
  358. * @arg @ref LL_EXTI_LINE_12
  359. * @arg @ref LL_EXTI_LINE_13
  360. * @arg @ref LL_EXTI_LINE_14
  361. * @arg @ref LL_EXTI_LINE_15
  362. * @arg @ref LL_EXTI_LINE_16
  363. * @arg @ref LL_EXTI_LINE_17
  364. * @arg @ref LL_EXTI_LINE_18
  365. * @arg @ref LL_EXTI_LINE_19
  366. * @arg @ref LL_EXTI_LINE_ALL_0_31
  367. * @note Please check each device line mapping for EXTI Line availability
  368. * @retval None
  369. */
  370. __STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine)
  371. {
  372. CLEAR_BIT(EXTI->EMR, ExtiLine);
  373. }
  374. /**
  375. * @brief Indicate if ExtiLine Event request is enabled for Lines in range 0 to 31
  376. * @rmtoll EMR EMx LL_EXTI_IsEnabledEvent_0_31
  377. * @param ExtiLine This parameter can be one of the following values:
  378. * @arg @ref LL_EXTI_LINE_0
  379. * @arg @ref LL_EXTI_LINE_1
  380. * @arg @ref LL_EXTI_LINE_2
  381. * @arg @ref LL_EXTI_LINE_3
  382. * @arg @ref LL_EXTI_LINE_4
  383. * @arg @ref LL_EXTI_LINE_5
  384. * @arg @ref LL_EXTI_LINE_6
  385. * @arg @ref LL_EXTI_LINE_7
  386. * @arg @ref LL_EXTI_LINE_8
  387. * @arg @ref LL_EXTI_LINE_9
  388. * @arg @ref LL_EXTI_LINE_10
  389. * @arg @ref LL_EXTI_LINE_11
  390. * @arg @ref LL_EXTI_LINE_12
  391. * @arg @ref LL_EXTI_LINE_13
  392. * @arg @ref LL_EXTI_LINE_14
  393. * @arg @ref LL_EXTI_LINE_15
  394. * @arg @ref LL_EXTI_LINE_16
  395. * @arg @ref LL_EXTI_LINE_17
  396. * @arg @ref LL_EXTI_LINE_18
  397. * @arg @ref LL_EXTI_LINE_19
  398. * @arg @ref LL_EXTI_LINE_ALL_0_31
  399. * @note Please check each device line mapping for EXTI Line availability
  400. * @retval State of bit (1 or 0).
  401. */
  402. __STATIC_INLINE uint32_t LL_EXTI_IsEnabledEvent_0_31(uint32_t ExtiLine)
  403. {
  404. return (READ_BIT(EXTI->EMR, ExtiLine) == (ExtiLine));
  405. }
  406. /**
  407. * @}
  408. */
  409. /** @defgroup EXTI_LL_EF_Rising_Trigger_Management Rising_Trigger_Management
  410. * @{
  411. */
  412. /**
  413. * @brief Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31
  414. * @note The configurable wakeup lines are edge-triggered. No glitch must be
  415. * generated on these lines. If a rising edge on a configurable interrupt
  416. * line occurs during a write operation in the EXTI_RTSR register, the
  417. * pending bit is not set.
  418. * Rising and falling edge triggers can be set for
  419. * the same interrupt line. In this case, both generate a trigger
  420. * condition.
  421. * @rmtoll RTSR RTx LL_EXTI_EnableRisingTrig_0_31
  422. * @param ExtiLine This parameter can be a combination of the following values:
  423. * @arg @ref LL_EXTI_LINE_0
  424. * @arg @ref LL_EXTI_LINE_1
  425. * @arg @ref LL_EXTI_LINE_2
  426. * @arg @ref LL_EXTI_LINE_3
  427. * @arg @ref LL_EXTI_LINE_4
  428. * @arg @ref LL_EXTI_LINE_5
  429. * @arg @ref LL_EXTI_LINE_6
  430. * @arg @ref LL_EXTI_LINE_7
  431. * @arg @ref LL_EXTI_LINE_8
  432. * @arg @ref LL_EXTI_LINE_9
  433. * @arg @ref LL_EXTI_LINE_10
  434. * @arg @ref LL_EXTI_LINE_11
  435. * @arg @ref LL_EXTI_LINE_12
  436. * @arg @ref LL_EXTI_LINE_13
  437. * @arg @ref LL_EXTI_LINE_14
  438. * @arg @ref LL_EXTI_LINE_15
  439. * @arg @ref LL_EXTI_LINE_16
  440. * @arg @ref LL_EXTI_LINE_18
  441. * @arg @ref LL_EXTI_LINE_19
  442. * @note Please check each device line mapping for EXTI Line availability
  443. * @retval None
  444. */
  445. __STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)
  446. {
  447. SET_BIT(EXTI->RTSR, ExtiLine);
  448. }
  449. /**
  450. * @brief Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31
  451. * @note The configurable wakeup lines are edge-triggered. No glitch must be
  452. * generated on these lines. If a rising edge on a configurable interrupt
  453. * line occurs during a write operation in the EXTI_RTSR register, the
  454. * pending bit is not set.
  455. * Rising and falling edge triggers can be set for
  456. * the same interrupt line. In this case, both generate a trigger
  457. * condition.
  458. * @rmtoll RTSR RTx LL_EXTI_DisableRisingTrig_0_31
  459. * @param ExtiLine This parameter can be a combination of the following values:
  460. * @arg @ref LL_EXTI_LINE_0
  461. * @arg @ref LL_EXTI_LINE_1
  462. * @arg @ref LL_EXTI_LINE_2
  463. * @arg @ref LL_EXTI_LINE_3
  464. * @arg @ref LL_EXTI_LINE_4
  465. * @arg @ref LL_EXTI_LINE_5
  466. * @arg @ref LL_EXTI_LINE_6
  467. * @arg @ref LL_EXTI_LINE_7
  468. * @arg @ref LL_EXTI_LINE_8
  469. * @arg @ref LL_EXTI_LINE_9
  470. * @arg @ref LL_EXTI_LINE_10
  471. * @arg @ref LL_EXTI_LINE_11
  472. * @arg @ref LL_EXTI_LINE_12
  473. * @arg @ref LL_EXTI_LINE_13
  474. * @arg @ref LL_EXTI_LINE_14
  475. * @arg @ref LL_EXTI_LINE_15
  476. * @arg @ref LL_EXTI_LINE_16
  477. * @arg @ref LL_EXTI_LINE_18
  478. * @arg @ref LL_EXTI_LINE_19
  479. * @note Please check each device line mapping for EXTI Line availability
  480. * @retval None
  481. */
  482. __STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine)
  483. {
  484. CLEAR_BIT(EXTI->RTSR, ExtiLine);
  485. }
  486. /**
  487. * @brief Check if rising edge trigger is enabled for Lines in range 0 to 31
  488. * @rmtoll RTSR RTx LL_EXTI_IsEnabledRisingTrig_0_31
  489. * @param ExtiLine This parameter can be a combination of the following values:
  490. * @arg @ref LL_EXTI_LINE_0
  491. * @arg @ref LL_EXTI_LINE_1
  492. * @arg @ref LL_EXTI_LINE_2
  493. * @arg @ref LL_EXTI_LINE_3
  494. * @arg @ref LL_EXTI_LINE_4
  495. * @arg @ref LL_EXTI_LINE_5
  496. * @arg @ref LL_EXTI_LINE_6
  497. * @arg @ref LL_EXTI_LINE_7
  498. * @arg @ref LL_EXTI_LINE_8
  499. * @arg @ref LL_EXTI_LINE_9
  500. * @arg @ref LL_EXTI_LINE_10
  501. * @arg @ref LL_EXTI_LINE_11
  502. * @arg @ref LL_EXTI_LINE_12
  503. * @arg @ref LL_EXTI_LINE_13
  504. * @arg @ref LL_EXTI_LINE_14
  505. * @arg @ref LL_EXTI_LINE_15
  506. * @arg @ref LL_EXTI_LINE_16
  507. * @arg @ref LL_EXTI_LINE_18
  508. * @arg @ref LL_EXTI_LINE_19
  509. * @note Please check each device line mapping for EXTI Line availability
  510. * @retval State of bit (1 or 0).
  511. */
  512. __STATIC_INLINE uint32_t LL_EXTI_IsEnabledRisingTrig_0_31(uint32_t ExtiLine)
  513. {
  514. return (READ_BIT(EXTI->RTSR, ExtiLine) == (ExtiLine));
  515. }
  516. /**
  517. * @}
  518. */
  519. /** @defgroup EXTI_LL_EF_Falling_Trigger_Management Falling_Trigger_Management
  520. * @{
  521. */
  522. /**
  523. * @brief Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31
  524. * @note The configurable wakeup lines are edge-triggered. No glitch must be
  525. * generated on these lines. If a falling edge on a configurable interrupt
  526. * line occurs during a write operation in the EXTI_FTSR register, the
  527. * pending bit is not set.
  528. * Rising and falling edge triggers can be set for
  529. * the same interrupt line. In this case, both generate a trigger
  530. * condition.
  531. * @rmtoll FTSR FTx LL_EXTI_EnableFallingTrig_0_31
  532. * @param ExtiLine This parameter can be a combination of the following values:
  533. * @arg @ref LL_EXTI_LINE_0
  534. * @arg @ref LL_EXTI_LINE_1
  535. * @arg @ref LL_EXTI_LINE_2
  536. * @arg @ref LL_EXTI_LINE_3
  537. * @arg @ref LL_EXTI_LINE_4
  538. * @arg @ref LL_EXTI_LINE_5
  539. * @arg @ref LL_EXTI_LINE_6
  540. * @arg @ref LL_EXTI_LINE_7
  541. * @arg @ref LL_EXTI_LINE_8
  542. * @arg @ref LL_EXTI_LINE_9
  543. * @arg @ref LL_EXTI_LINE_10
  544. * @arg @ref LL_EXTI_LINE_11
  545. * @arg @ref LL_EXTI_LINE_12
  546. * @arg @ref LL_EXTI_LINE_13
  547. * @arg @ref LL_EXTI_LINE_14
  548. * @arg @ref LL_EXTI_LINE_15
  549. * @arg @ref LL_EXTI_LINE_16
  550. * @arg @ref LL_EXTI_LINE_18
  551. * @arg @ref LL_EXTI_LINE_19
  552. * @note Please check each device line mapping for EXTI Line availability
  553. * @retval None
  554. */
  555. __STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine)
  556. {
  557. SET_BIT(EXTI->FTSR, ExtiLine);
  558. }
  559. /**
  560. * @brief Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31
  561. * @note The configurable wakeup lines are edge-triggered. No glitch must be
  562. * generated on these lines. If a Falling edge on a configurable interrupt
  563. * line occurs during a write operation in the EXTI_FTSR register, the
  564. * pending bit is not set.
  565. * Rising and falling edge triggers can be set for the same interrupt line.
  566. * In this case, both generate a trigger condition.
  567. * @rmtoll FTSR FTx LL_EXTI_DisableFallingTrig_0_31
  568. * @param ExtiLine This parameter can be a combination of the following values:
  569. * @arg @ref LL_EXTI_LINE_0
  570. * @arg @ref LL_EXTI_LINE_1
  571. * @arg @ref LL_EXTI_LINE_2
  572. * @arg @ref LL_EXTI_LINE_3
  573. * @arg @ref LL_EXTI_LINE_4
  574. * @arg @ref LL_EXTI_LINE_5
  575. * @arg @ref LL_EXTI_LINE_6
  576. * @arg @ref LL_EXTI_LINE_7
  577. * @arg @ref LL_EXTI_LINE_8
  578. * @arg @ref LL_EXTI_LINE_9
  579. * @arg @ref LL_EXTI_LINE_10
  580. * @arg @ref LL_EXTI_LINE_11
  581. * @arg @ref LL_EXTI_LINE_12
  582. * @arg @ref LL_EXTI_LINE_13
  583. * @arg @ref LL_EXTI_LINE_14
  584. * @arg @ref LL_EXTI_LINE_15
  585. * @arg @ref LL_EXTI_LINE_16
  586. * @arg @ref LL_EXTI_LINE_18
  587. * @arg @ref LL_EXTI_LINE_19
  588. * @note Please check each device line mapping for EXTI Line availability
  589. * @retval None
  590. */
  591. __STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine)
  592. {
  593. CLEAR_BIT(EXTI->FTSR, ExtiLine);
  594. }
  595. /**
  596. * @brief Check if falling edge trigger is enabled for Lines in range 0 to 31
  597. * @rmtoll FTSR FTx LL_EXTI_IsEnabledFallingTrig_0_31
  598. * @param ExtiLine This parameter can be a combination of the following values:
  599. * @arg @ref LL_EXTI_LINE_0
  600. * @arg @ref LL_EXTI_LINE_1
  601. * @arg @ref LL_EXTI_LINE_2
  602. * @arg @ref LL_EXTI_LINE_3
  603. * @arg @ref LL_EXTI_LINE_4
  604. * @arg @ref LL_EXTI_LINE_5
  605. * @arg @ref LL_EXTI_LINE_6
  606. * @arg @ref LL_EXTI_LINE_7
  607. * @arg @ref LL_EXTI_LINE_8
  608. * @arg @ref LL_EXTI_LINE_9
  609. * @arg @ref LL_EXTI_LINE_10
  610. * @arg @ref LL_EXTI_LINE_11
  611. * @arg @ref LL_EXTI_LINE_12
  612. * @arg @ref LL_EXTI_LINE_13
  613. * @arg @ref LL_EXTI_LINE_14
  614. * @arg @ref LL_EXTI_LINE_15
  615. * @arg @ref LL_EXTI_LINE_16
  616. * @arg @ref LL_EXTI_LINE_18
  617. * @arg @ref LL_EXTI_LINE_19
  618. * @note Please check each device line mapping for EXTI Line availability
  619. * @retval State of bit (1 or 0).
  620. */
  621. __STATIC_INLINE uint32_t LL_EXTI_IsEnabledFallingTrig_0_31(uint32_t ExtiLine)
  622. {
  623. return (READ_BIT(EXTI->FTSR, ExtiLine) == (ExtiLine));
  624. }
  625. /**
  626. * @}
  627. */
  628. /** @defgroup EXTI_LL_EF_Software_Interrupt_Management Software_Interrupt_Management
  629. * @{
  630. */
  631. /**
  632. * @brief Generate a software Interrupt Event for Lines in range 0 to 31
  633. * @note If the interrupt is enabled on this line in the EXTI_IMR, writing a 1 to
  634. * this bit when it is at '0' sets the corresponding pending bit in EXTI_PR
  635. * resulting in an interrupt request generation.
  636. * This bit is cleared by clearing the corresponding bit in the EXTI_PR
  637. * register (by writing a 1 into the bit)
  638. * @rmtoll SWIER SWIx LL_EXTI_GenerateSWI_0_31
  639. * @param ExtiLine This parameter can be a combination of the following values:
  640. * @arg @ref LL_EXTI_LINE_0
  641. * @arg @ref LL_EXTI_LINE_1
  642. * @arg @ref LL_EXTI_LINE_2
  643. * @arg @ref LL_EXTI_LINE_3
  644. * @arg @ref LL_EXTI_LINE_4
  645. * @arg @ref LL_EXTI_LINE_5
  646. * @arg @ref LL_EXTI_LINE_6
  647. * @arg @ref LL_EXTI_LINE_7
  648. * @arg @ref LL_EXTI_LINE_8
  649. * @arg @ref LL_EXTI_LINE_9
  650. * @arg @ref LL_EXTI_LINE_10
  651. * @arg @ref LL_EXTI_LINE_11
  652. * @arg @ref LL_EXTI_LINE_12
  653. * @arg @ref LL_EXTI_LINE_13
  654. * @arg @ref LL_EXTI_LINE_14
  655. * @arg @ref LL_EXTI_LINE_15
  656. * @arg @ref LL_EXTI_LINE_16
  657. * @arg @ref LL_EXTI_LINE_18
  658. * @arg @ref LL_EXTI_LINE_19
  659. * @note Please check each device line mapping for EXTI Line availability
  660. * @retval None
  661. */
  662. __STATIC_INLINE void LL_EXTI_GenerateSWI_0_31(uint32_t ExtiLine)
  663. {
  664. SET_BIT(EXTI->SWIER, ExtiLine);
  665. }
  666. /**
  667. * @}
  668. */
  669. /** @defgroup EXTI_LL_EF_Flag_Management Flag_Management
  670. * @{
  671. */
  672. /**
  673. * @brief Check if the ExtLine Flag is set or not for Lines in range 0 to 31
  674. * @note This bit is set when the selected edge event arrives on the interrupt
  675. * line. This bit is cleared by writing a 1 to the bit.
  676. * @rmtoll PR PIFx LL_EXTI_IsActiveFlag_0_31
  677. * @param ExtiLine This parameter can be a combination of the following values:
  678. * @arg @ref LL_EXTI_LINE_0
  679. * @arg @ref LL_EXTI_LINE_1
  680. * @arg @ref LL_EXTI_LINE_2
  681. * @arg @ref LL_EXTI_LINE_3
  682. * @arg @ref LL_EXTI_LINE_4
  683. * @arg @ref LL_EXTI_LINE_5
  684. * @arg @ref LL_EXTI_LINE_6
  685. * @arg @ref LL_EXTI_LINE_7
  686. * @arg @ref LL_EXTI_LINE_8
  687. * @arg @ref LL_EXTI_LINE_9
  688. * @arg @ref LL_EXTI_LINE_10
  689. * @arg @ref LL_EXTI_LINE_11
  690. * @arg @ref LL_EXTI_LINE_12
  691. * @arg @ref LL_EXTI_LINE_13
  692. * @arg @ref LL_EXTI_LINE_14
  693. * @arg @ref LL_EXTI_LINE_15
  694. * @arg @ref LL_EXTI_LINE_16
  695. * @arg @ref LL_EXTI_LINE_18
  696. * @arg @ref LL_EXTI_LINE_19
  697. * @note Please check each device line mapping for EXTI Line availability
  698. * @retval State of bit (1 or 0).
  699. */
  700. __STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine)
  701. {
  702. return (READ_BIT(EXTI->PR, ExtiLine) == (ExtiLine));
  703. }
  704. /**
  705. * @brief Read ExtLine Combination Flag for Lines in range 0 to 31
  706. * @note This bit is set when the selected edge event arrives on the interrupt
  707. * line. This bit is cleared by writing a 1 to the bit.
  708. * @rmtoll PR PIFx LL_EXTI_ReadFlag_0_31
  709. * @param ExtiLine This parameter can be a combination of the following values:
  710. * @arg @ref LL_EXTI_LINE_0
  711. * @arg @ref LL_EXTI_LINE_1
  712. * @arg @ref LL_EXTI_LINE_2
  713. * @arg @ref LL_EXTI_LINE_3
  714. * @arg @ref LL_EXTI_LINE_4
  715. * @arg @ref LL_EXTI_LINE_5
  716. * @arg @ref LL_EXTI_LINE_6
  717. * @arg @ref LL_EXTI_LINE_7
  718. * @arg @ref LL_EXTI_LINE_8
  719. * @arg @ref LL_EXTI_LINE_9
  720. * @arg @ref LL_EXTI_LINE_10
  721. * @arg @ref LL_EXTI_LINE_11
  722. * @arg @ref LL_EXTI_LINE_12
  723. * @arg @ref LL_EXTI_LINE_13
  724. * @arg @ref LL_EXTI_LINE_14
  725. * @arg @ref LL_EXTI_LINE_15
  726. * @arg @ref LL_EXTI_LINE_16
  727. * @arg @ref LL_EXTI_LINE_18
  728. * @arg @ref LL_EXTI_LINE_19
  729. * @note Please check each device line mapping for EXTI Line availability
  730. * @retval @note This bit is set when the selected edge event arrives on the interrupt
  731. */
  732. __STATIC_INLINE uint32_t LL_EXTI_ReadFlag_0_31(uint32_t ExtiLine)
  733. {
  734. return (uint32_t)(READ_BIT(EXTI->PR, ExtiLine));
  735. }
  736. /**
  737. * @brief Clear ExtLine Flags for Lines in range 0 to 31
  738. * @note This bit is set when the selected edge event arrives on the interrupt
  739. * line. This bit is cleared by writing a 1 to the bit.
  740. * @rmtoll PR PIFx LL_EXTI_ClearFlag_0_31
  741. * @param ExtiLine This parameter can be a combination of the following values:
  742. * @arg @ref LL_EXTI_LINE_0
  743. * @arg @ref LL_EXTI_LINE_1
  744. * @arg @ref LL_EXTI_LINE_2
  745. * @arg @ref LL_EXTI_LINE_3
  746. * @arg @ref LL_EXTI_LINE_4
  747. * @arg @ref LL_EXTI_LINE_5
  748. * @arg @ref LL_EXTI_LINE_6
  749. * @arg @ref LL_EXTI_LINE_7
  750. * @arg @ref LL_EXTI_LINE_8
  751. * @arg @ref LL_EXTI_LINE_9
  752. * @arg @ref LL_EXTI_LINE_10
  753. * @arg @ref LL_EXTI_LINE_11
  754. * @arg @ref LL_EXTI_LINE_12
  755. * @arg @ref LL_EXTI_LINE_13
  756. * @arg @ref LL_EXTI_LINE_14
  757. * @arg @ref LL_EXTI_LINE_15
  758. * @arg @ref LL_EXTI_LINE_16
  759. * @arg @ref LL_EXTI_LINE_18
  760. * @arg @ref LL_EXTI_LINE_19
  761. * @note Please check each device line mapping for EXTI Line availability
  762. * @retval None
  763. */
  764. __STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine)
  765. {
  766. WRITE_REG(EXTI->PR, ExtiLine);
  767. }
  768. /**
  769. * @}
  770. */
  771. #if defined(USE_FULL_LL_DRIVER)
  772. /** @defgroup EXTI_LL_EF_Init Initialization and de-initialization functions
  773. * @{
  774. */
  775. uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct);
  776. uint32_t LL_EXTI_DeInit(void);
  777. void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct);
  778. /**
  779. * @}
  780. */
  781. #endif /* USE_FULL_LL_DRIVER */
  782. /**
  783. * @}
  784. */
  785. /**
  786. * @}
  787. */
  788. #endif /* EXTI */
  789. /**
  790. * @}
  791. */
  792. #ifdef __cplusplus
  793. }
  794. #endif
  795. #endif /* STM32F1xx_LL_EXTI_H */