This is the DW1000 driver and our self developed distance measurement application based on it. We do this as a semester thesis at ETH Zürich under the Automatic Control Laboratory in the Department of electrical engineering.

Dependencies:   mbed

Committer:
manumaet
Date:
Mon Dec 01 13:04:18 2014 +0000
Revision:
31:6f76f3d518ac
Parent:
30:4ecc69d3cf8d
Child:
33:6ea4c3dd504d
ranging draft implemented, not working yet

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 31:6f76f3d518ac 26 } ;
manumaet 31:6f76f3d518ac 27 uint64_t rangingtimingsSender[10][2];
manumaet 31:6f76f3d518ac 28 uint64_t rangingtimingsReceiver[10][2];
manumaet 31:6f76f3d518ac 29 uint8_t ranging_i;
manumaet 31:6f76f3d518ac 30 uint64_t tofs[10];
manumaet 31:6f76f3d518ac 31
manumaet 31:6f76f3d518ac 32 rangingframe TX;
manumaet 31:6f76f3d518ac 33
manumaet 28:a830131560e8 34 // draft for first test
manumaet 28:a830131560e8 35 bool receiver;
manumaet 28:a830131560e8 36 char message[1021];
manumaet 28:a830131560e8 37 char messageRX[1021];
manumaet 28:a830131560e8 38 uint64_t TX_timestamp;
manumaet 28:a830131560e8 39 uint64_t RX_timestamp;
manumaet 28:a830131560e8 40 int event_i;
manumaet 28:a830131560e8 41 char event[10][20];
manumaet 28:a830131560e8 42 uint64_t eventtimes[10];
manumaet 28:a830131560e8 43 uint8_t counter;
manumaet 27:71178fdb78e1 44 };
manumaet 27:71178fdb78e1 45
manumaet 27:71178fdb78e1 46 #endif