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

待进一步解析

相关推荐
LCG米17 分钟前
嵌入式Python开发:MicroPython在物联网硬件上的实战应用案例
python·单片机·物联网
云山工作室1 小时前
基于zigbee的广告牌安全监测系统设计与实现(论文+源码)
单片机·毕业设计·毕设
DIY机器人工房1 小时前
简单理解:为什么错误计数器一般要选 uint32_t 类型?
stm32·单片机·嵌入式硬件·嵌入式·diy机器人工房
上大科技蔡生1 小时前
CS5567:具有宽占空比范围的60V同步降压DCDC控制器
单片机·嵌入式硬件·fpga开发·dcdc
lingzhilab1 小时前
零知IDE——基于STM32F103RBT6的PAJ7620U2手势控制WS2812 RGB灯带系统
stm32·单片机·嵌入式硬件
三佛科技-187366133971 小时前
BP85956D集成VCC电容电机驱动BUCK电源芯片(12V300mA应用电路)
stm32·单片机·物联网
爱睡觉的王宇昊2 小时前
PCB设计完全指南:从软件选择到基础规范(通用电路篇详解)
笔记·stm32·单片机·嵌入式硬件·学习
白书宇2 小时前
【STM32实战】从零开始写Linux 0.12内核 第1个实验安装IAR 8.5
linux·c语言·驱动开发·stm32·单片机·嵌入式硬件
意法半导体STM322 小时前
【官方原创】一站式生成STM32N6的ExtMemLoader, FSBL, Appli的点灯工程 LAT1614
人工智能·stm32·单片机·嵌入式硬件·mcu·stm32n6
ShiMetaPi2 小时前
GM-3568JHF丨ARM+FPGA异构开发板系列教程:外设教程 08 串口
stm32·单片机·fpga开发·rk3568