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

待进一步解析

相关推荐
Tomhex10 分钟前
ARMv7与Cortex-M3关系解析
stm32
傻童:CPU43 分钟前
stm32程序的启动过程
stm32
JaneHan_2 小时前
STM32CubeMX+HAL+Keil5 PWM呼吸灯
c语言·stm32·单片机
Ww.xh2 小时前
STM32嵌入AI模型全流程指南
stm32
Ww.xh2 小时前
STM32嵌入AI模型实战指南
stm32
傻童:CPU3 小时前
板级支持包的构建
stm32
进击的小头3 小时前
第7篇:嵌入式芯片运算核心:ALU_MAC_FPU的工作原理与性能差异
单片机·嵌入式硬件
振南的单片机世界3 小时前
RS485组网:一问一答,多个从机不打架
单片机·嵌入式硬件
开源盛世!!3 小时前
4.9-4.11
单片机·嵌入式硬件
路过羊圈的狼4 小时前
STM32使用SFUD (Serial Flash Universal Driver) 串行 Flash 通用驱动库驱动W25Q128
stm32·单片机·嵌入式硬件