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