GPS for mbed
Fork of GPS by
GPS.h@1:f491b73cbbcf, 2017-01-15 (annotated)
- Committer:
- Happy111
- Date:
- Sun Jan 15 16:05:12 2017 +0000
- Revision:
- 1:f491b73cbbcf
- Parent:
- 0:0f423a982334
MPOA_GPS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pangsk | 0:0f423a982334 | 1 | /* GPS class for mbed Microcontroller |
pangsk | 0:0f423a982334 | 2 | * Copyright (c) 2008, sford |
pangsk | 0:0f423a982334 | 3 | */ |
pangsk | 0:0f423a982334 | 4 | |
pangsk | 0:0f423a982334 | 5 | #include "mbed.h" |
pangsk | 0:0f423a982334 | 6 | |
pangsk | 0:0f423a982334 | 7 | #ifndef GPS_H |
pangsk | 0:0f423a982334 | 8 | #define GPS_H |
pangsk | 0:0f423a982334 | 9 | |
pangsk | 0:0f423a982334 | 10 | /* Class: GPS |
pangsk | 0:0f423a982334 | 11 | * A GPS interface for reading from a Globalsat EM-406 GPS Module |
pangsk | 0:0f423a982334 | 12 | */ |
pangsk | 0:0f423a982334 | 13 | class GPS { |
pangsk | 0:0f423a982334 | 14 | |
pangsk | 0:0f423a982334 | 15 | public: |
pangsk | 0:0f423a982334 | 16 | |
pangsk | 0:0f423a982334 | 17 | /* Constructor: GPS |
pangsk | 0:0f423a982334 | 18 | * Create the GPS, connected to the specified serial port |
pangsk | 0:0f423a982334 | 19 | */ |
pangsk | 0:0f423a982334 | 20 | GPS(PinName tx, PinName rx); |
pangsk | 0:0f423a982334 | 21 | |
pangsk | 0:0f423a982334 | 22 | /* Function: sample |
pangsk | 0:0f423a982334 | 23 | * Sample the incoming GPS data, returning whether there is a lock |
pangsk | 0:0f423a982334 | 24 | * |
pangsk | 0:0f423a982334 | 25 | * Variables: |
pangsk | 0:0f423a982334 | 26 | * returns - 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
pangsk | 0:0f423a982334 | 27 | */ |
pangsk | 0:0f423a982334 | 28 | int sample(); |
pangsk | 0:0f423a982334 | 29 | |
pangsk | 0:0f423a982334 | 30 | /* Variable: longitude |
pangsk | 0:0f423a982334 | 31 | * The longitude (call sample() to set) |
pangsk | 0:0f423a982334 | 32 | */ |
pangsk | 0:0f423a982334 | 33 | float longitude; |
pangsk | 0:0f423a982334 | 34 | |
pangsk | 0:0f423a982334 | 35 | /* Variable: latitude |
pangsk | 0:0f423a982334 | 36 | * The latitude (call sample() to set) |
pangsk | 0:0f423a982334 | 37 | */ |
pangsk | 0:0f423a982334 | 38 | float latitude; |
Happy111 | 1:f491b73cbbcf | 39 | char xns; |
Happy111 | 1:f491b73cbbcf | 40 | float xtime; |
Happy111 | 1:f491b73cbbcf | 41 | char xew; |
Happy111 | 1:f491b73cbbcf | 42 | int snum; |
Happy111 | 1:f491b73cbbcf | 43 | |
Happy111 | 1:f491b73cbbcf | 44 | int totmsg; |
Happy111 | 1:f491b73cbbcf | 45 | int actmsg; |
Happy111 | 1:f491b73cbbcf | 46 | int siv; |
Happy111 | 1:f491b73cbbcf | 47 | int prn1; |
Happy111 | 1:f491b73cbbcf | 48 | int svele1; |
Happy111 | 1:f491b73cbbcf | 49 | int svaz1; |
Happy111 | 1:f491b73cbbcf | 50 | int prn2; |
Happy111 | 1:f491b73cbbcf | 51 | int svele2; |
Happy111 | 1:f491b73cbbcf | 52 | int svaz2; |
Happy111 | 1:f491b73cbbcf | 53 | int prn3; |
Happy111 | 1:f491b73cbbcf | 54 | int svele3; |
Happy111 | 1:f491b73cbbcf | 55 | int svaz3; |
Happy111 | 1:f491b73cbbcf | 56 | int prn4; |
Happy111 | 1:f491b73cbbcf | 57 | int svele4; |
Happy111 | 1:f491b73cbbcf | 58 | int svaz4; |
Happy111 | 1:f491b73cbbcf | 59 | /* |
Happy111 | 1:f491b73cbbcf | 60 | int prn5; |
Happy111 | 1:f491b73cbbcf | 61 | int svele5; |
Happy111 | 1:f491b73cbbcf | 62 | int svaz5; |
Happy111 | 1:f491b73cbbcf | 63 | int prn6; |
Happy111 | 1:f491b73cbbcf | 64 | int svele6; |
Happy111 | 1:f491b73cbbcf | 65 | int svaz6; |
Happy111 | 1:f491b73cbbcf | 66 | int prn7; |
Happy111 | 1:f491b73cbbcf | 67 | int svele7; |
Happy111 | 1:f491b73cbbcf | 68 | int svaz7; |
Happy111 | 1:f491b73cbbcf | 69 | int prn8; |
Happy111 | 1:f491b73cbbcf | 70 | int svele8; |
Happy111 | 1:f491b73cbbcf | 71 | int svaz8; |
Happy111 | 1:f491b73cbbcf | 72 | */ |
Happy111 | 1:f491b73cbbcf | 73 | int tempprn1; |
Happy111 | 1:f491b73cbbcf | 74 | int tempsvele1; |
Happy111 | 1:f491b73cbbcf | 75 | int tempsvaz1; |
Happy111 | 1:f491b73cbbcf | 76 | int tempprn2; |
Happy111 | 1:f491b73cbbcf | 77 | int tempsvele2; |
Happy111 | 1:f491b73cbbcf | 78 | int tempsvaz2; |
Happy111 | 1:f491b73cbbcf | 79 | int tempprn3; |
Happy111 | 1:f491b73cbbcf | 80 | int tempsvele3; |
Happy111 | 1:f491b73cbbcf | 81 | int tempsvaz3; |
Happy111 | 1:f491b73cbbcf | 82 | int tempprn4; |
Happy111 | 1:f491b73cbbcf | 83 | int tempsvele4; |
Happy111 | 1:f491b73cbbcf | 84 | int tempsvaz4; |
pangsk | 0:0f423a982334 | 85 | |
pangsk | 0:0f423a982334 | 86 | private: |
pangsk | 0:0f423a982334 | 87 | |
pangsk | 0:0f423a982334 | 88 | float trunc(float v); |
pangsk | 0:0f423a982334 | 89 | void getline(); |
pangsk | 0:0f423a982334 | 90 | |
pangsk | 0:0f423a982334 | 91 | Serial _gps; |
pangsk | 0:0f423a982334 | 92 | char msg[256]; |
pangsk | 0:0f423a982334 | 93 | |
pangsk | 0:0f423a982334 | 94 | }; |
pangsk | 0:0f423a982334 | 95 | |
pangsk | 0:0f423a982334 | 96 | #endif |