Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
IrReceiver Class Reference

Abstract base class for demodulating IR receivers. More...

#include <IrReceiver.h>

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

Public Types

enum  irdata_t { IR_MARK , IR_SPACE }
 Enum for the duration types. More...
 

Public Member Functions

 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...
 

Static Public Attributes

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
 

Additional Inherited Members

- 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

Abstract base class for demodulating IR receivers.

Definition at line 12 of file IrReceiver.h.

Member Enumeration Documentation

◆ irdata_t

Enum for the duration types.

Enumerator
IR_MARK 

on-period, also called flash

IR_SPACE 

off-period, also called gap

Definition at line 52 of file IrReceiver.h.

Constructor & Destructor Documentation

◆ IrReceiver()

IrReceiver::IrReceiver ( size_t  bufSize,
pin_t  pin,
bool  pullup = false,
microseconds_t  markExcess = defaultMarkExcess 
)

Constructor.

Parameters
bufSize
pinGPIO pin to be used. Will be setup by the constructor.
pullupEnable hardware pullup within the processor.
markExcess

Definition at line 3 of file IrReceiver.cpp.

◆ ~IrReceiver()

virtual IrReceiver::~IrReceiver ( )
inlinevirtual

Definition at line 36 of file IrReceiver.h.

Member Function Documentation

◆ getFrequency()

virtual frequency_t IrReceiver::getFrequency ( ) const
inlinevirtual

Returns frequency of received signal.

This is a dumb default implementation, to be overridden when meaningful.

Returns
frequency

Implements IrReader.

Definition at line 39 of file IrReceiver.h.

◆ getPin()

pin_t IrReceiver::getPin ( ) const
inline

Definition at line 45 of file IrReceiver.h.

◆ receive()

void IrReceiver::receive ( )
virtual

Convenience function: enable, wait until data is collected or timeout has occured, disable.

Implements IrReader.

Definition at line 9 of file IrReceiver.cpp.

Member Data Documentation

◆ defaultMarkExcess

constexpr microseconds_t IrReceiver::defaultMarkExcess = 50U
staticconstexpr

Definition at line 20 of file IrReceiver.h.

◆ defaultPin

constexpr pin_t IrReceiver::defaultPin = 5
staticconstexpr

Definition at line 19 of file IrReceiver.h.

◆ invertingSensor

constexpr bool IrReceiver::invertingSensor = true
staticconstexpr

Are we using inverting sensor, like most TSOPs?

Definition at line 23 of file IrReceiver.h.


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