gpio_inittypedef
时间: 2023-06-11 07:07:28 浏览: 85
`GPIO_InitTypeDef` 是一个结构体类型,用于初始化 STM32F 系列芯片的 GPIO 外设。该结构体在 STM32Cube HAL 库中定义,包含以下成员:
- `GPIO_Pin`: 指定要初始化的 GPIO 引脚,可以是一个或多个引脚的按位或组合。
- `GPIO_Mode`: 指定 GPIO 引脚的工作模式,包括输入、输出、复用功能等。
- `GPIO_Speed`: 指定 GPIO 引脚的速度等级,可以是低速、中速或高速。
- `GPIO_Pull`: 指定 GPIO 引脚的上下拉电阻,可以是无、上拉或下拉。
以下是 `GPIO_InitTypeDef` 结构体的定义:
```c
typedef struct
{
uint32_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be any value of @ref GPIO_pins_define */
GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIOMode_TypeDef */
GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIOSpeed_TypeDef */
GPIOOType_TypeDef GPIO_OType; /*!< Specifies the operating output type for the selected pins.
This parameter can be a value of @ref GPIOOType_TypeDef */
GPIOPuPd_TypeDef GPIO_PuPd; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
This parameter can be a value of @ref GPIOPuPd_TypeDef */
} GPIO_InitTypeDef;
```