2018 revision to classic DataBus AVC code.

Dependencies:   LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell

Committer:
shimniok
Date:
Sat Dec 15 21:38:11 2018 +0000
Revision:
19:0d1728091519
Parent:
18:3f8a8f6e3cc1
Child:
20:043987d06f8d
Testing ublox

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimniok 16:eb28d0f64a9b 1 #ifndef __UBLOX6_H
shimniok 16:eb28d0f64a9b 2 #define __UBLOX6_H
shimniok 16:eb28d0f64a9b 3
shimniok 16:eb28d0f64a9b 4 /** uBlox GPS UBX Protocol Reader
shimniok 16:eb28d0f64a9b 5 * Parses uBlox GPS binary protocol
shimniok 16:eb28d0f64a9b 6 *
shimniok 16:eb28d0f64a9b 7 * @author Wayne Holder; Ported to mbed by Michael Shimniok
shimniok 16:eb28d0f64a9b 8 */
shimniok 16:eb28d0f64a9b 9 #include "mbed.h"
shimniok 16:eb28d0f64a9b 10
shimniok 16:eb28d0f64a9b 11 class Ublox6 {
shimniok 16:eb28d0f64a9b 12 public:
shimniok 16:eb28d0f64a9b 13 // TODO 3 convert this to time units
shimniok 19:0d1728091519 14 // TODO 3 move this somewhere else?
shimniok 16:eb28d0f64a9b 15 static const int lag=40; // number of updater steps by which gps output lags reality
shimniok 16:eb28d0f64a9b 16
shimniok 18:3f8a8f6e3cc1 17 Ublox6();
shimniok 18:3f8a8f6e3cc1 18
shimniok 16:eb28d0f64a9b 19 /**
shimniok 16:eb28d0f64a9b 20 * UBX protocol parser (Wayne Holder)
shimniok 16:eb28d0f64a9b 21 * @param cc is the character to parse
shimniok 19:0d1728091519 22 * @return 1 when entire packet of data obtained, 0 otherwise
shimniok 16:eb28d0f64a9b 23 */
shimniok 19:0d1728091519 24 int parse(unsigned char cc);
shimniok 16:eb28d0f64a9b 25
shimniok 19:0d1728091519 26 /** Read the latest data from GPS
shimniok 19:0d1728091519 27 * @param lat latitude in degrees
shimniok 19:0d1728091519 28 * @param lon longitude in degrees
shimniok 19:0d1728091519 29 * @param course heading/course in degrees
shimniok 19:0d1728091519 30 * @param speed speed m/s
shimniok 19:0d1728091519 31 * @return all parameters
shimniok 16:eb28d0f64a9b 32 */
shimniok 19:0d1728091519 33 void read(double& lat, double& lon, float& course, float& speed, float& hdop, int& svcount);
shimniok 16:eb28d0f64a9b 34
shimniok 16:eb28d0f64a9b 35 private:
shimniok 18:3f8a8f6e3cc1 36 typedef struct {
shimniok 18:3f8a8f6e3cc1 37 double lat;
shimniok 18:3f8a8f6e3cc1 38 double lon;
shimniok 18:3f8a8f6e3cc1 39 float course;
shimniok 18:3f8a8f6e3cc1 40 float speed;
shimniok 18:3f8a8f6e3cc1 41 float hdop;
shimniok 18:3f8a8f6e3cc1 42 int svcount;
shimniok 18:3f8a8f6e3cc1 43 } gps_data_t;
shimniok 18:3f8a8f6e3cc1 44
shimniok 18:3f8a8f6e3cc1 45 gps_data_t tmp;
shimniok 18:3f8a8f6e3cc1 46 gps_data_t latest;
shimniok 18:3f8a8f6e3cc1 47
shimniok 18:3f8a8f6e3cc1 48 int _ready; // is data ready to be copied?
shimniok 18:3f8a8f6e3cc1 49 bool _available; //
shimniok 18:3f8a8f6e3cc1 50
shimniok 18:3f8a8f6e3cc1 51 /*
shimniok 16:eb28d0f64a9b 52 float _latitude; // temp storage, latitude
shimniok 16:eb28d0f64a9b 53 float _longitude; // temp storage, longitude
shimniok 16:eb28d0f64a9b 54 float _hdop; // horiz dilution of precision
shimniok 16:eb28d0f64a9b 55 float _course_deg; // course in degrees
shimniok 16:eb28d0f64a9b 56 float _speed_mps; // speed in m/s
shimniok 18:3f8a8f6e3cc1 57 int _svcount; // space vehicle (satellite) count
shimniok 18:3f8a8f6e3cc1 58 */
shimniok 16:eb28d0f64a9b 59 };
shimniok 16:eb28d0f64a9b 60
shimniok 16:eb28d0f64a9b 61 #endif