IrReceiverSampler::IrReceiverSampler(size_t captureLength,
        pin_t pin_,
        boolean pullup,
        microseconds_t markExcess,
        milliseconds_t beginningTimeout,
        milliseconds_t endingTimeout) : IrReceiver(captureLength, pin_, pullup, markExcess) {
    setBeginningTimeout(beginningTimeout);
    setEndingTimeout(endingTimeout);
    durationData = new microseconds_t[bufferSize];
    dataLength = 0;
    timer = 0;
    receiverState = STATE_IDLE;
}
IrWidget::IrWidget(size_t captureLength,
        boolean pullup,
        int16_t markExcess,
        milliseconds_t beginningTimeout,
        milliseconds_t endingTimeout) : IrReader(captureLength) {
    setup(pullup);
    captureData = new microseconds_t[bufferSize];
    setMarkExcess(markExcess);
    setBeginningTimeout(beginningTimeout);
    //endingTimeout = _BV(RANGE_EXTENSION_BITS) - 1;
    setEndingTimeout(endingTimeout);

    // Test that allocated memory is indeed usable. Otherwise crash will occur.
    for (unsigned int i = 0; i < bufferSize; i++)
        captureData[i] = 0;
}