00001
00002 #ifndef AP_GPS_NMEA_h
00003 #define AP_GPS_NMEA_h
00004
00005 #include <GPS.h>
00006 #define GPS_BUFFERSIZE 120
00007
00008 #define NMEA_OUTPUT_SENTENCES "$PMTK314,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" //Set GPGGA and GPVTG
00009
00010 #define NMEA_BAUD_RATE_4800 "$PSRF100,1,4800,8,1,0*0E\r\n"
00011 #define NMEA_BAUD_RATE_9600 "$PSRF100,1,9600,8,1,0*0D\r\n"
00012 #define NMEA_BAUD_RATE_19200 "$PSRF100,1,19200,8,1,0*38\r\n"
00013 #define NMEA_BAUD_RATE_38400 "$PSRF100,1,38400,8,1,0*3D\r\n"
00014 #define NMEA_BAUD_RATE_57600 "$PSRF100,1,57600,8,1,0*36\r\n"
00015
00016 #define NMEA_OUTPUT_1HZ "$PMTK220,1000*1F\r\n"
00017 #define NMEA_OUTPUT_2HZ "$PMTK220,500*2B\r\n"
00018 #define NMEA_OUTPUT_4HZ "$PMTK220,250*29\r\n"
00019 #define NMEA_OTUPUT_5HZ "$PMTK220,200*2C\r\n"
00020 #define NMEA_OUTPUT_10HZ "$PMTK220,100*2F\r\n"
00021
00022 #define SBAS_ON "$PMTK313,1*2E\r\n"
00023 #define SBAS_OFF "$PMTK313,0*2F\r\n"
00024
00025 #define WAAS_ON "$PSRF151,1*3F\r\n"
00026 #define WAAS_OFF "$PSRF151,0*3E\r\n"
00027
00028 #define DGPS_OFF "$PMTK301,0*2C\r\n"
00029 #define DGPS_RTCM "$PMTK301,1*2D\r\n"
00030 #define DGPS_SBAS "$PMTK301,2*2E\r\n"
00031
00032 #define DATUM_GOOGLE "$PMTK330,0*2E\r\n"
00033
00034 class AP_GPS_NMEA : public GPS
00035 {
00036 public:
00037
00038 AP_GPS_NMEA(Stream *s);
00039 virtual void init();
00040 virtual bool read();
00041
00042
00043 uint8_t quality;
00044
00045 private:
00046
00047 uint8_t GPS_checksum;
00048 uint8_t GPS_checksum_calc;
00049 char buffer[GPS_BUFFERSIZE];
00050 int bufferidx;
00051
00052 bool parse_nmea_gps(void);
00053 uint8_t parseHex(char c);
00054 long parsedecimal(char *str,uint8_t num_car);
00055 long parsenumber(char *str,uint8_t numdec);
00056
00057 };
00058
00059 #endif