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 模塊已經打樣測試完畢,有興趣的可以申請購買了,更多信息參見 藍點論壇