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 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 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
 
class  IRsend
 Main class for sending IR signals. More...
 

Macros

#define SPACE   0
 
#define MARK   1
 
#define NO_MARK_OR_SPACE   2
 
#define RAW_BUFFER_LENGTH   750
 The RAW_BUFFER_LENGTH determines the length of the byte buffer where the received IR timing data is stored before decoding. More...
 
#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 BITS_IN_DECODED_RAW_DATA_TYPE   32
 
#define DECODED_RAW_DATA_ARRAY_SIZE   ((((RAW_BUFFER_LENGTH - 2) - 1) / (2 * BITS_IN_DECODED_RAW_DATA_TYPE)) + 1)
 
#define USE_DEFAULT_FEEDBACK_LED_PIN   0xFF
 Main class for receiving IR signals. More...
 
#define DISABLE_LED_FEEDBACK   false
 
#define ENABLE_LED_FEEDBACK   true
 
#define TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT   25
 
#define TICKS(us)   ((us)/MICROS_PER_TICK)
 
#define LTOL   (100 - TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT)
 Lower tolerance for comparison of measured data. More...
 
#define UTOL   (100 + TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT)
 Upper tolerance for comparison of measured data. More...
 
#define TICKS_LOW(us)   ((uint16_t ) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))
 
#define TICKS_HIGH(us)   ((uint16_t ) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
 
#define NO_REPEATS   0
 Just for better readability of code. More...
 
#define SEND_REPEAT_COMMAND   true
 used for e.g. NEC, where a repeat is different from just repeating the data. More...
 
#define OpenLASIR_GetMDeviceId(aCommand)   (aCommand & 0xFF)
 
#define OpenLASIR_GetMode(aCommand)   ((aCommand >> 8) & 0x1F)
 
#define OpenLASIR_GetData(aCommand)   (aCommand >> 13)
 

Typedefs

typedef unsigned int IRRawlenType
 
typedef uint8_t IRRawbufType
 
typedef uint32_t IRDecodedRawDataType
 

Functions

