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.
Dependencies: USBDevice max32630fthr
Revision 10:349d4fa9037f, committed 2017-07-01
- Comitter:
- koziniec
- Date:
- Sat Jul 01 12:31:17 2017 +0000
- Parent:
- 9:b8a60ade343e
- Child:
- 11:a9c16968e7f6
- Commit message:
- Milestone; GPS turns on. Waits for a fix, dumps to pc.serial and turns off GPS
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jul 01 07:57:16 2017 +0000
+++ b/main.cpp Sat Jul 01 12:31:17 2017 +0000
@@ -69,10 +69,6 @@
char *token;
token = strtok(nmea_sentence, ",");
if (strcmp(token,gprmc) == 0) { //GPRMC ?
- // gps_power(off); //Yes - No need for GPS now
- // while (gps.readable()){
- // char dummy = gps.getc(); //Empty serial buffer because overflows reveal MBED bugs :-(
- // }
pc.printf( " %s\n\r", token ); //Get the time
if (token != NULL) {
token = strtok(NULL, ",");
@@ -80,14 +76,58 @@
}
if (token != NULL) {
token = strtok(NULL, ",");
- pc.printf("Valid: %s\n\r",token);
+ if (*token == 'V') {
+ pc.printf("VOID");
+ }
}
- //If valid, get the rest of the tokens and pass to static variable.
-
+ if (*token == 'A') {
+ pc.printf("Got a fix\n\r");
+ gps_power(off); //Yes - No need for GPS now
+ while (gps.readable()) {
+ char dummy = gps.getc(); //Empty serial buffer because overflows reveal MBED bugs :-(
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("Latitude: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("North/South: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("Longitude: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("East/West: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("Speed in knots: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("True course: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("Date: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("Variation: %s\n\r",token);
+ }
+ if (token != NULL) {
+ token = strtok(NULL, ",");
+ pc.printf("East/West: %s\n\r",token);
+ }
+ }
+
}
}
-
+
while (gps.readable()) {