[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;

待进一步解析

相关推荐
flashier9 分钟前
ESP32学习笔记_WiFi(3)——HTTP
网络·笔记·单片机·网络协议·学习·http·esp32
兆龙电子单片机设计17 分钟前
【STM32项目开源】STM32单片机智能宠物管家
stm32·单片机·物联网·开源·毕业设计·宠物
阿呀呀呀24 分钟前
ESP32复位电路分析
单片机·嵌入式硬件
华清远见IT开放实验室1 小时前
【课程升级】STM32U5体系化课程深度升级!全103集,覆盖裸机开发+TouchGFX图形界面+智能手表项目,从入门到实战!
stm32·单片机·嵌入式硬件·智能手表
一路往蓝-Anbo1 小时前
第 2 篇:单例模式 (Singleton) 与 懒汉式硬件初始化
开发语言·数据结构·stm32·单片机·嵌入式硬件·链表·单例模式
嵌入你的世界1 小时前
cmBacktrace 实现原理解析:从 HardFault 现场到源码回溯
stm32·单片机·嵌入式硬件·cmbacktrace
BackCatK Chen2 小时前
浅聊:STM32 2026 年核心技术及选型建议
stm32·单片机·嵌入式硬件·csdn年度技术趋势预测
【赫兹威客】浩哥2 小时前
【赫兹威客】ESP32点灯实验
单片机·嵌入式硬件·esp32
羽获飞2 小时前
从零开始学嵌入式之STM32——4.使用寄存器点亮一个LED灯--代码优化
stm32·单片机·嵌入式硬件
卜锦元2 小时前
Mac 上无痛使用 Windows 双系统的完整实践(Intel 或 Apple M芯片都可以)
windows·单片机·macos·金融·系统架构