IRremote
IRCommandDispatcher.hpp
Go to the documentation of this file.
1 /*
2  * IRCommandDispatcher.hpp
3  *
4  * Library to process IR commands by calling functions specified in a mapping array.
5  * Commands can be tagged as blocking or non blocking.
6  *
7  * To run this example you need to install the "IRremote" or "IRMP" library.
8  * Install it under "Tools -> Manage Libraries..." or "Ctrl+Shift+I"
9  *
10  * The IR library calls a callback function, which executes a non blocking command directly in ISR (Interrupt Service Routine) context!
11  * A blocking command is stored and sets a stop flag for an already running blocking function to terminate.
12  * The blocking command can in turn be executed by main loop by calling IRDispatcher.checkAndRunSuspendedBlockingCommands().
13  *
14  * Copyright (C) 2019-2026 Armin Joachimsmeyer
15  * armin.joachimsmeyer@gmail.com
16  *
17  * This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
18  * This file is part of IRMP https://github.com/IRMP-org/IRMP.
19  * This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
20  *
21  * IRCommandDispatcher is free software: you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation, either version 3 of the License, or
24  * (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
29  * See the GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
33  */
34 
35 /*
36  * Program behavior is modified by the following macros
37  * USE_TINY_IR_RECEIVER
38  * USE_IRMP_LIBRARY
39  * DISPATCHER_IR_COMMAND_HAS_MORE_THAN_8_BIT
40  */
41 
42 #ifndef _IR_COMMAND_DISPATCHER_HPP
43 #define _IR_COMMAND_DISPATCHER_HPP
44 
45 #include <Arduino.h>
46 
47 #include "IRCommandDispatcher.h"
48 
49 //#define NO_LED_FEEDBACK_CODE // Activate this if you want to suppress LED feedback or if you do not have a LED. This saves 14 bytes code and 2 clock cycles per interrupt.
50 
51 //#define USE_TINY_IR_RECEIVER // Recommended and default, but only for NEC protocol!!! If disabled and IRMP_INPUT_PIN is defined, the IRMP library is used for decoding
52 //#define USE_IRREMOTE_LIBRARY // The IRremote library is used for decoding
53 //#define USE_IRMP_LIBRARY // The IRMP library is used for decoding
54 #if !defined(USE_TINY_IR_RECEIVER) && !defined(USE_IRREMOTE_LIBRARY) && !defined(USE_IRMP_LIBRARY)
55 #define USE_TINY_IR_RECEIVER // Set TiniIR as default library
56 #endif
57 
59 
60 #if defined(USE_TINY_IR_RECEIVER)
61 /******************************
62  * Code for the TinyIR library
63  ******************************/
64 #if defined(USE_ONKYO_PROTOCOL) && ! defined(DISPATCHER_IR_COMMAND_HAS_MORE_THAN_8_BIT)
65 #warning ONKYO protocol has 16 bit commands so activating of DISPATCHER_IR_COMMAND_HAS_MORE_THAN_8_BIT is recommended
66 #endif
67 #define USE_CALLBACK_FOR_TINY_RECEIVER // Call the function "handleReceivedTinyIRData()" below each time a frame or repeat is received.
68 #include "TinyIRReceiver.hpp" // included in "IRremote" and "IRMP" library
69 
70 // This block must be located after the includes of other *.hpp files
71 //#define LOCAL_INFO // This enables info output only for this file
72 //#define LOCAL_DEBUG // This enables debug output only for this file - only for development
73 //#define LOCAL_TRACE // This enables trace output only for this file - only for development
74 #include "LocalDebugLevelStart.h"
75 
78 }
79 /*
80  * This is the TinyReceiver callback function, which is called if a complete command was received.
81  * Interrupts are enabled here to allow e.g. delay() in commands.
82  * Copy the (volatile) IR data in order not to be overwritten on receiving of next frame.
83  * Next, check for right address if IR_ADDRESS is defined.
84  * At last call the dispatcher.
85  */
86 # if defined(ESP8266) || defined(ESP32)
87 IRAM_ATTR
88 # endif
94 
95 # if defined(LOCAL_INFO)
97 # endif
98 
99 # if defined(IR_ADDRESS)
100  // if available, compare address. TinyIRReceiverData.Address saves 6 bytes
101  if (TinyIRReceiverData.Address != IR_ADDRESS) { // IR_ADDRESS is defined in *IRCommandMapping.h
102  INFO_PRINT(F("Wrong address. Expected 0x"));
103  INFO_PRINTLN(IR_ADDRESS, HEX);
104  } else
105 # endif
106  {
108  // check if dispatcher enabled
110  /*
111  * Only short (non blocking) commands are executed directly in ISR (Interrupt Service Routine) context,
112  * others are stored for main loop which calls checkAndRunSuspendedBlockingCommands()
113  */
115  }
116  }
117 }
118 
119 #elif defined(USE_IRREMOTE_LIBRARY)
120 /*********************************
121  * Code for the IRremote library
122  *********************************/
123 #define DECODE_NEC // Includes Apple and Onkyo
124 #include "IRremote.hpp"
125 
126 // This block must be located after the includes of other *.hpp files
127 //#define LOCAL_INFO // This enables info output only for this file
128 //#define LOCAL_DEBUG // This enables debug output only for this file - only for development
129 //#define LOCAL_TRACE // This enables trace output only for this file - only for development
130 #include "LocalDebugLevelStart.h"
131 
132 void ReceiveCompleteCallbackHandler();
133 
135  // Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED
137  /*
138  * Tell the ISR to call this function, when a complete frame has been received
139  */
140  IrReceiver.registerReceiveCompleteCallback(ReceiveCompleteCallbackHandler);
141 }
142 
143 /*
144  * Callback function
145  * Here we know, that data is available.
146  * This function is executed in an ISR (Interrupt Service Routine) context.
147  * This means that interrupts are blocked here, so delay(), millis() and Serial prints of data longer than the print buffer size etc. will block forever.
148  * This is because they require their internal interrupt routines to run in order to return.
149  * Therefore it is best to make this callback function short and fast!
150  * A dirty hack is to enable interrupts again by calling sei() (enable interrupt again), but you should know what you are doing,
151  */
152 #if defined(ESP32) || defined(ESP8266)
153 IRAM_ATTR
154 # endif
155 void ReceiveCompleteCallbackHandler() {
156  /*
157  * Fill IrReceiver.decodedIRData
158  */
159  IrReceiver.decode();
160 
165 
166  // Interrupts are already enabled for SUPPORT_MULTIPLE_RECEIVER_INSTANCES
167 #if !defined(SUPPORT_MULTIPLE_RECEIVER_INSTANCES) && !defined(ARDUINO_ARCH_MBED) && !defined(ESP32) // no Serial etc. possible in callback for RTOS based cores like ESP, even when interrupts are enabled
168  interrupts(); // To enable tone(), delay() etc. for commands. Be careful with non-blocking and repeatable commands which lasts longer than the IR repeat duration.
169 # endif
170 
171 # if defined(LOCAL_INFO)
173  Serial.println();
174 # endif
175  /*
176  * Enable receiving of the next frame.
177  */
178  IrReceiver.resume();
179 
180 # if defined(IR_ADDRESS)
181  // if available, compare address
182  if (IRDispatcher.IRReceivedData.address != IR_ADDRESS) { // IR_ADDRESS is defined in *IRCommandMapping.h
183  INFO_PRINT(F("Wrong address. Expected 0x"));
184  INFO_PRINTLN(IR_ADDRESS, HEX);
185  } else
186 # endif
187  {
189  // check if dispatcher enabled
191  /*
192  * Only short (non blocking) commands are executed directly in ISR (Interrupt Service Routine) context,
193  * others are stored for main loop which calls checkAndRunSuspendedBlockingCommands()
194  */
196  }
197  }
198 }
199 
200 #elif defined(USE_IRMP_LIBRARY)
201 /******************************
202  * Code for the IRMP library
203  ******************************/
204 #define IRMP_USE_COMPLETE_CALLBACK 1 // Enable callback functionality. It is required if IRMP library is used.
205 #define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings for printIRInfo()
206 #include "irmp.hpp"
207 #include "LocalDebugLevelStart.h"
208 
209 IRMP_DATA irmp_data;
210 
211 void handleReceivedIRData();
212 
214 {
215  irmp_init();
216  irmp_register_complete_callback_function(&handleReceivedIRData); // fixed function in IRCommandDispatcher.hpp
217 }
218 
219 /*
220  * This is the callback function, which is called if a complete command was received.
221  * Interrupts are NOT enabled here so we must do it manually to allow e.g. delay() in commands.
222  * Copy the (volatile) IR data in order not to be overwritten on receiving of next frame.
223  * Next, check for right address if IR_ADDRESS is defined.
224  * At last call the dispatcher.
225  */
226 #if defined(ESP8266) || defined(ESP32)
227 IRAM_ATTR
228 #endif
229 void handleReceivedIRData()
230 {
231  irmp_get_data(&irmp_data);
232 
233  IRDispatcher.IRReceivedData.address = irmp_data.address;
234  IRDispatcher.IRReceivedData.command = irmp_data.command;
235  IRDispatcher.IRReceivedData.isRepeat = irmp_data.flags & IRMP_FLAG_REPETITION;
237 
238 #if !defined(ARDUINO_ARCH_MBED) && !defined(ESP32) // no Serial etc. possible in callback for RTOS based cores like ESP, even when interrupts are enabled
239  interrupts(); // To enable tone(), delay() etc. for commands. Be careful with non-blocking and repeatable commands which lasts longer than the IR repeat duration.
240 # endif
241 
242 # if defined(LOCAL_INFO)
243  irmp_result_print(&Serial, &irmp_data);
244 # endif
245 
246 # if defined(IR_ADDRESS)
247  // if available, compare address
248  if (IRDispatcher.IRReceivedData.address != IR_ADDRESS) {
249  INFO_PRINT(F("Wrong address. Expected 0x"));
250  INFO_PRINTLN(IR_ADDRESS, HEX);
251  } else
252 # endif
253  {
255  // check if dispatcher enabled
257  {
258  /*
259  * Only short (non blocking) commands are executed directly in ISR (Interrupt Service Routine) context,
260  * others are stored for main loop which calls checkAndRunSuspendedBlockingCommands()
261  */
263  }
264  }
265 }
266 #endif // elif defined(USE_IRMP_LIBRARY)
267 
268 /*******************************************
269  * Start of the IR library independent code
270  *******************************************/
271 void IRCommandDispatcher::printIRInfo(Print *aSerial) {
272  aSerial->println();
273  // For available IR commands see IRCommandMapping.h https://github.com/ArminJo/PWMMotorControl/blob/master/examples/SmartCarFollower/IRCommandMapping.h
274 #if defined(USE_IRMP_LIBRARY)
275 # if defined(IR_REMOTE_NAME)
276  aSerial->println(F("Listening to IR remote of type " STR(IR_REMOTE_NAME) " at pin " STR(IRMP_INPUT_PIN)));
277 # else
278  aSerial->println(F("Listening to IR remote at pin " STR(IRMP_INPUT_PIN)));
279 # endif
280  aSerial->print(F("Accepted protocols are: "));
281  irmp_print_active_protocols(&Serial);
282  aSerial->println();
283 #else
284 # if defined(IR_REMOTE_NAME)
285  aSerial->println(F("Listening to IR remote of type " STR(IR_REMOTE_NAME) " at pin " STR(IR_RECEIVE_PIN)));
286 # else
287  aSerial->println(F("Listening to IR remote at pin " STR(IR_RECEIVE_PIN)));
288 # endif
289 #endif
290 }
291 
292 /*
293  * The main dispatcher function called by IR-ISR, main loop and checkAndRunSuspendedBlockingCommands()
294  * Non blocking commands are executed immediately, blocking commands are executed if no other command is just running.
295  * If another blocking command is currently running, the request to stop is set
296  * and the command is stored for main loop to be later execute by checkAndRunSuspendedBlockingCommands().
297  * This function sets flags justCalledRegularIRCommand, executingBlockingCommand, requestToStopReceived
298  * @param aCallBlockingCommandImmediately Run blocking command directly, if no other command is just running.
299  * Should be false if called by ISR in order not to block ISR. Is true when called from checkAndRunSuspendedBlockingCommands().
300  */
301 void IRCommandDispatcher::checkAndCallCommand(bool aCallBlockingCommandImmediately) {
303  return;
304  }
305 
306  /*
307  * Search for command in Array of IRToCommandMappingStruct
308  */
309  for (uint_fast8_t i = 0; i < sizeof(IRMapping) / sizeof(struct IRToCommandMappingStruct); ++i) {
310  if (IRReceivedData.command == IRMapping[i].IRCode) {
311  /*
312  * Command found
313  */
314 #if defined(LOCAL_INFO)
315 # if defined(__AVR__)
316 # if defined(USE_DISPATCHER_COMMAND_STRINGS)
317  const __FlashStringHelper *tCommandName = reinterpret_cast<const __FlashStringHelper*>(IRMapping[i].CommandString);
318 # else
319  char tCommandName[7];
320  snprintf_P(tCommandName, sizeof(tCommandName), PSTR("0x%x"), IRMapping[i].IRCode);
321 # endif
322 # else
323 # if defined(USE_DISPATCHER_COMMAND_STRINGS)
324  const char *tCommandName = IRMapping[i].CommandString;
325 # else
326  char tCommandName[7];
327  snprintf(tCommandName, sizeof(tCommandName), "0x%x", IRMapping[i].IRCode);
328 # endif
329 # endif
330 #endif
331  /*
332  * Check for repeat and if repeat is allowed for the current command
333  */
334  if (IRReceivedData.isRepeat && !(IRMapping[i].Flags & IR_COMMAND_FLAG_REPEATABLE)) {
335 
336  DEBUG_PRINT(F("Repeats of command \""));
337  DEBUG_PRINT(tCommandName);
338  DEBUG_PRINTLN("\" not accepted");
339 
340  return;
341  }
342 
343  /*
344  * Do not accept recursive call of the same command
345  */
347 
348  DEBUG_PRINT(F("Recursive command \""));
349  DEBUG_PRINT(tCommandName);
350  DEBUG_PRINTLN("\" not accepted");
351 
352  return;
353  }
354 
355  /*
356  * Execute commands
357  */
358  bool tIsNonBlockingCommand = (IRMapping[i].Flags & IR_COMMAND_FLAG_NON_BLOCKING);
359  if (tIsNonBlockingCommand) {
360  // short command here, just call
361  INFO_PRINT(F("Run non blocking command: "));
362  INFO_PRINTLN(tCommandName);
363 #if defined(DISPATCHER_BUZZER_FEEDBACK_PIN) && defined(USE_TINY_IR_RECEIVER)
364  /*
365  * Do (non blocking) buzzer feedback before command is executed
366  */
367  if(IRMapping[i].Flags & IR_COMMAND_FLAG_BEEP) {
368  tone(DISPATCHER_BUZZER_FEEDBACK_PIN, 2200, 50);
369  }
370 #endif
371  IRMapping[i].CommandToCall();
372  } else {
373  /*
374  * Blocking command here
375  */
376  if (aCallBlockingCommandImmediately && currentBlockingCommandCalled == COMMAND_EMPTY) {
377  /*
378  * Here no blocking command was running and we are called from main loop
379  */
380  requestToStopReceived = false; // Do not stop the command executed now
382  currentBlockingCommandCalled = IRReceivedData.command; // set lock for recursive calls
383  lastBlockingCommandCalled = IRReceivedData.command; // set history, can be evaluated by main loop
384 
385  /*
386  * This call is blocking!!!
387  */
388  INFO_PRINT(F("Run blocking command: "));
389  INFO_PRINTLN(tCommandName);
390 
391 #if defined(DISPATCHER_BUZZER_FEEDBACK_PIN) && defined(USE_TINY_IR_RECEIVER)
392  /*
393  * Do (non blocking) buzzer feedback before command is executed
394  */
395  if(IRMapping[i].Flags & IR_COMMAND_FLAG_BEEP) {
396  tone(DISPATCHER_BUZZER_FEEDBACK_PIN, 2200, 50);
397  }
398 #endif
399 
400  IRMapping[i].CommandToCall();
401  TRACE_PRINTLN(F("End of blocking command"));
402 
404  } else {
405  /*
406  * Called by ISR or another command still running.
407  * Do not run command directly, but set request to stop to true and store command
408  * for main loop to execute by checkAndRunSuspendedBlockingCommands()
409  */
411  requestToStopReceived = true; // to stop running command
412  INFO_PRINT(F("Requested stop and stored blocking command "));
413  INFO_PRINT(tCommandName);
414  INFO_PRINTLN(F(" as next command to run."));
415  }
416  }
417  break; // command found
418  } // if (IRReceivedData.command == IRMapping[i].IRCode)
419  } // for loop
420  return;
421 }
422 
423 /*
424  * Intended to be called from main loop
425  * @return true, if command was called
426  */
428  /*
429  * Take last rejected command and call associated function
430  */
432 
433  INFO_PRINT(F("Run stored command=0x"));
435 
438  IRReceivedData.isRepeat = false;
439  requestToStopReceived = false; // Signal to main loop to stop the command currently executed
440  checkAndCallCommand(true);
441  return true;
442  }
443  return false;
444 }
445 
446 /*
447  * Not used internally
448  */
450 #if defined(LOCAL_INFO)
451  Serial.print(F("Set next command to run to 0x"));
452  Serial.print(aBlockingCommandToRunNext, HEX);
453 # if defined(USE_DISPATCHER_COMMAND_STRINGS)
454  Serial.print('|');
455  printIRCommandString(&Serial, aBlockingCommandToRunNext);
456 # endif
457  Serial.println();
458 #endif
459 
460  BlockingCommandToRunNext = aBlockingCommandToRunNext;
461  requestToStopReceived = true;
462 }
463 
464 /*
465  * Special delay function for the IRCommandDispatcher. Returns prematurely if requestToStopReceived is set.
466  * To be used in blocking functions as delay
467  * @return true - as soon as stop received
468  */
469 bool IRCommandDispatcher::delayAndCheckForStop(uint16_t aDelayMillis) {
470  uint32_t tStartMillis = millis();
471  do {
472  if (requestToStopReceived) {
473  return true;
474  }
475  } while (millis() - tStartMillis < aDelayMillis);
476  return false;
477 }
478 
479 void IRCommandDispatcher::printIRCommandStringForArrayIndex(Print *aSerial, uint_fast8_t aMappingArrayIndex) {
480 #if defined(__AVR__)
481 # if defined(USE_DISPATCHER_COMMAND_STRINGS)
482  aSerial->println(reinterpret_cast<const __FlashStringHelper*>(IRMapping[aMappingArrayIndex].CommandString));
483 # else
484  aSerial->print(F("0x"));
485  aSerial->println(IRMapping[aMappingArrayIndex].IRCode, HEX);
486 # endif
487 #else
488 # if defined(USE_DISPATCHER_COMMAND_STRINGS)
489  aSerial->println(IRMapping[aMappingArrayIndex].CommandString);
490 # else
491  aSerial->print("0x");
492  aSerial->println(IRMapping[aMappingArrayIndex].IRCode, HEX);
493 # endif
494 #endif
495 }
496 
498  for (uint_fast8_t i = 0; i < sizeof(IRMapping) / sizeof(struct IRToCommandMappingStruct); ++i) {
499  if (aCommand == IRMapping[i].IRCode) {
501  return;
502  }
503  }
504  aSerial->println(F("unknown"));
505 }
506 
507 void IRCommandDispatcher::setRequestToStopReceived(bool aRequestToStopReceived) {
508  requestToStopReceived = aRequestToStopReceived;
509 }
510 
511 #include "LocalDebugLevelEnd.h"
512 
513 #endif // _IR_COMMAND_DISPATCHER_HPP
IRData::address
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
Definition: IRremoteInt.h:164
TinyIRReceiver.hpp
IRCommandDispatcher::requestToStopReceived
volatile bool requestToStopReceived
Definition: IRCommandDispatcher.h:119
IRCommandDispatcher::currentBlockingCommandCalled
IRCommandType currentBlockingCommandCalled
Definition: IRCommandDispatcher.h:110
IRCommandDispatcher::printIRInfo
void printIRInfo(Print *aSerial)
Definition: IRCommandDispatcher.hpp:271
TinyIRReceiverCallbackDataStruct::Flags
uint8_t Flags
Definition: TinyIR.h:249
DEBUG_PRINT
#define DEBUG_PRINT(...)
Definition: LocalDebugLevelStart.h:79
INFO_PRINT
#define INFO_PRINT(...)
Definition: LocalDebugLevelStart.h:90
IRCommandDispatcher::init
void init()
Definition: IRCommandDispatcher.hpp:76
IRDataForCommandDispatcherStruct::isAvailable
volatile bool isAvailable
Definition: IRCommandDispatcher.h:90
TRACE_PRINTLN
#define TRACE_PRINTLN(...)
Definition: LocalDebugLevelStart.h:70
IRrecv::registerReceiveCompleteCallback
void registerReceiveCompleteCallback(void(*aReceiveCompleteCallbackFunction)(void))
Sets the function to call if a complete protocol frame has arrived.
Definition: IRReceive.hpp:369
IRCommandDispatcher::BlockingCommandToRunNext
IRCommandType BlockingCommandToRunNext
Definition: IRCommandDispatcher.h:112
IRDATA_FLAGS_IS_REPEAT
#define IRDATA_FLAGS_IS_REPEAT
The gap between the preceding frame is as smaller than the maximum gap expected for a repeat....
Definition: IRProtocol.h:125
IR_COMMAND_FLAG_REPEATABLE
#define IR_COMMAND_FLAG_REPEATABLE
Definition: IRCommandDispatcher.h:45
IRCommandDispatcher::setNextBlockingCommand
void setNextBlockingCommand(IRCommandType aBlockingCommandToRunNext)
Definition: IRCommandDispatcher.hpp:449
IRDataForCommandDispatcherStruct::MillisOfLastCode
volatile uint32_t MillisOfLastCode
Definition: IRCommandDispatcher.h:89
IRCommandDispatcher::printIRCommandStringForArrayIndex
void printIRCommandStringForArrayIndex(Print *aSerial, uint_fast8_t aMappingArrayIndex)
Definition: IRCommandDispatcher.hpp:479
TinyIRReceiverData
volatile TinyIRReceiverCallbackDataStruct TinyIRReceiverData
Definition: TinyIRReceiver.hpp:105
IRDataForCommandDispatcherStruct::isRepeat
bool isRepeat
Definition: IRCommandDispatcher.h:88
IRrecv::begin
void begin(uint_fast8_t aReceivePin, bool aEnableLEDFeedback=false, uint_fast8_t aFeedbackLEDPin=USE_DEFAULT_FEEDBACK_LED_PIN)
Initializes the receive and feedback pin.
Definition: IRReceive.hpp:311
IR_RECEIVE_PIN
#define IR_RECEIVE_PIN
Definition: TinyIRReceiver.hpp:124
IRCommandDispatcher
Definition: IRCommandDispatcher.h:93
IRCommandDispatcher::lastBlockingCommandCalled
IRCommandType lastBlockingCommandCalled
Definition: IRCommandDispatcher.h:111
LocalDebugLevelStart.h
handleReceivedTinyIRData
void handleReceivedTinyIRData()
Declaration of the callback function provided by the user application.
Definition: IRCommandDispatcher.hpp:89
IRDataForCommandDispatcherStruct::address
uint16_t address
Definition: IRCommandDispatcher.h:86
TinyIRReceiverCallbackDataStruct::Address
uint16_t Address
Definition: TinyIR.h:238
IRCommandDispatcher::printIRCommandString
void printIRCommandString(Print *aSerial, IRCommandType aCommand)
Definition: IRCommandDispatcher.hpp:497
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:401
STR
#define STR(x)
Definition: IRremote.hpp:85
IRData::flags
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
Definition: IRremoteInt.h:174
INFO_PRINTLN
#define INFO_PRINTLN(...)
Definition: LocalDebugLevelStart.h:91
IRrecv::printIRResultMinimal
void printIRResultMinimal(Print *aSerial)
Function to print protocol number, address, command, raw data and repeat flag of IrReceiver....
Definition: IRReceive.hpp:2065
IRCommandDispatcher::delayAndCheckForStop
bool delayAndCheckForStop(uint16_t aDelayMillis)
Definition: IRCommandDispatcher.hpp:469
IRCommandType
uint_fast8_t IRCommandType
Definition: IRCommandDispatcher.h:71
IRData::command
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
Definition: IRremoteInt.h:165
IRToCommandMappingStruct
Definition: IRCommandDispatcher.h:76
TinyIRReceiverCallbackDataStruct::Command
uint16_t Command
Definition: TinyIR.h:245
IRremote.hpp
Public API to the library.
IRCommandDispatcher.h
ENABLE_LED_FEEDBACK
#define ENABLE_LED_FEEDBACK
Definition: IRremoteInt.h:445
IRCommandDispatcher::setRequestToStopReceived
void setRequestToStopReceived(bool aRequestToStopReceived=true)
Definition: IRCommandDispatcher.hpp:507
printTinyReceiverResultMinimal
void printTinyReceiverResultMinimal(Print *aSerial)
Definition: TinyIRReceiver.hpp:469
IRDispatcher
IRCommandDispatcher IRDispatcher
Definition: IRCommandDispatcher.hpp:58
IRDataForCommandDispatcherStruct::command
IRCommandType command
Definition: IRCommandDispatcher.h:87
DEBUG_PRINTLN
#define DEBUG_PRINTLN(...)
Definition: LocalDebugLevelStart.h:80
IRCommandDispatcher::IRReceivedData
struct IRDataForCommandDispatcherStruct IRReceivedData
Definition: IRCommandDispatcher.h:125
IRCommandDispatcher::doNotUseDispatcher
bool doNotUseDispatcher
Definition: IRCommandDispatcher.h:123
IR_COMMAND_FLAG_BEEP
#define IR_COMMAND_FLAG_BEEP
Definition: IRCommandDispatcher.h:48
IRCommandDispatcher::checkAndCallCommand
void checkAndCallCommand(bool aCallBlockingCommandImmediately)
Definition: IRCommandDispatcher.hpp:301
IRrecv::decode
bool decode()
The main decode function, attempts to decode the recently receive IR signal.
Definition: IRReceive.hpp:560
initPCIInterruptForTinyReceiver
bool initPCIInterruptForTinyReceiver()
Sets IR_RECEIVE_PIN mode to INPUT, and if IR_FEEDBACK_LED_PIN is defined, sets feedback LED output mo...
Definition: TinyIRReceiver.hpp:457
IRCommandDispatcher::justCalledBlockingCommand
bool justCalledBlockingCommand
Definition: IRCommandDispatcher.h:113
IRrecv::resume
void resume()
Restart the ISR (Interrupt Service Routine) state machine, to enable receiving of the next IR frame.
Definition: IRReceive.hpp:491
IRCommandDispatcher::checkAndRunSuspendedBlockingCommands
bool checkAndRunSuspendedBlockingCommands()
Definition: IRCommandDispatcher.hpp:427
COMMAND_EMPTY
#define COMMAND_EMPTY
Definition: IRCommandDispatcher.h:72
IrReceiver
IRrecv IrReceiver
The receiver instance.
Definition: IRReceive.hpp:57
LocalDebugLevelEnd.h
IR_COMMAND_FLAG_NON_BLOCKING
#define IR_COMMAND_FLAG_NON_BLOCKING
Definition: IRCommandDispatcher.h:46