1 | /**
|
---|
2 | ******************************************************************************
|
---|
3 | * @file stm32f4xx_hal_exti.h
|
---|
4 | * @author MCD Application Team
|
---|
5 | * @brief Header file of EXTI HAL module.
|
---|
6 | ******************************************************************************
|
---|
7 | * @attention
|
---|
8 | *
|
---|
9 | * <h2><center>© Copyright (c) 2018 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_HAL_EXTI_H
|
---|
22 | #define STM32f4xx_HAL_EXTI_H
|
---|
23 |
|
---|
24 | #ifdef __cplusplus
|
---|
25 | extern "C" {
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | /* Includes ------------------------------------------------------------------*/
|
---|
29 | #include "stm32f4xx_hal_def.h"
|
---|
30 |
|
---|
31 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
32 | * @{
|
---|
33 | */
|
---|
34 |
|
---|
35 | /** @defgroup EXTI EXTI
|
---|
36 | * @brief EXTI HAL module driver
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 | /* Exported types ------------------------------------------------------------*/
|
---|
41 |
|
---|
42 | /** @defgroup EXTI_Exported_Types EXTI Exported Types
|
---|
43 | * @{
|
---|
44 | */
|
---|
45 | typedef enum
|
---|
46 | {
|
---|
47 | HAL_EXTI_COMMON_CB_ID = 0x00U
|
---|
48 | } EXTI_CallbackIDTypeDef;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * @brief EXTI Handle structure definition
|
---|
52 | */
|
---|
53 | typedef struct
|
---|
54 | {
|
---|
55 | uint32_t Line; /*!< Exti line number */
|
---|
56 | void (* PendingCallback)(void); /*!< Exti pending callback */
|
---|
57 | } EXTI_HandleTypeDef;
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * @brief EXTI Configuration structure definition
|
---|
61 | */
|
---|
62 | typedef struct
|
---|
63 | {
|
---|
64 | uint32_t Line; /*!< The Exti line to be configured. This parameter
|
---|
65 | can be a value of @ref EXTI_Line */
|
---|
66 | uint32_t Mode; /*!< The Exit Mode to be configured for a core.
|
---|
67 | This parameter can be a combination of @ref EXTI_Mode */
|
---|
68 | uint32_t Trigger; /*!< The Exti Trigger to be configured. This parameter
|
---|
69 | can be a value of @ref EXTI_Trigger */
|
---|
70 | uint32_t GPIOSel; /*!< The Exti GPIO multiplexer selection to be configured.
|
---|
71 | This parameter is only possible for line 0 to 15. It
|
---|
72 | can be a value of @ref EXTI_GPIOSel */
|
---|
73 | } EXTI_ConfigTypeDef;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * @}
|
---|
77 | */
|
---|
78 |
|
---|
79 | /* Exported constants --------------------------------------------------------*/
|
---|
80 | /** @defgroup EXTI_Exported_Constants EXTI Exported Constants
|
---|
81 | * @{
|
---|
82 | */
|
---|
83 |
|
---|
84 | /** @defgroup EXTI_Line EXTI Line
|
---|
85 | * @{
|
---|
86 | */
|
---|
87 | #define EXTI_LINE_0 (EXTI_GPIO | 0x00u) /*!< External interrupt line 0 */
|
---|
88 | #define EXTI_LINE_1 (EXTI_GPIO | 0x01u) /*!< External interrupt line 1 */
|
---|
89 | #define EXTI_LINE_2 (EXTI_GPIO | 0x02u) /*!< External interrupt line 2 */
|
---|
90 | #define EXTI_LINE_3 (EXTI_GPIO | 0x03u) /*!< External interrupt line 3 */
|
---|
91 | #define EXTI_LINE_4 (EXTI_GPIO | 0x04u) /*!< External interrupt line 4 */
|
---|
92 | #define EXTI_LINE_5 (EXTI_GPIO | 0x05u) /*!< External interrupt line 5 */
|
---|
93 | #define EXTI_LINE_6 (EXTI_GPIO | 0x06u) /*!< External interrupt line 6 */
|
---|
94 | #define EXTI_LINE_7 (EXTI_GPIO | 0x07u) /*!< External interrupt line 7 */
|
---|
95 | #define EXTI_LINE_8 (EXTI_GPIO | 0x08u) /*!< External interrupt line 8 */
|
---|
96 | #define EXTI_LINE_9 (EXTI_GPIO | 0x09u) /*!< External interrupt line 9 */
|
---|
97 | #define EXTI_LINE_10 (EXTI_GPIO | 0x0Au) /*!< External interrupt line 10 */
|
---|
98 | #define EXTI_LINE_11 (EXTI_GPIO | 0x0Bu) /*!< External interrupt line 11 */
|
---|
99 | #define EXTI_LINE_12 (EXTI_GPIO | 0x0Cu) /*!< External interrupt line 12 */
|
---|
100 | #define EXTI_LINE_13 (EXTI_GPIO | 0x0Du) /*!< External interrupt line 13 */
|
---|
101 | #define EXTI_LINE_14 (EXTI_GPIO | 0x0Eu) /*!< External interrupt line 14 */
|
---|
102 | #define EXTI_LINE_15 (EXTI_GPIO | 0x0Fu) /*!< External interrupt line 15 */
|
---|
103 | #define EXTI_LINE_16 (EXTI_CONFIG | 0x10u) /*!< External interrupt line 16 Connected to the PVD Output */
|
---|
104 | #define EXTI_LINE_17 (EXTI_CONFIG | 0x11u) /*!< External interrupt line 17 Connected to the RTC Alarm event */
|
---|
105 | #if defined(EXTI_IMR_IM18)
|
---|
106 | #define EXTI_LINE_18 (EXTI_CONFIG | 0x12u) /*!< External interrupt line 18 Connected to the USB OTG FS Wakeup from suspend event */
|
---|
107 | #else
|
---|
108 | #define EXTI_LINE_18 (EXTI_RESERVED | 0x12u) /*!< No interrupt supported in this line */
|
---|
109 | #endif /* EXTI_IMR_IM18 */
|
---|
110 | #if defined(EXTI_IMR_IM19)
|
---|
111 | #define EXTI_LINE_19 (EXTI_CONFIG | 0x13u) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
|
---|
112 | #else
|
---|
113 | #define EXTI_LINE_19 (EXTI_RESERVED | 0x13u) /*!< No interrupt supported in this line */
|
---|
114 | #endif /* EXTI_IMR_IM19 */
|
---|
115 | #if defined(EXTI_IMR_IM20)
|
---|
116 | #define EXTI_LINE_20 (EXTI_CONFIG | 0x14u) /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) Wakeup event */
|
---|
117 | #else
|
---|
118 | #define EXTI_LINE_20 (EXTI_RESERVED | 0x14u) /*!< No interrupt supported in this line */
|
---|
119 | #endif /* EXTI_IMR_IM20 */
|
---|
120 | #define EXTI_LINE_21 (EXTI_CONFIG | 0x15u) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
|
---|
121 | #define EXTI_LINE_22 (EXTI_CONFIG | 0x16u) /*!< External interrupt line 22 Connected to the RTC Wakeup event */
|
---|
122 | #if defined(EXTI_IMR_IM23)
|
---|
123 | #define EXTI_LINE_23 (EXTI_CONFIG | 0x17u) /*!< External interrupt line 23 Connected to the LPTIM1 asynchronous event */
|
---|
124 | #endif /* EXTI_IMR_IM23 */
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * @}
|
---|
128 | */
|
---|
129 |
|
---|
130 | /** @defgroup EXTI_Mode EXTI Mode
|
---|
131 | * @{
|
---|
132 | */
|
---|
133 | #define EXTI_MODE_NONE 0x00000000u
|
---|
134 | #define EXTI_MODE_INTERRUPT 0x00000001u
|
---|
135 | #define EXTI_MODE_EVENT 0x00000002u
|
---|
136 | /**
|
---|
137 | * @}
|
---|
138 | */
|
---|
139 |
|
---|
140 | /** @defgroup EXTI_Trigger EXTI Trigger
|
---|
141 | * @{
|
---|
142 | */
|
---|
143 |
|
---|
144 | #define EXTI_TRIGGER_NONE 0x00000000u
|
---|
145 | #define EXTI_TRIGGER_RISING 0x00000001u
|
---|
146 | #define EXTI_TRIGGER_FALLING 0x00000002u
|
---|
147 | #define EXTI_TRIGGER_RISING_FALLING (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
|
---|
148 | /**
|
---|
149 | * @}
|
---|
150 | */
|
---|
151 |
|
---|
152 | /** @defgroup EXTI_GPIOSel EXTI GPIOSel
|
---|
153 | * @brief
|
---|
154 | * @{
|
---|
155 | */
|
---|
156 | #define EXTI_GPIOA 0x00000000u
|
---|
157 | #define EXTI_GPIOB 0x00000001u
|
---|
158 | #define EXTI_GPIOC 0x00000002u
|
---|
159 | #if defined (GPIOD)
|
---|
160 | #define EXTI_GPIOD 0x00000003u
|
---|
161 | #endif /* GPIOD */
|
---|
162 | #if defined (GPIOE)
|
---|
163 | #define EXTI_GPIOE 0x00000004u
|
---|
164 | #endif /* GPIOE */
|
---|
165 | #if defined (GPIOF)
|
---|
166 | #define EXTI_GPIOF 0x00000005u
|
---|
167 | #endif /* GPIOF */
|
---|
168 | #if defined (GPIOG)
|
---|
169 | #define EXTI_GPIOG 0x00000006u
|
---|
170 | #endif /* GPIOG */
|
---|
171 | #if defined (GPIOH)
|
---|
172 | #define EXTI_GPIOH 0x00000007u
|
---|
173 | #endif /* GPIOH */
|
---|
174 | #if defined (GPIOI)
|
---|
175 | #define EXTI_GPIOI 0x00000008u
|
---|
176 | #endif /* GPIOI */
|
---|
177 | #if defined (GPIOJ)
|
---|
178 | #define EXTI_GPIOJ 0x00000009u
|
---|
179 | #endif /* GPIOJ */
|
---|
180 | #if defined (GPIOK)
|
---|
181 | #define EXTI_GPIOK 0x0000000Au
|
---|
182 | #endif /* GPIOK */
|
---|
183 |
|
---|
184 | /**
|
---|
185 | * @}
|
---|
186 | */
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * @}
|
---|
190 | */
|
---|
191 |
|
---|
192 | /* Exported macro ------------------------------------------------------------*/
|
---|
193 | /** @defgroup EXTI_Exported_Macros EXTI Exported Macros
|
---|
194 | * @{
|
---|
195 | */
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * @}
|
---|
199 | */
|
---|
200 |
|
---|
201 | /* Private constants --------------------------------------------------------*/
|
---|
202 | /** @defgroup EXTI_Private_Constants EXTI Private Constants
|
---|
203 | * @{
|
---|
204 | */
|
---|
205 | /**
|
---|
206 | * @brief EXTI Line property definition
|
---|
207 | */
|
---|
208 | #define EXTI_PROPERTY_SHIFT 24u
|
---|
209 | #define EXTI_CONFIG (0x02uL << EXTI_PROPERTY_SHIFT)
|
---|
210 | #define EXTI_GPIO ((0x04uL << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG)
|
---|
211 | #define EXTI_RESERVED (0x08uL << EXTI_PROPERTY_SHIFT)
|
---|
212 | #define EXTI_PROPERTY_MASK (EXTI_CONFIG | EXTI_GPIO)
|
---|
213 |
|
---|
214 | /**
|
---|
215 | * @brief EXTI bit usage
|
---|
216 | */
|
---|
217 | #define EXTI_PIN_MASK 0x0000001Fu
|
---|
218 |
|
---|
219 | /**
|
---|
220 | * @brief EXTI Mask for interrupt & event mode
|
---|
221 | */
|
---|
222 | #define EXTI_MODE_MASK (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT)
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * @brief EXTI Mask for trigger possibilities
|
---|
226 | */
|
---|
227 | #define EXTI_TRIGGER_MASK (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * @brief EXTI Line number
|
---|
231 | */
|
---|
232 | #if defined(EXTI_IMR_IM23)
|
---|
233 | #define EXTI_LINE_NB 24UL
|
---|
234 | #else
|
---|
235 | #define EXTI_LINE_NB 23UL
|
---|
236 | #endif /* EXTI_IMR_IM23 */
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * @}
|
---|
240 | */
|
---|
241 |
|
---|
242 | /* Private macros ------------------------------------------------------------*/
|
---|
243 | /** @defgroup EXTI_Private_Macros EXTI Private Macros
|
---|
244 | * @{
|
---|
245 | */
|
---|
246 | #define IS_EXTI_LINE(__EXTI_LINE__) ((((__EXTI_LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_PIN_MASK)) == 0x00u) && \
|
---|
247 | ((((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG) || \
|
---|
248 | (((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO)) && \
|
---|
249 | (((__EXTI_LINE__) & EXTI_PIN_MASK) < EXTI_LINE_NB))
|
---|
250 |
|
---|
251 | #define IS_EXTI_MODE(__EXTI_LINE__) ((((__EXTI_LINE__) & EXTI_MODE_MASK) != 0x00u) && \
|
---|
252 | (((__EXTI_LINE__) & ~EXTI_MODE_MASK) == 0x00u))
|
---|
253 |
|
---|
254 | #define IS_EXTI_TRIGGER(__EXTI_LINE__) (((__EXTI_LINE__) & ~EXTI_TRIGGER_MASK) == 0x00u)
|
---|
255 |
|
---|
256 | #define IS_EXTI_PENDING_EDGE(__EXTI_LINE__) ((__EXTI_LINE__) == EXTI_TRIGGER_RISING_FALLING)
|
---|
257 |
|
---|
258 | #define IS_EXTI_CONFIG_LINE(__EXTI_LINE__) (((__EXTI_LINE__) & EXTI_CONFIG) != 0x00u)
|
---|
259 |
|
---|
260 | #if !defined (GPIOD)
|
---|
261 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
262 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
263 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
264 | ((__PORT__) == EXTI_GPIOH))
|
---|
265 | #elif !defined (GPIOE)
|
---|
266 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
267 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
268 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
269 | ((__PORT__) == EXTI_GPIOD) || \
|
---|
270 | ((__PORT__) == EXTI_GPIOH))
|
---|
271 | #elif !defined (GPIOF)
|
---|
272 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
273 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
274 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
275 | ((__PORT__) == EXTI_GPIOD) || \
|
---|
276 | ((__PORT__) == EXTI_GPIOE) || \
|
---|
277 | ((__PORT__) == EXTI_GPIOH))
|
---|
278 | #elif !defined (GPIOI)
|
---|
279 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
280 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
281 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
282 | ((__PORT__) == EXTI_GPIOD) || \
|
---|
283 | ((__PORT__) == EXTI_GPIOE) || \
|
---|
284 | ((__PORT__) == EXTI_GPIOF) || \
|
---|
285 | ((__PORT__) == EXTI_GPIOG) || \
|
---|
286 | ((__PORT__) == EXTI_GPIOH))
|
---|
287 | #elif !defined (GPIOJ)
|
---|
288 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
289 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
290 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
291 | ((__PORT__) == EXTI_GPIOD) || \
|
---|
292 | ((__PORT__) == EXTI_GPIOE) || \
|
---|
293 | ((__PORT__) == EXTI_GPIOF) || \
|
---|
294 | ((__PORT__) == EXTI_GPIOG) || \
|
---|
295 | ((__PORT__) == EXTI_GPIOH) || \
|
---|
296 | ((__PORT__) == EXTI_GPIOI))
|
---|
297 | #else
|
---|
298 | #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
|
---|
299 | ((__PORT__) == EXTI_GPIOB) || \
|
---|
300 | ((__PORT__) == EXTI_GPIOC) || \
|
---|
301 | ((__PORT__) == EXTI_GPIOD) || \
|
---|
302 | ((__PORT__) == EXTI_GPIOE) || \
|
---|
303 | ((__PORT__) == EXTI_GPIOF) || \
|
---|
304 | ((__PORT__) == EXTI_GPIOG) || \
|
---|
305 | ((__PORT__) == EXTI_GPIOH) || \
|
---|
306 | ((__PORT__) == EXTI_GPIOI) || \
|
---|
307 | ((__PORT__) == EXTI_GPIOJ) || \
|
---|
308 | ((__PORT__) == EXTI_GPIOK))
|
---|
309 | #endif /* GPIOD */
|
---|
310 |
|
---|
311 | #define IS_EXTI_GPIO_PIN(__PIN__) ((__PIN__) < 16U)
|
---|
312 | /**
|
---|
313 | * @}
|
---|
314 | */
|
---|
315 |
|
---|
316 | /* Exported functions --------------------------------------------------------*/
|
---|
317 | /** @defgroup EXTI_Exported_Functions EXTI Exported Functions
|
---|
318 | * @brief EXTI Exported Functions
|
---|
319 | * @{
|
---|
320 | */
|
---|
321 |
|
---|
322 | /** @defgroup EXTI_Exported_Functions_Group1 Configuration functions
|
---|
323 | * @brief Configuration functions
|
---|
324 | * @{
|
---|
325 | */
|
---|
326 | /* Configuration functions ****************************************************/
|
---|
327 | HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
|
---|
328 | HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
|
---|
329 | HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti);
|
---|
330 | HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void));
|
---|
331 | HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine);
|
---|
332 | /**
|
---|
333 | * @}
|
---|
334 | */
|
---|
335 |
|
---|
336 | /** @defgroup EXTI_Exported_Functions_Group2 IO operation functions
|
---|
337 | * @brief IO operation functions
|
---|
338 | * @{
|
---|
339 | */
|
---|
340 | /* IO operation functions *****************************************************/
|
---|
341 | void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti);
|
---|
342 | uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
|
---|
343 | void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
|
---|
344 | void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti);
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * @}
|
---|
348 | */
|
---|
349 |
|
---|
350 | /**
|
---|
351 | * @}
|
---|
352 | */
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * @}
|
---|
356 | */
|
---|
357 |
|
---|
358 | /**
|
---|
359 | * @}
|
---|
360 | */
|
---|
361 |
|
---|
362 | #ifdef __cplusplus
|
---|
363 | }
|
---|
364 | #endif
|
---|
365 |
|
---|
366 | #endif /* STM32f4xx_HAL_EXTI_H */
|
---|
367 |
|
---|
368 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|