-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuni_gps.h
37 lines (33 loc) · 850 Bytes
/
uni_gps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef UNI_GPS_H
#define UNI_GPS_H
#include <TinyGPS.h>
typedef struct {
byte hour;
byte minute;
byte second;
int millisecond;
} TimeResult;
class UniGps
{
public:
UniGps(int pps_signal_input);
void setup(void (*interrupt_handler)());
void readData();
bool detected();
void printPeriodically();
bool current_time(TimeResult *, unsigned long current_millis);
void printGPSDate();
bool lock();
unsigned long charactersReceived();
bool synchronizeClocks(unsigned long current_millis);
private:
bool newData;
uint32_t last_gps_print_time;
unsigned long _last_pps_millis;
unsigned long _last_gps_time_in_seconds;
byte _last_hour; // to prevent the 'hour' from wrapping around when GPS date advances
int _pps_signal_input;
TinyGPS gps;
void printGPS();
};
#endif