branch for tests with T265

Dependencies:   Lib_Cntrl AHRS Lib_Misc

Committer:
Kiwicjam
Date:
Fri Nov 22 08:40:26 2019 +0000
Revision:
4:dc844fde64d7
Parent:
2:e7874762cc25
Workin set, not running,

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb2 2:e7874762cc25 1 #ifndef TFMINI_H
altb2 2:e7874762cc25 2 #define TFMINI_H
altb2 2:e7874762cc25 3
altb2 2:e7874762cc25 4 #include <mbed.h>
altb2 2:e7874762cc25 5
altb2 2:e7874762cc25 6 /**
altb2 2:e7874762cc25 7 * This is a device driver class for the TFmini LiDAR.
altb2 2:e7874762cc25 8 */
altb2 2:e7874762cc25 9 class TFmini
altb2 2:e7874762cc25 10 {
altb2 2:e7874762cc25 11 public:
altb2 2:e7874762cc25 12
altb2 2:e7874762cc25 13 TFmini(RawSerial& serial);
altb2 2:e7874762cc25 14
altb2 2:e7874762cc25 15 /** Return the distance to the nearest object, or -1.0 if not valid.
altb2 2:e7874762cc25 16 */
altb2 2:e7874762cc25 17 float operator()() {
altb2 2:e7874762cc25 18 return readDistance();
altb2 2:e7874762cc25 19 }
altb2 2:e7874762cc25 20
altb2 2:e7874762cc25 21 virtual ~TFmini();
altb2 2:e7874762cc25 22
altb2 2:e7874762cc25 23 float readDistance();
altb2 2:e7874762cc25 24 float readStrength();
altb2 2:e7874762cc25 25
altb2 2:e7874762cc25 26 private:
altb2 2:e7874762cc25 27
altb2 2:e7874762cc25 28 RawSerial& serial; // reference to serial interface for communication
altb2 2:e7874762cc25 29
altb2 2:e7874762cc25 30 int16_t dist; // actual distance measurements of LiDAR
altb2 2:e7874762cc25 31 int16_t strength; // signal strength of LiDAR
altb2 2:e7874762cc25 32 uint16_t checksum; // save check value
altb2 2:e7874762cc25 33
altb2 2:e7874762cc25 34 uint8_t uartData[9]; // buffer for seriel uart LiDar data
altb2 2:e7874762cc25 35 uint8_t cnt; // dataCounter
altb2 2:e7874762cc25 36
altb2 2:e7874762cc25 37 static const uint8_t HEADER = 0x59; //frame header of data package
altb2 2:e7874762cc25 38
altb2 2:e7874762cc25 39 void receive();
altb2 2:e7874762cc25 40
altb2 2:e7874762cc25 41 };
altb2 2:e7874762cc25 42
altb2 2:e7874762cc25 43 #endif