20#ifndef STM32H7xx_HAL_GPIO_H
21#define STM32H7xx_HAL_GPIO_H
88#define GPIO_PIN_0 ((uint16_t)0x0001)
89#define GPIO_PIN_1 ((uint16_t)0x0002)
90#define GPIO_PIN_2 ((uint16_t)0x0004)
91#define GPIO_PIN_3 ((uint16_t)0x0008)
92#define GPIO_PIN_4 ((uint16_t)0x0010)
93#define GPIO_PIN_5 ((uint16_t)0x0020)
94#define GPIO_PIN_6 ((uint16_t)0x0040)
95#define GPIO_PIN_7 ((uint16_t)0x0080)
96#define GPIO_PIN_8 ((uint16_t)0x0100)
97#define GPIO_PIN_9 ((uint16_t)0x0200)
98#define GPIO_PIN_10 ((uint16_t)0x0400)
99#define GPIO_PIN_11 ((uint16_t)0x0800)
100#define GPIO_PIN_12 ((uint16_t)0x1000)
101#define GPIO_PIN_13 ((uint16_t)0x2000)
102#define GPIO_PIN_14 ((uint16_t)0x4000)
103#define GPIO_PIN_15 ((uint16_t)0x8000)
104#define GPIO_PIN_All ((uint16_t)0xFFFF)
106#define GPIO_PIN_MASK (0x0000FFFFU)
121#define GPIO_MODE_INPUT MODE_INPUT
122#define GPIO_MODE_OUTPUT_PP (MODE_OUTPUT | OUTPUT_PP)
123#define GPIO_MODE_OUTPUT_OD (MODE_OUTPUT | OUTPUT_OD)
124#define GPIO_MODE_AF_PP (MODE_AF | OUTPUT_PP)
125#define GPIO_MODE_AF_OD (MODE_AF | OUTPUT_OD)
126#define GPIO_MODE_ANALOG MODE_ANALOG
127#define GPIO_MODE_IT_RISING (MODE_INPUT | EXTI_IT | TRIGGER_RISING)
128#define GPIO_MODE_IT_FALLING (MODE_INPUT | EXTI_IT | TRIGGER_FALLING)
129#define GPIO_MODE_IT_RISING_FALLING (MODE_INPUT | EXTI_IT | TRIGGER_RISING | TRIGGER_FALLING)
131#define GPIO_MODE_EVT_RISING (MODE_INPUT | EXTI_EVT | TRIGGER_RISING)
132#define GPIO_MODE_EVT_FALLING (MODE_INPUT | EXTI_EVT | TRIGGER_FALLING)
133#define GPIO_MODE_EVT_RISING_FALLING (MODE_INPUT | EXTI_EVT | TRIGGER_RISING | TRIGGER_FALLING)
143#define GPIO_SPEED_FREQ_LOW (0x00000000U)
144#define GPIO_SPEED_FREQ_MEDIUM (0x00000001U)
145#define GPIO_SPEED_FREQ_HIGH (0x00000002U)
146#define GPIO_SPEED_FREQ_VERY_HIGH (0x00000003U)
156#define GPIO_NOPULL (0x00000000U)
157#define GPIO_PULLUP (0x00000001U)
158#define GPIO_PULLDOWN (0x00000002U)
179#define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__))
187#define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__))
195#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__))
203#define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__))
205#if defined(DUAL_CORE)
212#define __HAL_GPIO_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI->C2PR1 & (__EXTI_LINE__))
220#define __HAL_GPIO_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI->C2PR1 = (__EXTI_LINE__))
228#define __HAL_GPIO_EXTID2_GET_IT(__EXTI_LINE__) (EXTI->C2PR1 & (__EXTI_LINE__))
236#define __HAL_GPIO_EXTID2_CLEAR_IT(__EXTI_LINE__) (EXTI->C2PR1 = (__EXTI_LINE__))
245#define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER1 |= (__EXTI_LINE__))
263void HAL_GPIO_DeInit(
GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin);
274void HAL_GPIO_TogglePin(
GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
276void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin);
277void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin);
293#define GPIO_MODE_Pos 0u
294#define GPIO_MODE (0x3uL << GPIO_MODE_Pos)
295#define MODE_INPUT (0x0uL << GPIO_MODE_Pos)
296#define MODE_OUTPUT (0x1uL << GPIO_MODE_Pos)
297#define MODE_AF (0x2uL << GPIO_MODE_Pos)
298#define MODE_ANALOG (0x3uL << GPIO_MODE_Pos)
299#define OUTPUT_TYPE_Pos 4u
300#define OUTPUT_TYPE (0x1uL << OUTPUT_TYPE_Pos)
301#define OUTPUT_PP (0x0uL << OUTPUT_TYPE_Pos)
302#define OUTPUT_OD (0x1uL << OUTPUT_TYPE_Pos)
303#define EXTI_MODE_Pos 16u
304#define EXTI_MODE (0x3uL << EXTI_MODE_Pos)
305#define EXTI_IT (0x1uL << EXTI_MODE_Pos)
306#define EXTI_EVT (0x2uL << EXTI_MODE_Pos)
307#define TRIGGER_MODE_Pos 20u
308#define TRIGGER_MODE (0x7uL << TRIGGER_MODE_Pos)
309#define TRIGGER_RISING (0x1uL << TRIGGER_MODE_Pos)
310#define TRIGGER_FALLING (0x2uL << TRIGGER_MODE_Pos)
311#define TRIGGER_LEVEL (0x4uL << TRIGGER_MODE_Pos)
321#define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET))
322#define IS_GPIO_PIN(__PIN__) ((((uint32_t)(__PIN__) & GPIO_PIN_MASK) != 0x00U) &&\
323 (((uint32_t)(__PIN__) & ~GPIO_PIN_MASK) == 0x00U))
324#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\
325 ((MODE) == GPIO_MODE_OUTPUT_PP) ||\
326 ((MODE) == GPIO_MODE_OUTPUT_OD) ||\
327 ((MODE) == GPIO_MODE_AF_PP) ||\
328 ((MODE) == GPIO_MODE_AF_OD) ||\
329 ((MODE) == GPIO_MODE_IT_RISING) ||\
330 ((MODE) == GPIO_MODE_IT_FALLING) ||\
331 ((MODE) == GPIO_MODE_IT_RISING_FALLING) ||\
332 ((MODE) == GPIO_MODE_EVT_RISING) ||\
333 ((MODE) == GPIO_MODE_EVT_FALLING) ||\
334 ((MODE) == GPIO_MODE_EVT_RISING_FALLING) ||\
335 ((MODE) == GPIO_MODE_ANALOG))
336#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_SPEED_FREQ_LOW) || ((SPEED) == GPIO_SPEED_FREQ_MEDIUM) || \
337 ((SPEED) == GPIO_SPEED_FREQ_HIGH) || ((SPEED) == GPIO_SPEED_FREQ_VERY_HIGH))
339#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \
340 ((PULL) == GPIO_PULLDOWN))
GPIO_PinState
GPIO Bit SET and Bit RESET enumeration.
Definition: stm32h7xx_hal_gpio.h:69
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
Header file of GPIO HAL Extension module.
GPIO Init structure definition.
Definition: stm32h7xx_hal_gpio.h:48
uint32_t Mode
Definition: stm32h7xx_hal_gpio.h:52
uint32_t Alternate
Definition: stm32h7xx_hal_gpio.h:61
uint32_t Pull
Definition: stm32h7xx_hal_gpio.h:55
uint32_t Pin
Definition: stm32h7xx_hal_gpio.h:49
uint32_t Speed
Definition: stm32h7xx_hal_gpio.h:58
General Purpose I/O.
Definition: stm32h723xx.h:1066