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

Fork of lib_gps by wayne roberts

Committer:
jknapp_smtc
Date:
Mon Aug 15 22:52:52 2016 +0000
Revision:
5:f06be7a1f427
Parent:
3:03d7275dc4fd
Changed to Lat and Long to be 32 bit integers

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 2:b531881123bf 40 GPS(PinName uart_tx, PinName uart_rx, PinName en);
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;
jknapp_smtc 5:f06be7a1f427 50 int32_t LatitudeBinary32, LongitudeBinary32;
dudmuck 1:2f5fbb33ae8b 51 bool have_fix;
dudmuck 3:03d7275dc4fd 52 bool en_invert;
dudmuck 0:0bd73064b7f6 53
dudmuck 0:0bd73064b7f6 54 private:
dudmuck 0:0bd73064b7f6 55 int ParseGPSData(int idx);
dudmuck 0:0bd73064b7f6 56 bool NmeaValidateChecksum(int idx);
dudmuck 0:0bd73064b7f6 57 int NmeaChecksum( char *nmeaStr, uint8_t nmeaStrSize, char * checksum );
dudmuck 0:0bd73064b7f6 58 void on_uart_rx(void);
dudmuck 0:0bd73064b7f6 59 uint8_t rx_buf_lens[NUM_RX_BUFS];
dudmuck 0:0bd73064b7f6 60 uint8_t rx_bufs_in_idx;
dudmuck 0:0bd73064b7f6 61 uint8_t rx_bufs_out_idx;
dudmuck 0:0bd73064b7f6 62 char rx_bufs[NUM_RX_BUFS][RX_BUF_SIZE];
dudmuck 0:0bd73064b7f6 63 void ConvertPositionFromStringToNumerical( );
dudmuck 0:0bd73064b7f6 64 void ConvertPositionIntoBinary( );
dudmuck 2:b531881123bf 65 /*void pps(void);
dudmuck 2:b531881123bf 66 bool pps_occurred;*/
dudmuck 2:b531881123bf 67
dudmuck 2:b531881123bf 68 Serial m_uart;
dudmuck 2:b531881123bf 69 DigitalOut m_en_pin;
dudmuck 0:0bd73064b7f6 70 };
dudmuck 0:0bd73064b7f6 71