void printIRResultShort (Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap) __attribute__((deprecated("Remove last parameter
 
void printIRResultShort (Print *aSerial, IRData *aIRDataPtr) __attribute__((deprecated("Use member function or printIRDataShort() instead.")))
 
void printIRDataShort (Print *aSerial, IRData *aIRDataPtr)
 
bool matchTicks (uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
 Match function WITHOUT compensating for marks exceeded or spaces shortened by demodulator hardware Match is true, if signal value is bigger/equal 75% and less/equal 125% of aMatchValueMicros. More...
 
bool matchTicks (uint16_t aMeasuredTicks, uint16_t aMatchValueMicros, int16_t aCompensationMicrosForTicks)
 Match function WITH compensating for marks exceeded or spaces shortened by demodulator hardware. More...
 
bool matchMark (uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
 Compensate for marks exceeded by demodulator hardware. More...
 
bool matchSpace (uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
 Compensate for spaces shortened by demodulator hardware. More...
 
bool MATCH (uint16_t measured, uint16_t desired)
 
bool MATCH_MARK (uint16_t measured_ticks, uint16_t desired_us)
 
bool MATCH_SPACE (uint16_t measured_ticks, uint16_t desired_us)
 
int getMarkExcessMicros ()
 Getter function for MARK_EXCESS_MICROS. More...
 
void printActiveIRProtocols (Print *aSerial)
 
void setLEDFeedback (bool aEnableLEDFeedback)
 
void setLEDFeedbackPin (uint8_t aFeedbackLEDPin)
 
void setFeedbackLED (bool aSwitchLedOn)
 Flash LED while receiving or sending IR data. More...
 
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...
 
void IRReceiveTimerInterruptHandler ()
 
void sendNECSpecialRepeat ()
 Static function variant of IRsend::sendNECRepeat For use in ProtocolConstants. More...
 
void sendOpenLASIRSpecialRepeat ()
 Static function variant of IRsend::sendOpenLASIRRepeat For use in ProtocolConstants. More...
 
void sendLG2SpecialRepeat ()
 Static function for sending special repeat frame. More...
 
void sendSamsungLGSpecialRepeat ()
 Like above, but implemented as a static function Used for sending special repeat frame. More...
 

Variables

unsigned long sMicrosAtLastStopTimer
 
void it is not supported any more
 
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-2026 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

◆ BITS_IN_DECODED_RAW_DATA_TYPE

#define BITS_IN_DECODED_RAW_DATA_TYPE   32

Definition at line 153 of file IRremoteInt.h.

◆ DECODED_RAW_DATA_ARRAY_SIZE

#define DECODED_RAW_DATA_ARRAY_SIZE   ((((RAW_BUFFER_LENGTH - 2) - 1) / (2 * BITS_IN_DECODED_RAW_DATA_TYPE)) + 1)

Definition at line 158 of file IRremoteInt.h.

◆ DISABLE_LED_FEEDBACK

#define DISABLE_LED_FEEDBACK   false

Definition at line 445 of file IRremoteInt.h.

◆ ENABLE_LED_FEEDBACK

#define ENABLE_LED_FEEDBACK   true

Definition at line 446 of file IRremoteInt.h.

◆ IR_REC_STATE_IDLE

#define IR_REC_STATE_IDLE   0

Definition at line 117 of file IRremoteInt.h.

◆ IR_REC_STATE_MARK

#define IR_REC_STATE_MARK   1

Definition at line 118 of file IRremoteInt.h.

◆ IR_REC_STATE_SPACE

#define IR_REC_STATE_SPACE   2

Definition at line 119 of file IRremoteInt.h.

◆ IR_REC_STATE_STOP

#define IR_REC_STATE_STOP   3

Definition at line 120 of file IRremoteInt.h.

◆ LTOL

Lower tolerance for comparison of measured data.

Definition at line 476 of file IRremoteInt.h.

◆ MARK

#define MARK   1

Definition at line 40 of file IRremoteInt.h.

◆ NO_MARK_OR_SPACE

#define NO_MARK_OR_SPACE   2

Definition at line 41 of file IRremoteInt.h.

◆ NO_REPEATS

#define NO_REPEATS   0

Just for better readability of code.

Definition at line 501 of file IRremoteInt.h.

◆ OpenLASIR_GetData

#define OpenLASIR_GetData (   aCommand)    (aCommand >> 13)

Definition at line 645 of file IRremoteInt.h.

◆ OpenLASIR_GetMDeviceId

#define OpenLASIR_GetMDeviceId (   aCommand)    (aCommand & 0xFF)

Definition at line 643 of file IRremoteInt.h.

◆ OpenLASIR_GetMode

#define OpenLASIR_GetMode (   aCommand)    ((aCommand >> 8) & 0x1F)

Definition at line 644 of file IRremoteInt.h.

◆ RAW_BUFFER_LENGTH

#define RAW_BUFFER_LENGTH   750

The RAW_BUFFER_LENGTH determines the length of the byte buffer where the received IR timing data is stored before decoding.

100 is sufficient for standard protocols up to 48 bits, with 1 bit consisting of one mark and space plus 1 byte for initial gap, 2 bytes for header and 1 byte for stop bit. 48 bit protocols are PANASONIC, KASEIKYO, SAMSUNG48, RC6. 32 bit protocols like NEC, SAMSUNG, WHYNTER, SONY(20), LG(28) requires a buffer length of 68. 16 bit protocols like BOSEWAVE, DENON, FAST, JVC, LEGO_PF, RC5, SONY(12 or 15) requires a buffer length of 36. MAGIQUEST requires a buffer length of 112. Air conditioners often send a longer protocol data stream up to 750 bits.

Definition at line 79 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 502 of file IRremoteInt.h.

◆ SPACE

#define SPACE   0

Definition at line 39 of file IRremoteInt.h.

◆ TICKS

#define TICKS (   us)    ((us)/MICROS_PER_TICK)

Definition at line 469 of file IRremoteInt.h.

◆ TICKS_HIGH

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

Definition at line 481 of file IRremoteInt.h.

◆ TICKS_LOW

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

Definition at line 480 of file IRremoteInt.h.

◆ TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT

#define TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT   25

Definition at line 466 of file IRremoteInt.h.

◆ USE_DEFAULT_FEEDBACK_LED_PIN

#define USE_DEFAULT_FEEDBACK_LED_PIN   0xFF

Main class for receiving IR signals.

Definition at line 213 of file IRremoteInt.h.

◆ UTOL

Upper tolerance for comparison of measured data.

Definition at line 479 of file IRremoteInt.h.

Typedef Documentation

◆ IRDecodedRawDataType

typedef uint32_t IRDecodedRawDataType

Definition at line 151 of file IRremoteInt.h.

◆ IRRawbufType

typedef uint8_t IRRawbufType

Definition at line 107 of file IRremoteInt.h.

◆ IRRawlenType

typedef unsigned int IRRawlenType

Definition at line 88 of file IRremoteInt.h.

Function Documentation

◆ disableLEDFeedbackForSend()

void disableLEDFeedbackForSend ( )

◆ enableLEDFeedbackForSend()

void enableLEDFeedbackForSend ( )

◆ printIRResultShort()

void printIRResultShort ( Print *  aSerial,
IRData aIRDataPtr,
bool  aPrintRepeatGap 
)

Variable Documentation

◆ disableLEDFeedbackForReceive

constexpr auto disableLEDFeedbackForReceive = disableLEDFeedback
constexpr

Definition at line 453 of file IRremoteInt.h.

◆ enableLEDFeedbackForReceive

constexpr auto enableLEDFeedbackForReceive = enableLEDFeedback
constexpr

Definition at line 451 of file IRremoteInt.h.

◆ more

void it is not supported any more

Definition at line 415 of file IRremoteInt.h.

◆ sMicrosAtLastStopTimer

unsigned long sMicrosAtLastStopTimer

Definition at line 49 of file IRReceive.hpp.