IRremote
IRremoteInt.h File Reference

Contains all declarations required for the interface to IRremote. Could not be named IRremote.h, since this has another semantic (it must include all *.hpp files) for old example code found in the wild. More...

#include <Arduino.h>
#include "IRProtocol.h"
Include dependency graph for IRremoteInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  irparams_struct
 This struct contains the data and control used for receiver static functions and the ISR (interrupt service routine) Only StateForISR needs to be volatile. More...
 
struct  IRData
 Data structure for the user application, available as decodedIRData. More...
 
struct  decode_results
 Results returned from old decoders !!!deprecated!!! More...
 
class  IRrecv
 Main class for receiving IR signals. More...
 
class  IRsend
 Main class for sending IR signals. More...
 

Macros

#define MARK   1
 
#define SPACE   0
 
#define DISABLE_LED_FEEDBACK   false
 For better readability of code. More...
 
#define ENABLE_LED_FEEDBACK   true
 
#define USE_DEFAULT_FEEDBACK_LED_PIN   0
 
#define IR_REC_STATE_IDLE   0
 
#define IR_REC_STATE_MARK   1
 
#define IR_REC_STATE_SPACE   2
 
#define IR_REC_STATE_STOP   3
 
#define IR_DEBUG_PRINT(...)   void()
 If DEBUG, print the arguments, otherwise do nothing. More...
 
#define IR_DEBUG_PRINTLN(...)   void()
 If DEBUG, print the arguments as a line, otherwise do nothing. More...
 
#define IR_TRACE_PRINT(...)   void()
 
#define IR_TRACE_PRINTLN(...)   void()
 
#define IRDATA_FLAGS_EMPTY   0x00
 
#define IRDATA_FLAGS_IS_REPEAT   0x01
 
#define IRDATA_FLAGS_IS_AUTO_REPEAT   0x02
 
#define IRDATA_FLAGS_PARITY_FAILED   0x04
 the current (autorepeat) frame violated parity check More...
 
#define IRDATA_FLAGS_TOGGLE_BIT   0x08
 is set if RC5 or RC6 toggle bit is set More...
 
#define IRDATA_FLAGS_IS_SPECIAL_REPEAT   0x08
 is set if we received a NEC special receive (full frame instead of repeat frame) More...
 
#define IRDATA_FLAGS_EXTRA_INFO   0x10
 there is extra info not contained in address and data (e.g. Kaseikyo unknown vendor ID) More...
 
#define IRDATA_FLAGS_WAS_OVERFLOW   0x40
 irparams.rawlen is 0 in this case to avoid endless OverflowFlag More...
 
#define IRDATA_FLAGS_IS_LSB_FIRST   0x00
 
#define IRDATA_FLAGS_IS_MSB_FIRST   0x80
 Just for info. Value is mainly determined by the protocol. More...
 
#define IRDATA_TOGGLE_BIT_MASK   0x08
 is set if RC5 or RC6 toggle bit is set More...
 
#define RAW_DATA_ARRAY_SIZE   ((((RAW_BUFFER_LENGTH - 2) - 1) / 64) + 1)
 
#define DO_NOT_ENABLE_LED_FEEDBACK   0x00
 
#define LED_FEEDBACK_DISABLED_COMPLETELY   0x00
 
#define LED_FEEDBACK_ENABLED_FOR_RECEIVE   0x01
 
#define LED_FEEDBACK_ENABLED_FOR_SEND   0x02
 
#define TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING   25
 
#define LTOL   (100 - TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING)
 Lower tolerance for comparison of measured data. More...
 
#define UTOL   (100 + TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING)
 Upper tolerance for comparison of measured data. More...
 
#define TICKS_LOW(us)   ((unsigned int ) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))
 
#define TICKS_HIGH(us)   ((unsigned int ) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
 
#define NO_REPEATS   0
 Just for better readability of code. More...
 
#define SEND_STOP_BIT   true
 
#define SEND_REPEAT_COMMAND   true
 used for e.g. NEC, where a repeat is different from just repeating the data. More...
 

Functions

