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.
Decoders/GPGSAdecoder.hpp@2:72ac4d7044a7, 2016-02-14 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris215 | 0:0c1aa5906cef | 1 | #include "mbed.h" |
chris215 | 0:0c1aa5906cef | 2 | #include "mbedGPSDefs.h" |
chris215 | 0:0c1aa5906cef | 3 | |
chris215 | 0:0c1aa5906cef | 4 | void DecodeGPGSA(char * tokenStr,GPSInfo& data) |
chris215 | 0:0c1aa5906cef | 5 | { |
chris215 | 0:0c1aa5906cef | 6 | int parameterCount = 0; |
chris215 | 0:0c1aa5906cef | 7 | char *rest; // to point to the rest of the string after token extraction. |
chris215 | 0:0c1aa5906cef | 8 | char *token; // to point to the actual token returned. |
chris215 | 0:0c1aa5906cef | 9 | char *ptr = tokenStr; // make q point to start of hello. |
chris215 | 0:0c1aa5906cef | 10 | token = strtok_r(ptr, ",",&rest); |
chris215 | 0:0c1aa5906cef | 11 | while (token != NULL) |
chris215 | 0:0c1aa5906cef | 12 | { |
chris215 | 2:72ac4d7044a7 | 13 | //Debuging.printf("DEBUG ... PARAM_CNT:%d\n",parameterCount); |
chris215 | 0:0c1aa5906cef | 14 | if(parameterCount == 1) |
chris215 | 0:0c1aa5906cef | 15 | data.mode = *token; |
chris215 | 0:0c1aa5906cef | 16 | |
chris215 | 0:0c1aa5906cef | 17 | if(parameterCount == 2){ |
chris215 | 0:0c1aa5906cef | 18 | data.fix = atoi(token); |
chris215 | 0:0c1aa5906cef | 19 | } |
chris215 | 0:0c1aa5906cef | 20 | |
chris215 | 0:0c1aa5906cef | 21 | if(parameterCount == (3 + data.TrackedSatCnt)){ |
chris215 | 0:0c1aa5906cef | 22 | data.PDOP = atof(token); |
chris215 | 2:72ac4d7044a7 | 23 | //Debuging.printf("DEBUG ... PDOP:%f\n",data.PDOP); |
chris215 | 0:0c1aa5906cef | 24 | } |
chris215 | 0:0c1aa5906cef | 25 | if(parameterCount == (3 + data.TrackedSatCnt + 1)){ |
chris215 | 0:0c1aa5906cef | 26 | data.HDOP = atof(token); |
chris215 | 0:0c1aa5906cef | 27 | //printf("DEBUG ... HDOP:%f\n",data.HDOP); |
chris215 | 0:0c1aa5906cef | 28 | } |
chris215 | 0:0c1aa5906cef | 29 | if(parameterCount == (3 + data.TrackedSatCnt + 2)){ |
chris215 | 0:0c1aa5906cef | 30 | data.VDOP = atof(token); |
chris215 | 0:0c1aa5906cef | 31 | //printf("DEBUG ... VDOP:%f\n",data.VDOP); |
chris215 | 0:0c1aa5906cef | 32 | } |
chris215 | 0:0c1aa5906cef | 33 | parameterCount++; |
chris215 | 0:0c1aa5906cef | 34 | ptr = rest; // rest contains the left over part..assign it to ptr. |
chris215 | 0:0c1aa5906cef | 35 | token = strtok_r(ptr, ",",&rest); |
chris215 | 0:0c1aa5906cef | 36 | } |
chris215 | 0:0c1aa5906cef | 37 | } |