STM32U575之GPIO详解
typedef struct
{
uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be a value of @ref GPIO_pins */
uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIO_mode */
uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins.
This parameter can be a value of @ref GPIO_pull */
uint32_t Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIO_speed */
uint32_t Alternate; /*!< Peripheral to be connected to the selected pins
This parameter can be a value of @ref GPIOEx_Alternate_function_selection */
} GPIO_InitTypeDef;
1. GPIO_InitStruct.Pin:// 配置管脚号;
2.GPIO_InitStruct.Mode;// 配置管脚模式
#define GPIO_MODE_INPUT 输入浮空模式,不使用上下拉电阻;
#define GPIO_MODE_OUTPUT_PP: 具有上下拉的推挽输出模式,在外部不使用上下拉电阻推免输出1时为高电平,输出0时为低电平;
#define GPIO_MODE_OUTPUT_OD 具有上下拉的开漏输出模式。如果不使用上拉或下拉电阻,推挽输出1时为高阻态,输出0时为低电平;
#define GPIO_MODE_AF_PP: 具有上下拉的复用功能推挽模式;
#define GPIO_MODE_AF_OD 具有上下拉的复用功能开漏模式
#define GPIO_MODE_ANALOG 作为模拟引脚,用于ADC输入引脚或DAC输出引脚;
#define GPIO_MODE_IT_RISING 外部中断上跳沿触发
#define GPIO_MODE_IT_FALLING 外部中断下跳沿触发
#define GPIO_MODE_IT_RISING_FALLING 外部中断上下跳沿触发
#define GPIO_MODE_EVT_RISING
#define GPIO_MODE_EVT_FALLING
#define GPIO_MODE_EVT_RISING_FALLING
3. GPIO_InitStruct.Mode;// 配置管脚模式
#define GPIO_NOPULL 无上下拉
#define GPIO_PULLUP 上拉
#define GPIO_PULLDOWN 下拉
4. GPIO_InitStruct.Speed // 定时输出模式引脚的最高输出频率
#define GPIO_SPEED_FREQ_LOW // 低速 2MHz
#define GPIO_SPEED_FREQ_MEDIUM // 中速12.5~50MHz
#define GPIO_SPEED_FREQ_HIGH // 高速25~100MHz
#define GPIO_SPEED_FREQ_VERY_HIGH // 50~200MHz

浙公网安备 33010602011771号