stm32f4xx_ll_exti.h 33 KB

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