This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541协议栈怎么入门.....QWQ

Other Parts Discussed in Thread: CC2541

Q1

对于web开发的我来讲,只会调方法 ヽ(・ω・´メ)

没想到在蓝牙上点个灯都如此费劲

我的蓝牙模块上灯的IO口为P0_5,但是simpleBLEPeripheral这个项目里面hal_board_cfg.h文件里定义了3个灯

/* 1 - Green */

/* 2 - Red */

/* 3 - Yellow */

但是为啥hal_led.h里面是四个灯

#define HAL_LED_1 0x01
#define HAL_LED_2 0x02
#define HAL_LED_3 0x04
#define HAL_LED_4 0x08

这里不懂

--------------------------------------------------------------------------------------

Q2.1

对于亮灯的方法来说如果不使用协议栈我是这样的

P0DIR |= 0x20; //案例代码为 P1DIR |= 0x13;   说是设置P1.0、P1.1、P1.4设置为输出,我这里是设置P0_5为输出哈?

然后我直接就

P0_5=1;

然后灯就一直亮了

--------------------------------

Q2.2

P0_5的定义是放在<ioCC2540.h>之中吗?这个文件在哪?

--------------------------------------------------------------------------------------

Q3

是的,我把代码

P0DIR |= 0x20;
P0_5=1;
delay_ms(300);
P0_5=0;
delay_ms(300);

放在SimpleBLEPeripheral_Main函数中但是不论我怎么调delay_ms的参数,灯都是异常亮灭

我是不是需要在hal_board_cfg.h这个文件中定义P0_5这个灯然后再调用什么函数来使灯亮灭呢?


最后,万分感谢各位大佬的回答ヽ(^ω^)ノ