新手入门
- 积分
- 10
- 金钱
- 10
- 注册时间
- 2019-7-11
- 在线时间
- 1 小时
|
第一种方式:
//GPIO Config
GPIO_InitTypeDef* GPIO_InitStruct_Key;
GPIO_InitStruct_Key->GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruct_Key->GPIO_Pin = GPIO_Pin_2 |GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStruct_Key->GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStruct_Key->GPIO_Speed = GPIO_Speed_100MHz;
//GPIO Init
GPIO_Init(GPIOE,GPIO_InitStruct_Key);
第二种方式:
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100M
GPIO_Init(GPIOE, &GPIO_InitStructure);
以上两种方式有何不同,为什么开始我用第一种方式进行定义结构体的时候,下载到板子后,板子没有任何反应,然后改成第二种方式进行定义后,按键可以正常运行,并且,我如果我从第二种方法再改回到第一种的时候,下载后也能正常运行了,求大神帮忙解答一下
|
|