Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

MMRanging/MMRanging.h

Committer:
manumaet
Date:
2014-12-02
Revision:
33:6ea4c3dd504d
Parent:
31:6f76f3d518ac
Child:
34:f56962030c5c

File content as of revision 33:6ea4c3dd504d:

// 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();
        
        struct rangingframe {               // has a length of 10 bytes
            uint8_t type;
            uint8_t sequence_number;
            uint64_t time_difference_receiver;
            uint16_t dummy;
        } ;
        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