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  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 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 BITS_IN_RAW_DATA_TYPE   32
 
#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 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_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...
 

Typedefs

typedef unsigned int IRRawlenType
 
typedef uint8_t IRRawbufType
 
typedef uint32_t IRRawDataType
 

Functions

bool matchTicks (uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
 Match function without 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 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...
 
void IRReceiveTimerInterruptHandler ()
 
void sendNECSpecialRepeat ()
 Static function variant of IRsend::sendNECRepeat 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

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-2023 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_RAW_DATA_TYPE

#define BITS_IN_RAW_DATA_TYPE   32

Definition at line 111 of file IRremoteInt.h.

◆ 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 392 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 162 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 166 of file IRremoteInt.h.

◆ IR_REC_STATE_IDLE

#define IR_REC_STATE_IDLE   0

Definition at line 121 of file IRremoteInt.h.

◆ IR_REC_STATE_MARK

#define IR_REC_STATE_MARK   1

Definition at line 122 of file IRremoteInt.h.

◆ IR_REC_STATE_SPACE

#define IR_REC_STATE_SPACE   2

Definition at line 123 of file IRremoteInt.h.

◆ IR_REC_STATE_STOP

#define IR_REC_STATE_STOP   3

Definition at line 124 of file IRremoteInt.h.

◆ IR_TRACE_PRINT

#define IR_TRACE_PRINT (   ...)    void()

Definition at line 173 of file IRremoteInt.h.

◆ IR_TRACE_PRINTLN

#define IR_TRACE_PRINTLN (   ...)    void()

Definition at line 174 of file IRremoteInt.h.

◆ LED_FEEDBACK_DISABLED_COMPLETELY

#define LED_FEEDBACK_DISABLED_COMPLETELY   0x00

Definition at line 393 of file IRremoteInt.h.

◆ LED_FEEDBACK_ENABLED_FOR_RECEIVE

#define LED_FEEDBACK_ENABLED_FOR_RECEIVE   0x01

Definition at line 394 of file IRremoteInt.h.

◆ LED_FEEDBACK_ENABLED_FOR_SEND

#define LED_FEEDBACK_ENABLED_FOR_SEND   0x02

Definition at line 395 of file IRremoteInt.h.

◆ LTOL

Lower tolerance for comparison of measured data.

Definition at line 424 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 449 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 82 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 450 of file IRremoteInt.h.

◆ SPACE

#define SPACE   0

Definition at line 40 of file IRremoteInt.h.

◆ TICKS

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

Definition at line 417 of file IRremoteInt.h.

◆ TICKS_HIGH

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

Definition at line 429 of file IRremoteInt.h.

◆ TICKS_LOW

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

Definition at line 428 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 414 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 427 of file IRremoteInt.h.

Typedef Documentation

◆ IRRawbufType

typedef uint8_t IRRawbufType

Definition at line 103 of file IRremoteInt.h.

◆ IRRawDataType

typedef uint32_t IRRawDataType

Definition at line 109 of file IRremoteInt.h.

◆ IRRawlenType

typedef unsigned int IRRawlenType

Definition at line 91 of file IRremoteInt.h.

Variable Documentation

◆ disableLEDFeedbackForReceive

constexpr auto disableLEDFeedbackForReceive = disableLEDFeedback
constexpr

Definition at line 401 of file IRremoteInt.h.

◆ enableLEDFeedbackForReceive

constexpr auto enableLEDFeedbackForReceive = enableLEDFeedback
constexpr

Definition at line 399 of file IRremoteInt.h.