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.
Fork of NEO-6m-GPS by
GPS.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 GPS interface for reading from a serial GPS module */ 00030 class GPS { 00031 public: 00032 00033 /** Create the GPS 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 GPS(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 00046 /** Beijig time format(shi,fen,miao) **/ 00047 int hour; 00048 int minute; 00049 int seconed; 00050 00051 /** The longitude (call sample() to set) */ 00052 float longitude; 00053 00054 /** display north/south, east/west unit**/ 00055 char ns, ew, unit; 00056 00057 /** The latitude (call sample() to set) */ 00058 float latitude; 00059 00060 /** The time (call sample() to set) */ 00061 float time; 00062 00063 /** Number of satellites received (call sample() to set) */ 00064 int sats; 00065 00066 /** Horizontal dilusion of precision (call sample() to set) */ 00067 float hdop; 00068 00069 /** The altitude (call sample() to set) 00070 Note that the accurate altitude is corrected by the geoid 00071 See http://homepages.slingshot.co.nz/~geoff36/datum.htm 00072 */ 00073 float alt; 00074 00075 /** The geoid (call sample() to set) */ 00076 float geoid; 00077 00078 /** The NMEA sentence */ 00079 char msg[256]; 00080 00081 00082 private: 00083 float trunc(float v); 00084 void getline(); 00085 00086 //create a serial object 00087 Serial _gps; 00088 }; 00089 00090 #endif
Generated on Thu Jul 28 2022 06:58:29 by
1.7.2
