Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IrReceiverPoll Class Reference

An implementation of IrReceiver using polling of the input pin. More...

#include <IrReceiverPoll.h>

Inheritance diagram for IrReceiverPoll:
Inheritance graph
[legend]
Collaboration diagram for IrReceiverPoll:
Collaboration graph
[legend]

Public Member Functions

 IrReceiverPoll (size_t captureLength=defaultCaptureLength, pin_t pin=defaultPin, bool pullup=false, microseconds_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
 
 ~IrReceiverPoll ()
 
bool isReady () const
 Returns true if there is collected data. More...
 
void reset ()
 
size_t getDataLength () const
 Returns the number of collected durations. More...
 
microseconds_t getDuration (unsigned int i) const
 Returns the index-th duration, if possible. More...
 
void setEndingTimeout (milliseconds_t timeOut)
 
milliseconds_t getEndingTimeout () const
 
milliseconds_t getBeginningTimeout () const
 
void setBeginningTimeout (milliseconds_t timeOut)
 
void enable ()
 In this class, enable does the actual collection of the data. More...
 
void disable ()
 Stop reception of IR data. More...
 
- Public Member Functions inherited from IrReceiver
 IrReceiver (size_t bufSize, pin_t pin, bool pullup=false, microseconds_t markExcess=defaultMarkExcess)
 Constructor. More...
 
virtual ~IrReceiver ()
 
virtual frequency_t getFrequency () const
 Returns frequency of received signal. More...
 
virtual void receive ()
 Convenience function: enable, wait until data is collected or timeout has occured, disable. More...
 
pin_t getPin () const
 
- Public Member Functions inherited from IrReader
virtual void reset ()
 
virtual frequency_t getFrequency () const =0
 Returns frequency of received signal. More...
 
virtual void enable ()
 Start reception of IR data. More...
 
virtual void disable ()
 Stop reception of IR data. More...
 
virtual void receive ()=0
 Convenience function: enable, wait until data is collected or timeout has occured, disable. More...
 
virtual bool isReady () const =0
 Returns true if there is collected data. More...
 
 operator bool () const
 Same as isReady() More...
 
virtual size_t getDataLength () const =0
 Returns the number of collected durations. More...
 
virtual microseconds_t getDuration (unsigned int index) const =0
 Returns the index-th duration, if possible. More...
 
virtual void dump (Stream &stream) const
 Prints a textual representation of the received data to the Stream supplied. More...
 
IrSequencetoIrSequence () const
 Generates an IrSequence from the IrReader. More...
 
virtual bool isEmpty () const
 
virtual void setEndingTimeout (milliseconds_t timeOut)
 
virtual milliseconds_t getEndingTimeout () const
 
virtual void setBeginningTimeout (milliseconds_t timeOut)
 
virtual milliseconds_t getBeginningTimeout () const
 
unsigned int getBufferSize () const
 
void setMarkExcess (int16_t markExcess_)
 Sets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations. More...
 
int16_t getMarkExcess () const
 Gets the markExcess, a number (possibly negative) to be subtracted from the on-durations and added to the off.durations. More...
 

Additional Inherited Members

- Public Types inherited from IrReceiver
enum  irdata_t { IR_MARK , IR_SPACE }
 Enum for the duration types. More...
 
- Static Public Attributes inherited from IrReceiver
static constexpr pin_t defaultPin = 5
 
static constexpr microseconds_t defaultMarkExcess = 50U
 
static constexpr bool invertingSensor = true
 Are we using inverting sensor, like most TSOPs? More...
 
- Static Public Attributes inherited from IrReader
static constexpr milliseconds_t defaultBeginningTimeout = 2000U
 
static constexpr milliseconds_t defaultEndingTimeout = 30U
 
static constexpr size_t defaultCaptureLength = 100U
 
- Protected Member Functions inherited from IrReader
 IrReader (size_t bufSize_)
 Constructs an IrReader with buffersize bufSize_, possibly increased to be even. More...
 
 IrReader ()
 
virtual ~IrReader ()
 
- Static Protected Member Functions inherited from IrReader
static unsigned int forceEven (unsigned int x)
 
- Protected Attributes inherited from IrReader
milliseconds_t beginningTimeout
 
milliseconds_t endingTimeout
 
size_t bufferSize
 
int16_t markExcess
 Microseconds subtracted from pulses and added to gaps. More...
 
bool timeouted
 True if last receive ended with a timeout. More...
 

Detailed Description

An implementation of IrReceiver using polling of the input pin.

It uses no timer or other hardware resources, and should thus run on all platforms.

Definition at line 11 of file IrReceiverPoll.h.

Constructor & Destructor Documentation

◆ IrReceiverPoll()

IrReceiverPoll::IrReceiverPoll ( size_t  captureLength = defaultCaptureLength,
pin_t  pin = defaultPin,
bool  pullup = false,
microseconds_t  markExcess = defaultMarkExcess,
milliseconds_t  beginningTimeout = defaultBeginningTimeout,
milliseconds_t  endingTimeout = defaultEndingTimeout 
)

Definition at line 4 of file IrReceiverPoll.cpp.

◆ ~IrReceiverPoll()

IrReceiverPoll::~IrReceiverPoll ( )

Definition at line 16 of file IrReceiverPoll.cpp.

Member Function Documentation

◆ disable()

void IrReceiverPoll::disable ( )
inlinevirtual

Stop reception of IR data.

Reimplemented from IrReader.

Definition at line 66 of file IrReceiverPoll.h.

◆ enable()

void IrReceiverPoll::enable ( )
virtual

In this class, enable does the actual collection of the data.

It returns when either the signal is captured, or (beginning) timeout occurs.

Reimplemented from IrReader.

Definition at line 26 of file IrReceiverPoll.cpp.

◆ getBeginningTimeout()

milliseconds_t IrReceiverPoll::getBeginningTimeout ( ) const
inlinevirtual

Reimplemented from IrReader.

Definition at line 51 of file IrReceiverPoll.h.

◆ getDataLength()

size_t IrReceiverPoll::getDataLength ( ) const
inlinevirtual

Returns the number of collected durations.

Returns
number durations

Implements IrReader.

Definition at line 35 of file IrReceiverPoll.h.

◆ getDuration()

microseconds_t IrReceiverPoll::getDuration ( unsigned int  index) const
inlinevirtual

Returns the index-th duration, if possible.

Parameters
indexindex of duration
Returns
requested duration

Implements IrReader.

Definition at line 39 of file IrReceiverPoll.h.

◆ getEndingTimeout()

milliseconds_t IrReceiverPoll::getEndingTimeout ( ) const
inlinevirtual

Reimplemented from IrReader.

Definition at line 47 of file IrReceiverPoll.h.

◆ isReady()

bool IrReceiverPoll::isReady ( ) const
inlinevirtual

Returns true if there is collected data.

Returns
status

Implements IrReader.

Definition at line 29 of file IrReceiverPoll.h.

◆ reset()

void IrReceiverPoll::reset ( )
virtual

Reimplemented from IrReader.

Definition at line 21 of file IrReceiverPoll.cpp.

◆ setBeginningTimeout()

void IrReceiverPoll::setBeginningTimeout ( milliseconds_t  timeOut)
inlinevirtual

Reimplemented from IrReader.

Definition at line 55 of file IrReceiverPoll.h.

◆ setEndingTimeout()

void IrReceiverPoll::setEndingTimeout ( milliseconds_t  timeOut)
inlinevirtual

Reimplemented from IrReader.

Definition at line 43 of file IrReceiverPoll.h.


The documentation for this class was generated from the following files: