VFD modular clock firmware

Dependencies:   DipCortex-EEprom RTC flw mbed

Committer:
Backstr?m
Date:
Tue Feb 24 23:01:40 2015 +0900
Revision:
12:dfb422107412
Parent:
0:f6e68b4ce169
Added tag v1.0.2 for changeset 34b344fdec98

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Backstrom 0:f6e68b4ce169 1 /*
Backstrom 0:f6e68b4ce169 2 * GPS support for VFD Modular Clock
Backstrom 0:f6e68b4ce169 3 * (C) 2012 William B Phelps
Backstrom 0:f6e68b4ce169 4 *
Backstrom 0:f6e68b4ce169 5 * mbed Port (C) 2014 Akafugu Corporation
Backstrom 0:f6e68b4ce169 6 *
Backstrom 0:f6e68b4ce169 7 * This program is free software; you can redistribute it and/or modify it under the
Backstrom 0:f6e68b4ce169 8 * terms of the GNU General Public License as published by the Free Software
Backstrom 0:f6e68b4ce169 9 * Foundation; either version 2 of the License, or (at your option) any later
Backstrom 0:f6e68b4ce169 10 * version.
Backstrom 0:f6e68b4ce169 11 *
Backstrom 0:f6e68b4ce169 12 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
Backstrom 0:f6e68b4ce169 13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
Backstrom 0:f6e68b4ce169 14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
Backstrom 0:f6e68b4ce169 15 *
Backstrom 0:f6e68b4ce169 16 */
Backstrom 0:f6e68b4ce169 17
Backstrom 0:f6e68b4ce169 18 #ifndef GPS_H_
Backstrom 0:f6e68b4ce169 19 #define GPS_H_
Backstrom 0:f6e68b4ce169 20
Backstrom 0:f6e68b4ce169 21 #ifdef HAVE_GPS
Backstrom 0:f6e68b4ce169 22
Backstrom 0:f6e68b4ce169 23 #include "mbed.h"
Backstrom 0:f6e68b4ce169 24
Backstrom 0:f6e68b4ce169 25 //convenience macro to convert to and from tm years
Backstrom 0:f6e68b4ce169 26 #define tmYearToY2k(Y) ((Y) - 100) // offset is from 1900
Backstrom 0:f6e68b4ce169 27 #define y2kYearToTm(Y) ((Y) + 100)
Backstrom 0:f6e68b4ce169 28
Backstrom 0:f6e68b4ce169 29 // String buffer size:
Backstrom 0:f6e68b4ce169 30 #define GPSBUFFERSIZE 96
Backstrom 0:f6e68b4ce169 31 //The year the clock was programmed, used for error checking
Backstrom 0:f6e68b4ce169 32 #define PROGRAMMING_YEAR 14
Backstrom 0:f6e68b4ce169 33
Backstrom 0:f6e68b4ce169 34 #define SECS_PER_HOUR (3600UL)
Backstrom 0:f6e68b4ce169 35
Backstrom 0:f6e68b4ce169 36 extern unsigned long tGPSupdate; // really time_t
Backstrom 0:f6e68b4ce169 37
Backstrom 0:f6e68b4ce169 38 // we double buffer: read into one line and leave one for the main program
Backstrom 0:f6e68b4ce169 39 //extern volatile char gpsBuffer1[GPSBUFFERSIZE];
Backstrom 0:f6e68b4ce169 40 //extern volatile char gpsBuffer2[GPSBUFFERSIZE];
Backstrom 0:f6e68b4ce169 41 // our index into filling the current line
Backstrom 0:f6e68b4ce169 42 //extern volatile uint8_t gpsBufferPtr;
Backstrom 0:f6e68b4ce169 43 // pointers to the double buffers
Backstrom 0:f6e68b4ce169 44 //extern volatile char *gpsNextBuffer;
Backstrom 0:f6e68b4ce169 45 //extern volatile char *gpsLastBuffer;
Backstrom 0:f6e68b4ce169 46 //extern volatile uint8_t gpsDataReady_;
Backstrom 0:f6e68b4ce169 47
Backstrom 0:f6e68b4ce169 48 //GPS serial data handling functions:
Backstrom 0:f6e68b4ce169 49 uint8_t gpsDataReady(void);
Backstrom 0:f6e68b4ce169 50 void GPSread(char c);
Backstrom 0:f6e68b4ce169 51 char *gpsNMEA(void);
Backstrom 0:f6e68b4ce169 52 time_t parseGPSdata(char *gpsBuffer, bool& error, bool& fix, int8_t tzh, uint8_t tzm);
Backstrom 0:f6e68b4ce169 53
Backstrom 0:f6e68b4ce169 54 uint8_t leapyear(uint16_t y);
Backstrom 0:f6e68b4ce169 55 void gps_init();
Backstrom 0:f6e68b4ce169 56
Backstrom 0:f6e68b4ce169 57 #endif // HAVE_GPS
Backstrom 0:f6e68b4ce169 58 #endif // GPS_H_