MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / handleReceivedIRData

Function handleReceivedIRData

src/IRCommandDispatcher.hpp:229–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227IRAM_ATTR
228#endif
229void 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;
236 IRDispatcher.IRReceivedData.MillisOfLastCode = millis();
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 {
254 IRDispatcher.IRReceivedData.isAvailable = true;
255 // check if dispatcher enabled
256 if (!IRDispatcher.doNotUseDispatcher)
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 */
262 IRDispatcher.checkAndCallCommand(false);
263 }
264 }
265}
266#endif // elif defined(USE_IRMP_LIBRARY)
267
268/*******************************************

Callers

nothing calls this directly

Calls 1

checkAndCallCommandMethod · 0.80

Tested by

no test coverage detected