Modified AdaFruit GPS library
gps.h@0:7f20540d3281, 2015-04-08 (annotated)
- Committer:
- StressedDave
- Date:
- Wed Apr 08 19:06:39 2015 +0000
- Revision:
- 0:7f20540d3281
- Child:
- 1:a091e3ca8443
Baseline for MTK GPS parser
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
StressedDave | 0:7f20540d3281 | 1 | #ifndef GPS_H |
StressedDave | 0:7f20540d3281 | 2 | #define GPS_H |
StressedDave | 0:7f20540d3281 | 3 | |
StressedDave | 0:7f20540d3281 | 4 | #include "mbed.h" |
StressedDave | 0:7f20540d3281 | 5 | #define knots_to_ms 0.514444444f |
StressedDave | 0:7f20540d3281 | 6 | #define pi 3.14159265359f |
StressedDave | 0:7f20540d3281 | 7 | #include "arm_math.h" |
StressedDave | 0:7f20540d3281 | 8 | #include "math_helper.h" |
StressedDave | 0:7f20540d3281 | 9 | #include "arm_common_tables.h" |
StressedDave | 0:7f20540d3281 | 10 | |
StressedDave | 0:7f20540d3281 | 11 | class GPS{ |
StressedDave | 0:7f20540d3281 | 12 | public: |
StressedDave | 0:7f20540d3281 | 13 | |
StressedDave | 0:7f20540d3281 | 14 | GPS(void); |
StressedDave | 0:7f20540d3281 | 15 | bool parse(char *nmea); |
StressedDave | 0:7f20540d3281 | 16 | |
StressedDave | 0:7f20540d3281 | 17 | float latitude; |
StressedDave | 0:7f20540d3281 | 18 | float longitude; |
StressedDave | 0:7f20540d3281 | 19 | float speed; |
StressedDave | 0:7f20540d3281 | 20 | float angle; |
StressedDave | 0:7f20540d3281 | 21 | uint8_t hour, minute, seconds, year, month, day; |
StressedDave | 0:7f20540d3281 | 22 | uint16_t milliseconds; |
StressedDave | 0:7f20540d3281 | 23 | bool fix; |
StressedDave | 0:7f20540d3281 | 24 | char currentline[120]; |
StressedDave | 0:7f20540d3281 | 25 | uint16_t lineidx; |
StressedDave | 0:7f20540d3281 | 26 | bool newSentence; |
StressedDave | 0:7f20540d3281 | 27 | bool firstfix; |
StressedDave | 0:7f20540d3281 | 28 | |
StressedDave | 0:7f20540d3281 | 29 | private: |
StressedDave | 0:7f20540d3281 | 30 | |
StressedDave | 0:7f20540d3281 | 31 | uint16_t parseHex(char c) { |
StressedDave | 0:7f20540d3281 | 32 | //Converts Hex character to value - for checksum calculation |
StressedDave | 0:7f20540d3281 | 33 | if (c <= '9') |
StressedDave | 0:7f20540d3281 | 34 | return c - '0'; |
StressedDave | 0:7f20540d3281 | 35 | if (c < 'A') |
StressedDave | 0:7f20540d3281 | 36 | return 0; |
StressedDave | 0:7f20540d3281 | 37 | if (c <= 'F') |
StressedDave | 0:7f20540d3281 | 38 | return (c - 'A')+10; |
StressedDave | 0:7f20540d3281 | 39 | return 0; |
StressedDave | 0:7f20540d3281 | 40 | } |
StressedDave | 0:7f20540d3281 | 41 | |
StressedDave | 0:7f20540d3281 | 42 | float timef; |
StressedDave | 0:7f20540d3281 | 43 | bool checksum; |
StressedDave | 0:7f20540d3281 | 44 | char lat, lon; |
StressedDave | 0:7f20540d3281 | 45 | float mins; |
StressedDave | 0:7f20540d3281 | 46 | |
StressedDave | 0:7f20540d3281 | 47 | }; |
StressedDave | 0:7f20540d3281 | 48 | #endif |