stm32f1xx_ll_exti.h 32 KB

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