17 delete [] durationData;
35 return micros() - then;
38bool IrReceiverPoll::searchForStart() {
39 unsigned long start = micros();
42 if (
timeSince(start) > beginningTimeoutInMicros)
49void IrReceiverPoll::collectData() {
52 unsigned long lastTime = micros();
55 if (data != lastDataRead) {
56 unsigned long now = micros();
57 recordDuration(now - lastTime);
61 unsigned long now = micros();
62 if (now - lastTime > endingTimeoutInMicros) {
63 recordDuration(now - lastTime);
71void IrReceiverPoll::recordDuration(
unsigned long t) {
static constexpr microseconds_t MICROSECONDS_T_MAX
Largest microseconds_t number possible.
uint16_t microseconds_t
Type for durations in micro seconds.
uint16_t milliseconds_t
Type for durations in milli seconds.
uint8_t pin_t
Type for GPIO pin, compatible with Arduino libs.
unsigned long timeSince(unsigned long then)
milliseconds_t beginningTimeout
milliseconds_t endingTimeout
bool timeouted
True if last receive ended with a timeout.
void setBeginningTimeout(milliseconds_t timeOut)
IrReceiverPoll(size_t captureLength=defaultCaptureLength, pin_t pin=defaultPin, bool pullup=false, microseconds_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
void enable()
In this class, enable does the actual collection of the data.
void setEndingTimeout(milliseconds_t timeOut)
Abstract base class for demodulating IR receivers.
irdata_t
Enum for the duration types.
@ IR_SPACE
off-period, also called gap
@ IR_MARK
on-period, also called flash