Go to the documentation of this file.
26 #ifdef HAS_AVR_INTERRUPT_H
27 #include <avr/interrupt.h>
43 int MATCH(
int measured,
int desired) {
64 DBG_PRINT(F(
"Testing mark (actual vs desired): "));
76 int compensated_ticks = measured_ticks -
MARK_EXCESS;
77 bool passed = ((compensated_ticks >=
TICKS_LOW(desired_us)) && (compensated_ticks <=
TICKS_HIGH(desired_us)));
90 DBG_PRINT(F(
"Testing space (actual vs desired): "));
102 int compensated_ticks = measured_ticks +
MARK_EXCESS;
103 bool passed = ((compensated_ticks >=
TICKS_LOW(desired_us)) && (compensated_ticks <=
TICKS_HIGH(desired_us)));
139 if (irdata ==
MARK) {
154 if (irdata ==
SPACE) {
162 if (irdata ==
MARK) {
177 if (irdata ==
MARK) {
191 if (irdata ==
MARK) {
uint8_t overflow
Raw buffer overflow occurred.
unsigned int timer
State timer, counts 50uS ticks.
#define BLINKLED_OFF()
Board dependent macro to turn BLINKLED off.
#define BLINKLED_ON()
Board dependent macro to turn BLINKLED on.
#define MARK_EXCESS
When received, marks tend to be too long and spaces tend to be too short.
#define DBG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
uint8_t recvpin
Pin connected to IR data from detector.
#define DBG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
int MATCH_SPACE(int measured_ticks, int desired_us)
int MATCH(int measured, int desired)
uint8_t rcvstate
State Machine state.
volatile irparams_t irparams
Allow all parts of the code access to the ISR data NB.
#define IR_REC_STATE_STOP
#define IR_REC_STATE_MARK
#define GAP_TICKS
Minimum gap between IR transmissions, in USECPERTICK.
#define IR_REC_STATE_OVERFLOW
Public API to the library.
#define SPACE
Sensor output for a space ("gap")
int MATCH_MARK(int measured_ticks, int desired_us)
unsigned int rawbuf[RAW_BUFFER_LENGTH]
raw data
#define RAW_BUFFER_LENGTH
Maximum length of raw duration buffer. Must be odd.
uint8_t blinkflag
true -> enable blinking of pin on IR processing
#define IR_REC_STATE_SPACE
#define MARK
Sensor output for a mark ("flash")
unsigned int rawlen
counter of entries in rawbuf
#define IR_REC_STATE_IDLE