forked from DeuxVis/Lora-TTNMapper-T-Beam
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgps.h
39 lines (34 loc) · 1.45 KB
/
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
38
39
#ifndef __GPS_H__
#define __GPS_H__
#include <TinyGPS++.h>
#include <HardwareSerial.h>
#define GPS_TX 12
#define GPS_RX 15
class gps
{
public:
void init();
bool checkGpsFix();
void buildPacket(uint8_t txBuffer[9]);
void encode();
double lat();
double lng();
void wakeup();
void softwareReset();
void enableSleep();
void setLowPower();
private:
uint32_t LatitudeBinary, LongitudeBinary;
uint16_t altitudeGps;
uint8_t hdopGps;
char t[32]; // used to sprintf for Serial output
TinyGPSPlus tGps;
uint8_t GPSpowersave[10] = { 0xB5, 0x62, 0x06, 0x11, 0x02, 0x00, 0x08, 0x01, 0x22, 0x92 };
const byte RXM_PMREQ[12] = {0xB5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x16, 0x74};
// const byte RXM_PMREQ[16] {0xb5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4d, 0x3b}; //power off until wakeup call
uint8_t GPSon[16] = {0xB5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x37};
//31.19 CFG-RST (0x06 0x04) checksum calculation https://gist.github.com/tomazas/3ab51f91cdc418f5704d
byte CFG_RST[12] = {0xb5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01,0x00, 0x0F, 0x66};//Controlled Software reset
byte CFG_RXM[10] = {0xb5, 0x62, 0x06, 0x11, 0x02, 0x00, 0x08,0x04,0x25, 0x95};//Controlled Software reset
};
#endif