[stm32f407]GPIO配置方式

GPIO模式:

cpp 复制代码
    GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN;
    GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;//是否需要
    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_11;
    GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;//上拉
    GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;

GPIO_Mode:

cpp 复制代码
typedef enum
{ 
  GPIO_Mode_IN   = 0x00, /*!< GPIO Input Mode */
  GPIO_Mode_OUT  = 0x01, /*!< GPIO Output Mode */
  GPIO_Mode_AF   = 0x02, /*!< GPIO Alternate function Mode */
  GPIO_Mode_AN   = 0x03  /*!< GPIO Analog Mode */
}GPIOMode_TypeDef;

GPIO_OType:

cpp 复制代码
typedef enum
{ 
  GPIO_OType_PP = 0x00,
  GPIO_OType_OD = 0x01
}GPIOOType_TypeDef;

GPIO_PuPd:

cpp 复制代码
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;

待进一步解析

相关推荐
czwxkn15 分钟前
1.PCB设计:电容
单片机·嵌入式硬件
nudt_qxx1 小时前
Ubuntu 24.04/26.04 与 Windows 10/11 双系统时间不同步终极解决方案
windows·stm32·ubuntu
达不溜的日记1 小时前
PDUR路由基本功能
网络·stm32·单片机·嵌入式硬件·mcu·51单片机·信息与通信
踏着七彩祥云的小丑1 小时前
嵌入式——认识电子元器件——可控硅系列
单片机·嵌入式硬件
MikelSun2 小时前
Sun01 - STM32智能编译烧录助手
人工智能·stm32·单片机·物联网·iot
Ww.xh2 小时前
STM32按键去抖防竞争方案
stm32·单片机·嵌入式硬件
Deitymoon2 小时前
ESP8266——烧录AT固件
单片机·嵌入式硬件
xiangw@GZ2 小时前
PCB工艺与核心参数全解析
嵌入式硬件·pcb工艺
LS_learner2 小时前
KiCad 绘制PCB使用 AI 增强方案
嵌入式硬件
LS_learner2 小时前
自动绘制或辅助绘制PCB的AI工具
嵌入式硬件