[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 小时前
STM32G473串口通信-USART/UART配置和清除串口寄存器状态的注意事项
stm32·单片机·嵌入式硬件
YTao_G1 小时前
STM32模块:023 WDG看门狗
stm32·单片机·嵌入式硬件
不想学习\??!1 小时前
STM32-DAC数模转换
stm32·单片机·嵌入式硬件
YTao_G1 小时前
STM32模块:021 BKP寄存器&RTC实时时钟
stm32·嵌入式硬件·实时音视频
Cyrus_柯1 小时前
单片机基础
嵌入式硬件·计算机基础
F133168929572 小时前
WD0407 40V 7A 超级肖特基二极管,应用于开关汽车工业控制
stm32·单片机·嵌入式硬件·汽车·51单片机
板栗焖小鸡2 小时前
STM32-ADC详解-光照强度实战
stm32·单片机·嵌入式硬件
嘿·嘘3 小时前
第八章 STM32之IAP编程
stm32·单片机·嵌入式硬件
林内克思5 小时前
stm32Cubmax的配置
stm32·单片机·嵌入式硬件
互联科技报5 小时前
重振索尼复古微型电脑——计划以OrangePi CM5 作为主板升级
单片机·嵌入式硬件·电脑