Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

Committer:
manumaet
Date:
Tue Dec 02 13:55:01 2014 +0000
Revision:
33:6ea4c3dd504d
Parent:
31:6f76f3d518ac
Child:
34:f56962030c5c
first simple measurement works (gives 1.0362 us)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
manumaet 27:71178fdb78e1 1 // by Matthias Grob & Manuel Stalder - ETH Zürich - 2015
manumaet 27:71178fdb78e1 2
manumaet 27:71178fdb78e1 3 #ifndef MMRANGING_H
manumaet 27:71178fdb78e1 4 #define MMRANGING_H
manumaet 27:71178fdb78e1 5
manumaet 27:71178fdb78e1 6 #include "mbed.h"
manumaet 27:71178fdb78e1 7 #include "DW1000.h"
manumaet 27:71178fdb78e1 8
manumaet 27:71178fdb78e1 9 #define MMRANGING_TIMEUNIT 1/(128*499.2) // conversion between LSB of TX and RX timestamps and microseconds
manumaet 27:71178fdb78e1 10
manumaet 27:71178fdb78e1 11 class MMRanging {
manumaet 28:a830131560e8 12 public:
manumaet 28:a830131560e8 13 MMRanging(DW1000& DW);
manumaet 28:a830131560e8 14 void requestRanging();
manumaet 31:6f76f3d518ac 15 void requestTime();
manumaet 28:a830131560e8 16 //private:
manumaet 28:a830131560e8 17 DW1000& dw;
manumaet 28:a830131560e8 18
manumaet 30:4ecc69d3cf8d 19 void callbackRX();
manumaet 30:4ecc69d3cf8d 20 void callbackTX();
manumaet 30:4ecc69d3cf8d 21
manumaet 31:6f76f3d518ac 22 struct rangingframe { // has a length of 10 bytes
manumaet 31:6f76f3d518ac 23 uint8_t type;
manumaet 31:6f76f3d518ac 24 uint8_t sequence_number;
manumaet 31:6f76f3d518ac 25 uint64_t time_difference_receiver;
manumaet 33:6ea4c3dd504d 26 uint16_t dummy;
manumaet 31:6f76f3d518ac 27 } ;
manumaet 31:6f76f3d518ac 28 uint64_t rangingtimingsSender[10][2];
manumaet 31:6f76f3d518ac 29 uint64_t rangingtimingsReceiver[10][2];
manumaet 31:6f76f3d518ac 30 uint8_t ranging_i;
manumaet 31:6f76f3d518ac 31 uint64_t tofs[10];
manumaet 31:6f76f3d518ac 32
manumaet 31:6f76f3d518ac 33 rangingframe TX;
manumaet 31:6f76f3d518ac 34
manumaet 28:a830131560e8 35 // draft for first test
manumaet 28:a830131560e8 36 bool receiver;
manumaet 28:a830131560e8 37 char message[1021];
manumaet 28:a830131560e8 38 char messageRX[1021];
manumaet 28:a830131560e8 39 uint64_t TX_timestamp;
manumaet 28:a830131560e8 40 uint64_t RX_timestamp;
manumaet 28:a830131560e8 41 int event_i;
manumaet 28:a830131560e8 42 char event[10][20];
manumaet 28:a830131560e8 43 uint64_t eventtimes[10];
manumaet 28:a830131560e8 44 uint8_t counter;
manumaet 27:71178fdb78e1 45 };
manumaet 27:71178fdb78e1 46
manumaet 27:71178fdb78e1 47 #endif