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