Infrared4Arduino
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
IrWidget Class Referenceabstract

Base class for classes based upon ICP pins capture. More...

#include <IrWidget.h>

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

Public Member Functions

virtual void capture ()=0
 
void receive ()
 For compatibility with the receiver classes, receive is a synonym for capture. More...
 
size_t getDataLength () const
 Returns the number of collected durations. More...
 
bool isReady () const
 Returns true if there is collected data. More...
 
void reset ()
 
microseconds_t getDuration (unsigned int i) const
 Returns the index-th duration, if possible. More...
 
void setEndingTimeout (milliseconds_t timeout)
 Sets the ending timeout. More...
 
milliseconds_t getEndingTimeout () const
 
frequency_t getFrequency () const
 Returns frequency of received signal. More...
 
void dump (Stream &stream) const
 Prints a textual representation of the received data to the Stream supplied. More...
 
- Public Member Functions inherited from IrReader
virtual void enable ()
 Start reception of IR data. More...
 
virtual void disable ()
 Stop reception of IR data. More...
 
IrSequencetoIrSequence () const
 Generates an IrSequence from the IrReader. More...
 
virtual bool isEmpty () 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 const int16_t defaultMarkExcess = 0
 
static const bool invertingSensor = true
 Set true means if sensor signal is inverted (low = signal on) (false has not been tested, and is not supported). More...
 
- Static Public Attributes inherited from IrReader
static const milliseconds_t defaultBeginningTimeout = 2000U
 
static const milliseconds_t defaultEndingTimeout = 30U
 
static const size_t defaultCaptureLength = 100U
 

Protected Types

typedef uint8_t ovlBitsDataType
 

Protected Member Functions

 IrWidget (size_t captureLength=defaultCaptureLength, bool pullup=false, int16_t markExcess=defaultMarkExcess, milliseconds_t beginningTimeout=defaultBeginningTimeout, milliseconds_t endingTimeout=defaultEndingTimeout)
 
virtual ~IrWidget ()
 
void debugPinToggle (void)
 
void debugPinClear (void)
 
virtual uint32_t unpackTimeVal (uint32_t val) const =0
 
- 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

static uint32_t timerValueToNanoSeconds (uint32_t x)
 
- Static Protected Member Functions inherited from IrReader
static unsigned int forceEven (unsigned int x)
 

Protected Attributes

frequency_t frequency
 
ovlBitsDataType endingTimeout
 
uint16_t * captureData
 
uint16_t captureCount
 
- 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...
 

Static Protected Attributes

static const uint8_t RANGE_EXTENSION_BITS = 4
 
static const uint8_t sampleSize = 2
 

Detailed Description

Base class for classes based upon ICP pins capture.

See this article (in German).

Definition at line 45 of file IrWidget.h.

Member Typedef Documentation

◆ ovlBitsDataType

typedef uint8_t IrWidget::ovlBitsDataType
protected

Definition at line 128 of file IrWidget.h.

Constructor & Destructor Documentation

◆ IrWidget()

IrWidget::IrWidget ( size_t  captureLength = defaultCaptureLength,
bool  pullup = false,
int16_t  markExcess = defaultMarkExcess,
milliseconds_t  beginningTimeout = defaultBeginningTimeout,
milliseconds_t  endingTimeout = defaultEndingTimeout 
)
protected

Definition at line 34 of file IrWidget.cpp.

◆ ~IrWidget()

IrWidget::~IrWidget ( )
protectedvirtual

Definition at line 51 of file IrWidget.cpp.

Member Function Documentation

◆ capture()

virtual void IrWidget::capture ( )
pure virtual

Implemented in IrWidgetAggregating.

◆ debugPinClear()

void IrWidget::debugPinClear ( void  )
inlineprotected

Definition at line 194 of file IrWidget.h.

◆ debugPinToggle()

void IrWidget::debugPinToggle ( void  )
inlineprotected

Definition at line 188 of file IrWidget.h.

◆ dump()

void IrWidget::dump ( Stream &  stream) const
virtual

Prints a textual representation of the received data to the Stream supplied.

Parameters
streamStream to which to print

Reimplemented from IrReader.

Definition at line 64 of file IrWidget.cpp.

◆ getDataLength()

size_t IrWidget::getDataLength ( ) const
inlinevirtual

Returns the number of collected durations.

Returns
number durations

Implements IrReader.

Definition at line 75 of file IrWidget.h.

◆ getDuration()

microseconds_t IrWidget::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 87 of file IrWidget.h.

◆ getEndingTimeout()

milliseconds_t IrWidget::getEndingTimeout ( ) const
virtual

Reimplemented from IrReader.

Definition at line 59 of file IrWidget.cpp.

◆ getFrequency()

frequency_t IrWidget::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 102 of file IrWidget.h.

◆ isReady()

bool IrWidget::isReady ( ) const
inlinevirtual

Returns true if there is collected data.

Returns
status

Implements IrReader.

Definition at line 79 of file IrWidget.h.

◆ receive()

void IrWidget::receive ( )
inlinevirtual

For compatibility with the receiver classes, receive is a synonym for capture.

Implements IrReader.

Definition at line 71 of file IrWidget.h.

◆ reset()

void IrWidget::reset ( )
inlinevirtual

Reimplemented from IrReader.

Definition at line 83 of file IrWidget.h.

◆ setEndingTimeout()

void IrWidget::setEndingTimeout ( milliseconds_t  timeout)
virtual

Sets the ending timeout.

In this implementation, this is effectively rounded to the nearest multiple of 32 milliseconds.

Parameters
timeouttimeout in milliseconds.

Reimplemented from IrReader.

Definition at line 55 of file IrWidget.cpp.

◆ timerValueToNanoSeconds()

static uint32_t IrWidget::timerValueToNanoSeconds ( uint32_t  x)
inlinestaticprotected

Definition at line 207 of file IrWidget.h.

◆ unpackTimeVal()

virtual uint32_t IrWidget::unpackTimeVal ( uint32_t  val) const
protectedpure virtual

Member Data Documentation

◆ captureCount

uint16_t IrWidget::captureCount
protected

Definition at line 200 of file IrWidget.h.

◆ captureData

uint16_t* IrWidget::captureData
protected

Definition at line 199 of file IrWidget.h.

◆ defaultMarkExcess

const int16_t IrWidget::defaultMarkExcess = 0
static

Definition at line 47 of file IrWidget.h.

◆ endingTimeout

ovlBitsDataType IrWidget::endingTimeout
protected

Definition at line 133 of file IrWidget.h.

◆ frequency

frequency_t IrWidget::frequency
protected

Definition at line 50 of file IrWidget.h.

◆ invertingSensor

const bool IrWidget::invertingSensor = true
static

Set true means if sensor signal is inverted (low = signal on) (false has not been tested, and is not supported).

Definition at line 64 of file IrWidget.h.

◆ RANGE_EXTENSION_BITS

const uint8_t IrWidget::RANGE_EXTENSION_BITS = 4
staticprotected

Definition at line 131 of file IrWidget.h.

◆ sampleSize

const uint8_t IrWidget::sampleSize = 2
staticprotected

Definition at line 201 of file IrWidget.h.


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