Allows for a GPS module to be connected to a serial port and exposes an easy to use API to get the GPS data.
Fork of MODGPS by
Diff: example1.cpp
- Revision:
- 6:64771e31464e
- Parent:
- 2:8aa059e7d8b1
--- a/example1.cpp Wed Apr 20 09:15:07 2011 +0000 +++ b/example1.cpp Thu Apr 21 14:06:17 2011 +0000 @@ -12,6 +12,11 @@ // your GPS module to. GPS gps(NC, GPSRX); +char rmc[GPS_BUFFER_LEN]; +char gga[GPS_BUFFER_LEN]; +char vtg[GPS_BUFFER_LEN]; +char ukn[GPS_BUFFER_LEN]; + // 0.1 second flash of LED2 DigitalOut led2(LED2); Timeout t2; @@ -40,6 +45,14 @@ // can read the messages. pc.baud(PCBAUD); + // Tell MODGPS "we want copies of the NMEA sentences". When a callback + // is made our buffers will contain a copy of the last received sentence + // before it was processed/destroyed. + gps.setRmc(rmc); + gps.setGga(gga); + gps.setVtg(vtg); + gps.setUkn(ukn); + // SET THIS. // Most GPS modules use 9600,8,n,1 so that's what // we default to here. Ensure your GPS module matches