GPIO 配置示例

概述:学习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;

转载于:https://www.cnblogs.com/itloverhpu/p/3157693.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值