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.
Diff: gps.h
- Revision:
- 3:d2c57ab99c8e
- Parent:
- 2:7e718a1be318
- Child:
- 4:06944df56a2d
diff -r 7e718a1be318 -r d2c57ab99c8e gps.h
--- a/gps.h Fri Jan 27 22:47:35 2017 +0000
+++ b/gps.h Mon Feb 06 08:25:12 2017 +0000
@@ -1,5 +1,5 @@
#include "mbed.h"
-
+
char lati[20], longi[20];
int Ilati, Ilongi;
@@ -77,15 +77,16 @@
}
/**************************************/
+
uint8_t parseGGA() {
gga2 = strtok(gga1, ",");
- while (gga2 != NULL) {
- sep++;
+ while (gga2 != NULL) {
switch (sep) {
case 1: // heure d'envoi de la trame
if (mode == 2) {
strcpy(tmp2,time( gga2,&(GPGGA.tim) ));
- pc.printf("\r\n-----Donnees GPS-----\r\nTim: %s\r\n",tmp2);
+ pc.printf("\r\n-----Donnees GPS-----\r\nTim: %s\r\n",tmp2);
+
}
break;
case 2 : // latitude
@@ -93,9 +94,7 @@
strcpy(tmp,convert( gga2,&(GPGGA.lat) ));
sprintf(lati,"\r%s",tmp);
pc.printf("\r%s",lati);
- //pc.printf("\rLat:%s",tmp);
- // lati=tmp;
- // Ilati=atoi(lati);
+
}
break;
case 3 : // N: Nord, S : Sud
@@ -120,6 +119,7 @@
GPGGA.lat.azimute = gga2[0];
//strcpy(GPGGA.lon.azimute,gga2);
pc.printf("%s\n\r-----Donnees GPS-----\r\n",gga2);
+
wait(0.25);
}
break;
@@ -180,19 +180,26 @@
pc.printf("%s\n\r",gga2);
}
break;
- }
+ }
gga2 = strtok(NULL, ",");
+ sep++;
}
- sep = 0;
+ sep = 1;
return *gga2;
+
}
-uint8_t getGPSstring(uint8_t str) { // str used to choose between GPS trame type, here we have only GPGGA wich is available
+uint8_t getGPSstring() { // str used to choose between GPS trame type, here we have only GPGGA wich is available
+uint8_t str=1;
if (pc.scanf("%s", &gpsString) ==1) {
- if(str==1) {
- if (sscanf(gpsString, "$GPGGA,%s",gga1) >=1) {
- sep = 0;
+ //pc.printf("Tentive");
+ if(str==1) {
+ if (sscanf(gpsString, "$GPGGA,%s",gga1) >=1)
+ {
+ sep = 1;
+ //pc.printf("recharge gga");
parseGGA();
+ //pc.printf("recharge gga fin");
}
return *gga2;
}
@@ -203,3 +210,4 @@
return 0;
}
}
+