Library for ublox neo 6m
GPS.h@0:8f2e256775d7, 2015-05-04 (annotated)
- Committer:
- fookies
- Date:
- Mon May 04 03:41:27 2015 +0000
- Revision:
- 0:8f2e256775d7
- Child:
- 1:7908d7196d1e
for student
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 | |
fookies | 0:8f2e256775d7 | 51 | char msg[256]; |
fookies | 0:8f2e256775d7 | 52 | |
fookies | 0:8f2e256775d7 | 53 | private: |
fookies | 0:8f2e256775d7 | 54 | float trunc(float v); |
fookies | 0:8f2e256775d7 | 55 | void getline(); |
fookies | 0:8f2e256775d7 | 56 | |
fookies | 0:8f2e256775d7 | 57 | Serial _gps; |
fookies | 0:8f2e256775d7 | 58 | |
fookies | 0:8f2e256775d7 | 59 | }; |
fookies | 0:8f2e256775d7 | 60 | |
fookies | 0:8f2e256775d7 | 61 | #endif |