GPS Library for Nucleo

Dependencies:   Adafruit_GPS

Dependents:   Full-Project

Fork of MBed_Adafruit-GPS-Library by Myron Lee

Committer:
ptcrews
Date:
Mon Dec 07 00:05:43 2015 +0000
Revision:
5:1249c2cfdede
Parent:
3:f2477af055c3
Added comments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ptcrews 3:f2477af055c3 1 #include "main.h"
ptcrews 3:f2477af055c3 2 #include "MBed_Adafruit_GPS.h"
ptcrews 3:f2477af055c3 3
ptcrews 5:1249c2cfdede 4 #define REFRESH_TIME 2000 // Refresh time in ms
ptcrews 5:1249c2cfdede 5 #define N_GPS_QUERIES 300000 // Number of queries to send GPS -- changing may lose readings
ptcrews 5:1249c2cfdede 6 #define SEC_WAIT_FOR_FIX 60 // Number of seconds to wait for the GPS to get a fix
ptcrews 5:1249c2cfdede 7 #define GPS_BAUD 9600 // Sets the GPS baud rate
ptcrews 3:f2477af055c3 8
ptcrews 3:f2477af055c3 9 #ifndef _GPS_WRAPPER_CLASS
ptcrews 3:f2477af055c3 10 #define _GPS_WRAPPER_CLASS
ptcrews 3:f2477af055c3 11
ptcrews 5:1249c2cfdede 12 /* Class: GPS_Sensor
ptcrews 5:1249c2cfdede 13 * ----------------
ptcrews 5:1249c2cfdede 14 * Defines a "wrapper" class for the Adafruit GPS
ptcrews 5:1249c2cfdede 15 * library. Abstracts their functions for use with
ptcrews 5:1249c2cfdede 16 * this project.
ptcrews 5:1249c2cfdede 17 */
ptcrews 3:f2477af055c3 18 class GPS_Sensor {
ptcrews 3:f2477af055c3 19 public:
ptcrews 3:f2477af055c3 20 GPS_Sensor() : gps_Serial(GPS_TX, GPS_RX), myGPS(&gps_Serial), gpsEN(GPS_EN){}
ptcrews 3:f2477af055c3 21 void setup();
ptcrews 3:f2477af055c3 22 void read(struct reading& lastReadingBuffer);
ptcrews 3:f2477af055c3 23 void turnOff() { gpsEN.write(0); }
ptcrews 3:f2477af055c3 24 void turnOn() { gpsEN.write(1); }
ptcrews 3:f2477af055c3 25
ptcrews 3:f2477af055c3 26 private:
ptcrews 3:f2477af055c3 27 Serial gps_Serial;
ptcrews 3:f2477af055c3 28 Adafruit_GPS myGPS;
ptcrews 3:f2477af055c3 29 DigitalOut gpsEN;
ptcrews 3:f2477af055c3 30 Timer refresh_Timer;
ptcrews 3:f2477af055c3 31 };
ptcrews 3:f2477af055c3 32
ptcrews 3:f2477af055c3 33 #endif