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

Revision:
2:8aa059e7d8b1
Parent:
0:db98027c0bbb
Child:
3:28a1b60b0f37
--- a/GPS.cpp	Sat Nov 20 21:02:06 2010 +0000
+++ b/GPS.cpp	Fri Apr 15 12:23:52 2011 +0000
@@ -97,6 +97,22 @@
     return q;
 }
 
+GPS_VTG *
+GPS::vtg(GPS_VTG *q)
+{
+    GPS_VTG a, b;
+    
+    if (q == NULL) q = new GPS_VTG;
+    
+    do {
+        memcpy(&a, &theVTG, sizeof(GPS_VTG));
+        memcpy(&b, &theVTG, sizeof(GPS_VTG));
+    }
+    while (memcmp(&a, &b, sizeof(GPS_VTG)) != 0);
+    
+    return q;
+}
+
 void
 GPS::ticktock(void)
 {
@@ -115,6 +131,10 @@
             thePlace.nmea_gga(s);            
             cb_gga.call();
         }
+        else if (!strncmp(s, "$GPVTG", 6)) {
+            theVTG.nmea_vtg(s);            
+            cb_vtg.call();
+        }
         process_required = false;
     }
 }
@@ -126,7 +146,7 @@
     theTime++; // Increment the time/date by one second. 
     cb_pps.call();
 }
-    
+
 void 
 GPS::rx_irq(void)
 {
@@ -137,6 +157,7 @@
         iir = (uint32_t)*((char *)_base + GPS_IIR); 
         while((int)(*((char *)_base + GPS_LSR) & 0x1)) {
             c = (char)(*((char *)_base + GPS_RBR) & 0xFF); 
+            // debugging LPC_UART0->RBR = c;
             buffer[active_buffer][rx_buffer_in++] = c;
             rx_buffer_in &= (GPS_BUFFER_LEN - 1);
             if (c == '\n') {