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

待进一步解析

相关推荐
List<String> error_P5 小时前
STM32 Systick定时器介绍
stm32·定时器·systick
蓑衣客VS索尼克5 小时前
STM32G4针对串口通信异常的操作
stm32·单片机·嵌入式硬件
小康小小涵6 小时前
STM32F103RCT6编写iNav1.7.3飞控固件底层开发
stm32·单片机·嵌入式硬件
小郭团队9 小时前
1_6_五段式SVPWM (传统算法反正切+DPWM2)算法理论与 MATLAB 实现详解
嵌入式硬件·算法·matlab·dsp开发
小郭团队9 小时前
1_7_五段式SVPWM (传统算法反正切+DPWM3)算法理论与 MATLAB 实现详解
开发语言·嵌入式硬件·算法·matlab·dsp开发
爱潜水的小L10 小时前
自学嵌入式day49,arm led、蜂鸣器和bsp
arm开发·单片机·嵌入式硬件
物联网牛七七11 小时前
stm32内核寄存器和外设寄存器
stm32·单片机·嵌入式硬件
嗯嗯=11 小时前
STM32单片机学习篇3
stm32·单片机·学习
梁洪飞12 小时前
通过链接文件和Start.S学习armv7
linux·arm开发·嵌入式硬件·学习·arm
m0_5557629013 小时前
STM32H7 + VS Code + OpenOCD + STLink 完整配置教程
stm32·单片机·嵌入式硬件