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