标题: 求助GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; [打印本页]

作者: hcx00000    时间: 2021-4-3 07:33
标题: 求助GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOE, ENABLE);         //使能PB,PE端口时钟
既然使能PB,PE端口时钟,为什么下一句
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;                 //LED0-->B.5 端口配置
是B.5端口而不是E.5,我的困惑是怎么判断选的是哪一个端口,依据是什么?

作者: ANT1987    时间: 2021-4-3 17:01
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;                                 //LED0-->B.5 端口配置
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;     
GPIO_Init(GPIOB, &GPIO_InitStructure);                        

这样才是选择B.5,你那两行选择不了




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1