Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

Revision:
20:257d56530ae1
Parent:
19:e94bc88c1eb0
Child:
21:23bf4399020d
diff -r e94bc88c1eb0 -r 257d56530ae1 main.cpp
--- a/main.cpp	Tue Nov 25 14:48:51 2014 +0000
+++ b/main.cpp	Tue Nov 25 15:22:53 2014 +0000
@@ -11,7 +11,7 @@
 uint64_t timestamp_old = 0;
 
 void callbackRX(int framelength) {
-    if(framelength<200) {
+    if (framelength<200) {
         char* receive = dw.receiveString();                             // receive a string
         pc.printf("Received: \"%s\" %d ", receive, framelength);
         delete[] receive;
@@ -24,8 +24,7 @@
     uint64_t difference = timestamp - timestamp_old;
     timestamp_old = timestamp;
     //pc.printf("Timestamp: %lld\r\n", difference);
-    pc.printf("Timestamp: %fs", difference*timeunit);       // TODO: gives some wrong values because of timer overflow
-    pc.printf("\r\n");
+    pc.printf("Timestamp: %fs\r\n", difference*timeunit);       // TODO: gives some wrong values because of timer overflow
     dw.startRX();
 }
 
@@ -40,22 +39,17 @@
 }
 
 int main() {
-    pc.printf("DecaWave 0.1\r\nup and running!\r\n");
-    
-    dw.setEUI(0xFAEDCD01FAEDCD01);                  // basic methods called to check if we have a slave
+    pc.printf("DecaWave 0.1\r\nup and running!\r\n");  
+    dw.setEUI(0xFAEDCD01FAEDCD01);                  // basic methods called to check if we have a working SPI connection
     pc.printf("%d DEVICE_ID register: 0x%X\r\n", i, dw.getDeviceID());
     pc.printf("%d EUI register: %016llX\r\n", i, dw.getEUI());
     pc.printf("%d Voltage: %f\r\n", i, dw.getVoltage());
     
-    uint32_t conf = 0;     // read System Configuration
-    dw.readRegister(DW1000_SYS_CFG, 0, (uint8_t*)&conf, 4);
-    pc.printf("%d System Configuration: %X\r\n", i, conf);
-    
     dw.callbackRX = &callbackRX;        // TODO: must not jump to NULL & setter
     dw.callbackTX = &callbackTX;
     
     // Receiver initialisation
-    dw.writeRegister16(DW1000_SYS_MASK, 0, 0x4080); // RX only good frame 0x4000, RX all frames 0x2000, TX done 0x0080
+    dw.writeRegister16(DW1000_SYS_MASK, 0, 0x4080); // TODO: RX only good frame 0x4000, RX all frames 0x2000, TX done 0x0080
     dw.startRX();
     
     while(1) {