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:
3:28a1b60b0f37
Parent:
2:8aa059e7d8b1
Child:
6:64771e31464e
--- a/GPS.h	Fri Apr 15 12:23:52 2011 +0000
+++ b/GPS.h	Sat Apr 16 09:37:33 2011 +0000
@@ -696,6 +696,7 @@
     
     //! A callback object for the NMEA RMS message processed signal user API.
     FunctionPointer cb_vtg;
+    
     //! Set the baud rate the GPS module is using.
     /** 
      * Set the baud rate of the serial port
@@ -707,7 +708,7 @@
      */
     void baud(int baudrate) { Serial::baud(baudrate); }
     
-    //! Set the serial port format the GPS module is using. 
+   //! Set the serial port format the GPS module is using. 
    /**
     * Set the transmission format used by the Serial port
     *
@@ -720,6 +721,24 @@
     */
     void format(int bits, Parity parity, int stop_bits) { Serial::format(bits, (Serial::Parity)parity, stop_bits); }
     
+   //! Send incoming GPS bytes to Uart0
+   /**
+    * Send incoming GPS bytes to Uart0
+    *
+    * This can be useful for printing out the bytes from the GPS onto
+    * a the common debug port Uart0. Note, Uart0 should have been setup
+    * and initialised before switching this on. Also, realistically,
+    * you should ensure Uart0 has a higher baud rate than that being
+    * used by the GPS. Sending of bytes to Uart0 is "raw" and should
+    * only be used to initially gather data and should NOT be used as
+    * part of the application design. If you need to forward on the 
+    * data you should come up with a proper strategy.
+    *
+    * @ingroup API 
+    * @param b - True to send to Uart0, false otherwise
+    */
+    void NmeaOnUart0(bool b) { _nmeaOnUart0 = b; }
+        
 protected:
 
     //! Flag set true when a GPS PPS has been attached to a pin.
@@ -738,7 +757,13 @@
     GPS_Geodetic thePlace;
     
     //! A GPS_VTG object used to hold vector data.
-    GPS_VTG      theVTG;       
+    GPS_VTG      theVTG; 
+    
+    //! Used to record the previous byte received.
+    char _lastByte;
+    
+    //! Used for debugging.
+    bool _nmeaOnUart0;      
 };
 
 #endif