GPS library

Revision:
1:55ded12c9c89
Parent:
0:15611c7938a3
Child:
2:c17f5ba1c3f0
--- a/GPS.cpp	Tue Jun 08 14:10:27 2010 +0000
+++ b/GPS.cpp	Thu Mar 10 18:21:41 2016 +0000
@@ -22,8 +22,11 @@
  
 #include "GPS.h"
 
+Serial pc1(USBTX, USBRX);
+
 GPS::GPS(PinName tx, PinName rx) : _gps(tx, rx) {
-    _gps.baud(4800);    
+    _gps.baud(4800);
+      
     longitude = 0.0;
     latitude = 0.0;        
 }
@@ -35,8 +38,10 @@
 
     while(1) {        
         getline();
-
         // Check if it is a GPGGA msg (matches both locked and non-locked msg)
+        pc1.printf(msg);
+        pc1.printf("\n");
+        wait(5);
         if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) { 
             if(!lock) {
                 longitude = 0.0;
@@ -69,13 +74,17 @@
 }
 
 void GPS::getline() {
-    while(_gps.getc() != '$');    // wait for the start of a line
-    for(int i=0; i<256; i++) {
-        msg[i] = _gps.getc();
-        if(msg[i] == '\r') {
-            msg[i] = 0;
-            return;
-        }
+    while(1) {
+        char a = _gps.getc();
+        pc1.printf("%c", a);
     }
-    error("Overflowed message limit");
+//    while(_gps.getc() != '$');    // wait for the start of a line
+//    for(int i=0; i<256; i++) {
+//        msg[i] = _gps.getc();
+//        if(msg[i] == '\r') {
+//            msg[i] = 0;
+//            return;
+//        }
+//    }
+//    error("Overflowed message limit");
 }