DWM1000 收发RXLED TXLED控制代码修改

DWM1000 模块一共可以最多外接4个LED,但是API默认只会只用到两个LED,分别是RXLED、TX LED。

特别注意:RXLED 是模块在RX 状态,而不是接收到数据。

修改代码,使得4个LED全部工作,修改代码如下,在DWM1000 初始化完,调用dwt_setleds(1)即可。

 1 void dwt_setleds(uint8 test)
 2 {
 3     uint8 buf[2];
 4 
 5     if(test & 0x1)
 6     {
 7         // Set up MFIO for LED output
 8         dwt_readfromdevice(GPIO_CTRL_ID,0x00,2,buf);
 9         buf[0] &= ~0xC0; //clear the bits
10         buf[0] |= 0x40;
11 
12         
13         buf[1] &= ~0x3F; //clear the bits
14         buf[1] |= 0x15;
15         dwt_writetodevice(GPIO_CTRL_ID,0x00,2,&buf[0]);
16 
17         // Enable LP Oscillator to run from counter, turn on debounce clock
18         dwt_readfromdevice(PMSC_ID,0x02,1,buf);
19         buf[0] |= 0x84; //
20         dwt_writetodevice(PMSC_ID,0x02,1,buf);
21 
22         // Enable LEDs to blink
23         buf[0] = 0x10; // Blink period.
24         buf[1] = 0x01; // Enable blink counter
25         dwt_writetodevice(PMSC_ID,PMSC_LEDC_OFFSET,2,buf);
26 
27     }

蓝点DWM1000 模块已经打样测试完毕,有兴趣的可以申请购买了,更多信息参见 蓝点论坛

原文地址:https://www.cnblogs.com/tuzhuke/p/10013843.html