5 Length len = (t < timebaseLower) ? invalid
6 : (t <= timebaseUpper) ? half
7 : (t >= 2*timebaseLower && t <= 2*timebaseUpper) ? full
13 bool result = getDuration(flash, 1);
17 return getDuration(gap, 3) ? 1
18 : getDuration(gap, 1) ? 0
28 unsigned int index = 0U;
29 unsigned int sum = 0U;
33 while (doublet < 25) {
34 Length length = decodeDuration(irCapturer.
getDuration(index++));
35 if (length == invalid)
37 doublet += (int) length;
39 sum = (sum << 1U) + (index & 1U);
47 F = (sum & 0x3FU) | ((~sum & 0x1000U) >> 6U);
48 D = (sum & 0x7C0U) >> 6U;
49 T = (sum & 0x0800U) >> 11U;
52 sprintf(decode, format, D, F, T);
uint16_t microseconds_t
Type for durations in micro seconds.
void setValid(bool valid_)
static bool isEnding(microseconds_t duration)
Tests if the argument is large enough to be considered an ending of a decodable signal.
bool printDecode(Stream &stream) const
If valid, prints the decode to the stream.
Abstract base class for all IR readers, capturing or receiving.
virtual size_t getDataLength() const =0
Returns the number of collected durations.
virtual microseconds_t getDuration(unsigned int index) const =0
Returns the index-th duration, if possible.
A decoder class for RC5 signals.
static bool tryDecode(const IrReader &irReader, Stream &stream)
Convenience function; constructs an Rc5Decoder and calls its printDecode.
Rc5Decoder(const IrReader &irReader)
Constructs a Rc5Decoder from an IrReader, containing data.
const char * getDecode() const
Returns a textual description the decode for human consumption.