forked from bengtmartensson/Infrared4Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRc5Decoder.h
51 lines (41 loc) · 1.12 KB
/
Rc5Decoder.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
#ifndef RC5DECODER_H
#define RC5DECODER_H
#include "IrDecoder.h"
#include "IrReader.h"
class Rc5Decoder : public IrDecoder {
public:
static const char *format;
Rc5Decoder(const IrReader& irReader);
virtual ~Rc5Decoder() {}
int getF() const {
return F;
}
int getD() const {
return D;
}
int getT() const {
return T;
}
static boolean tryDecode(const IrReader& irReader, Stream& string);
const char *getDecode() const;
private:
char decode[13];
const static microseconds_t timebase = 889U;
const static microseconds_t timebaseLower = 800U;
const static microseconds_t timebaseUpper = 1000U;
static boolean getDuration(microseconds_t duration, unsigned int time) {
return duration <= time * timebaseUpper
&& duration >= time * timebaseLower;
}
int F;
int D;
int T;
enum Length {
invalid = 0,
half = 1,
full = 2
};
static Length decodeDuration(microseconds_t t);
static unsigned int decodeFlashGap(microseconds_t flash, microseconds_t gap);
};
#endif /* RC5DECODER_H */