高级会员

- 积分
- 514
- 金钱
- 514
- 注册时间
- 2012-3-21
- 在线时间
- 0 小时
|

楼主 |
发表于 2013-8-6 12:23:00
|
显示全部楼层
回复【3楼】shihantu:
---------------------------------
我还是不懂,给我讲下吧。
程序的目的是把两个LED点亮,硬件上两个LED分别连在PA2和PA3上。初始化完整代码如下
#define LED_PIN_0 (GPIO_PinSource2)
#define LED_PIN_1 (GPIO_PinSource3)
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = (1<<LED_PIN_0) | (1><<LED_PIN_1); //1<<LED_PIN_0怎么理解?
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); //这里怎么是GPIOB,不应该是GPIOA ?
我做过实验,上述代码确实可以把两个led点亮。但我不明白为什么?> |
|