Mbed library to handle GPS data reception and parsing

Dependents:   GPS_U-blox_NEO-6M_Code

Features

  • All positionning parameters are contained into a global data structure.
  • Automatic nema string parsing and data structure update.
    • GSA,GGA,VTG and RMC
  • Convert latitude and longitude to decimal value.
  • Converts latittude,longitude and altitude to ECEF coordinates.

Planed developement

  • Test library for RTOS use.
  • Complete the nema parsing decoders (couple of parameters are not parsed yet and not present in the data structure).
  • Add conversion tool to get ENU coordinates.
Committer:
chris215
Date:
Sun Feb 14 05:55:38 2016 +0000
Revision:
2:72ac4d7044a7
Parent:
0:0c1aa5906cef
Child:
3:20f8faf2ad18
Modified librairy to increase performance. Reduced interrupt overhead by removing most of the nema parsing.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris215 0:0c1aa5906cef 1 #ifndef _MBED_GPS_DEFS_H_
chris215 0:0c1aa5906cef 2 #define _MBED_GPS_DEFS_H_
chris215 0:0c1aa5906cef 3 //=======================================================================
chris215 0:0c1aa5906cef 4 // GPS Special caracters
chris215 0:0c1aa5906cef 5 #define START_CHAR '$'
chris215 0:0c1aa5906cef 6 #define END_CHAR 0x0D
chris215 0:0c1aa5906cef 7 //=======================================================================
chris215 0:0c1aa5906cef 8 // GPS BUFFER SIZE
chris215 0:0c1aa5906cef 9 #define RX_BUFFER_SIZE 80
chris215 0:0c1aa5906cef 10 //=======================================================================
chris215 0:0c1aa5906cef 11 // GPS COMMANDS
chris215 0:0c1aa5906cef 12 #define GPS_CMD_GPGGA "$GPGGA"
chris215 2:72ac4d7044a7 13 #define GPS_GPGGAR 1
chris215 0:0c1aa5906cef 14 #define GPS_CMD_GPGSA "$GPGSA"
chris215 2:72ac4d7044a7 15 #define GPS_GPGSAR 2
chris215 0:0c1aa5906cef 16 #define GPS_CMD_GPGSV "$GPGSV"
chris215 2:72ac4d7044a7 17 #define GPS_GPGSVR 3
chris215 0:0c1aa5906cef 18 #define GPS_CMD_GPRMC "$GPRMC"
chris215 2:72ac4d7044a7 19 #define GPS_GPRMCR 4
chris215 0:0c1aa5906cef 20 #define GPS_CMD_GPVTG "$GPVTG"
chris215 2:72ac4d7044a7 21 #define GPS_GPVTGR 5
chris215 0:0c1aa5906cef 22 //=======================================================================
chris215 0:0c1aa5906cef 23 // GPS MESSAGE STRUCTURE
chris215 0:0c1aa5906cef 24 typedef struct {
chris215 0:0c1aa5906cef 25 char data[RX_BUFFER_SIZE];
chris215 2:72ac4d7044a7 26 char MessageIsNew;
chris215 0:0c1aa5906cef 27 }message;
chris215 0:0c1aa5906cef 28
chris215 0:0c1aa5906cef 29 //=======================================================================
chris215 0:0c1aa5906cef 30 // GPS COORDINATE POINT STRUCTURES
chris215 0:0c1aa5906cef 31 typedef struct{
chris215 0:0c1aa5906cef 32 double latitude;
chris215 0:0c1aa5906cef 33 double longitude;
chris215 0:0c1aa5906cef 34 float altitude;
chris215 0:0c1aa5906cef 35 }geodPoint;
chris215 0:0c1aa5906cef 36
chris215 0:0c1aa5906cef 37 typedef struct{
chris215 0:0c1aa5906cef 38 double x;
chris215 0:0c1aa5906cef 39 double y;
chris215 0:0c1aa5906cef 40 double z;
chris215 0:0c1aa5906cef 41 }ECEFPoint;
chris215 0:0c1aa5906cef 42
chris215 0:0c1aa5906cef 43 typedef struct{
chris215 0:0c1aa5906cef 44 float dx;
chris215 0:0c1aa5906cef 45 float dy;
chris215 0:0c1aa5906cef 46 float dz;
chris215 0:0c1aa5906cef 47 float d;
chris215 0:0c1aa5906cef 48 }ECEFDistance;
chris215 0:0c1aa5906cef 49
chris215 0:0c1aa5906cef 50 typedef struct{
chris215 0:0c1aa5906cef 51 char time[7];
chris215 0:0c1aa5906cef 52 char hour;
chris215 0:0c1aa5906cef 53 char min;
chris215 0:0c1aa5906cef 54 char sec;
chris215 0:0c1aa5906cef 55 int msec;
chris215 0:0c1aa5906cef 56 }FIXtime;
chris215 0:0c1aa5906cef 57 typedef struct{
chris215 0:0c1aa5906cef 58 char date[7];
chris215 0:0c1aa5906cef 59 char day;
chris215 0:0c1aa5906cef 60 char month;
chris215 0:0c1aa5906cef 61 char year;
chris215 0:0c1aa5906cef 62 }FIXDate;
chris215 0:0c1aa5906cef 63
chris215 0:0c1aa5906cef 64 typedef struct{
chris215 0:0c1aa5906cef 65 double latitude;
chris215 0:0c1aa5906cef 66 char latLoc;
chris215 0:0c1aa5906cef 67 double longitude;
chris215 0:0c1aa5906cef 68 char lonLoc;
chris215 0:0c1aa5906cef 69 float GPStime;
chris215 0:0c1aa5906cef 70 char GPSStatus;
chris215 0:0c1aa5906cef 71 char FixQal;
chris215 0:0c1aa5906cef 72 float GPSAltitude;
chris215 0:0c1aa5906cef 73 float GEOIDHeight;
chris215 0:0c1aa5906cef 74
chris215 0:0c1aa5906cef 75 float TrueTrack; //Relative to true north
chris215 0:0c1aa5906cef 76 float MagneticTrack; //Relative to magnetic north
chris215 0:0c1aa5906cef 77 float GroundSpeedN;
chris215 0:0c1aa5906cef 78 float GroundSpeedK;
chris215 0:0c1aa5906cef 79
chris215 0:0c1aa5906cef 80 char TrackedSatCnt;
chris215 0:0c1aa5906cef 81
chris215 0:0c1aa5906cef 82 char mode; //A=automatic M=manual
chris215 0:0c1aa5906cef 83 char fix; //1=not valid, 2=2d, 3=3d
chris215 0:0c1aa5906cef 84
chris215 0:0c1aa5906cef 85 float PDOP,HDOP,VDOP;
chris215 0:0c1aa5906cef 86
chris215 0:0c1aa5906cef 87 FIXtime time;
chris215 0:0c1aa5906cef 88 FIXDate date;
chris215 0:0c1aa5906cef 89 }GPSInfo;
chris215 0:0c1aa5906cef 90 #endif