-
Notifications
You must be signed in to change notification settings - Fork 0
/
Neo6GPS.h
56 lines (48 loc) · 1.19 KB
/
Neo6GPS.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef NEO6GPS_h
#define NEO6GPS_h
#define __NEO6GPS_VERSION__ 1.0.0
#include "Arduino.h"
#ifndef ESP32
#include <WiFi.h>
#elif ESP8266
#include <ESP8266WiFi.h>
#endif
#define TIMEOUT 3 // Wait for 60 Seconds
struct gpsData
{
bool status; /* data is valid or not */
uint8_t sec; /* seconds */
uint8_t min; /* minutes */
uint8_t hour; /* hours */
uint8_t date; /* date of the month */
uint8_t month; /* month */
uint8_t year; /* year */
float latitude; /* latitude */
float longitude; /* longitude */
#ifdef ALL_DATA
float speedOG; /* Speed over ground */
float courseOG; /* course over ground */
#endif
};
class Neo6GPS
{
private:
int _timeout;
uint8_t reTry=0;
Stream* _serial;
String _serialBuffer="";
char tempBuff[20]={0};
uint8_t _commaIndex=0;
uint8_t commaIndex=0;
uint16_t tempValue=0;
int16_t timeZone=0;
String _readSerial();
void _clearSerial();
void _parsGPRMC(struct gpsData *ldata);
public:
Neo6GPS();
void begin(Stream &serial);
bool readData(struct gpsData *ldata);
void setTimeZone(int8_t hrs,int8_t mins);
};
#endif