.

Dependents:   My_GPS_BLE

Fork of SerialGPS by Components

Committer:
VictorMC
Date:
Wed Jan 13 15:48:13 2016 +0000
Revision:
4:ee9ad57fa0bb
Parent:
3:4e2136c38f29
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 3:4e2136c38f29 1 /* mbed GPS Module Library
screamer 3:4e2136c38f29 2 * Copyright (c) 2008-2010, sford
screamer 3:4e2136c38f29 3 * Copyright (c) 2013, B.Adryan
screamer 3:4e2136c38f29 4 *
screamer 3:4e2136c38f29 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
screamer 3:4e2136c38f29 6 * of this software and associated documentation files (the "Software"), to deal
screamer 3:4e2136c38f29 7 * in the Software without restriction, including without limitation the rights
screamer 3:4e2136c38f29 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
screamer 3:4e2136c38f29 9 * copies of the Software, and to permit persons to whom the Software is
screamer 3:4e2136c38f29 10 * furnished to do so, subject to the following conditions:
screamer 3:4e2136c38f29 11 *
screamer 3:4e2136c38f29 12 * The above copyright notice and this permission notice shall be included in
screamer 3:4e2136c38f29 13 * all copies or substantial portions of the Software.
screamer 3:4e2136c38f29 14 *
screamer 3:4e2136c38f29 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
screamer 3:4e2136c38f29 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
screamer 3:4e2136c38f29 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
screamer 3:4e2136c38f29 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
screamer 3:4e2136c38f29 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
screamer 3:4e2136c38f29 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
screamer 3:4e2136c38f29 21 * THE SOFTWARE.
screamer 3:4e2136c38f29 22 */
screamer 3:4e2136c38f29 23
screamer 3:4e2136c38f29 24 #include "mbed.h"
screamer 3:4e2136c38f29 25
screamer 3:4e2136c38f29 26 #ifndef MBED_GPS_H
screamer 3:4e2136c38f29 27 #define MBED_GPS_H
screamer 3:4e2136c38f29 28
screamer 3:4e2136c38f29 29 /** A SerialGPS interface for reading from a serial GPS module */
screamer 3:4e2136c38f29 30 class SerialGPS {
screamer 3:4e2136c38f29 31 public:
screamer 3:4e2136c38f29 32
screamer 3:4e2136c38f29 33 /** Create the SerialGPS interface, connected to the specified serial port and speed.
screamer 3:4e2136c38f29 34 * for example, GlobalSat EM406-A (e.g. on SparkFun GPS Shield) is 4800 Baud,
screamer 3:4e2136c38f29 35 * Adafruit Ultimate GPSv3 (connected to serial) is 9600 Baud
screamer 3:4e2136c38f29 36 */
screamer 3:4e2136c38f29 37 SerialGPS(PinName tx, PinName rx, int Baud);
screamer 3:4e2136c38f29 38
screamer 3:4e2136c38f29 39 /** Sample the incoming GPS data, returning whether there is a lock
screamer 3:4e2136c38f29 40 *
screamer 3:4e2136c38f29 41 * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0
screamer 3:4e2136c38f29 42 */
screamer 3:4e2136c38f29 43 int sample();
screamer 3:4e2136c38f29 44
screamer 3:4e2136c38f29 45 /** The longitude (call sample() to set) */
screamer 3:4e2136c38f29 46 float longitude;
screamer 3:4e2136c38f29 47
screamer 3:4e2136c38f29 48 /** The latitude (call sample() to set) */
screamer 3:4e2136c38f29 49 float latitude;
screamer 3:4e2136c38f29 50
screamer 3:4e2136c38f29 51 /** The time (call sample() to set) */
screamer 3:4e2136c38f29 52 float time;
screamer 3:4e2136c38f29 53
screamer 3:4e2136c38f29 54 /** Number of satellites received (call sample() to set) */
screamer 3:4e2136c38f29 55 int sats;
screamer 3:4e2136c38f29 56
screamer 3:4e2136c38f29 57 /** Horizontal dilusion of precision (call sample() to set) */
screamer 3:4e2136c38f29 58 float hdop;
screamer 3:4e2136c38f29 59
screamer 3:4e2136c38f29 60 /** The altitude (call sample() to set)
screamer 3:4e2136c38f29 61 * Note that the accurate altitude is corrected by the geoid
screamer 3:4e2136c38f29 62 * See http://homepages.slingshot.co.nz/~geoff36/datum.htm
screamer 3:4e2136c38f29 63 */
screamer 3:4e2136c38f29 64 float alt;
screamer 3:4e2136c38f29 65
screamer 3:4e2136c38f29 66 /** The geoid (call sample() to set) */
screamer 3:4e2136c38f29 67 float geoid;
screamer 3:4e2136c38f29 68
screamer 3:4e2136c38f29 69 /** The NMEA sentence */
screamer 3:4e2136c38f29 70 char msg[256];
screamer 3:4e2136c38f29 71
screamer 3:4e2136c38f29 72
screamer 3:4e2136c38f29 73 private:
screamer 3:4e2136c38f29 74 float trunc(float v);
screamer 3:4e2136c38f29 75 void getline();
screamer 3:4e2136c38f29 76
screamer 3:4e2136c38f29 77 Serial _gps;
screamer 3:4e2136c38f29 78 };
screamer 3:4e2136c38f29 79
screamer 3:4e2136c38f29 80 #endif