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

待进一步解析

相关推荐
仰望星空的凡人2 小时前
瑞萨RH850/U2A 时钟系统深度解析:从时钟源、PLL 到外设时钟树的架构与应用
单片机·嵌入式硬件
Zw-awa3 小时前
云台是什么?舵机、步进、无刷电机一篇讲透,从控制原理到选型避坑
stm32
2501_922639587 小时前
率能半导体 SS8230 H桥驱动芯片:15V/1.8A,覆盖摄像机、玩具、机器人三大场景
stm32·单片机·嵌入式硬件·硬件工程
橘为己有44110 小时前
STM32:I2C(1)
stm32·单片机·嵌入式硬件
少司府11 小时前
嵌入式外设篇(三)GPIO·三:MCU系统结构、总线与统一编制
linux·python·stm32·单片机·嵌入式硬件·mcu·嵌入式软件
2501_9226395813 小时前
率能半导体 SS8812T双通道H桥驱动芯片:36V/1.6A,覆盖POS打印机、安防相机、办公自动化、游戏机、机器人五大应用场景
stm32·单片机·嵌入式硬件·硬件工程
ScilogyHunter13 小时前
[14] TMS570LC4357_VIM向量中断:128 通道、双 VIM 与硬件向量分发
单片机·编辑器·vim·excel·hercules·tms570
国科安芯14 小时前
FPGA上电偶发不启动:多轨电源时序、PGOOD与并联供电的FAE排查笔记——ASP4644S2B在星载智能处理板中的工程应用分析
笔记·单片机·嵌入式硬件·fpga开发·低轨卫星·抗辐射
国科安芯1 天前
卫星控制板偶发复位:MCU供电、时钟、ECC与总线的联合定位——AS32S601ZIT2在星载控制单元中的FAE排查方法
单片机·嵌入式硬件·mcu·risc-v·抗辐射·通信芯片
Zw-awa1 天前
姿态是怎么算出来的:互补解算、四元数和欧拉角
stm32