Fork of SerialGPS that uses the SoftSerial library instead of the mbed serial device.
Fork of SerialGPS by
Revision 4:bc32bec014b3, committed 2017-11-29
- Comitter:
- pferland
- Date:
- Wed Nov 29 15:41:39 2017 +0000
- Parent:
- 3:4e2136c38f29
- Commit message:
- Software Serial support, fixed error in longitude conversion
Changed in this revision
SerialGPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
SerialGPS.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4e2136c38f29 -r bc32bec014b3 SerialGPS.cpp --- a/SerialGPS.cpp Wed May 07 07:22:16 2014 +0000 +++ b/SerialGPS.cpp Wed Nov 29 15:41:39 2017 +0000 @@ -58,7 +58,7 @@ float degrees = trunc(latitude / 100.0f); float minutes = latitude - (degrees * 100.0f); latitude = degrees + minutes / 60.0f; - degrees = trunc(longitude / 100.0f * 0.01f); + degrees = trunc(longitude / 100.0f); minutes = longitude - (degrees * 100.0f); longitude = degrees + minutes / 60.0f; return 1; @@ -68,10 +68,10 @@ } float SerialGPS::trunc(float v) { - if(v < 0.0) { - v*= -1.0; + if(v < 0.0f) { + v*= -1.0f; v = floor(v); - v*=-1.0; + v*=-1.0f; } else { v = floor(v); }
diff -r 4e2136c38f29 -r bc32bec014b3 SerialGPS.h --- a/SerialGPS.h Wed May 07 07:22:16 2014 +0000 +++ b/SerialGPS.h Wed Nov 29 15:41:39 2017 +0000 @@ -22,6 +22,7 @@ */ #include "mbed.h" +#include "SoftSerial.h" #ifndef MBED_GPS_H #define MBED_GPS_H @@ -74,7 +75,7 @@ float trunc(float v); void getline(); - Serial _gps; + SoftSerial _gps; }; #endif \ No newline at end of file