Slightly modified version of the SerialGPS library (https://os.mbed.com/teams/components/code/SerialGPS/) to support the BufferedSerial class
Diff: SerialGPS.h
- Revision:
- 2:e7f24389167b
- Parent:
- 1:214714f54773
- Child:
- 3:ebd79e3acf14
--- a/SerialGPS.h Mon Feb 15 20:32:48 2021 +0100 +++ b/SerialGPS.h Tue Feb 16 16:48:14 2021 +0100 @@ -21,73 +21,76 @@ * THE SOFTWARE. */ -#include "mbed.h" - #ifndef MBED_GPS_H #define MBED_GPS_H +#include "mbed.h" + /** * A SerialGPS interface for reading from a serial GPS module */ -class SerialGPS { -public: +class SerialGPS +{ + public: - /** Create the SerialGPS interface, connected to the specified serial port and speed. - * for example, GlobalSat EM406-A (e.g. on SparkFun GPS Shield) is 4800 Baud, - * Adafruit Ultimate GPSv3 (connected to serial) is 9600 Baud - */ - SerialGPS(PinName tx, PinName rx, int baud); - - /** Sample the incoming GPS data, returning whether there is a lock - * - * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 - */ - int sample(); + /** Create the SerialGPS interface, connected to the specified serial port and speed. + * for example, GlobalSat EM406-A (e.g. on SparkFun GPS Shield) is 4800 Baud, + * Adafruit Ultimate GPSv3 (connected to serial) is 9600 Baud + */ + SerialGPS(PinName tx, PinName rx, int baud); - /** - * The longitude (call sample() to set) - */ - float longitude; + /** Sample the incoming GPS data, returning whether there is a lock + * + * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 + */ + int sample(); + + /** + * The longitude (call sample() to set) + */ + float longitude; - /** - * The latitude (call sample() to set) - */ - float latitude; + /** + * The latitude (call sample() to set) + */ + float latitude; - /** - * The time (call sample() to set) - */ - float time; + /** + * The time (call sample() to set) + */ + float time; - /** - * Number of satellites received (call sample() to set) - */ - int sats; + /** + * Number of satellites received (call sample() to set) + */ + int sats; - /** Horizontal dilusion of precision (call sample() to set) */ - float hdop; + /** + * Horizontal dilusion of precision (call sample() to set) + */ + float hdop; - /** The altitude (call sample() to set) - * Note that the accurate altitude is corrected by the geoid - * See http://homepages.slingshot.co.nz/~geoff36/datum.htm - */ - float alt; + /** The altitude (call sample() to set) + * Note that the accurate altitude is corrected by the geoid + * See http://homepages.slingshot.co.nz/~geoff36/datum.htm + */ + float alt; - /** The geoid (call sample() to set) */ - float geoid; - - /** - * The NMEA sentence - */ - char msg[256]; + /** + * The geoid (call sample() to set) + */ + float geoid; + /** + * The NMEA sentence + */ + char msg[256]; -private: - float trunc(float v); - void getline(); - - UnbufferedSerial* _gps_p; - UnbufferedSerial& _gps; + private: + float trunc(float v); + void getline(); + BufferedSerial* _gps_p; + BufferedSerial& _gps; }; #endif \ No newline at end of file