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

待进一步解析

相关推荐
一条破秋裤31 分钟前
STM32F103 RCC 第一层复习:时钟树、外设时钟与重复测试
stm32·单片机·嵌入式硬件
Kuakewei8882 小时前
PD/QC快充协议诱骗芯片设计手册:Type-C受电端完整应用方案
嵌入式硬件
smartpi_ai2 小时前
原理图上的 1.2V 是输入还是输出?蜂鸟 M 裸芯供电架构、CORE 滤波设计与外围器件三规矩
单片机·嵌入式硬件·架构
扬扬的三格电力笔记3 小时前
编码器信号远距离传输总出错?聊聊 HTL/TTL 转光纤模块,解决编码器干扰与距离难题
网络·嵌入式硬件
一条破秋裤3 小时前
STM32 单片机两层学习规划
stm32·单片机·学习
2601_950790683 小时前
国产单片机厂家推荐:用统一回复协议筛选候选
单片机·嵌入式硬件
天空'之城4 小时前
单片机基础核心知识点汇总(三十二)
单片机·嵌入式硬件
雨田言炎4 小时前
2026/09/09 STM32F103复习(三)
stm32·单片机·嵌入式硬件
Jackson_GJH4 小时前
模拟 IIC 逻辑的深度解构
stm32·单片机·嵌入式硬件
苹果嘉尔121385 小时前
imx6ull芯片——设置流程
单片机·嵌入式硬件