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

待进一步解析

相关推荐
阿让啊1 小时前
C语言strtol 函数使用方法
c语言·数据结构·c++·单片机·嵌入式硬件
DebugKitty5 小时前
硬件开发1-51单片机4-DS18B20
单片机·嵌入式硬件·51单片机·ds18b20
Hello_Embed5 小时前
STM32HAL 快速入门(十九):UART 编程(二)—— 中断方式实现收发及局限分析
笔记·stm32·单片机·嵌入式硬件·学习
沐欣工作室_lvyiyi5 小时前
基于单片机的可燃性气体泄漏智能报警系统
stm32·单片机·嵌入式硬件·毕业设计
hazy1k5 小时前
STM32H750 RTC介绍及应用
网络·stm32·实时音视频
殷忆枫6 小时前
基于STM32物联网冻保鲜运输智能控制系统
stm32·嵌入式硬件·物联网
武文斌776 小时前
单片机:DS18B20测温度、74HC595扩展芯片、8*8LED矩阵
运维·服务器·单片机·嵌入式硬件
hardStudy_h7 小时前
GPIO介绍
单片机·嵌入式硬件
xyx-3v8 小时前
STM32的USART的数据寄存器只有一个吗?
stm32·单片机·嵌入式硬件
古译汉书8 小时前
嵌入式铁头山羊stm32-ADC实现定时器触发的注入序列的单通道转换-Day26
开发语言·数据结构·stm32·单片机·嵌入式硬件·算法