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

待进一步解析

相关推荐
DIY机器人工房6 小时前
简单理解:新唐 NuMicro M483这款MCU
stm32·diy机器人工房·新唐 numicro m480·m480
某林2127 小时前
基于SLAM Toolbox的移动机器人激光建图算法原理与工程实现
stm32·嵌入式硬件·算法·slam
DTI07017 小时前
xilinx的vivado工具综合一直转圈圈,卡死后如何解决?
嵌入式硬件·fpga开发
点灯小铭9 小时前
基于单片机的去皮计价与超重报警电子秤设计与实现
单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
章鱼哥嵌入式开发11 小时前
【 STM32 ADC电压采集与串口显示系统】
stm32·单片机·课程设计·嵌入式学习·实验室测量
树上掉下一只鱼12 小时前
STM32F4xxx系列 - DAC生成噪声波
stm32
HappyShengxiang13 小时前
TI发布全新Cortex-M33的MCU产品MSPM33C321A
单片机·嵌入式硬件·mcu·电赛
✧˖‹gσσ∂ иιghт›✧13 小时前
stm32 cube max+keil5的环境怎么printf重定向
stm32·单片机·嵌入式硬件
芋头莎莎14 小时前
keil 4 51单片机的安装教程
单片机·嵌入式硬件·51单片机
xingzhemengyou115 小时前
STM32 时钟树
stm32·单片机