概述:学习STM32的GPIO configration

/****************************************************************************
* 名 称:void FM_Configuration(void)
* 功 能:I2C FM收音机模块TEA5767控制线的初始化
* 入口参数:无
* 出口参数:无
* 说 明:
* 调用方法:无
****************************************************************************/
void FM_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;      //GPIO_InitTypeDef @stm32f10x.gpio.h是一个结构体
/* 配置PB10,PB11为I2C的 SCL SDL */
GPIO_InitStructure.GPIO_Pin      = GPIO_Pin_10 | GPIO_Pin_11;   //选择PIN
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;            //10MHZ,2MHZ,50MHZ
GPIO_InitStructure.GPIO_Mode   = GPIO_Mode_IPU;                 //模式
GPIO_Init(GPIOB, &GPIO_InitStructure);                                  //Init
}

***

typedef struct
{
uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
                           This parameter can be any value of @ref GPIO_pins_define */

GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
                                                 This parameter can be a value of @ref GPIOSpeed_TypeDef */

GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
                                                This parameter can be a value of @ref GPIOMode_TypeDef */
}GPIO_InitTypeDef;

相关文章:

  • 2021-08-30
  • 2021-06-05
  • 2021-10-16
  • 2021-08-12
  • 2021-11-13
  • 2022-02-07
  • 2021-08-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-10-31
  • 2021-06-03
  • 2021-08-27
  • 2021-08-19
相关资源
相似解决方案