VFD modular clock firmware

Dependencies:   DipCortex-EEprom RTC flw mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gps.h Source File

gps.h

00001 /*
00002  * GPS support for VFD Modular Clock
00003  * (C) 2012 William B Phelps
00004  *
00005  * mbed Port (C) 2014 Akafugu Corporation
00006  *
00007  * This program is free software; you can redistribute it and/or modify it under the
00008  * terms of the GNU General Public License as published by the Free Software
00009  * Foundation; either version 2 of the License, or (at your option) any later
00010  * version.
00011  *
00012  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
00013  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00014  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
00015  *
00016  */
00017 
00018 #ifndef GPS_H_
00019 #define GPS_H_
00020 
00021 #ifdef HAVE_GPS
00022 
00023 #include "mbed.h"
00024 
00025 //convenience macro to convert to and from tm years
00026 #define  tmYearToY2k(Y)      ((Y) - 100)    // offset is from 1900
00027 #define  y2kYearToTm(Y)      ((Y) + 100)
00028 
00029 // String buffer size:
00030 #define GPSBUFFERSIZE 96 
00031 //The year the clock was programmed, used for error checking
00032 #define PROGRAMMING_YEAR 14
00033 
00034 #define SECS_PER_HOUR (3600UL)
00035 
00036 extern unsigned long tGPSupdate;  // really time_t
00037 
00038 // we double buffer: read into one line and leave one for the main program
00039 //extern volatile char gpsBuffer1[GPSBUFFERSIZE];
00040 //extern volatile char gpsBuffer2[GPSBUFFERSIZE];
00041 // our index into filling the current line
00042 //extern volatile uint8_t gpsBufferPtr;
00043 // pointers to the double buffers
00044 //extern volatile char *gpsNextBuffer;
00045 //extern volatile char *gpsLastBuffer;
00046 //extern volatile uint8_t gpsDataReady_;
00047 
00048 //GPS serial data handling functions:
00049 uint8_t gpsDataReady(void);
00050 void GPSread(char c);
00051 char *gpsNMEA(void);
00052 time_t parseGPSdata(char *gpsBuffer, bool& error, bool& fix, int8_t tzh, uint8_t tzm);
00053 
00054 uint8_t leapyear(uint16_t y);
00055 void gps_init();
00056 
00057 #endif // HAVE_GPS
00058 #endif // GPS_H_