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

待进一步解析

相关推荐
串口哑火达人12 小时前
(六)RT-Thread网络通信--AT组件与ESP8266
c语言·单片机·嵌入式硬件·mcu·物联网
qq_4112624212 小时前
把esp32-c2当单片机用,不用wifi,如何配置,节省更多内存
单片机·嵌入式硬件
kaikaile199515 小时前
农业物联网基于STM32的LoRa无线通信系统设计与实现
stm32·嵌入式硬件·物联网
wsoz17 小时前
MCU中部署TinyMaix
单片机·mcu·神经网络·嵌入式·tinymaix
香水5只用六神17 小时前
【RTOS快速入门】07_同步互斥与通信概述
单片机·嵌入式硬件·学习·操作系统·freertos·rtos·嵌入式软件
爱倒腾的老唐17 小时前
01、STM32-嵌入式系统
stm32·嵌入式硬件
码农三叔18 小时前
(6-4-02)IMU融合与机体状态估计:综合实战:腿式机器人的IMU关节融合与状态估计(2)
人工智能·嵌入式硬件·机器人·人机交互·人形机器人
qq_3975623118 小时前
RV1106的安装使用 + linux的编程运行
单片机·嵌入式硬件
良许Linux19 小时前
ASIC的设计和制造
单片机·嵌入式硬件·fpga开发·程序员·嵌入式·制造
雨洛lhw19 小时前
DMA技术
嵌入式硬件·dma