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

待进一步解析

相关推荐
兆龙电子单片机设计8 分钟前
【STM32项目开源】STM32单片机智能台灯系统
stm32·单片机·物联网·开源·毕业设计
sheepwjl14 分钟前
《嵌入式硬件(十七):基于IMX6ULL的温度传感器LM75a操作》
单片机·嵌入式硬件·imx6ull·lm75a
liujing1023292928 分钟前
stm32_基于 STM32U575 的飞行器姿态实时监控系统
stm32
jmlinux6 小时前
stm32与串口屏双向通讯官方例程
c语言·stm32·单片机·嵌入式硬件·物联网
GilgameshJSS10 小时前
STM32H742-ARM例程32-LCD
c语言·arm开发·stm32·单片机·嵌入式硬件·计算机外设
weixin_5168652612 小时前
STM32H750寄存器操作(硬件I2C)
stm32·1024程序员节
heisd_113 小时前
什么是状态机编程和模块化编程
单片机·嵌入式硬件
liujing1023292914 小时前
stm32_关于乐鑫ESP8266-07S WIFI模组烧录安信可科技的MQTT固件流程
科技·stm32·嵌入式硬件
zzz海羊15 小时前
江科大stm32 | OLED显示汉字
stm32·单片机·嵌入式硬件
Jack1530276827916 小时前
误接电容正负极的风险与注意事项
单片机·嵌入式硬件·逆变器·摇头机·电动工具·dc/dc变换器