forked from zendes/SBUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSBUS.h
36 lines (31 loc) · 743 Bytes
/
SBUS.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
#ifndef SBUS_h
#define SBUS_h
#include "Arduino.h"
#define SBUS_FAILSAFE_INACTIVE 0
#define SBUS_FAILSAFE_ACTIVE 1
#define SBUS_STARTBYTE 0x0f
#define SBUS_ENDBYTE 0x00
class SBUS {
public:
SBUS(HardwareSerial & serial) : _serial (serial) {}
void begin();
void begin(bool useTimer);
void process();
int getChannel(int channel);
int getNormalizedChannel(int channel);
int getFailsafeStatus();
int getFrameLoss();
long getGoodFrames();
long getLostFrames();
long getDecoderErrorFrames();
long long getLastTime();
private:
HardwareSerial & _serial;
int _channels[18];
int _failsafe;
long _goodFrames;
long _lostFrames;
long _decoderErrorFrames;
long long _lastGoodFrame;
};
#endif