Library for ublox neo 6m
GPS.h@2:2b9befe69d07, 2019-04-16 (annotated)
- Committer:
- QuangAnhLe
- Date:
- Tue Apr 16 21:53:03 2019 +0000
- Revision:
- 2:2b9befe69d07
- Parent:
- 1:9a8a3f68b005
SMS
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 | |
fookies | 0:8f2e256775d7 | 42 | /** The longitude (call sample() to set) */ |
fookies | 0:8f2e256775d7 | 43 | float longitude; |
fookies | 0:8f2e256775d7 | 44 | |
fookies | 0:8f2e256775d7 | 45 | /** The latitude (call sample() to set) */ |
fookies | 0:8f2e256775d7 | 46 | float latitude; |
fookies | 0:8f2e256775d7 | 47 | |
fookies | 0:8f2e256775d7 | 48 | /** The UTC time */ |
fookies | 0:8f2e256775d7 | 49 | float utc; |
fookies | 0:8f2e256775d7 | 50 | |
QuangAnhLe | 1:9a8a3f68b005 | 51 | //int sek, min, hour; |
QuangAnhLe | 1:9a8a3f68b005 | 52 | |
QuangAnhLe | 1:9a8a3f68b005 | 53 | /**fix quality*/ |
QuangAnhLe | 1:9a8a3f68b005 | 54 | int fix; |
QuangAnhLe | 1:9a8a3f68b005 | 55 | |
QuangAnhLe | 1:9a8a3f68b005 | 56 | /**fix3D fix - values include: 1 = no fix,2 = 2D fix,3 = 3D fix */ |
QuangAnhLe | 1:9a8a3f68b005 | 57 | int fix_3d; |
QuangAnhLe | 1:9a8a3f68b005 | 58 | |
QuangAnhLe | 1:9a8a3f68b005 | 59 | /**Altitude, Meters, above mean sea level*/ |
QuangAnhLe | 1:9a8a3f68b005 | 60 | float altitude; |
QuangAnhLe | 1:9a8a3f68b005 | 61 | |
QuangAnhLe | 1:9a8a3f68b005 | 62 | /**Number of satellites being tracked*/ |
QuangAnhLe | 1:9a8a3f68b005 | 63 | int sat_tracked; |
QuangAnhLe | 1:9a8a3f68b005 | 64 | |
QuangAnhLe | 1:9a8a3f68b005 | 65 | /**dilution of precision (PDOP)*/ |
QuangAnhLe | 2:2b9befe69d07 | 66 | //double pdop; |
QuangAnhLe | 1:9a8a3f68b005 | 67 | |
QuangAnhLe | 1:9a8a3f68b005 | 68 | /**Horizontal dilution of precision (HDOP) */ |
QuangAnhLe | 2:2b9befe69d07 | 69 | //double hdop; |
QuangAnhLe | 1:9a8a3f68b005 | 70 | |
QuangAnhLe | 1:9a8a3f68b005 | 71 | /**Vertical dilution of precision (VDOP)*/ |
QuangAnhLe | 1:9a8a3f68b005 | 72 | //float vdop; |
QuangAnhLe | 1:9a8a3f68b005 | 73 | //char aut; |
QuangAnhLe | 1:9a8a3f68b005 | 74 | |
QuangAnhLe | 1:9a8a3f68b005 | 75 | /**speed in knots*/ |
QuangAnhLe | 1:9a8a3f68b005 | 76 | float speed; |
QuangAnhLe | 1:9a8a3f68b005 | 77 | |
QuangAnhLe | 1:9a8a3f68b005 | 78 | /**date of object*/ |
QuangAnhLe | 1:9a8a3f68b005 | 79 | int date; |
QuangAnhLe | 1:9a8a3f68b005 | 80 | |
QuangAnhLe | 1:9a8a3f68b005 | 81 | /**PRNs (IDS) of satellites used for fix (space for 12) */ |
QuangAnhLe | 1:9a8a3f68b005 | 82 | int id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11,id12,id13; |
QuangAnhLe | 1:9a8a3f68b005 | 83 | |
QuangAnhLe | 1:9a8a3f68b005 | 84 | char msg[280]; |
fookies | 0:8f2e256775d7 | 85 | |
fookies | 0:8f2e256775d7 | 86 | private: |
fookies | 0:8f2e256775d7 | 87 | float trunc(float v); |
fookies | 0:8f2e256775d7 | 88 | void getline(); |
QuangAnhLe | 1:9a8a3f68b005 | 89 | //void getline2(); |
fookies | 0:8f2e256775d7 | 90 | |
fookies | 0:8f2e256775d7 | 91 | Serial _gps; |
fookies | 0:8f2e256775d7 | 92 | |
fookies | 0:8f2e256775d7 | 93 | }; |
fookies | 0:8f2e256775d7 | 94 | |
fookies | 0:8f2e256775d7 | 95 | #endif |