|
[mw_shl_code=c,true]void GPIO_DefaultInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC \
| RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF \
| RCC_AHB1Periph_GPIOG, ENABLE); //使能所有时钟
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | \
GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | \
GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | \
GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; //选中所有IO口
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //100M
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化GPIOA
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化GPIOB
GPIO_Init(GPIOC, &GPIO_InitStructure); //初始化GPIOC
GPIO_Init(GPIOD, &GPIO_InitStructure); //初始化GPIOD
GPIO_Init(GPIOE, &GPIO_InitStructure); //初始化GPIOE
GPIO_Init(GPIOF, &GPIO_InitStructure); //初始化GPIOF
GPIO_Init(GPIOG, &GPIO_InitStructure); //初始化GPIOG
}[/mw_shl_code]
|