11 boolean result = getDuration(flash, 1);
15 return getDuration(gap, 3) ? 1
16 : getDuration(gap, 1) ? 0
25 int Nec1Decoder::decodeParameter(
const IrReader& irReader,
unsigned int index) {
27 for (
int i = 7; i >= 0; i--) {
31 sum = (sum << 1) + result;
37 unsigned int index = 0;
40 success = getDuration(irReader.
getDuration(index++), 16U);
43 success = getDuration(irReader.
getDuration(index++), 4U);
46 success = getDuration(irReader.
getDuration(index++), 1U);
57 success = getDuration(irReader.
getDuration(index++), 16U);
60 success = getDuration(irReader.
getDuration(index++), 8U);
63 D = decodeParameter(irReader, index);
67 S = decodeParameter(irReader, index);
71 F = decodeParameter(irReader, index);
75 int invF = decodeParameter(irReader, index);
78 if ((F ^ invF) != 0xFF)
82 success = getDuration(irReader.
getDuration(index++), 1U);
92 strcpy(decode,
"NEC1");
94 sprintf(junk,
" %d", D);
97 sprintf(junk,
" %d", S);
100 sprintf(junk,
" %d", F);
101 strcat(decode, junk);
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 nec1DittoLiteral[]
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_)
Abstract base class for all decoder classes.
A decoder class for NEC1 signals.
static boolean tryDecode(const IrReader &irReader, Stream &stream)
Convenience function; constructs an Nec1Decoder and calls its printDecode.