-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTelemetry.h
66 lines (52 loc) · 961 Bytes
/
Telemetry.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
57
58
59
60
61
62
63
64
65
66
#ifndef Telemetry_h
#define Telemetry_h
#include "Arduino.h"
#include "Battery.h"
#ifdef SOFTWARE_TELEMETRY
#include "SoftwareSerial.h"
#endif
#ifdef SOFTWARE_TELEMETRY
#define RXPIN 10
#define TXPIN 11
#else
#define RXPIN 0
#define TXPIN 1
#endif
#ifdef SOFTWARE_TELEMETRY
#define SERIAL_STREAM in
#else
#define SERIAL_STREAM Serial1
#endif
class Telemetry {
private:
uint8_t current;
uint8_t a1;
uint8_t a2;
uint8_t rssi;
bool hasTelemetry;
uint8_t buffer[5] = {};
#ifdef SOFTWARE_TELEMETRY
SoftwareSerial in;
#endif
public:
Telemetry();
void begin();
void update();
inline uint8_t getRssi();
inline uint8_t getA1();
inline uint8_t getA2();
inline bool aquired();
};
inline uint8_t Telemetry::getRssi() {
return rssi;
}
inline uint8_t Telemetry::getA1() {
return A1_TO_BYTE(a1);
}
inline uint8_t Telemetry::getA2() {
return A2_TO_BYTE(a2);
}
inline bool Telemetry::aquired() {
return hasTelemetry;
}
#endif