gps ok

Dependents:   Tarea6_Gsm_gps

Fork of GPS by Gustavo Ramirez

Committer:
jclondonol
Date:
Tue Jun 05 03:21:48 2018 +0000
Revision:
2:cefda8b10525
Parent:
1:653fe36ca211
tarea 6

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jclondonol 2:cefda8b10525 1 /* mbed EM-406 GPS Module Library
jclondonol 2:cefda8b10525 2 * Copyright (c) 2008-2010, sford
jclondonol 2:cefda8b10525 3 *
jclondonol 2:cefda8b10525 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
jclondonol 2:cefda8b10525 5 * of this software and associated documentation files (the "Software"), to deal
jclondonol 2:cefda8b10525 6 * in the Software without restriction, including without limitation the rights
jclondonol 2:cefda8b10525 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
jclondonol 2:cefda8b10525 8 * copies of the Software, and to permit persons to whom the Software is
jclondonol 2:cefda8b10525 9 * furnished to do so, subject to the following conditions:
jclondonol 2:cefda8b10525 10 *
jclondonol 2:cefda8b10525 11 * The above copyright notice and this permission notice shall be included in
jclondonol 2:cefda8b10525 12 * all copies or substantial portions of the Software.
jclondonol 2:cefda8b10525 13 *
jclondonol 2:cefda8b10525 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
jclondonol 2:cefda8b10525 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
jclondonol 2:cefda8b10525 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
jclondonol 2:cefda8b10525 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
jclondonol 2:cefda8b10525 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
jclondonol 2:cefda8b10525 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
jclondonol 2:cefda8b10525 20 * THE SOFTWARE.
jclondonol 2:cefda8b10525 21 */
simon 0:15611c7938a3 22
simon 0:15611c7938a3 23 #include "mbed.h"
simon 0:15611c7938a3 24
simon 0:15611c7938a3 25 #ifndef MBED_GPS_H
simon 0:15611c7938a3 26 #define MBED_GPS_H
simon 0:15611c7938a3 27
simon 0:15611c7938a3 28 /** A GPS interface for reading from a Globalsat EM-406 GPS Module */
simon 0:15611c7938a3 29 class GPS {
simon 0:15611c7938a3 30 public:
simon 0:15611c7938a3 31
simon 0:15611c7938a3 32 /** Create the GPS interface, connected to the specified serial port
simon 0:15611c7938a3 33 */
simon 0:15611c7938a3 34 GPS(PinName tx, PinName rx);
simon 0:15611c7938a3 35
simon 0:15611c7938a3 36 /** Sample the incoming GPS data, returning whether there is a lock
simon 0:15611c7938a3 37 *
simon 0:15611c7938a3 38 * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0
simon 0:15611c7938a3 39 */
simon 0:15611c7938a3 40 int sample();
simon 0:15611c7938a3 41
simon 0:15611c7938a3 42 /** The longitude (call sample() to set) */
simon 0:15611c7938a3 43 float longitude;
jclondonol 2:cefda8b10525 44
simon 0:15611c7938a3 45 /** The latitude (call sample() to set) */
simon 0:15611c7938a3 46 float latitude;
simon 0:15611c7938a3 47
simon 0:15611c7938a3 48 private:
simon 0:15611c7938a3 49 float trunc(float v);
simon 0:15611c7938a3 50 void getline();
simon 0:15611c7938a3 51
simon 0:15611c7938a3 52 Serial _gps;
simon 0:15611c7938a3 53 char msg[256];
jclondonol 2:cefda8b10525 54
simon 0:15611c7938a3 55 };
simon 0:15611c7938a3 56
simon 0:15611c7938a3 57 #endif