2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
GPS/GPS.h
- Committer:
- shimniok
- Date:
- 2019-01-03
- Revision:
- 43:9a285515f33a
- Child:
- 44:0d72a8a1288a
File content as of revision 43:9a285515f33a:
#ifndef __GPS_H #define __GPS_H /** uBlox GPS UBX Protocol Reader * Parses uBlox GPS binary protocol * * @author Wayne Holder; Ported to mbed by Michael Shimniok */ #include "mbed.h" class GPS { public: GPS(): _callback(0) {} /** * Parse one character of protocol * @param c is the character to parse * @return 1 when entire packet of data obtained, 0 otherwise */ virtual int parse(char c) = 0; void subscribe(Callback<void()> cb) { _callback = cb; } /** Read the latest data from GPS * @param lat latitude in degrees * @param lon longitude in degrees * @param course heading/course in degrees * @param speed speed m/s * @param hdop horizontal dilution of precision * @param svcount is the number of sattelites being tracked * @return all parameters */ void read(double& lat, double& lon, float& course, float& speed, float& hdop, int& svcount) { lat = latest.lat; lon = latest.lon; course = latest.course; speed = latest.speed; hdop = latest.hdop; svcount = latest.svcount; } protected: typedef struct { double lat; double lon; float course; float speed; float hdop; int svcount; } gps_data_t; gps_data_t latest; gps_data_t tmp; Callback<void()> _callback; }; #endif