GPS/NMEA Parser that has been ported from Arduino to mbed tested with BufferedSerial original from here : http://arduiniana.org/libraries/tinygpsplus/
Dependents: WNC_Pubnub_obd2b_ign_em506SoftSerial_RESETFE2 mbed_xbeetest
A Full-featured GPS/NMEA Parser that has been tested with BufferedSerial
TinyGPS++ is a library for parsing NMEA data streams provided by GPS modules. Like its predecessor, TinyGPS, this library provides compact and easy-to-use methods for extracting position, date, time, altitude, speed, and course from consumer GPS devices. However, TinyGPS++’s programmer interface is considerably simpler to use than TinyGPS,
The library can extract arbitrary data from any of the myriad NMEA sentences out there, even proprietary ones
from here : http://arduiniana.org/libraries/tinygpsplus/
Revision 1:9163a9f5fc36, committed 2016-01-22
- Comitter:
- Sir_Binky
- Date:
- Fri Jan 22 13:30:33 2016 +0000
- Parent:
- 0:3407bd06cfae
- Commit message:
- added a "Binary" version of the lat and lng; Binary representation of the double;
Changed in this revision
| TinyGPSplus.cpp | Show annotated file Show diff for this revision Revisions of this file |
| TinyGPSplus.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TinyGPSplus.cpp Fri Jan 22 08:42:46 2016 +0000
+++ b/TinyGPSplus.cpp Fri Jan 22 13:30:33 2016 +0000
@@ -366,6 +366,43 @@
return rawLngData.negative ? -ret : ret;
}
+int32_t TinyGPSLocation::latBinary()
+{
+ int32_t ret;
+ long double temp,lat;
+ lat = TinyGPSLocation::lat();
+ if( lat >= 0 ) // North
+ {
+ temp = lat * 8388607; // 2^23 - 1
+ ret = temp / 90;
+ }
+ else // South
+ {
+ temp = lat * 8388608; // -2^23
+ ret = temp / 90;
+ }
+ return ret;
+}
+
+int32_t TinyGPSLocation::lngBinary()
+{
+ int32_t ret;
+ long double temp,lng;
+ lng = TinyGPSLocation::lng();
+
+ if( lng >= 0 ) // East
+ {
+ temp = lng * 8388607; // 2^23 - 1
+ ret = temp / 180;
+ }
+ else // West
+ {
+ temp = lng * 8388608; // -2^23
+ ret = temp / 180;
+ }
+ return ret;
+}
+
void TinyGPSDate::commit()
{
date = newDate;
--- a/TinyGPSplus.h Fri Jan 22 08:42:46 2016 +0000
+++ b/TinyGPSplus.h Fri Jan 22 13:30:33 2016 +0000
@@ -61,6 +61,8 @@
const RawDegrees &rawLng() { updated = false; return rawLngData; }
double lat();
double lng();
+ int32_t lngBinary();
+ int32_t latBinary();
TinyGPSLocation() : valid(false), updated(false)
{}