Changes Lat & Long Binary variable to be 32 bit integers representing micro-degrees.

Fork of lib_gps by wayne roberts

Committer:
dudmuck
Date:
Wed Mar 18 00:55:27 2015 +0000
Revision:
0:0bd73064b7f6
Child:
1:2f5fbb33ae8b
NMEA GPS receiver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudmuck 0:0bd73064b7f6 1
dudmuck 0:0bd73064b7f6 2 /*!
dudmuck 0:0bd73064b7f6 3 * Generic definition
dudmuck 0:0bd73064b7f6 4 */
dudmuck 0:0bd73064b7f6 5 #ifndef SUCCESS
dudmuck 0:0bd73064b7f6 6 #define SUCCESS 1
dudmuck 0:0bd73064b7f6 7 #endif
dudmuck 0:0bd73064b7f6 8
dudmuck 0:0bd73064b7f6 9 #ifndef FAIL
dudmuck 0:0bd73064b7f6 10 #define FAIL 0
dudmuck 0:0bd73064b7f6 11 #endif
dudmuck 0:0bd73064b7f6 12
dudmuck 0:0bd73064b7f6 13 #define NUM_RX_BUFS 6
dudmuck 0:0bd73064b7f6 14 #define RX_BUF_SIZE 96
dudmuck 0:0bd73064b7f6 15
dudmuck 0:0bd73064b7f6 16 /* Structure to handle the GPS parsed data in ASCII */
dudmuck 0:0bd73064b7f6 17 typedef struct
dudmuck 0:0bd73064b7f6 18 {
dudmuck 0:0bd73064b7f6 19 char NmeaDataType[6];
dudmuck 0:0bd73064b7f6 20 char NmeaUtcTime[11];
dudmuck 0:0bd73064b7f6 21 char NmeaDataStatus[2];
dudmuck 0:0bd73064b7f6 22 char NmeaLatitude[10];
dudmuck 0:0bd73064b7f6 23 char NmeaLatitudePole[2];
dudmuck 0:0bd73064b7f6 24 char NmeaLongitude[11];
dudmuck 0:0bd73064b7f6 25 char NmeaLongitudePole[2];
dudmuck 0:0bd73064b7f6 26 char NmeaFixQuality[2];
dudmuck 0:0bd73064b7f6 27 char NmeaSatelliteTracked[3];
dudmuck 0:0bd73064b7f6 28 char NmeaHorizontalDilution[6];
dudmuck 0:0bd73064b7f6 29 char NmeaAltitude[8];
dudmuck 0:0bd73064b7f6 30 char NmeaAltitudeUnit[2];
dudmuck 0:0bd73064b7f6 31 char NmeaHeightGeoid[8];
dudmuck 0:0bd73064b7f6 32 char NmeaHeightGeoidUnit[2];
dudmuck 0:0bd73064b7f6 33 char NmeaSpeed[8];
dudmuck 0:0bd73064b7f6 34 char NmeaDetectionAngle[8];
dudmuck 0:0bd73064b7f6 35 char NmeaDate[8];
dudmuck 0:0bd73064b7f6 36 }tNmeaGpsData;
dudmuck 0:0bd73064b7f6 37
dudmuck 0:0bd73064b7f6 38 class GPS {
dudmuck 0:0bd73064b7f6 39 public:
dudmuck 0:0bd73064b7f6 40 GPS();
dudmuck 0:0bd73064b7f6 41 ~GPS();
dudmuck 0:0bd73064b7f6 42 void enable(bool);
dudmuck 0:0bd73064b7f6 43 bool enabled(void);
dudmuck 0:0bd73064b7f6 44 void service(void);
dudmuck 0:0bd73064b7f6 45 void init(void);
dudmuck 0:0bd73064b7f6 46
dudmuck 0:0bd73064b7f6 47 double Latitude, Longitude;
dudmuck 0:0bd73064b7f6 48 char verbose; // flag
dudmuck 0:0bd73064b7f6 49 tNmeaGpsData NmeaGpsData;
dudmuck 0:0bd73064b7f6 50 int32_t LatitudeBinary, LongitudeBinary;
dudmuck 0:0bd73064b7f6 51
dudmuck 0:0bd73064b7f6 52 private:
dudmuck 0:0bd73064b7f6 53 int ParseGPSData(int idx);
dudmuck 0:0bd73064b7f6 54 bool NmeaValidateChecksum(int idx);
dudmuck 0:0bd73064b7f6 55 int NmeaChecksum( char *nmeaStr, uint8_t nmeaStrSize, char * checksum );
dudmuck 0:0bd73064b7f6 56 void on_uart_rx(void);
dudmuck 0:0bd73064b7f6 57 uint8_t rx_buf_lens[NUM_RX_BUFS];
dudmuck 0:0bd73064b7f6 58 uint8_t rx_bufs_in_idx;
dudmuck 0:0bd73064b7f6 59 uint8_t rx_bufs_out_idx;
dudmuck 0:0bd73064b7f6 60 char rx_bufs[NUM_RX_BUFS][RX_BUF_SIZE];
dudmuck 0:0bd73064b7f6 61 void ConvertPositionFromStringToNumerical( );
dudmuck 0:0bd73064b7f6 62 void ConvertPositionIntoBinary( );
dudmuck 0:0bd73064b7f6 63 void pps(void);
dudmuck 0:0bd73064b7f6 64 bool pps_occurred;
dudmuck 0:0bd73064b7f6 65 };
dudmuck 0:0bd73064b7f6 66