Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Sparkfun_GPS_Shield My_GPS Teste_GPS_luis STM32L152RE ... more
Fork of SerialGPS by
SerialGPS.h
00001 /* mbed GPS Module Library 00002 * Copyright (c) 2008-2010, sford 00003 * Copyright (c) 2013, B.Adryan 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in 00013 * all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 * THE SOFTWARE. 00022 */ 00023 00024 #include "mbed.h" 00025 00026 #ifndef MBED_GPS_H 00027 #define MBED_GPS_H 00028 00029 /** A SerialGPS interface for reading from a serial GPS module */ 00030 class SerialGPS { 00031 public: 00032 00033 /** Create the SerialGPS interface, connected to the specified serial port and speed. 00034 * for example, GlobalSat EM406-A (e.g. on SparkFun GPS Shield) is 4800 Baud, 00035 * Adafruit Ultimate GPSv3 (connected to serial) is 9600 Baud 00036 */ 00037 SerialGPS(PinName tx, PinName rx, int Baud); 00038 00039 /** Sample the incoming GPS data, returning whether there is a lock 00040 * 00041 * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 00042 */ 00043 int sample(); 00044 00045 /** The longitude (call sample() to set) */ 00046 float longitude; 00047 00048 /** The latitude (call sample() to set) */ 00049 float latitude; 00050 00051 /** The time (call sample() to set) */ 00052 float time; 00053 00054 /** Number of satellites received (call sample() to set) */ 00055 int sats; 00056 00057 /** Horizontal dilusion of precision (call sample() to set) */ 00058 float hdop; 00059 00060 /** The altitude (call sample() to set) 00061 * Note that the accurate altitude is corrected by the geoid 00062 * See http://homepages.slingshot.co.nz/~geoff36/datum.htm 00063 */ 00064 float alt; 00065 00066 /** The geoid (call sample() to set) */ 00067 float geoid; 00068 00069 /** The NMEA sentence */ 00070 char msg[256]; 00071 00072 00073 private: 00074 float trunc(float v); 00075 void getline(); 00076 00077 Serial _gps; 00078 }; 00079 00080 #endif
Generated on Fri Jul 15 2022 22:53:53 by
1.7.2

Adafruit Ultimate GPS Breakout v3
Sparkfun GPS Shield (EM406A)