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

待进一步解析

相关推荐
Darken033 分钟前
基于单片机STM32中的OLED显示屏
stm32·单片机·oled·显示屏
Bona Sun23 分钟前
单片机手搓掌上游戏机(十九)—pico运行doom之硬件连接
c语言·c++·单片机·游戏机
Darken0328 分钟前
什么是SPI协议?
单片机·spi
努力小周41 分钟前
基于STM32物联网智能老年人防摔系统
stm32·单片机·嵌入式硬件·物联网·c#·课程设计
brave and determined42 分钟前
传感器学习(day02)毫米波雷达:重塑人机交互新维度
单片机·嵌入式硬件·嵌入式·人机交互·传感器·毫米波·嵌入式设计
Bona Sun1 小时前
单片机手搓掌上游戏机(二十二)—pico运行doom之固件和rom上传
c语言·c++·单片机·游戏机
贝塔实验室1 小时前
新手如何使用Altium Designer创建第一张原理图(一)
单片机·嵌入式硬件·fpga开发·proteus·硬件工程·基带工程·嵌入式实时数据库
十五年专注C++开发1 小时前
嵌入式软件架构设计浅谈
c语言·c++·单片机·嵌入式
宇宙realman_9991 小时前
DSP28335 CPU 定时器深度解析:从原理到实战
单片机·嵌入式硬件
黑客思维者1 小时前
嵌入式设备软件数字签名系统:从设计到落地实操指南
嵌入式硬件·数字签名