stm32f1xx_ll_exti.h 32 KB

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