Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
IrReceiver.cpp
Go to the documentation of this file.
1#include "IrReceiver.h"
2
3IrReceiver::IrReceiver(size_t bufSize, pin_t pin_, bool pullup, microseconds_t me) : IrReader(bufSize) {
4 pin = pin_;
5 markExcess = me;
6 Board::getInstance()->setPinMode(pin, pullup ? INPUT_PULLUP : INPUT);
7}
8
10 enable();
11 while (!isReady())
12 ;
13 disable();
14}
uint16_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:15
uint8_t pin_t
Type for GPIO pin, compatible with Arduino libs.
Definition: InfraredTypes.h:41
static Board * getInstance()
Definition: Board.h:53
void setPinMode(pin_t pin, PinMode mode)
Definition: Board.h:48
Abstract base class for all IR readers, capturing or receiving.
Definition: IrReader.h:30
virtual void disable()
Stop reception of IR data.
Definition: IrReader.h:94
virtual bool isReady() const =0
Returns true if there is collected data.
int16_t markExcess
Microseconds subtracted from pulses and added to gaps.
Definition: IrReader.h:44
virtual void enable()
Start reception of IR data.
Definition: IrReader.h:88
virtual void receive()
Convenience function: enable, wait until data is collected or timeout has occured,...
Definition: IrReceiver.cpp:9
IrReceiver(size_t bufSize, pin_t pin, bool pullup=false, microseconds_t markExcess=defaultMarkExcess)
Constructor.
Definition: IrReceiver.cpp:3