Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32G4 / Drivers / STM32G4xx_HAL_Driver / Inc / stm32g4xx_hal_exti.h
blob4c8bff826591a836332abae6a005bdd7ea8f1a7f
1 /**
2 ******************************************************************************
3 * @file stm32g4xx_hal_exti.h
4 * @author MCD Application Team
5 * @brief Header file of EXTI HAL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
10 * All rights reserved.</center></h2>
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
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32G4xx_HAL_EXTI_H
22 #define STM32G4xx_HAL_EXTI_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32g4xx_hal_def.h"
31 /** @addtogroup STM32G4xx_HAL_Driver
32 * @{
35 /** @defgroup EXTI EXTI
36 * @brief EXTI HAL module driver
37 * @{
40 /* Exported types ------------------------------------------------------------*/
42 /** @defgroup EXTI_Exported_Types EXTI Exported Types
43 * @{
45 typedef enum
47 HAL_EXTI_COMMON_CB_ID = 0x00UL
48 } EXTI_CallbackIDTypeDef;
51 /**
52 * @brief EXTI Handle structure definition
54 typedef struct
56 uint32_t Line; /*!< Exti line number */
57 void (* PendingCallback)(void); /*!< Exti pending callback */
58 } EXTI_HandleTypeDef;
60 /**
61 * @brief EXTI Configuration structure definition
63 typedef struct
65 uint32_t Line; /*!< The Exti line to be configured. This parameter
66 can be a value of @ref EXTI_Line */
67 uint32_t Mode; /*!< The Exit Mode to be configured for a core.
68 This parameter can be a combination of @ref EXTI_Mode */
69 uint32_t Trigger; /*!< The Exti Trigger to be configured. This parameter
70 can be a value of @ref EXTI_Trigger */
71 uint32_t GPIOSel; /*!< The Exti GPIO multiplexer selection to be configured.
72 This parameter is only possible for line 0 to 15. It
73 can be a value of @ref EXTI_GPIOSel */
74 } EXTI_ConfigTypeDef;
76 /**
77 * @}
80 /* Exported constants --------------------------------------------------------*/
81 /** @defgroup EXTI_Exported_Constants EXTI Exported Constants
82 * @{
85 /** @defgroup EXTI_Line EXTI Line
86 * @{
88 #define EXTI_LINE_0 (EXTI_GPIO | EXTI_REG1 | 0x00u)
89 #define EXTI_LINE_1 (EXTI_GPIO | EXTI_REG1 | 0x01u)
90 #define EXTI_LINE_2 (EXTI_GPIO | EXTI_REG1 | 0x02u)
91 #define EXTI_LINE_3 (EXTI_GPIO | EXTI_REG1 | 0x03u)
92 #define EXTI_LINE_4 (EXTI_GPIO | EXTI_REG1 | 0x04u)
93 #define EXTI_LINE_5 (EXTI_GPIO | EXTI_REG1 | 0x05u)
94 #define EXTI_LINE_6 (EXTI_GPIO | EXTI_REG1 | 0x06u)
95 #define EXTI_LINE_7 (EXTI_GPIO | EXTI_REG1 | 0x07u)
96 #define EXTI_LINE_8 (EXTI_GPIO | EXTI_REG1 | 0x08u)
97 #define EXTI_LINE_9 (EXTI_GPIO | EXTI_REG1 | 0x09u)
98 #define EXTI_LINE_10 (EXTI_GPIO | EXTI_REG1 | 0x0Au)
99 #define EXTI_LINE_11 (EXTI_GPIO | EXTI_REG1 | 0x0Bu)
100 #define EXTI_LINE_12 (EXTI_GPIO | EXTI_REG1 | 0x0Cu)
101 #define EXTI_LINE_13 (EXTI_GPIO | EXTI_REG1 | 0x0Du)
102 #define EXTI_LINE_14 (EXTI_GPIO | EXTI_REG1 | 0x0Eu)
103 #define EXTI_LINE_15 (EXTI_GPIO | EXTI_REG1 | 0x0Fu)
104 #define EXTI_LINE_16 (EXTI_CONFIG | EXTI_REG1 | 0x10u)
105 #define EXTI_LINE_17 (EXTI_CONFIG | EXTI_REG1 | 0x11u)
106 #define EXTI_LINE_18 (EXTI_DIRECT | EXTI_REG1 | 0x12u)
107 #define EXTI_LINE_19 (EXTI_CONFIG | EXTI_REG1 | 0x13u)
108 #define EXTI_LINE_20 (EXTI_CONFIG | EXTI_REG1 | 0x14u)
109 #define EXTI_LINE_21 (EXTI_CONFIG | EXTI_REG1 | 0x15u)
110 #define EXTI_LINE_22 (EXTI_CONFIG | EXTI_REG1 | 0x16u)
111 #define EXTI_LINE_23 (EXTI_DIRECT | EXTI_REG1 | 0x17u)
112 #define EXTI_LINE_24 (EXTI_DIRECT | EXTI_REG1 | 0x18u)
113 #define EXTI_LINE_25 (EXTI_DIRECT | EXTI_REG1 | 0x19u)
114 #define EXTI_LINE_26 (EXTI_DIRECT | EXTI_REG1 | 0x1Au)
115 #define EXTI_LINE_27 (EXTI_DIRECT | EXTI_REG1 | 0x1Bu)
116 #define EXTI_LINE_28 (EXTI_DIRECT | EXTI_REG1 | 0x1Cu)
117 #define EXTI_LINE_29 (EXTI_CONFIG | EXTI_REG1 | 0x1Du)
118 #define EXTI_LINE_30 (EXTI_CONFIG | EXTI_REG1 | 0x1Eu)
119 #define EXTI_LINE_31 (EXTI_CONFIG | EXTI_REG1 | 0x1Fu)
120 #define EXTI_LINE_32 (EXTI_CONFIG | EXTI_REG2 | 0x00u)
121 #define EXTI_LINE_33 (EXTI_CONFIG | EXTI_REG2 | 0x01u)
122 #define EXTI_LINE_34 (EXTI_DIRECT | EXTI_REG2 | 0x02u)
123 #define EXTI_LINE_35 (EXTI_DIRECT | EXTI_REG2 | 0x03u)
124 #define EXTI_LINE_36 (EXTI_DIRECT | EXTI_REG2 | 0x04u)
125 #define EXTI_LINE_37 (EXTI_DIRECT | EXTI_REG2 | 0x05u)
126 #define EXTI_LINE_38 (EXTI_CONFIG | EXTI_REG2 | 0x06u)
127 #define EXTI_LINE_39 (EXTI_CONFIG | EXTI_REG2 | 0x07u)
128 #define EXTI_LINE_40 (EXTI_CONFIG | EXTI_REG2 | 0x08u)
129 #define EXTI_LINE_41 (EXTI_CONFIG | EXTI_REG2 | 0x09u)
130 #define EXTI_LINE_42 (EXTI_DIRECT | EXTI_REG2 | 0x0Au)
131 #define EXTI_LINE_43 (EXTI_DIRECT | EXTI_REG2 | 0x0Bu)
133 * @}
136 /** @defgroup EXTI_Mode EXTI Mode
137 * @{
139 #define EXTI_MODE_NONE 0x00000000U
140 #define EXTI_MODE_INTERRUPT 0x00000001U
141 #define EXTI_MODE_EVENT 0x00000002U
143 * @}
146 /** @defgroup EXTI_Trigger EXTI Trigger
147 * @{
149 #define EXTI_TRIGGER_NONE 0x00000000U
150 #define EXTI_TRIGGER_RISING 0x00000001U
151 #define EXTI_TRIGGER_FALLING 0x00000002U
152 #define EXTI_TRIGGER_RISING_FALLING (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
154 * @}
157 /** @defgroup EXTI_GPIOSel EXTI GPIOSel
158 * @brief
159 * @{
161 #define EXTI_GPIOA 0x00000000U
162 #define EXTI_GPIOB 0x00000001U
163 #define EXTI_GPIOC 0x00000002U
164 #define EXTI_GPIOD 0x00000003U
165 #define EXTI_GPIOE 0x00000004U
166 #define EXTI_GPIOF 0x00000005U
167 #define EXTI_GPIOG 0x00000006U
169 * @}
173 * @}
176 /* Exported macro ------------------------------------------------------------*/
177 /** @defgroup EXTI_Exported_Macros EXTI Exported Macros
178 * @{
182 * @}
185 /* Private constants --------------------------------------------------------*/
186 /** @defgroup EXTI_Private_Constants EXTI Private Constants
187 * @{
190 * @brief EXTI Line property definition
192 #define EXTI_PROPERTY_SHIFT 24U
193 #define EXTI_DIRECT (0x01uL << EXTI_PROPERTY_SHIFT)
194 #define EXTI_CONFIG (0x02uL << EXTI_PROPERTY_SHIFT)
195 #define EXTI_GPIO ((0x04uL << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG)
196 #define EXTI_RESERVED (0x08uL << EXTI_PROPERTY_SHIFT)
197 #define EXTI_PROPERTY_MASK (EXTI_DIRECT | EXTI_CONFIG | EXTI_GPIO)
200 * @brief EXTI Register and bit usage
202 #define EXTI_REG_SHIFT 16U
203 #define EXTI_REG1 (0x00uL << EXTI_REG_SHIFT)
204 #define EXTI_REG2 (0x01uL << EXTI_REG_SHIFT)
205 #define EXTI_REG_MASK (EXTI_REG1 | EXTI_REG2)
206 #define EXTI_PIN_MASK 0x0000001FU
209 * @brief EXTI Mask for interrupt & event mode
211 #define EXTI_MODE_MASK (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT)
214 * @brief EXTI Mask for trigger possibilities
216 #define EXTI_TRIGGER_MASK (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
219 * @brief EXTI Line number
221 #define EXTI_LINE_NB 44UL
224 * @}
227 /* Private macros ------------------------------------------------------------*/
228 /** @defgroup EXTI_Private_Macros EXTI Private Macros
229 * @{
231 #define IS_EXTI_LINE(__LINE__) ((((__LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_REG_MASK | EXTI_PIN_MASK)) == 0x00U) && \
232 ((((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_DIRECT) || \
233 (((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG) || \
234 (((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO)) && \
235 (((__LINE__) & (EXTI_REG_MASK | EXTI_PIN_MASK)) < \
236 (((EXTI_LINE_NB / 32u) << EXTI_REG_SHIFT) | (EXTI_LINE_NB % 32u))))
238 #define IS_EXTI_MODE(__LINE__) ((((__LINE__) & EXTI_MODE_MASK) != 0x00U) && \
239 (((__LINE__) & ~EXTI_MODE_MASK) == 0x00U))
241 #define IS_EXTI_TRIGGER(__LINE__) (((__LINE__) & ~EXTI_TRIGGER_MASK) == 0x00U)
243 #define IS_EXTI_CONFIG_LINE(__LINE__) (((__LINE__) & EXTI_CONFIG) != 0x00U)
245 #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \
246 ((__PORT__) == EXTI_GPIOB) || \
247 ((__PORT__) == EXTI_GPIOC) || \
248 ((__PORT__) == EXTI_GPIOD) || \
249 ((__PORT__) == EXTI_GPIOE) || \
250 ((__PORT__) == EXTI_GPIOF) || \
251 ((__PORT__) == EXTI_GPIOG))
253 #define IS_EXTI_GPIO_PIN(__PIN__) ((__PIN__) < 16u)
255 #define IS_EXTI_PENDING_EDGE(__EDGE__) (((__EDGE__) == EXTI_TRIGGER_RISING) || \
256 ((__EDGE__) == EXTI_TRIGGER_FALLING)|| \
257 ((__EDGE__) == EXTI_TRIGGER_RISING_FALLING))
259 #define IS_EXTI_CB(__CB__) ((__CB__) == HAL_EXTI_COMMON_CB_ID)
261 * @}
265 /* Exported functions --------------------------------------------------------*/
266 /** @defgroup EXTI_Exported_Functions EXTI Exported Functions
267 * @brief EXTI Exported Functions
268 * @{
271 /** @defgroup EXTI_Exported_Functions_Group1 Configuration functions
272 * @brief Configuration functions
273 * @{
275 /* Configuration functions ****************************************************/
276 HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
277 HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
278 HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti);
279 HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void));
280 HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine);
282 * @}
285 /** @defgroup EXTI_Exported_Functions_Group2 IO operation functions
286 * @brief IO operation functions
287 * @{
289 /* IO operation functions *****************************************************/
290 void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti);
291 uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
292 void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
293 void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti);
296 * @}
300 * @}
304 * @}
308 * @}
311 #ifdef __cplusplus
313 #endif
315 #endif /* STM32G4xx_HAL_EXTI_H */
317 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/