注:STM32F407VGT6 with STM32F4 DSP and standard peripherals library v1.8.0
void Pins_Init()
{
GPIO_InitTypeDef GPIO_InitStructure
//定义GPIO初始化结构体
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOE,ENABLE)
//使能IO口时钟
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2
//引脚选择
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN
//设置IO口模式
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_100MHz
//设置IO口输出速度
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP
//设置IO口为上拉(GPIO_PuPd_UP),下拉(GPIO_PuPd_DOWN)或不使用(GPIO_PuPd_NOPULL)
GPIO_Init(GPIOE,&GPIO_InitStructure)
//初始化该IO口
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_13
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_OUT
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP
//设置IO口的输出类型:推挽输出(GPIO_OType_PP),开漏输出(GPIO_OType_OD)
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_100MHz
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;
GPIO_Init(GPIOC,&GPIO_InitStructure);
GPIO_ResetBits(GPIOC,GPIO_Pin_13)
//将选定的引脚置0
}