Tobi's ubw test branch
Dependencies: mavlink_bridge mbed
Fork of AIT_UWB_Range by
MMRanging/MMRanging.h@36:883de6f9a73b, 2015-02-20 (annotated)
- Committer:
- manumaet
- Date:
- Fri Feb 20 09:07:52 2015 +0000
- Revision:
- 36:883de6f9a73b
- Parent:
- 35:95d838d33bf5
- Child:
- 37:40f94c634c3e
before changing data rate (disabled resetAll)
Who changed what in which revision?
User | Revision | Line number | New 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 | 35:95d838d33bf5 | 9 | #define MMRANGING_TIMEUNIT_US 1/(128*499.2) // conversion between LSB of TX and RX timestamps and microseconds |
manumaet | 35:95d838d33bf5 | 10 | #define MMRANGING_TIMEUNIT_NS 1000/(128*499.2) // conversion between LSB of TX and RX timestamps and nanoseconds |
manumaet | 27:71178fdb78e1 | 11 | |
manumaet | 27:71178fdb78e1 | 12 | class MMRanging { |
manumaet | 28:a830131560e8 | 13 | public: |
manumaet | 28:a830131560e8 | 14 | MMRanging(DW1000& DW); |
manumaet | 36:883de6f9a73b | 15 | void requestRanging(uint8_t destination); |
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 | 36:883de6f9a73b | 21 | void sendRangingframe(uint8_t destination, uint8_t sequence_number, uint8_t type, uint64_t time_difference_receiver); |
manumaet | 30:4ecc69d3cf8d | 22 | |
manumaet | 36:883de6f9a73b | 23 | uint8_t address; |
manumaet | 34:f56962030c5c | 24 | struct rangingframe { |
manumaet | 36:883de6f9a73b | 25 | uint8_t source; |
manumaet | 36:883de6f9a73b | 26 | uint8_t destination; |
manumaet | 36:883de6f9a73b | 27 | uint8_t sequence_number; |
manumaet | 36:883de6f9a73b | 28 | uint8_t type; |
manumaet | 31:6f76f3d518ac | 29 | uint64_t time_difference_receiver; |
manumaet | 36:883de6f9a73b | 30 | }; |
manumaet | 36:883de6f9a73b | 31 | |
manumaet | 31:6f76f3d518ac | 32 | uint64_t rangingtimingsSender[10][2]; |
manumaet | 31:6f76f3d518ac | 33 | uint64_t rangingtimingsReceiver[10][2]; |
manumaet | 35:95d838d33bf5 | 34 | uint64_t tofs; |
manumaet | 31:6f76f3d518ac | 35 | |
manumaet | 31:6f76f3d518ac | 36 | rangingframe TX; |
manumaet | 31:6f76f3d518ac | 37 | |
manumaet | 28:a830131560e8 | 38 | // draft for first test |
manumaet | 28:a830131560e8 | 39 | bool receiver; |
manumaet | 28:a830131560e8 | 40 | uint64_t TX_timestamp; |
manumaet | 28:a830131560e8 | 41 | uint64_t RX_timestamp; |
manumaet | 28:a830131560e8 | 42 | int event_i; |
manumaet | 28:a830131560e8 | 43 | char event[10][20]; |
manumaet | 28:a830131560e8 | 44 | uint8_t counter; |
manumaet | 27:71178fdb78e1 | 45 | }; |
manumaet | 27:71178fdb78e1 | 46 | |
manumaet | 27:71178fdb78e1 | 47 | #endif |