MicroController_GPIO
GPIO初始化
GPIO_InitTypeDef GPIO_InitStructure; //定义结构体变量
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOF, ENABLE ); //使能端口F时钟
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //输出模式
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //管脚设置F9
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; //速度为100M
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽输出
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init( GPIOF, &GPIO_InitStructure ); //初始化结构体
GPIO_Mode
参数:GPIO_Mode_IN
输入模式GPIO_Mode_OUT
输出模式GPIO_Mode_AF
复用模式GPIO_Mode_AN
模拟输入模式
GPIO_OType
参数:GPIO_OType_PP
推挽输出GPIO_OType_OD
开漏输出
GPIO使用
设置为高电平
GPIO_SetBits( GPIOF, GPIO_Pin_9 );
设置为低电平
GPIO_ResetBits( GPIOF, GPIO_Pin_9 );