GPS

Fork of GPS by Sam Clarke

Committer:
SamClarke
Date:
Sat Oct 13 04:27:18 2012 +0000
Revision:
2:dcc14e81f8be
Parent:
1:0a034c2dbea6
Child:
3:5cb504ce2793
Format for time from hhmmss.msms to hh:mm:ss.msms; gps.hours; gps.minutes; gps.seconds;

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 2:dcc14e81f8be 32 int hours;
SamClarke 2:dcc14e81f8be 33 int minutes;
SamClarke 2:dcc14e81f8be 34 float seconds;
SamClarke 1:0a034c2dbea6 35 char validity,ns,ew;// RMC data status A = Data Valid; V = Data Not valid;
SamClarke 1:0a034c2dbea6 36 float latitude; //
SamClarke 1:0a034c2dbea6 37 float longitude; //
SamClarke 1:0a034c2dbea6 38 float speed; // speed in knots
SamClarke 1:0a034c2dbea6 39 float heading; // heading in degrees derived from previous & current location
SamClarke 1:0a034c2dbea6 40 int date; //
SamClarke 1:0a034c2dbea6 41 int fixtype; // 0 = no fix; 1 = fix; 2=differential fix
SamClarke 1:0a034c2dbea6 42 int satellites; // number of satellites used
SamClarke 1:0a034c2dbea6 43 float altitude; //
SamClarke 1:0a034c2dbea6 44
SamClarke 1:0a034c2dbea6 45 private:
SamClarke 1:0a034c2dbea6 46
SamClarke 1:0a034c2dbea6 47 float trunc ( float v);
SamClarke 1:0a034c2dbea6 48 void getData();
SamClarke 1:0a034c2dbea6 49 Serial _UltimateGps;
SamClarke 1:0a034c2dbea6 50 char NEMA[256];
SamClarke 1:0a034c2dbea6 51 };
SamClarke 1:0a034c2dbea6 52 #endif
SamClarke 1:0a034c2dbea6 53
SamClarke 1:0a034c2dbea6 54 /*
SamClarke 1:0a034c2dbea6 55 #define 1HZ_STREAM "$PMTK220,1000*1F\r\n" // 1.0 second interval
SamClarke 1:0a034c2dbea6 56 #define 5HZ_STREAM "$PMTK220,200*2C\r\n" // 0.2 second interval
SamClarke 1:0a034c2dbea6 57 #define 10HZ_STREAM "$PMTK220,100*2F\r\n" // 0.1 second interval
SamClarke 1:0a034c2dbea6 58
SamClarke 1:0a034c2dbea6 59 #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 60 #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 61 #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 62 */