16IrReceiverSampler::IrReceiverSampler(
size_t captureLength,
22 setBeginningTimeout(beginningTimeout);
23 setEndingTimeout(endingTimeout);
27 receiverState = STATE_IDLE;
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.
static constexpr pin_t invalidPin
Symbolic name for an invalid pin number.
virtual void enableSampler(pin_t pin __attribute__((unused)))
Start the periodic ISR sampler routine.
virtual void disableSampler()
Turn off sampler routine.
static void debugPinHigh()
static Board * getInstance()
static void debugPinLow()
static const unsigned long microsPerTick
virtual void timerReset()
TODO.
int16_t markExcess
Microseconds subtracted from pulses and added to gaps.
milliseconds_t beginningTimeout
milliseconds_t endingTimeout
unsigned int getBufferSize() const
This receiving class samples the input pin every 50 microseconds using a timer interrupt.
void enable()
Start reception of IR data.
milliseconds_t getBeginningTimeout() const
@ STATE_IDLE
Between signals; waiting for first mark.
@ STATE_STOP
Complete signal has been read.
@ STATE_MARK
Last read a mark.
@ STATE_SPACE
Last read a space.
uint32_t beginningTimeoutInTicks
milliseconds_t getEndingTimeout() const
volatile microseconds_t * durationData
Data buffer.
static IrReceiverSampler * newIrReceiverSampler(size_t captureLength=defaultCaptureLength, pin_t pin=defaultPin, bool pullup=false, microseconds_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
This factory method replaces public constructors.
virtual ~IrReceiverSampler()
volatile ReceiverState_t receiverState
State of the state machine.
static IrReceiverSampler * getInstance()
Returns a pointer to the instance, or nullptr.
void setBeginningTimeout(milliseconds_t timeOut)
volatile size_t dataLength
Number of entries in durationData.
volatile uint32_t timer
state timer, counts 50uS ticks.
static void deleteInstance()
Deletes the instance, thereby freeing up the resources it occupied, and allowing for another instance...
void disable()
Stop reception of IR data.
uint32_t endingTimeoutInTicks
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