void GPIO_Init(void)
{
GPIO_InitTypeDef GPIOX_InitStructure;//定义一个结构体
GPIOX_InitStructure.GPIO_Pin=GPIO_Pin_Y;//配置引脚
GPIOX_InitStructure.GPIO_Mode=GPIO_Mode_;//配置端口模式为输出
GPIOX_InitStructure.GPIO_Speed=;//配置输出速度
GPIOX_InitStructure.GPIO_OType=GPIO_OType_;//推挽输出
GPIOX_InitStructure.GPIO_PuPd= GPIO_PuPd_;//上拉
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOX,ENABLE);//打开gpio串口使能
GPIO_Init(GPIOX, &GPIOX_InitStructure);//初始化
GPIO_SetBits(GPIOX,GPIO_Pin_Y);//引脚置高电平
GPIO_ResetBits(GPIOX,GPIO_Pin_Y);//引脚置低电平
}
GPIO初始化代码
于 2023-05-16 20:37:22 首次发布