-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMCU_GPS_readings.h
39 lines (31 loc) · 1.17 KB
/
MCU_GPS_readings.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
#pragma once
#include <string.h>
#include <stdint.h>
#ifdef HT_DEBUG_EN
#include "Arduino.h"
#endif
#pragma pack(push,1)
// @Parseclass
class MCU_GPS_readings {
public:
MCU_GPS_readings() = default;
MCU_GPS_readings(uint8_t buf[8]) { load(buf); }
inline void load(uint8_t buf[]) { memcpy(this, buf, sizeof(*this)); }
inline void write(uint8_t buf[]) const { memcpy(buf, this, sizeof(*this)); }
inline int32_t get_latitude() const { return latitude; }
inline int32_t get_longitude() const { return longitude; }
inline void set_latitude(int32_t latitude) { this->latitude = latitude; }
inline void set_longitude(int32_t longitude) { this->longitude = longitude; }
#ifdef HT_DEBUG_EN
void print() {
SerialUSB.println("\n\nGPS Readings");
SerialUSB.println( "-----------");
SerialUSB.print("Latitude: "); SerialUSB.println(latitude / 1000000.);
SerialUSB.print("Longitude: "); SerialUSB.println(longitude / 1000000.);
}
#endif
private:
int32_t latitude; // @Parse @Scale(100000)
int32_t longitude; // @Parse @Scale(100000)
};
#pragma pack(pop)