Library for ublox neo 6m
GPS.h@1:380b615d1237, 2019-11-29 (annotated)
- Committer:
- JorgeGtz
- Date:
- Fri Nov 29 19:59:45 2019 +0000
- Revision:
- 1:380b615d1237
- Parent:
- 0:8f2e256775d7
Satelite
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fookies | 0:8f2e256775d7 | 1 | /* mbed EM-406 GPS Module Library |
fookies | 0:8f2e256775d7 | 2 | * Copyright (c) 2008-2010, sford |
fookies | 0:8f2e256775d7 | 3 | * |
fookies | 0:8f2e256775d7 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
fookies | 0:8f2e256775d7 | 5 | * of this software and associated documentation files (the "Software"), to deal |
fookies | 0:8f2e256775d7 | 6 | * in the Software without restriction, including without limitation the rights |
fookies | 0:8f2e256775d7 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
fookies | 0:8f2e256775d7 | 8 | * copies of the Software, and to permit persons to whom the Software is |
fookies | 0:8f2e256775d7 | 9 | * furnished to do so, subject to the following conditions: |
fookies | 0:8f2e256775d7 | 10 | * |
fookies | 0:8f2e256775d7 | 11 | * The above copyright notice and this permission notice shall be included in |
fookies | 0:8f2e256775d7 | 12 | * all copies or substantial portions of the Software. |
fookies | 0:8f2e256775d7 | 13 | * |
fookies | 0:8f2e256775d7 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
fookies | 0:8f2e256775d7 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
fookies | 0:8f2e256775d7 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
fookies | 0:8f2e256775d7 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
fookies | 0:8f2e256775d7 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
fookies | 0:8f2e256775d7 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
fookies | 0:8f2e256775d7 | 20 | * THE SOFTWARE. |
fookies | 0:8f2e256775d7 | 21 | */ |
fookies | 0:8f2e256775d7 | 22 | |
fookies | 0:8f2e256775d7 | 23 | #include "mbed.h" |
fookies | 0:8f2e256775d7 | 24 | |
fookies | 0:8f2e256775d7 | 25 | #ifndef MBED_GPS_H |
fookies | 0:8f2e256775d7 | 26 | #define MBED_GPS_H |
fookies | 0:8f2e256775d7 | 27 | |
fookies | 0:8f2e256775d7 | 28 | /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ |
fookies | 0:8f2e256775d7 | 29 | class GPS { |
fookies | 0:8f2e256775d7 | 30 | public: |
fookies | 0:8f2e256775d7 | 31 | |
fookies | 0:8f2e256775d7 | 32 | /** Create the GPS interface, connected to the specified serial port |
fookies | 0:8f2e256775d7 | 33 | */ |
fookies | 0:8f2e256775d7 | 34 | GPS(PinName tx, PinName rx); |
fookies | 0:8f2e256775d7 | 35 | |
fookies | 0:8f2e256775d7 | 36 | /** Sample the incoming GPS data, returning whether there is a lock |
fookies | 0:8f2e256775d7 | 37 | * |
fookies | 0:8f2e256775d7 | 38 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
fookies | 0:8f2e256775d7 | 39 | */ |
fookies | 0:8f2e256775d7 | 40 | int sample(); |
fookies | 0:8f2e256775d7 | 41 | |
JorgeGtz | 1:380b615d1237 | 42 | /** Beijig time format(shi,fen,miao) **/ |
JorgeGtz | 1:380b615d1237 | 43 | int hour; |
JorgeGtz | 1:380b615d1237 | 44 | int minute; |
JorgeGtz | 1:380b615d1237 | 45 | int seconed; |
JorgeGtz | 1:380b615d1237 | 46 | |
fookies | 0:8f2e256775d7 | 47 | /** The longitude (call sample() to set) */ |
fookies | 0:8f2e256775d7 | 48 | float longitude; |
JorgeGtz | 1:380b615d1237 | 49 | |
JorgeGtz | 1:380b615d1237 | 50 | /** display north/south, east/west unit**/ |
JorgeGtz | 1:380b615d1237 | 51 | char ns, ew, unit; |
JorgeGtz | 1:380b615d1237 | 52 | |
fookies | 0:8f2e256775d7 | 53 | /** The latitude (call sample() to set) */ |
fookies | 0:8f2e256775d7 | 54 | float latitude; |
fookies | 0:8f2e256775d7 | 55 | |
JorgeGtz | 1:380b615d1237 | 56 | /** The time (call sample() to set) */ |
JorgeGtz | 1:380b615d1237 | 57 | float time; |
JorgeGtz | 1:380b615d1237 | 58 | |
JorgeGtz | 1:380b615d1237 | 59 | /** Number of satellites received (call sample() to set) */ |
JorgeGtz | 1:380b615d1237 | 60 | int sats; |
JorgeGtz | 1:380b615d1237 | 61 | |
JorgeGtz | 1:380b615d1237 | 62 | /** Horizontal dilusion of precision (call sample() to set) */ |
JorgeGtz | 1:380b615d1237 | 63 | float hdop; |
JorgeGtz | 1:380b615d1237 | 64 | |
JorgeGtz | 1:380b615d1237 | 65 | /** The altitude (call sample() to set) |
JorgeGtz | 1:380b615d1237 | 66 | Note that the accurate altitude is corrected by the geoid |
JorgeGtz | 1:380b615d1237 | 67 | See http://homepages.slingshot.co.nz/~geoff36/datum.htm |
JorgeGtz | 1:380b615d1237 | 68 | */ |
JorgeGtz | 1:380b615d1237 | 69 | float alt; |
JorgeGtz | 1:380b615d1237 | 70 | |
JorgeGtz | 1:380b615d1237 | 71 | /** The geoid (call sample() to set) */ |
JorgeGtz | 1:380b615d1237 | 72 | float geoid; |
JorgeGtz | 1:380b615d1237 | 73 | |
JorgeGtz | 1:380b615d1237 | 74 | /** The NMEA sentence */ |
JorgeGtz | 1:380b615d1237 | 75 | char msg[256]; |
fookies | 0:8f2e256775d7 | 76 | float utc; |
fookies | 0:8f2e256775d7 | 77 | |
fookies | 0:8f2e256775d7 | 78 | |
fookies | 0:8f2e256775d7 | 79 | private: |
fookies | 0:8f2e256775d7 | 80 | float trunc(float v); |
fookies | 0:8f2e256775d7 | 81 | void getline(); |
fookies | 0:8f2e256775d7 | 82 | |
fookies | 0:8f2e256775d7 | 83 | Serial _gps; |
fookies | 0:8f2e256775d7 | 84 | |
fookies | 0:8f2e256775d7 | 85 | }; |
fookies | 0:8f2e256775d7 | 86 | |
fookies | 0:8f2e256775d7 | 87 | #endif |