Committer:
keerthanasp
Date:
Thu Feb 10 15:32:45 2011 +0000
Revision:
0:70e7fa78c4ac

        

Who changed what in which revision?

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