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