Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: GPS-GPRS_Tracker Plan13
Diff: GPS.cpp
- Revision:
- 4:9ac674d05370
- Parent:
- 3:5cb504ce2793
- Child:
- 5:96d5736d9613
diff -r 5cb504ce2793 -r 9ac674d05370 GPS.cpp
--- a/GPS.cpp Sun Oct 21 09:28:41 2012 +0000
+++ b/GPS.cpp Sun Jan 19 07:44:51 2014 +0000
@@ -1,5 +1,4 @@
#include "GPS.h"
-
GPS::GPS(PinName tx, PinName rx) : _UltimateGps(tx, rx)
{
_UltimateGps.baud(9600);
@@ -7,14 +6,14 @@
int GPS::parseData()
{
-
while(1) {
getData();
if(sscanf(NEMA, "GPGGA, %*f, %*f, %*c, %*f, %*c, %d, %d, %*f, %f", &fixtype, &satellites, &altitude) >=1);
- if(sscanf(NEMA, "GPRMC, %2d%2d%f, %c, %f, %c, %f, %c, %f, %f, %d", &hours, &minutes, &seconds, &validity, &latitude, &ns, &longitude, &ew, &speed, &heading, &date) >=1) {
+ if(sscanf(NEMA, "GPRMC, %2d%2d%f, %c, %f, %c, %f, %c, %f, %f, %2d%2d%2d", &hours, &minutes, &seconds, &validity, &latitude, &ns, &longitude, &ew, &speed, &heading, &day, &month, &year) >=1) {
if(fixtype == 0) {
return 0;
}
+ year += 2000;
if(ns =='S') {
latitude *= -1.0;
}