Allows for a GPS module to be connected to a serial port and exposes an easy to use API to get the GPS data. New feature, added Mbed/LPC17xx RTC synchronisation
Dependents: SatGPS AntiTheftGPS FLIGHT_CONTROL_AND_COMMUNICATIONS_SYSTEM GPS-Lora ... more
Diff: GPS_Time.cpp
- Revision:
- 2:8aa059e7d8b1
- Parent:
- 0:db98027c0bbb
- Child:
- 5:7f130f85d5a4
diff -r 6aec92e77ad2 -r 8aa059e7d8b1 GPS_Time.cpp --- a/GPS_Time.cpp Sat Nov 20 21:02:06 2010 +0000 +++ b/GPS_Time.cpp Fri Apr 15 12:23:52 2011 +0000 @@ -33,6 +33,10 @@ tenths = 0; hundreths = 0; status = 'V'; + velocity = 0; + track = 0; + magvar_dir = 'W'; + magvar = 0; } GPS_Time * @@ -98,6 +102,7 @@ } } +// $GPRMC,112709.735,A,5611.5340,N,00302.0306,W,000.0,307.0,150411,,,A*70 void GPS_Time::nmea_rmc(char *s) { @@ -106,13 +111,21 @@ char *time = (char *)NULL; char *date = (char *)NULL; char *stat = (char *)NULL; - + char *vel = (char *)NULL; + char *trk = (char *)NULL; + char *magv = (char *)NULL; + char *magd = (char *)NULL; + token = strtok(s, ","); while (token) { switch (token_counter) { - case 9: date = token; break; - case 1: time = token; break; - case 2: stat = token; break; + case 9: date = token; break; + case 1: time = token; break; + case 2: stat = token; break; + case 7: vel = token; break; + case 8: trk = token; break; + case 10: magv = token; break; + case 11: magd = token; break; } token = strtok((char *)NULL, ","); token_counter++; @@ -126,7 +139,10 @@ month = (char)((date[2] - '0') * 10) + (date[3] - '0'); year = (int)((date[4] - '0') * 10) + (date[5] - '0') + 2000; status = stat[0]; - + velocity = atof(vel); + track = atof(trk); + magvar = atof(magv); + magvar_dir = magd[0]; } }