GPSlibrary

Files at this revision

API Documentation at this revision

Comitter:
Nerosho
Date:
Mon Aug 26 11:39:19 2019 +0000
Parent:
2:e3c59956d8ce
Child:
6:5694d998a23f
Child:
7:a7d233fc6578
Commit message:
0826

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
GPS.h Show annotated file Show diff for this revision Revisions of this file
--- a/GPS.cpp	Sun Aug 18 05:06:58 2019 +0000
+++ b/GPS.cpp	Mon Aug 26 11:39:19 2019 +0000
@@ -1,3 +1,9 @@
+/*
+*2019.0826
+*
+*/
+
+
 #include "mbed.h"
 #include "GPS.h"
 
@@ -7,61 +13,44 @@
     _tx=tx;
     _rx=rx;
 }
-//Serial pc(USBTX,USBRX);
 
-//char getGPS[128];
-//int i=0;
+
 
 int GPS::getGPGGA()
 {
     //Serial gps(_tx,_rx);
     //gps.baud(9600);
-    //Serial pc(USBTX,USBRX);
-    //pc.baud(19200);
-
-    int i=0;
-
-    //while(1) {
-
-
 
     if(_gps.readable()) {
-        //GPSread=1;
+        getGPS[0]='\0';
+        GPSread=0;
+
+        while(1) {
 
-        //for (i=0; i<256; i++) {
-        getGPS[i]=_gps.getc();
+            recvGPS=_gps.getc();
+            char s[2];
+            s[0] = recvGPS;
+            s[1] = '\0';
+            strcat(getGPS, s);
 
-        if(getGPS[i]=='\n') {
+            if(recvGPS==10) {
+
+                if((getGPS[4]=='G')&&(getGPS[5]=='A')) {
 
 
-            if((getGPS[5]=='G')&&(getGPS[6]=='A')) {
-
-
-                for(int n=0; n<i+1; n++) {
-                    //pc.printf("%c",getGPS[n]);
-
-                    GPSMessage[n] = getGPS[n];
+                    GPSread=1;
                     return 1;
 
                 }
 
-                //pc.printf("%s",GPSMessage);
+                break;
+
+            }
+        }
+    }
+
+    // wait(1);
+    return 0;
 
 
-            }//if GAの終わり
-
-            i=0;
-
-            //break;
-
-        }//if \nの終わり
-
-        i++;
-
-        //}//forの終わり
-
-    }
-
-    //}//whileの終わり
-    return 0;
 }
\ No newline at end of file
--- a/GPS.h	Sun Aug 18 05:06:58 2019 +0000
+++ b/GPS.h	Mon Aug 26 11:39:19 2019 +0000
@@ -21,6 +21,9 @@
     char GPSMessage[128];
     //char errorMessage[128];
     char getGPS[128];
+
+    char recvGPS;
+    
     //int i=0; 
 
 };