RTEMS 6.1-rc6
Loading...
Searching...
No Matches
stm32h7xx_hal_gpio.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_GPIO_H
21#define STM32H7xx_HAL_GPIO_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
38/* Exported types ------------------------------------------------------------*/
47typedef struct
48{
49 uint32_t Pin;
52 uint32_t Mode;
55 uint32_t Pull;
58 uint32_t Speed;
61 uint32_t Alternate;
64
68typedef enum
69{
70 GPIO_PIN_RESET = 0U,
71 GPIO_PIN_SET
77/* Exported constants --------------------------------------------------------*/
78
88#define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
89#define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */
90#define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */
91#define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */
92#define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */
93#define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */
94#define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */
95#define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */
96#define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */
97#define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */
98#define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */
99#define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */
100#define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */
101#define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */
102#define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */
103#define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */
104#define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */
105
106#define GPIO_PIN_MASK (0x0000FFFFU) /* PIN mask for assert test */
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)
167/* Exported macro ------------------------------------------------------------*/
179#define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__))
180
187#define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__))
188
195#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__))
196
203#define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__))
204
205#if defined(DUAL_CORE)
212#define __HAL_GPIO_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI->C2PR1 & (__EXTI_LINE__))
213
220#define __HAL_GPIO_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI->C2PR1 = (__EXTI_LINE__))
221
228#define __HAL_GPIO_EXTID2_GET_IT(__EXTI_LINE__) (EXTI->C2PR1 & (__EXTI_LINE__))
229
236#define __HAL_GPIO_EXTID2_CLEAR_IT(__EXTI_LINE__) (EXTI->C2PR1 = (__EXTI_LINE__))
237#endif
238
245#define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER1 |= (__EXTI_LINE__))
250/* Include GPIO HAL Extension module */
252
253/* Exported functions --------------------------------------------------------*/
261/* Initialization and de-initialization functions *****************************/
262void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init);
263void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin);
271/* IO operation functions *****************************************************/
272GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
273void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
274void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
275HAL_StatusTypeDef HAL_GPIO_LockPin(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);
278
286/* Private types -------------------------------------------------------------*/
287/* Private variables ---------------------------------------------------------*/
288/* Private constants ---------------------------------------------------------*/
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)
316/* Private macros ------------------------------------------------------------*/
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))
338
339#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \
340 ((PULL) == GPIO_PULLDOWN))
341
346/* Private functions ---------------------------------------------------------*/
364#ifdef __cplusplus
365}
366#endif
367
368#endif /* STM32H7xx_HAL_GPIO_H */
369
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