[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号14 分钟前
【STM32】hal库 多通道ADC(+DMA)采集 连续模式
stm32·单片机·嵌入式硬件
Shang1809893572620 分钟前
MS2107高性能USB 2.0视频信号和音频采集,支持NTSC/PAL制式,适用于低成本视频采集设备
嵌入式硬件·fpga开发·音视频·硬件工程·信息与通信·dsp开发
学工科的皮皮志^_^2 小时前
网口学习理解
经验分享·笔记·嵌入式硬件·学习·fpga开发·以太网
沐欣工作室_lvyiyi3 小时前
基于物联网的家畜管理的监测与控制系统(论文+源码)
单片机·物联网·毕业设计·家畜管理
大牛攻城狮3 小时前
使用stm32cubeide stm32f103 freeRTOS 实现Modbus RTU协议寄存器读写过程详解
stm32·freertos·modbus·stm32cubeide·modbus rtu·stm32从机·工程代码
蓑衣客VS索尼克3 小时前
第二篇:按键交互入门:STM32 GPIO输入与消抖处理
stm32·单片机·嵌入式硬件
蓬荜生灰3 小时前
第5章—STM32工程创建
stm32·单片机·嵌入式硬件
hazy1k3 小时前
51单片机基础-定时器中断
stm32·单片机·嵌入式硬件·51单片机
恒锐丰小吕4 小时前
矽塔 SA8204 输入耐压36V 2.5A可调过流保护 集成故障报告的智能过压/过流保护芯片
嵌入式硬件·硬件工程
太空1号5 小时前
VxWorks入门小白菜鸟教程3 —— 编译运行VxWorksSDK示例hello_cmake_rtp(Windows篇)
windows·嵌入式硬件