bool matchTicks (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
 Match function without compensating for marks exceeded or spaces shortened by demodulator hardware Currently not used. More...
 
bool matchMark (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
 Compensate for marks exceeded by demodulator hardware. More...
 
bool matchSpace (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
 Compensate for spaces shortened by demodulator hardware. More...
 
bool MATCH (unsigned int measured, unsigned int desired)
 
bool MATCH_MARK (unsigned int measured_ticks, unsigned int desired_us)
 
bool MATCH_SPACE (unsigned int measured_ticks, unsigned int desired_us)
 
int getMarkExcessMicros ()
 Getter function for MARK_EXCESS_MICROS. More...
 
void printIRResultShort (Print *aSerial, IRData *aIRDataPtr, bool aPrintGap)
 Internal function to print decoded result and flags in one line. More...
 
void printIRSendUsage (Print *aSerial, IRData *aIRDataPtr)
 
const __FlashStringHelper * getProtocolString ()
 
void printActiveIRProtocols (Print *aSerial)
 
void setFeedbackLED (bool aSwitchLedOn)
 Flash LED while receiving or sending IR data. More...
 
void setLEDFeedback (uint8_t aFeedbackLEDPin, uint8_t aEnableLEDFeedback)
 Enable blinking of feedback LED (LED_BUILTIN is taken as default) on IR sending and receiving Cannot disable it here!!! Use disableLEDFeedbackForReceive() or disableLEDFeedbackForSend() More...
 
void setLEDFeedback (bool aEnableLEDFeedback)
 
void enableLEDFeedback ()
 
void disableLEDFeedback ()
 
void enableLEDFeedbackForSend ()
 
void disableLEDFeedbackForSend ()
 
void setBlinkPin (uint8_t aFeedbackLEDPin) __attribute__((deprecated("Please use setLEDFeedback().")))
 Old deprecated function name for setLEDFeedback() More...
 

Variables

uint_fast8_t sBiphaseDecodeRawbuffOffset
 
constexpr auto enableLEDFeedbackForReceive = enableLEDFeedback
 
constexpr auto disableLEDFeedbackForReceive = disableLEDFeedback
 
IRrecv IrReceiver
 The receiver instance. More...
 
IRsend IrSender
 

Detailed Description

Contains all declarations required for the interface to IRremote. Could not be named IRremote.h, since this has another semantic (it must include all *.hpp files) for old example code found in the wild.

This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.

MIT License

Copyright (c) 2015-2022 Ken Shirriff http://www.righto.com, Rafi Khan, Armin Joachimsmeyer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file IRremoteInt.h.

Macro Definition Documentation

◆ DISABLE_LED_FEEDBACK

#define DISABLE_LED_FEEDBACK   false

For better readability of code.

Definition at line 63 of file IRremoteInt.h.

◆ DO_NOT_ENABLE_LED_FEEDBACK

#define DO_NOT_ENABLE_LED_FEEDBACK   0x00

Definition at line 347 of file IRremoteInt.h.

◆ ENABLE_LED_FEEDBACK

#define ENABLE_LED_FEEDBACK   true

Definition at line 64 of file IRremoteInt.h.

◆ IR_DEBUG_PRINT

#define IR_DEBUG_PRINT (   ...)    void()

If DEBUG, print the arguments, otherwise do nothing.

Definition at line 111 of file IRremoteInt.h.

◆ IR_DEBUG_PRINTLN

#define IR_DEBUG_PRINTLN (   ...)    void()

If DEBUG, print the arguments as a line, otherwise do nothing.

Definition at line 115 of file IRremoteInt.h.

◆ IR_REC_STATE_IDLE

#define IR_REC_STATE_IDLE   0

Definition at line 73 of file IRremoteInt.h.

◆ IR_REC_STATE_MARK

#define IR_REC_STATE_MARK   1

Definition at line 74 of file IRremoteInt.h.

◆ IR_REC_STATE_SPACE

#define IR_REC_STATE_SPACE   2

Definition at line 75 of file IRremoteInt.h.

◆ IR_REC_STATE_STOP

#define IR_REC_STATE_STOP   3

Definition at line 76 of file IRremoteInt.h.

◆ IR_TRACE_PRINT

#define IR_TRACE_PRINT (   ...)    void()

Definition at line 122 of file IRremoteInt.h.

◆ IR_TRACE_PRINTLN

#define IR_TRACE_PRINTLN (   ...)    void()

Definition at line 123 of file IRremoteInt.h.

◆ IRDATA_FLAGS_EMPTY

#define IRDATA_FLAGS_EMPTY   0x00

Definition at line 132 of file IRremoteInt.h.

◆ IRDATA_FLAGS_EXTRA_INFO

#define IRDATA_FLAGS_EXTRA_INFO   0x10

there is extra info not contained in address and data (e.g. Kaseikyo unknown vendor ID)

Definition at line 138 of file IRremoteInt.h.

◆ IRDATA_FLAGS_IS_AUTO_REPEAT

#define IRDATA_FLAGS_IS_AUTO_REPEAT   0x02

Definition at line 134 of file IRremoteInt.h.

◆ IRDATA_FLAGS_IS_LSB_FIRST

#define IRDATA_FLAGS_IS_LSB_FIRST   0x00

Definition at line 140 of file IRremoteInt.h.

◆ IRDATA_FLAGS_IS_MSB_FIRST

#define IRDATA_FLAGS_IS_MSB_FIRST   0x80

Just for info. Value is mainly determined by the protocol.

Definition at line 141 of file IRremoteInt.h.

◆ IRDATA_FLAGS_IS_REPEAT

#define IRDATA_FLAGS_IS_REPEAT   0x01

Definition at line 133 of file IRremoteInt.h.

◆ IRDATA_FLAGS_IS_SPECIAL_REPEAT

#define IRDATA_FLAGS_IS_SPECIAL_REPEAT   0x08

is set if we received a NEC special receive (full frame instead of repeat frame)

Definition at line 137 of file IRremoteInt.h.

◆ IRDATA_FLAGS_PARITY_FAILED

#define IRDATA_FLAGS_PARITY_FAILED   0x04

the current (autorepeat) frame violated parity check

Definition at line 135 of file IRremoteInt.h.

◆ IRDATA_FLAGS_TOGGLE_BIT

#define IRDATA_FLAGS_TOGGLE_BIT   0x08

is set if RC5 or RC6 toggle bit is set

Definition at line 136 of file IRremoteInt.h.

◆ IRDATA_FLAGS_WAS_OVERFLOW

#define IRDATA_FLAGS_WAS_OVERFLOW   0x40

irparams.rawlen is 0 in this case to avoid endless OverflowFlag

Definition at line 139 of file IRremoteInt.h.

◆ IRDATA_TOGGLE_BIT_MASK

#define IRDATA_TOGGLE_BIT_MASK   0x08

is set if RC5 or RC6 toggle bit is set

Definition at line 144 of file IRremoteInt.h.

◆ LED_FEEDBACK_DISABLED_COMPLETELY

#define LED_FEEDBACK_DISABLED_COMPLETELY   0x00

Definition at line 348 of file IRremoteInt.h.

◆ LED_FEEDBACK_ENABLED_FOR_RECEIVE

#define LED_FEEDBACK_ENABLED_FOR_RECEIVE   0x01

Definition at line 349 of file IRremoteInt.h.

◆ LED_FEEDBACK_ENABLED_FOR_SEND

#define LED_FEEDBACK_ENABLED_FOR_SEND   0x02

Definition at line 350 of file IRremoteInt.h.

◆ LTOL

Lower tolerance for comparison of measured data.

Definition at line 374 of file IRremoteInt.h.

◆ MARK

#define MARK   1

Definition at line 39 of file IRremoteInt.h.

◆ NO_REPEATS

#define NO_REPEATS   0

Just for better readability of code.

Definition at line 401 of file IRremoteInt.h.

◆ RAW_DATA_ARRAY_SIZE

#define RAW_DATA_ARRAY_SIZE   ((((RAW_BUFFER_LENGTH - 2) - 1) / 64) + 1)

Definition at line 146 of file IRremoteInt.h.

◆ SEND_REPEAT_COMMAND

#define SEND_REPEAT_COMMAND   true

used for e.g. NEC, where a repeat is different from just repeating the data.

Definition at line 403 of file IRremoteInt.h.

◆ SEND_STOP_BIT

#define SEND_STOP_BIT   true

Definition at line 402 of file IRremoteInt.h.

◆ SPACE

#define SPACE   0

Definition at line 40 of file IRremoteInt.h.

◆ TICKS_HIGH

#define TICKS_HIGH (   us)    ((unsigned int ) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))

Definition at line 386 of file IRremoteInt.h.

◆ TICKS_LOW

#define TICKS_LOW (   us)    ((unsigned int ) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))

Definition at line 385 of file IRremoteInt.h.

◆ TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING

#define TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING   25

Definition at line 369 of file IRremoteInt.h.

◆ USE_DEFAULT_FEEDBACK_LED_PIN

#define USE_DEFAULT_FEEDBACK_LED_PIN   0

Definition at line 65 of file IRremoteInt.h.

◆ UTOL

Upper tolerance for comparison of measured data.

Definition at line 377 of file IRremoteInt.h.

Function Documentation

◆ getProtocolString()

const __FlashStringHelper* getProtocolString ( )

Variable Documentation

◆ disableLEDFeedbackForReceive

constexpr auto disableLEDFeedbackForReceive = disableLEDFeedback
constexpr

Definition at line 356 of file IRremoteInt.h.

◆ enableLEDFeedbackForReceive

constexpr auto enableLEDFeedbackForReceive = enableLEDFeedback
constexpr

Definition at line 354 of file IRremoteInt.h.