A basic library for the Adafruit Ultimate GPS module. (MTK3339) http://www.adafruit.com/products/746

Fork of GPS by Sam Clarke

Committer:
SamClarke
Date:
Tue Oct 09 18:47:58 2012 +0000
Revision:
1:0a034c2dbea6
Parent:
0:697a7215cc10
Child:
2:dcc14e81f8be
cleaned up :)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SamClarke 1:0a034c2dbea6 1 /******************************************************
SamClarke 1:0a034c2dbea6 2 * A basic mbed library for the Adafruit ultimate *
SamClarke 1:0a034c2dbea6 3 * GPS module NOTE: the LOCUS functions are yet to be *
SamClarke 1:0a034c2dbea6 4 * implemented *
SamClarke 1:0a034c2dbea6 5 * *
SamClarke 1:0a034c2dbea6 6 * Written by: Sam Clarke *
SamClarke 1:0a034c2dbea6 7 ******************************************************/
SamClarke 1:0a034c2dbea6 8
SamClarke 1:0a034c2dbea6 9 #include "mbed.h"
SamClarke 1:0a034c2dbea6 10 #include <string>
SamClarke 1:0a034c2dbea6 11
SamClarke 1:0a034c2dbea6 12 #ifndef GPS_H
SamClarke 1:0a034c2dbea6 13 #define GPS_H
SamClarke 1:0a034c2dbea6 14
SamClarke 1:0a034c2dbea6 15 // EXAMPLE OUTPUTS
SamClarke 1:0a034c2dbea6 16 //
SamClarke 1:0a034c2dbea6 17 // $GPRMC,064951.000,A,2307.1256,N,12016.4438,E,0.03,165.48,260406,3.05,W,A*2C
SamClarke 1:0a034c2dbea6 18 // $GPRMC, time, status, latitude, N/S, longitude, E/W, speed(knots), heading, date, N/A, N/A, MODE*CHECKSUM
SamClarke 1:0a034c2dbea6 19 //
SamClarke 1:0a034c2dbea6 20 // $GPGGA,064951.000,2307.1256,N,12016.4438,E,1,8,0.95,39.9,M,17.8,M,,*65
SamClarke 1:0a034c2dbea6 21 // $GPGGA, time, latitude, N/S, longitude, E/W, fix, satellites, hdop, altitude, M, geoidal sep , M,,*CHECKSUM
SamClarke 1:0a034c2dbea6 22 // $GPGGA, %f, %*f, %*c, %*f, %*c, %d, %d, %*f, %*f, %*c, %*f , %*c,,%*c%*c%*c0
SamClarke 1:0a034c2dbea6 23
SamClarke 1:0a034c2dbea6 24 class GPS
SamClarke 1:0a034c2dbea6 25 {
SamClarke 1:0a034c2dbea6 26 public:
SamClarke 1:0a034c2dbea6 27
SamClarke 1:0a034c2dbea6 28 GPS(PinName tx, PinName rx);
SamClarke 1:0a034c2dbea6 29 void Init();
SamClarke 1:0a034c2dbea6 30 int parseData();
SamClarke 1:0a034c2dbea6 31 float time; // UTC time
SamClarke 1:0a034c2dbea6 32 char validity,ns,ew;// RMC data status A = Data Valid; V = Data Not valid;
SamClarke 1:0a034c2dbea6 33 float latitude; //
SamClarke 1:0a034c2dbea6 34 float longitude; //
SamClarke 1:0a034c2dbea6 35 float speed; // speed in knots
SamClarke 1:0a034c2dbea6 36 float heading; // heading in degrees derived from previous & current location
SamClarke 1:0a034c2dbea6 37 int date; //
SamClarke 1:0a034c2dbea6 38 int fixtype; // 0 = no fix; 1 = fix; 2=differential fix
SamClarke 1:0a034c2dbea6 39 int satellites; // number of satellites used
SamClarke 1:0a034c2dbea6 40 float altitude; //
SamClarke 1:0a034c2dbea6 41
SamClarke 1:0a034c2dbea6 42 private:
SamClarke 1:0a034c2dbea6 43
SamClarke 1:0a034c2dbea6 44 float trunc ( float v);
SamClarke 1:0a034c2dbea6 45 void getData();
SamClarke 1:0a034c2dbea6 46 Serial _UltimateGps;
SamClarke 1:0a034c2dbea6 47 char NEMA[256];
SamClarke 1:0a034c2dbea6 48 };
SamClarke 1:0a034c2dbea6 49 #endif
SamClarke 1:0a034c2dbea6 50
SamClarke 1:0a034c2dbea6 51 /*
SamClarke 1:0a034c2dbea6 52 #define 1HZ_STREAM "$PMTK220,1000*1F\r\n" // 1.0 second interval
SamClarke 1:0a034c2dbea6 53 #define 5HZ_STREAM "$PMTK220,200*2C\r\n" // 0.2 second interval
SamClarke 1:0a034c2dbea6 54 #define 10HZ_STREAM "$PMTK220,100*2F\r\n" // 0.1 second interval
SamClarke 1:0a034c2dbea6 55
SamClarke 1:0a034c2dbea6 56 #define OUTPUT_RMC "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"
SamClarke 1:0a034c2dbea6 57 #define OUTPUT_RMCGGA "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n"
SamClarke 1:0a034c2dbea6 58 #define OUTPUT_OFF "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n"
SamClarke 0:697a7215cc10 59 */