itloverhpu

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

posted on 2013-06-26 23:21  itloverhpu  阅读(409)  评论(0编辑  收藏  举报