GPS for mbed

Dependents:   ecu_reader gsm_SET

Committer:
pangsk
Date:
Fri Jul 27 15:07:00 2012 +0000
Revision:
0:0f423a982334
[mbed] converted /ecu_reader/GPS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pangsk 0:0f423a982334 1 /* GPS class for mbed Microcontroller
pangsk 0:0f423a982334 2 * Copyright (c) 2008, sford
pangsk 0:0f423a982334 3 */
pangsk 0:0f423a982334 4
pangsk 0:0f423a982334 5 #include "mbed.h"
pangsk 0:0f423a982334 6
pangsk 0:0f423a982334 7 #ifndef GPS_H
pangsk 0:0f423a982334 8 #define GPS_H
pangsk 0:0f423a982334 9
pangsk 0:0f423a982334 10 /* Class: GPS
pangsk 0:0f423a982334 11 * A GPS interface for reading from a Globalsat EM-406 GPS Module
pangsk 0:0f423a982334 12 */
pangsk 0:0f423a982334 13 class GPS {
pangsk 0:0f423a982334 14
pangsk 0:0f423a982334 15 public:
pangsk 0:0f423a982334 16
pangsk 0:0f423a982334 17 /* Constructor: GPS
pangsk 0:0f423a982334 18 * Create the GPS, connected to the specified serial port
pangsk 0:0f423a982334 19 */
pangsk 0:0f423a982334 20 GPS(PinName tx, PinName rx);
pangsk 0:0f423a982334 21
pangsk 0:0f423a982334 22 /* Function: sample
pangsk 0:0f423a982334 23 * Sample the incoming GPS data, returning whether there is a lock
pangsk 0:0f423a982334 24 *
pangsk 0:0f423a982334 25 * Variables:
pangsk 0:0f423a982334 26 * returns - 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0
pangsk 0:0f423a982334 27 */
pangsk 0:0f423a982334 28 int sample();
pangsk 0:0f423a982334 29
pangsk 0:0f423a982334 30 /* Variable: longitude
pangsk 0:0f423a982334 31 * The longitude (call sample() to set)
pangsk 0:0f423a982334 32 */
pangsk 0:0f423a982334 33 float longitude;
pangsk 0:0f423a982334 34
pangsk 0:0f423a982334 35 /* Variable: latitude
pangsk 0:0f423a982334 36 * The latitude (call sample() to set)
pangsk 0:0f423a982334 37 */
pangsk 0:0f423a982334 38 float latitude;
pangsk 0:0f423a982334 39
pangsk 0:0f423a982334 40 private:
pangsk 0:0f423a982334 41
pangsk 0:0f423a982334 42 float trunc(float v);
pangsk 0:0f423a982334 43 void getline();
pangsk 0:0f423a982334 44
pangsk 0:0f423a982334 45 Serial _gps;
pangsk 0:0f423a982334 46 char msg[256];
pangsk 0:0f423a982334 47
pangsk 0:0f423a982334 48 };
pangsk 0:0f423a982334 49
pangsk 0:0f423a982334 50 #endif