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

MMRanging/MMRanging.h

Committer:
manumaet
Date:
2014-12-27
Revision:
34:f56962030c5c
Parent:
33:6ea4c3dd504d
Child:
35:95d838d33bf5

File content as of revision 34:f56962030c5c:

// by Matthias Grob & Manuel Stalder - ETH Zürich - 2015

#ifndef MMRANGING_H
#define MMRANGING_H

#include "mbed.h"
#include "DW1000.h"

#define MMRANGING_TIMEUNIT      1/(128*499.2)               // conversion between LSB of TX and RX timestamps and microseconds

class MMRanging {
    public:
        MMRanging(DW1000& DW);
        void requestRanging();
        void requestTime();
    //private:
        DW1000& dw;
        
        void callbackRX();
        void callbackTX();
        void sendRangingframe(uint8_t type, uint8_t sequence_number, uint64_t time_difference_receiver, uint16_t dummy);
        
        struct rangingframe {
            uint32_t type;
            uint32_t sequence_number;
            uint64_t time_difference_receiver;
        } ;
        uint64_t rangingtimingsSender[10][2];
        uint64_t rangingtimingsReceiver[10][2];
        uint8_t ranging_i;
        uint64_t tofs[10];
        
        rangingframe TX;
        
        // draft for first test
        bool receiver;
        char message[1021];
        char messageRX[1021];
        uint64_t TX_timestamp;
        uint64_t RX_timestamp;
        int event_i;
        char event[10][20];
        uint64_t eventtimes[10];
        uint8_t counter;
};

#endif