1 /**
2 ******************************************************************************
3 * @file stm32f2xx_ll_exti.h
4 * @author MCD Application Team
5 * @brief Header file of EXTI LL module.
6 ******************************************************************************
7 * @attention
8 *
9 * Copyright (c) 2017 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.
15 *
16 ******************************************************************************
17 */
18
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __STM32F2xx_LL_EXTI_H
21 #define __STM32F2xx_LL_EXTI_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32f2xx.h"
29
30 /** @addtogroup STM32F2xx_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_ALL_0_31
263 * @note Please check each device line mapping for EXTI Line availability
264 * @retval None
265 */
LL_EXTI_EnableIT_0_31(uint32_t ExtiLine)266 __STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine)
267 {
268 SET_BIT(EXTI->IMR, ExtiLine);
269 }
270
271 /**
272 * @brief Disable ExtiLine Interrupt request for Lines in range 0 to 31
273 * @note The reset value for the direct or internal lines (see RM)
274 * is set to 1 in order to enable the interrupt by default.
275 * Bits are set automatically at Power on.
276 * @rmtoll IMR IMx LL_EXTI_DisableIT_0_31
277 * @param ExtiLine This parameter can be one of the following values:
278 * @arg @ref LL_EXTI_LINE_0
279 * @arg @ref LL_EXTI_LINE_1
280 * @arg @ref LL_EXTI_LINE_2
281 * @arg @ref LL_EXTI_LINE_3
282 * @arg @ref LL_EXTI_LINE_4
283 * @arg @ref LL_EXTI_LINE_5
284 * @arg @ref LL_EXTI_LINE_6
285 * @arg @ref LL_EXTI_LINE_7
286 * @arg @ref LL_EXTI_LINE_8
287 * @arg @ref LL_EXTI_LINE_9
288 * @arg @ref LL_EXTI_LINE_10
289 * @arg @ref LL_EXTI_LINE_11
290 * @arg @ref LL_EXTI_LINE_12
291 * @arg @ref LL_EXTI_LINE_13
292 * @arg @ref LL_EXTI_LINE_14
293 * @arg @ref LL_EXTI_LINE_15
294 * @arg @ref LL_EXTI_LINE_16
295 * @arg @ref LL_EXTI_LINE_17
296 * @arg @ref LL_EXTI_LINE_18
297 * @arg @ref LL_EXTI_LINE_19
298 * @arg @ref LL_EXTI_LINE_20
299 * @arg @ref LL_EXTI_LINE_21
300 * @arg @ref LL_EXTI_LINE_22
301 * @arg @ref LL_EXTI_LINE_ALL_0_31
302 * @note Please check each device line mapping for EXTI Line availability
303 * @retval None
304 */
LL_EXTI_DisableIT_0_31(uint32_t ExtiLine)305 __STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine)
306 {
307 CLEAR_BIT(EXTI->IMR, ExtiLine);
308 }
309
310
311 /**
312 * @brief Indicate if ExtiLine Interrupt request is enabled for Lines in range 0 to 31
313 * @note The reset value for the direct or internal lines (see RM)
314 * is set to 1 in order to enable the interrupt by default.
315 * Bits are set automatically at Power on.
316 * @rmtoll IMR IMx LL_EXTI_IsEnabledIT_0_31
317 * @param ExtiLine This parameter can be one of the following values:
318 * @arg @ref LL_EXTI_LINE_0
319 * @arg @ref LL_EXTI_LINE_1
320 * @arg @ref LL_EXTI_LINE_2
321 * @arg @ref LL_EXTI_LINE_3
322 * @arg @ref LL_EXTI_LINE_4
323 * @arg @ref LL_EXTI_LINE_5
324 * @arg @ref LL_EXTI_LINE_6
325 * @arg @ref LL_EXTI_LINE_7
326 * @arg @ref LL_EXTI_LINE_8
327 * @arg @ref LL_EXTI_LINE_9
328 * @arg @ref LL_EXTI_LINE_10
329 * @arg @ref LL_EXTI_LINE_11
330 * @arg @ref LL_EXTI_LINE_12
331 * @arg @ref LL_EXTI_LINE_13
332 * @arg @ref LL_EXTI_LINE_14
333 * @arg @ref LL_EXTI_LINE_15
334 * @arg @ref LL_EXTI_LINE_16
335 * @arg @ref LL_EXTI_LINE_17
336 * @arg @ref LL_EXTI_LINE_18
337 * @arg @ref LL_EXTI_LINE_19
338 * @arg @ref LL_EXTI_LINE_20
339 * @arg @ref LL_EXTI_LINE_21
340 * @arg @ref LL_EXTI_LINE_22
341 * @arg @ref LL_EXTI_LINE_ALL_0_31
342 * @note Please check each device line mapping for EXTI Line availability
343 * @retval State of bit (1 or 0).
344 */
LL_EXTI_IsEnabledIT_0_31(uint32_t ExtiLine)345 __STATIC_INLINE uint32_t LL_EXTI_IsEnabledIT_0_31(uint32_t ExtiLine)
346 {
347 return (READ_BIT(EXTI->IMR, ExtiLine) == (ExtiLine));
348 }
349
350
351 /**
352 * @}
353 */
354
355 /** @defgroup EXTI_LL_EF_Event_Management Event_Management
356 * @{
357 */
358
359 /**
360 * @brief Enable ExtiLine Event request for Lines in range 0 to 31
361 * @rmtoll EMR EMx LL_EXTI_EnableEvent_0_31
362 * @param ExtiLine This parameter can be one of the following values:
363 * @arg @ref LL_EXTI_LINE_0
364 * @arg @ref LL_EXTI_LINE_1
365 * @arg @ref LL_EXTI_LINE_2
366 * @arg @ref LL_EXTI_LINE_3
367 * @arg @ref LL_EXTI_LINE_4
368 * @arg @ref LL_EXTI_LINE_5
369 * @arg @ref LL_EXTI_LINE_6
370 * @arg @ref LL_EXTI_LINE_7
371 * @arg @ref LL_EXTI_LINE_8
372 * @arg @ref LL_EXTI_LINE_9
373 * @arg @ref LL_EXTI_LINE_10
374 * @arg @ref LL_EXTI_LINE_11
375 * @arg @ref LL_EXTI_LINE_12
376 * @arg @ref LL_EXTI_LINE_13
377 * @arg @ref LL_EXTI_LINE_14
378 * @arg @ref LL_EXTI_LINE_15
379 * @arg @ref LL_EXTI_LINE_16
380 * @arg @ref LL_EXTI_LINE_17
381 * @arg @ref LL_EXTI_LINE_18
382 * @arg @ref LL_EXTI_LINE_19
383 * @arg @ref LL_EXTI_LINE_20
384 * @arg @ref LL_EXTI_LINE_21
385 * @arg @ref LL_EXTI_LINE_22
386 * @arg @ref LL_EXTI_LINE_ALL_0_31
387 * @note Please check each device line mapping for EXTI Line availability
388 * @retval None
389 */
LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine)390 __STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine)
391 {
392 SET_BIT(EXTI->EMR, ExtiLine);
393
394 }
395
396
397 /**
398 * @brief Disable ExtiLine Event request for Lines in range 0 to 31
399 * @rmtoll EMR EMx LL_EXTI_DisableEvent_0_31
400 * @param ExtiLine This parameter can be one of the following values:
401 * @arg @ref LL_EXTI_LINE_0
402 * @arg @ref LL_EXTI_LINE_1
403 * @arg @ref LL_EXTI_LINE_2
404 * @arg @ref LL_EXTI_LINE_3
405 * @arg @ref LL_EXTI_LINE_4
406 * @arg @ref LL_EXTI_LINE_5
407 * @arg @ref LL_EXTI_LINE_6
408 * @arg @ref LL_EXTI_LINE_7
409 * @arg @ref LL_EXTI_LINE_8
410 * @arg @ref LL_EXTI_LINE_9
411 * @arg @ref LL_EXTI_LINE_10
412 * @arg @ref LL_EXTI_LINE_11
413 * @arg @ref LL_EXTI_LINE_12
414 * @arg @ref LL_EXTI_LINE_13
415 * @arg @ref LL_EXTI_LINE_14
416 * @arg @ref LL_EXTI_LINE_15
417 * @arg @ref LL_EXTI_LINE_16
418 * @arg @ref LL_EXTI_LINE_17
419 * @arg @ref LL_EXTI_LINE_18
420 * @arg @ref LL_EXTI_LINE_19
421 * @arg @ref LL_EXTI_LINE_20
422 * @arg @ref LL_EXTI_LINE_21
423 * @arg @ref LL_EXTI_LINE_22
424 * @arg @ref LL_EXTI_LINE_ALL_0_31
425 * @note Please check each device line mapping for EXTI Line availability
426 * @retval None
427 */
LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine)428 __STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine)
429 {
430 CLEAR_BIT(EXTI->EMR, ExtiLine);
431 }
432
433
434 /**
435 * @brief Indicate if ExtiLine Event request is enabled for Lines in range 0 to 31
436 * @rmtoll EMR EMx LL_EXTI_IsEnabledEvent_0_31
437 * @param ExtiLine This parameter can be one of the following values:
438 * @arg @ref LL_EXTI_LINE_0
439 * @arg @ref LL_EXTI_LINE_1
440 * @arg @ref LL_EXTI_LINE_2
441 * @arg @ref LL_EXTI_LINE_3
442 * @arg @ref LL_EXTI_LINE_4
443 * @arg @ref LL_EXTI_LINE_5
444 * @arg @ref LL_EXTI_LINE_6
445 * @arg @ref LL_EXTI_LINE_7
446 * @arg @ref LL_EXTI_LINE_8
447 * @arg @ref LL_EXTI_LINE_9
448 * @arg @ref LL_EXTI_LINE_10
449 * @arg @ref LL_EXTI_LINE_11
450 * @arg @ref LL_EXTI_LINE_12
451 * @arg @ref LL_EXTI_LINE_13
452 * @arg @ref LL_EXTI_LINE_14
453 * @arg @ref LL_EXTI_LINE_15
454 * @arg @ref LL_EXTI_LINE_16
455 * @arg @ref LL_EXTI_LINE_17
456 * @arg @ref LL_EXTI_LINE_18
457 * @arg @ref LL_EXTI_LINE_19
458 * @arg @ref LL_EXTI_LINE_20
459 * @arg @ref LL_EXTI_LINE_21
460 * @arg @ref LL_EXTI_LINE_22
461 * @arg @ref LL_EXTI_LINE_ALL_0_31
462 * @note Please check each device line mapping for EXTI Line availability
463 * @retval State of bit (1 or 0).
464 */
LL_EXTI_IsEnabledEvent_0_31(uint32_t ExtiLine)465 __STATIC_INLINE uint32_t LL_EXTI_IsEnabledEvent_0_31(uint32_t ExtiLine)
466 {
467 return (READ_BIT(EXTI->EMR, ExtiLine) == (ExtiLine));
468
469 }
470
471
472 /**
473 * @}
474 */
475
476 /** @defgroup EXTI_LL_EF_Rising_Trigger_Management Rising_Trigger_Management
477 * @{
478 */
479
480 /**
481 * @brief Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31
482 * @note The configurable wakeup lines are edge-triggered. No glitch must be
483 * generated on these lines. If a rising edge on a configurable interrupt
484 * line occurs during a write operation in the EXTI_RTSR register, the
485 * pending bit is not set.
486 * Rising and falling edge triggers can be set for
487 * the same interrupt line. In this case, both generate a trigger
488 * condition.
489 * @rmtoll RTSR RTx LL_EXTI_EnableRisingTrig_0_31
490 * @param ExtiLine This parameter can be a combination of the following values:
491 * @arg @ref LL_EXTI_LINE_0
492 * @arg @ref LL_EXTI_LINE_1
493 * @arg @ref LL_EXTI_LINE_2
494 * @arg @ref LL_EXTI_LINE_3
495 * @arg @ref LL_EXTI_LINE_4
496 * @arg @ref LL_EXTI_LINE_5
497 * @arg @ref LL_EXTI_LINE_6
498 * @arg @ref LL_EXTI_LINE_7
499 * @arg @ref LL_EXTI_LINE_8
500 * @arg @ref LL_EXTI_LINE_9
501 * @arg @ref LL_EXTI_LINE_10
502 * @arg @ref LL_EXTI_LINE_11
503 * @arg @ref LL_EXTI_LINE_12
504 * @arg @ref LL_EXTI_LINE_13
505 * @arg @ref LL_EXTI_LINE_14
506 * @arg @ref LL_EXTI_LINE_15
507 * @arg @ref LL_EXTI_LINE_16
508 * @arg @ref LL_EXTI_LINE_18
509 * @arg @ref LL_EXTI_LINE_19
510 * @arg @ref LL_EXTI_LINE_20
511 * @arg @ref LL_EXTI_LINE_21
512 * @arg @ref LL_EXTI_LINE_22
513 * @note Please check each device line mapping for EXTI Line availability
514 * @retval None
515 */
LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)516 __STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)
517 {
518 SET_BIT(EXTI->RTSR, ExtiLine);
519
520 }
521
522
523 /**
524 * @brief Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31
525 * @note The configurable wakeup lines are edge-triggered. No glitch must be
526 * generated on these lines. If a rising edge on a configurable interrupt
527 * line occurs during a write operation in the EXTI_RTSR register, the
528 * pending bit is not set.
529 * Rising and falling edge triggers can be set for
530 * the same interrupt line. In this case, both generate a trigger
531 * condition.
532 * @rmtoll RTSR RTx LL_EXTI_DisableRisingTrig_0_31
533 * @param ExtiLine This parameter can be a combination of the following values:
534 * @arg @ref LL_EXTI_LINE_0
535 * @arg @ref LL_EXTI_LINE_1
536 * @arg @ref LL_EXTI_LINE_2
537 * @arg @ref LL_EXTI_LINE_3
538 * @arg @ref LL_EXTI_LINE_4
539 * @arg @ref LL_EXTI_LINE_5
540 * @arg @ref LL_EXTI_LINE_6
541 * @arg @ref LL_EXTI_LINE_7
542 * @arg @ref LL_EXTI_LINE_8
543 * @arg @ref LL_EXTI_LINE_9
544 * @arg @ref LL_EXTI_LINE_10
545 * @arg @ref LL_EXTI_LINE_11
546 * @arg @ref LL_EXTI_LINE_12
547 * @arg @ref LL_EXTI_LINE_13
548 * @arg @ref LL_EXTI_LINE_14
549 * @arg @ref LL_EXTI_LINE_15
550 * @arg @ref LL_EXTI_LINE_16
551 * @arg @ref LL_EXTI_LINE_18
552 * @arg @ref LL_EXTI_LINE_19
553 * @arg @ref LL_EXTI_LINE_20
554 * @arg @ref LL_EXTI_LINE_21
555 * @arg @ref LL_EXTI_LINE_22
556 * @note Please check each device line mapping for EXTI Line availability
557 * @retval None
558 */
LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine)559 __STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine)
560 {
561 CLEAR_BIT(EXTI->RTSR, ExtiLine);
562
563 }
564
565
566 /**
567 * @brief Check if rising edge trigger is enabled for Lines in range 0 to 31
568 * @rmtoll RTSR RTx LL_EXTI_IsEnabledRisingTrig_0_31
569 * @param ExtiLine This parameter can be a combination of the following values:
570 * @arg @ref LL_EXTI_LINE_0
571 * @arg @ref LL_EXTI_LINE_1
572 * @arg @ref LL_EXTI_LINE_2
573 * @arg @ref LL_EXTI_LINE_3
574 * @arg @ref LL_EXTI_LINE_4
575 * @arg @ref LL_EXTI_LINE_5
576 * @arg @ref LL_EXTI_LINE_6
577 * @arg @ref LL_EXTI_LINE_7
578 * @arg @ref LL_EXTI_LINE_8
579 * @arg @ref LL_EXTI_LINE_9
580 * @arg @ref LL_EXTI_LINE_10
581 * @arg @ref LL_EXTI_LINE_11
582 * @arg @ref LL_EXTI_LINE_12
583 * @arg @ref LL_EXTI_LINE_13
584 * @arg @ref LL_EXTI_LINE_14
585 * @arg @ref LL_EXTI_LINE_15
586 * @arg @ref LL_EXTI_LINE_16
587 * @arg @ref LL_EXTI_LINE_18
588 * @arg @ref LL_EXTI_LINE_19
589 * @arg @ref LL_EXTI_LINE_20
590 * @arg @ref LL_EXTI_LINE_21
591 * @arg @ref LL_EXTI_LINE_22
592 * @note Please check each device line mapping for EXTI Line availability
593 * @retval State of bit (1 or 0).
594 */
LL_EXTI_IsEnabledRisingTrig_0_31(uint32_t ExtiLine)595 __STATIC_INLINE uint32_t LL_EXTI_IsEnabledRisingTrig_0_31(uint32_t ExtiLine)
596 {
597 return (READ_BIT(EXTI->RTSR, ExtiLine) == (ExtiLine));
598 }
599
600
601 /**
602 * @}
603 */
604
605 /** @defgroup EXTI_LL_EF_Falling_Trigger_Management Falling_Trigger_Management
606 * @{
607 */
608
609 /**
610 * @brief Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31
611 * @note The configurable wakeup lines are edge-triggered. No glitch must be
612 * generated on these lines. If a falling edge on a configurable interrupt
613 * line occurs during a write operation in the EXTI_FTSR register, the
614 * pending bit is not set.
615 * Rising and falling edge triggers can be set for
616 * the same interrupt line. In this case, both generate a trigger
617 * condition.
618 * @rmtoll FTSR FTx LL_EXTI_EnableFallingTrig_0_31
619 * @param ExtiLine This parameter can be a combination of the following values:
620 * @arg @ref LL_EXTI_LINE_0
621 * @arg @ref LL_EXTI_LINE_1
622 * @arg @ref LL_EXTI_LINE_2
623 * @arg @ref LL_EXTI_LINE_3
624 * @arg @ref LL_EXTI_LINE_4
625 * @arg @ref LL_EXTI_LINE_5
626 * @arg @ref LL_EXTI_LINE_6
627 * @arg @ref LL_EXTI_LINE_7
628 * @arg @ref LL_EXTI_LINE_8
629 * @arg @ref LL_EXTI_LINE_9
630 * @arg @ref LL_EXTI_LINE_10
631 * @arg @ref LL_EXTI_LINE_11
632 * @arg @ref LL_EXTI_LINE_12
633 * @arg @ref LL_EXTI_LINE_13
634 * @arg @ref LL_EXTI_LINE_14
635 * @arg @ref LL_EXTI_LINE_15
636 * @arg @ref LL_EXTI_LINE_16
637 * @arg @ref LL_EXTI_LINE_18
638 * @arg @ref LL_EXTI_LINE_19
639 * @arg @ref LL_EXTI_LINE_20
640 * @arg @ref LL_EXTI_LINE_21
641 * @arg @ref LL_EXTI_LINE_22
642 * @note Please check each device line mapping for EXTI Line availability
643 * @retval None
644 */
LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine)645 __STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine)
646 {
647 SET_BIT(EXTI->FTSR, ExtiLine);
648 }
649
650
651 /**
652 * @brief Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31
653 * @note The configurable wakeup lines are edge-triggered. No glitch must be
654 * generated on these lines. If a Falling edge on a configurable interrupt
655 * line occurs during a write operation in the EXTI_FTSR register, the
656 * pending bit is not set.
657 * Rising and falling edge triggers can be set for the same interrupt line.
658 * In this case, both generate a trigger condition.
659 * @rmtoll FTSR FTx LL_EXTI_DisableFallingTrig_0_31
660 * @param ExtiLine This parameter can be a combination of the following values:
661 * @arg @ref LL_EXTI_LINE_0
662 * @arg @ref LL_EXTI_LINE_1
663 * @arg @ref LL_EXTI_LINE_2
664 * @arg @ref LL_EXTI_LINE_3
665 * @arg @ref LL_EXTI_LINE_4
666 * @arg @ref LL_EXTI_LINE_5
667 * @arg @ref LL_EXTI_LINE_6
668 * @arg @ref LL_EXTI_LINE_7
669 * @arg @ref LL_EXTI_LINE_8
670 * @arg @ref LL_EXTI_LINE_9
671 * @arg @ref LL_EXTI_LINE_10
672 * @arg @ref LL_EXTI_LINE_11
673 * @arg @ref LL_EXTI_LINE_12
674 * @arg @ref LL_EXTI_LINE_13
675 * @arg @ref LL_EXTI_LINE_14
676 * @arg @ref LL_EXTI_LINE_15
677 * @arg @ref LL_EXTI_LINE_16
678 * @arg @ref LL_EXTI_LINE_18
679 * @arg @ref LL_EXTI_LINE_19
680 * @arg @ref LL_EXTI_LINE_20
681 * @arg @ref LL_EXTI_LINE_21
682 * @arg @ref LL_EXTI_LINE_22
683 * @note Please check each device line mapping for EXTI Line availability
684 * @retval None
685 */
LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine)686 __STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine)
687 {
688 CLEAR_BIT(EXTI->FTSR, ExtiLine);
689 }
690
691
692 /**
693 * @brief Check if falling edge trigger is enabled for Lines in range 0 to 31
694 * @rmtoll FTSR FTx LL_EXTI_IsEnabledFallingTrig_0_31
695 * @param ExtiLine This parameter can be a combination of the following values:
696 * @arg @ref LL_EXTI_LINE_0
697 * @arg @ref LL_EXTI_LINE_1
698 * @arg @ref LL_EXTI_LINE_2
699 * @arg @ref LL_EXTI_LINE_3
700 * @arg @ref LL_EXTI_LINE_4
701 * @arg @ref LL_EXTI_LINE_5
702 * @arg @ref LL_EXTI_LINE_6
703 * @arg @ref LL_EXTI_LINE_7
704 * @arg @ref LL_EXTI_LINE_8
705 * @arg @ref LL_EXTI_LINE_9
706 * @arg @ref LL_EXTI_LINE_10
707 * @arg @ref LL_EXTI_LINE_11
708 * @arg @ref LL_EXTI_LINE_12
709 * @arg @ref LL_EXTI_LINE_13
710 * @arg @ref LL_EXTI_LINE_14
711 * @arg @ref LL_EXTI_LINE_15
712 * @arg @ref LL_EXTI_LINE_16
713 * @arg @ref LL_EXTI_LINE_18
714 * @arg @ref LL_EXTI_LINE_19
715 * @arg @ref LL_EXTI_LINE_20
716 * @arg @ref LL_EXTI_LINE_21
717 * @arg @ref LL_EXTI_LINE_22
718 * @note Please check each device line mapping for EXTI Line availability
719 * @retval State of bit (1 or 0).
720 */
LL_EXTI_IsEnabledFallingTrig_0_31(uint32_t ExtiLine)721 __STATIC_INLINE uint32_t LL_EXTI_IsEnabledFallingTrig_0_31(uint32_t ExtiLine)
722 {
723 return (READ_BIT(EXTI->FTSR, ExtiLine) == (ExtiLine));
724 }
725
726
727 /**
728 * @}
729 */
730
731 /** @defgroup EXTI_LL_EF_Software_Interrupt_Management Software_Interrupt_Management
732 * @{
733 */
734
735 /**
736 * @brief Generate a software Interrupt Event for Lines in range 0 to 31
737 * @note If the interrupt is enabled on this line in the EXTI_IMR, writing a 1 to
738 * this bit when it is at '0' sets the corresponding pending bit in EXTI_PR
739 * resulting in an interrupt request generation.
740 * This bit is cleared by clearing the corresponding bit in the EXTI_PR
741 * register (by writing a 1 into the bit)
742 * @rmtoll SWIER SWIx LL_EXTI_GenerateSWI_0_31
743 * @param ExtiLine This parameter can be a combination of the following values:
744 * @arg @ref LL_EXTI_LINE_0
745 * @arg @ref LL_EXTI_LINE_1
746 * @arg @ref LL_EXTI_LINE_2
747 * @arg @ref LL_EXTI_LINE_3
748 * @arg @ref LL_EXTI_LINE_4
749 * @arg @ref LL_EXTI_LINE_5
750 * @arg @ref LL_EXTI_LINE_6
751 * @arg @ref LL_EXTI_LINE_7
752 * @arg @ref LL_EXTI_LINE_8
753 * @arg @ref LL_EXTI_LINE_9
754 * @arg @ref LL_EXTI_LINE_10
755 * @arg @ref LL_EXTI_LINE_11
756 * @arg @ref LL_EXTI_LINE_12
757 * @arg @ref LL_EXTI_LINE_13
758 * @arg @ref LL_EXTI_LINE_14
759 * @arg @ref LL_EXTI_LINE_15
760 * @arg @ref LL_EXTI_LINE_16
761 * @arg @ref LL_EXTI_LINE_18
762 * @arg @ref LL_EXTI_LINE_19
763 * @arg @ref LL_EXTI_LINE_20
764 * @arg @ref LL_EXTI_LINE_21
765 * @arg @ref LL_EXTI_LINE_22
766 * @note Please check each device line mapping for EXTI Line availability
767 * @retval None
768 */
LL_EXTI_GenerateSWI_0_31(uint32_t ExtiLine)769 __STATIC_INLINE void LL_EXTI_GenerateSWI_0_31(uint32_t ExtiLine)
770 {
771 SET_BIT(EXTI->SWIER, ExtiLine);
772 }
773
774
775 /**
776 * @}
777 */
778
779 /** @defgroup EXTI_LL_EF_Flag_Management Flag_Management
780 * @{
781 */
782
783 /**
784 * @brief Check if the ExtLine Flag is set or not for Lines in range 0 to 31
785 * @note This bit is set when the selected edge event arrives on the interrupt
786 * line. This bit is cleared by writing a 1 to the bit.
787 * @rmtoll PR PIFx LL_EXTI_IsActiveFlag_0_31
788 * @param ExtiLine This parameter can be a combination of the following values:
789 * @arg @ref LL_EXTI_LINE_0
790 * @arg @ref LL_EXTI_LINE_1
791 * @arg @ref LL_EXTI_LINE_2
792 * @arg @ref LL_EXTI_LINE_3
793 * @arg @ref LL_EXTI_LINE_4
794 * @arg @ref LL_EXTI_LINE_5
795 * @arg @ref LL_EXTI_LINE_6
796 * @arg @ref LL_EXTI_LINE_7
797 * @arg @ref LL_EXTI_LINE_8
798 * @arg @ref LL_EXTI_LINE_9
799 * @arg @ref LL_EXTI_LINE_10
800 * @arg @ref LL_EXTI_LINE_11
801 * @arg @ref LL_EXTI_LINE_12
802 * @arg @ref LL_EXTI_LINE_13
803 * @arg @ref LL_EXTI_LINE_14
804 * @arg @ref LL_EXTI_LINE_15
805 * @arg @ref LL_EXTI_LINE_16
806 * @arg @ref LL_EXTI_LINE_18
807 * @arg @ref LL_EXTI_LINE_19
808 * @arg @ref LL_EXTI_LINE_20
809 * @arg @ref LL_EXTI_LINE_21
810 * @arg @ref LL_EXTI_LINE_22
811 * @note Please check each device line mapping for EXTI Line availability
812 * @retval State of bit (1 or 0).
813 */
LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine)814 __STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine)
815 {
816 return (READ_BIT(EXTI->PR, ExtiLine) == (ExtiLine));
817 }
818
819
820 /**
821 * @brief Read ExtLine Combination Flag for Lines in range 0 to 31
822 * @note This bit is set when the selected edge event arrives on the interrupt
823 * line. This bit is cleared by writing a 1 to the bit.
824 * @rmtoll PR PIFx LL_EXTI_ReadFlag_0_31
825 * @param ExtiLine This parameter can be a combination of the following values:
826 * @arg @ref LL_EXTI_LINE_0
827 * @arg @ref LL_EXTI_LINE_1
828 * @arg @ref LL_EXTI_LINE_2
829 * @arg @ref LL_EXTI_LINE_3
830 * @arg @ref LL_EXTI_LINE_4
831 * @arg @ref LL_EXTI_LINE_5
832 * @arg @ref LL_EXTI_LINE_6
833 * @arg @ref LL_EXTI_LINE_7
834 * @arg @ref LL_EXTI_LINE_8
835 * @arg @ref LL_EXTI_LINE_9
836 * @arg @ref LL_EXTI_LINE_10
837 * @arg @ref LL_EXTI_LINE_11
838 * @arg @ref LL_EXTI_LINE_12
839 * @arg @ref LL_EXTI_LINE_13
840 * @arg @ref LL_EXTI_LINE_14
841 * @arg @ref LL_EXTI_LINE_15
842 * @arg @ref LL_EXTI_LINE_16
843 * @arg @ref LL_EXTI_LINE_18
844 * @arg @ref LL_EXTI_LINE_19
845 * @arg @ref LL_EXTI_LINE_20
846 * @arg @ref LL_EXTI_LINE_21
847 * @arg @ref LL_EXTI_LINE_22
848 * @note Please check each device line mapping for EXTI Line availability
849 * @retval @note This bit is set when the selected edge event arrives on the interrupt
850 */
LL_EXTI_ReadFlag_0_31(uint32_t ExtiLine)851 __STATIC_INLINE uint32_t LL_EXTI_ReadFlag_0_31(uint32_t ExtiLine)
852 {
853 return (uint32_t)(READ_BIT(EXTI->PR, ExtiLine));
854 }
855
856
857 /**
858 * @brief Clear ExtLine Flags for Lines in range 0 to 31
859 * @note This bit is set when the selected edge event arrives on the interrupt
860 * line. This bit is cleared by writing a 1 to the bit.
861 * @rmtoll PR PIFx LL_EXTI_ClearFlag_0_31
862 * @param ExtiLine This parameter can be a combination of the following values:
863 * @arg @ref LL_EXTI_LINE_0
864 * @arg @ref LL_EXTI_LINE_1
865 * @arg @ref LL_EXTI_LINE_2
866 * @arg @ref LL_EXTI_LINE_3
867 * @arg @ref LL_EXTI_LINE_4
868 * @arg @ref LL_EXTI_LINE_5
869 * @arg @ref LL_EXTI_LINE_6
870 * @arg @ref LL_EXTI_LINE_7
871 * @arg @ref LL_EXTI_LINE_8
872 * @arg @ref LL_EXTI_LINE_9
873 * @arg @ref LL_EXTI_LINE_10
874 * @arg @ref LL_EXTI_LINE_11
875 * @arg @ref LL_EXTI_LINE_12
876 * @arg @ref LL_EXTI_LINE_13
877 * @arg @ref LL_EXTI_LINE_14
878 * @arg @ref LL_EXTI_LINE_15
879 * @arg @ref LL_EXTI_LINE_16
880 * @arg @ref LL_EXTI_LINE_18
881 * @arg @ref LL_EXTI_LINE_19
882 * @arg @ref LL_EXTI_LINE_20
883 * @arg @ref LL_EXTI_LINE_21
884 * @arg @ref LL_EXTI_LINE_22
885 * @note Please check each device line mapping for EXTI Line availability
886 * @retval None
887 */
LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine)888 __STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine)
889 {
890 WRITE_REG(EXTI->PR, ExtiLine);
891 }
892
893
894 /**
895 * @}
896 */
897
898 #if defined(USE_FULL_LL_DRIVER)
899 /** @defgroup EXTI_LL_EF_Init Initialization and de-initialization functions
900 * @{
901 */
902
903 uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct);
904 uint32_t LL_EXTI_DeInit(void);
905 void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct);
906
907
908 /**
909 * @}
910 */
911 #endif /* USE_FULL_LL_DRIVER */
912
913 /**
914 * @}
915 */
916
917 /**
918 * @}
919 */
920
921 #endif /* EXTI */
922
923 /**
924 * @}
925 */
926
927 #ifdef __cplusplus
928 }
929 #endif
930
931 #endif /* __STM32F2xx_LL_EXTI_H */
932
933