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:
Sat Dec 27 14:37:12 2014 +0000
Revision:
34:f56962030c5c
Parent:
33:6ea4c3dd504d
Child:
35:95d838d33bf5
when merging to eclipse & svn

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 34:f56962030c5c 21 void sendRangingframe(uint8_t type, uint8_t sequence_number, uint64_t time_difference_receiver, uint16_t dummy);
manumaet 30:4ecc69d3cf8d 22
manumaet 34:f56962030c5c 23 struct rangingframe {
manumaet 34:f56962030c5c 24 uint32_t type;
manumaet 34:f56962030c5c 25 uint32_t sequence_number;
manumaet 31:6f76f3d518ac 26 uint64_t time_difference_receiver;
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