Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GPS by
GPS.h
00001 /****************************************************** 00002 * A basic mbed library for the Adafruit ultimate * 00003 * GPS module NOTE: the LOCUS functions are yet to be * 00004 * implemented * 00005 * * 00006 * Written by: Sam Clarke * 00007 ******************************************************/ 00008 00009 #include "mbed.h" 00010 #include <string> 00011 00012 #ifndef GPS_H 00013 #define GPS_H 00014 00015 // EXAMPLE OUTPUTS 00016 // 00017 // $GPRMC,064951.000,A,2307.1256,N,12016.4438,E,0.03,165.48,260406,3.05,W,A*2C 00018 // $GPRMC, time, status, latitude, N/S, longitude, E/W, speed(knots), heading, date, N/A, N/A, MODE*CHECKSUM 00019 // 00020 // $GPGGA,064951.000,2307.1256,N,12016.4438,E,1,8,0.95,39.9,M,17.8,M,,*65 00021 // $GPGGA, time, latitude, N/S, longitude, E/W, fix, satellites, hdop, altitude, M, geoidal sep , M,,*CHECKSUM 00022 // $GPGGA, %f, %*f, %*c, %*f, %*c, %d, %d, %*f, %*f, %*c, %*f , %*c,,%*c%*c%*c0 00023 00024 class GPS 00025 { 00026 public: 00027 00028 GPS(PinName tx, PinName rx); 00029 void Init(); 00030 int parseData(); 00031 int structJSON(char * content); 00032 float time; // UTC time 00033 int hours; 00034 int minutes; 00035 float seconds; 00036 char validity,ns,ew;// RMC data status A = Data Valid; V = Data Not valid; 00037 float latitude; // 00038 float longitude; // 00039 float speed; // speed in knots 00040 float heading; // heading in degrees derived from previous & current location 00041 string date; // 00042 int day; 00043 int month; 00044 int year; 00045 int fixtype; // 0 = no fix; 1 = fix; 2=differential fix 00046 int satellites; // number of satellites used 00047 float altitude; // 00048 string fix; 00049 string cardinal; 00050 float kph; 00051 00052 private: 00053 00054 float trunc ( float v); 00055 void getData(); 00056 Serial _UltimateGps; 00057 char NEMA[256]; 00058 }; 00059 #endif 00060 00061 /* 00062 #define 1HZ_STREAM "$PMTK220,1000*1F\r\n" // 1.0 second interval 00063 #define 5HZ_STREAM "$PMTK220,200*2C\r\n" // 0.2 second interval 00064 #define 10HZ_STREAM "$PMTK220,100*2F\r\n" // 0.1 second interval 00065 00066 #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" 00067 #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" 00068 #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" 00069 */
Generated on Fri Aug 5 2022 11:19:33 by
