33 #ifndef _IR_RECEIVE_HPP
34 #define _IR_RECEIVE_HPP
42 #if defined(TRACE) && !defined(LOCAL_TRACE)
53 #if !defined(NO_LED_RECEIVE_FEEDBACK_CODE)
54 #define LED_RECEIVE_FEEDBACK_CODE // Resolve the double negative
90 #if defined(LED_RECEIVE_FEEDBACK_CODE)
93 (void) aFeedbackLEDPin;
115 #if defined(ESP8266) || defined(ESP32)
116 #pragma GCC diagnostic push
117 #pragma GCC diagnostic ignored "-Wvolatile"
122 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
127 #if defined(TIMER_REQUIRES_RESET_INTR_PENDING)
133 uint8_t tIRInputLevel = *
irparams.IRReceivePinPortInputRegister &
irparams.IRReceivePinMask;
143 tTickCounterForISR++;
161 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
185 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
188 #if RECORD_GAP_TICKS <= 400
189 if (tTickCounterForISR > UINT8_MAX) {
190 tTickCounterForISR = UINT8_MAX;
226 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
239 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
242 #if RECORD_GAP_TICKS <= 400
243 if (tTickCounterForISR > UINT8_MAX) {
244 tTickCounterForISR = UINT8_MAX;
256 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
265 #if defined(LED_RECEIVE_FEEDBACK_CODE)
271 #ifdef _IR_MEASURE_TIMING
283 #if defined(SUPPORT_MULTIPLE_RECEIVER_INSTANCES)
285 UserIRReceiveTimerInterruptHandler();
293 #if defined(TIMER_INTR_NAME) || defined(ISR)
294 # if defined(TIMER_INTR_NAME)
295 ISR (TIMER_INTR_NAME)
315 void IRrecv::begin(uint_fast8_t aReceivePin,
bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
318 #if defined(LED_RECEIVE_FEEDBACK_CODE)
322 (void) aEnableLEDFeedback;
323 (void) aFeedbackLEDPin;
326 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
338 # if defined(__digitalPinToBit)
339 if (__builtin_constant_p(aReceivePinNumber)) {
340 irparams.IRReceivePinMask = 1UL << (__digitalPinToBit(aReceivePinNumber));
342 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
345 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
347 # if defined(__digitalPinToPINReg)
351 if (__builtin_constant_p(aReceivePinNumber)) {
352 irparams.IRReceivePinPortInputRegister = __digitalPinToPINReg(aReceivePinNumber);
354 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
357 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
362 if (__builtin_constant_p(aReceivePinNumber)) {
369 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
393 #ifdef _IR_MEASURE_TIMING
410 #ifdef _IR_MEASURE_TIMING
435 #ifdef _IR_MEASURE_TIMING
447 #ifdef _IR_MEASURE_TIMING
451 #if defined(ESP8266) || defined(ESP32)
452 #pragma GCC diagnostic push
459 #if defined(SEND_PWM_BY_TIMER) && !defined(SEND_PWM_DOES_NOT_USE_RECEIVE_TIMER)
518 #if defined(LOCAL_DEBUG)
519 Serial.print(F(
"Overflow happened, try to increase the \"RAW_BUFFER_LENGTH\" value of "));
521 Serial.println(F(
" with #define RAW_BUFFER_LENGTH=<biggerValue>"));
589 #if defined(DECODE_NEC) || defined(DECODE_ONKYO)
596 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
603 #if defined(DECODE_DENON)
610 #if defined(DECODE_SONY)
617 #if defined(DECODE_RC5)
624 #if defined(DECODE_RC6)
631 #if defined(DECODE_LG)
638 #if defined(DECODE_JVC)
645 #if defined(DECODE_SAMSUNG)
655 #if defined(DECODE_BEO)
662 #if defined(DECODE_FAST)
669 #if defined(DECODE_WHYNTER)
676 #if defined(DECODE_LEGO_PF)
683 #if defined(DECODE_BOSEWAVE)
690 #if defined(DECODE_MAGIQUEST)
700 #if defined(DECODE_DISTANCE_WIDTH)
710 #if defined(DECODE_HASH)
748 bool aIsPulseWidthProtocol,
bool aMSBfirst) {
750 #if defined(LOCAL_DEBUG)
751 Serial.print(F(
"aOneMicros="));
752 Serial.print(aOneMicros);
753 Serial.print(F(
", 0.75*aOneMicros="));
754 Serial.print((aOneMicros * 3) / 4);
755 Serial.print(F(
", MARK_EXCESS_MICROS=" STR(
MARK_EXCESS_MICROS)
" isPulseWidthProtocol="));
756 Serial.print(aIsPulseWidthProtocol);
764 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
767 uint16_t tCurrentTicks;
768 if (aIsPulseWidthProtocol) {
773 tCurrentTicks = *tRawBufPointer++;
774 tBitValue =
matchMark(tCurrentTicks, aOneMicros);
782 tCurrentTicks = *tRawBufPointer++;
783 tBitValue =
matchSpace(tCurrentTicks, aOneMicros);
795 tDecodedData |= tMask;
828 uint16_t aOneThresholdMicros,
bool aIsPulseWidthProtocol,
bool aMSBfirst) {
830 #if defined(LOCAL_DEBUG)
831 Serial.print(F(
"OneThresholdMicros="));
832 Serial.print(aOneThresholdMicros);
833 Serial.print(F(
" isPulseWidthProtocol="));
834 Serial.print(aIsPulseWidthProtocol);
842 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
844 if (!aIsPulseWidthProtocol) {
848 bool tBitValue = tCurrentMicros > aOneThresholdMicros;
851 if (aIsPulseWidthProtocol) {
864 tDecodedData |= tMask;
882 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
bool aMSBfirst) {
886 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
891 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
893 unsigned int tMarkTicks;
894 unsigned int tSpaceTicks;
897 if (isPulseDistanceProtocol) {
903 tSpaceTicks = *tRawBufPointer++;
904 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
911 tMarkTicks = *tRawBufPointer++;
912 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
925 tDecodedData |= tMask;
941 uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
943 (void) aZeroSpaceMicros;
958 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
962 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
967 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
969 unsigned int tMarkTicks;
970 unsigned int tSpaceTicks;
973 if (isPulseDistanceProtocol) {
978 tMarkTicks = *tRawBufPointer++;
979 tSpaceTicks = *tRawBufPointer++;
980 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
983 if (!
matchMark(tMarkTicks, aOneMarkMicros)) {
984 #if defined(LOCAL_DEBUG)
985 Serial.print(F(
"Mark="));
987 Serial.print(F(
" is not "));
988 Serial.print(aOneMarkMicros);
989 Serial.print(F(
". Index="));
990 Serial.print(aNumberOfBits - i);
997 if (!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)) {
998 #if defined(LOCAL_DEBUG)
999 Serial.print(F(
"Space="));
1001 Serial.print(F(
" is not "));
1002 Serial.print(aZeroSpaceMicros);
1003 Serial.print(F(
". Index="));
1004 Serial.print(aNumberOfBits - i);
1015 tMarkTicks = *tRawBufPointer++;
1016 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
1017 tSpaceTicks = *tRawBufPointer++;
1020 if ((tBitValue && !
matchSpace(tSpaceTicks, aOneSpaceMicros))
1021 || ((!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)))) {
1022 #if defined(LOCAL_DEBUG)
1023 Serial.print(F(
"Space="));
1025 Serial.print(F(
" is not "));
1026 Serial.print(aOneSpaceMicros);
1027 Serial.print(F(
" or "));
1028 Serial.print(aZeroSpaceMicros);
1029 Serial.print(F(
". Index="));
1030 Serial.print(aNumberOfBits - i);
1035 if (!tBitValue && !
matchMark(tMarkTicks, aZeroMarkMicros)) {
1036 #if defined(LOCAL_DEBUG)
1037 Serial.print(F(
"Mark="));
1039 Serial.print(F(
" is not "));
1040 Serial.print(aZeroMarkMicros);
1041 Serial.print(F(
". Index="));
1042 Serial.print(aNumberOfBits - i);
1058 tDecodedData |= tMask;
1075 #if defined(USE_STRICT_DECODER)
1083 #if defined(USE_STRICT_DECODER)
1090 uint16_t tThresholdMicros;
1092 # if defined(USE_THRESHOLD_DECODER)
1093 if (tIsPulseWidthProtocol) {
1105 if (tIsPulseWidthProtocol) {
1117 uint_fast8_t aNumberOfBits,
IRRawlenType aStartOffset) {
1120 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
1121 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
1157 uint_fast8_t tLevelOfCurrentInterval;
1195 return tLevelOfCurrentInterval;
1201 #define FNV_PRIME_32 16777619
1202 #define FNV_BASIS_32 2166136261
1210 if (newval * 10 < oldval * 8) {
1213 if (oldval * 10 < newval * 8) {
1265 if (aResults->
rawlen < 6) {
1269 for (uint8_t i = 3; i < aResults->
rawlen; i++) {
1275 aResults->
value = hash;
1276 aResults->
bits = 32;
1293 #if defined(LOCAL_TRACE)
1295 Serial.println(F(
": Header mark length is wrong"));
1300 #if defined(LOCAL_TRACE)
1302 Serial.println(F(
": Header space length is wrong"));
1312 #if defined(LOCAL_TRACE)
1314 Serial.println(F(
": Header mark length is wrong"));
1319 #if defined(LOCAL_TRACE)
1321 Serial.println(F(
": Header space length is wrong"));
1335 #
if defined(ENABLE_COMPLETE_REPEAT_CHECK)
1348 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1350 uint16_t tMatchValueMicrosQuarter = aMatchValueMicros / 4;
1351 #if defined(LOCAL_TRACE)
1352 Serial.print(F(
"Testing (actual vs desired): "));
1353 Serial.print(tMeasuredMicros);
1354 Serial.print(F(
"us vs "));
1355 Serial.print(aMatchValueMicros);
1356 Serial.print(F(
"us: "));
1357 Serial.print(tMatchValueMicrosQuarter * 3);
1358 Serial.print(F(
" <= "));
1360 Serial.print(F(
" <= "));
1361 Serial.print(tMatchValueMicrosQuarter * 5);
1363 bool passed = (tMeasuredMicros >= (tMatchValueMicrosQuarter * 3) && tMeasuredMicros <= (tMatchValueMicrosQuarter * 5));
1364 #if defined(LOCAL_TRACE)
1366 Serial.println(F(
" => passed"));
1368 Serial.println(F(
" => FAILED"));
1378 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros, int16_t aCompensationMicrosForTicks) {
1379 uint16_t tMeasuredMicros = (aMeasuredTicks *
MICROS_PER_TICK) + aCompensationMicrosForTicks;
1380 uint16_t tMatchValueMicrosQuarter = aMatchValueMicros / 4;
1381 #if defined(LOCAL_TRACE)
1382 Serial.print(F(
"Testing (actual vs desired): "));
1383 Serial.print(tMeasuredMicros);
1384 Serial.print(F(
"us vs "));
1385 Serial.print(aMatchValueMicros);
1386 Serial.print(F(
"us: "));
1387 Serial.print(tMatchValueMicrosQuarter * 3);
1388 Serial.print(F(
" < "));
1390 Serial.print(F(
" <= "));
1391 Serial.print(tMatchValueMicrosQuarter * 5);
1393 bool passed = (tMeasuredMicros > (tMatchValueMicrosQuarter * 3) && tMeasuredMicros <= (tMatchValueMicrosQuarter * 5));
1394 #if defined(LOCAL_TRACE)
1396 Serial.println(F(
" => passed"));
1398 Serial.println(F(
" => FAILED"));
1403 bool MATCH(uint16_t measured_ticks, uint16_t desired_us) {
1404 return matchTicks(measured_ticks, desired_us);
1411 bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1412 #if (MARK_EXCESS_MICROS == 0)
1413 return matchTicks(aMeasuredTicks, aMatchValueMicros);
1416 # if !defined(USE_OLD_MATCH_FUNCTIONS)
1422 # if defined(LOCAL_TRACE)
1423 Serial.print(F(
"Testing mark (actual vs desired): "));
1425 Serial.print(F(
"us vs "));
1426 Serial.print(aMatchValueMicros);
1427 Serial.print(F(
"us: "));
1432 Serial.print(F(
" <= "));
1434 Serial.print(F(
" <= "));
1438 bool passed = ((aMeasuredTicks >=
TICKS_LOW(aMatchValueMicros))
1439 && (aMeasuredTicks <=
TICKS_HIGH(aMatchValueMicros)));
1440 # if defined(LOCAL_TRACE)
1442 Serial.println(F(
" => passed"));
1444 Serial.println(F(
" => FAILED"));
1452 return matchMark(measured_ticks, desired_us);
1459 bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1460 #if (MARK_EXCESS_MICROS == 0)
1461 return matchTicks(aMeasuredTicks, aMatchValueMicros);
1463 # if !defined(USE_OLD_MATCH_FUNCTIONS)
1468 # if defined(LOCAL_TRACE)
1469 Serial.print(F(
"Testing space (actual vs desired): "));
1471 Serial.print(F(
"us vs "));
1472 Serial.print(aMatchValueMicros);
1473 Serial.print(F(
"us: "));
1474 Serial.print(F(
"LOW="));
1475 Serial.print(
TICKS_LOW(aMatchValueMicros));
1476 Serial.print(F(
" "));
1478 Serial.print(F(
" <= "));
1480 Serial.print(F(
" <= "));
1484 bool passed = ((aMeasuredTicks >=
TICKS_LOW(aMatchValueMicros))
1485 && (aMeasuredTicks <=
TICKS_HIGH(aMatchValueMicros)));
1486 # if defined(LOCAL_TRACE)
1488 Serial.println(F(
" => passed"));
1490 Serial.println(F(
" => FAILED"));
1498 return matchSpace(measured_ticks, desired_us);
1521 aSerial->print(F(
"Space of "));
1523 aSerial->print(F(
" us between two detected transmission is smaller than the minimal gap of "));
1525 aSerial->println(F(
" us known for implemented protocols like NEC, Sony, RC% etc.."));
1526 aSerial->println(F(
"But it can be OK for some yet unsupported protocols, and especially for repeats."));
1527 aSerial->println(F(
"If you get unexpected results, try to increase the RECORD_GAP_MICROS in IRremote.h."));
1547 #if defined(DECODE_ONKYO)
1548 aSerial->print(F(
"Onkyo, "));
1549 #elif defined(DECODE_NEC)
1550 aSerial->print(F(
"NEC/NEC2/Onkyo/Apple, "));
1552 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
1553 aSerial->print(F(
"Panasonic/Kaseikyo, "));
1555 #if defined(DECODE_DENON)
1556 aSerial->print(F(
"Denon/Sharp, "));
1558 #if defined(DECODE_SONY)
1559 aSerial->print(F(
"Sony, "));
1561 #if defined(DECODE_RC5)
1562 aSerial->print(F(
"RC5, "));
1564 #if defined(DECODE_RC6)
1565 aSerial->print(F(
"RC6, "));
1567 #if defined(DECODE_LG)
1568 aSerial->print(F(
"LG, "));
1570 #if defined(DECODE_JVC)
1571 aSerial->print(F(
"JVC, "));
1573 #if defined(DECODE_SAMSUNG)
1574 aSerial->print(F(
"Samsung, "));
1579 #if defined(DECODE_BEO)
1580 aSerial->print(F(
"Bang & Olufsen, "));
1582 #if defined(DECODE_FAST)
1583 aSerial->print(F(
"FAST, "));
1585 #if defined(DECODE_WHYNTER)
1586 aSerial->print(F(
"Whynter, "));
1588 #if defined(DECODE_LEGO_PF)
1589 aSerial->print(F(
"Lego Power Functions, "));
1591 #if defined(DECODE_BOSEWAVE)
1592 aSerial->print(F(
"Bosewave, "));
1594 #if defined(DECODE_MAGIQUEST)
1595 aSerial->print(F(
"MagiQuest, "));
1597 #if defined(DECODE_DISTANCE_WIDTH)
1598 aSerial->print(F(
"Universal Pulse Distance Width, "));
1600 #if defined(DECODE_HASH)
1601 aSerial->print(F(
"Hash "));
1603 #if defined(NO_DECODER) // for sending raw only
1624 (void) aPrintRepeatGap;
1631 aSerial->println(F(
"Overflow"));
1633 aSerial->print(F(
"Protocol="));
1636 #if defined(DECODE_HASH)
1637 aSerial->print(F(
" Hash=0x"));
1638 #if (__INT_WIDTH__ < 32)
1645 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1646 aSerial->print(
' ');
1648 aSerial->println(F(
" bits (incl. gap and start) received"));
1651 #if defined(DECODE_DISTANCE_WIDTH)
1657 aSerial->print(F(
" Address=0x"));
1660 aSerial->print(F(
", Command=0x"));
1664 aSerial->print(F(
", Extra=0x"));
1669 aSerial->print(F(
", Parity fail"));
1673 aSerial->print(F(
", Toggle=1"));
1675 #if defined(DECODE_DISTANCE_WIDTH)
1683 aSerial->print(F(
", Raw-Data=0x"));
1684 #if (__INT_WIDTH__ < 32)
1689 aSerial->print(F(
", "));
1695 aSerial->print(F(
" bits,"));
1698 aSerial->print(F(
" MSB first"));
1700 aSerial->print(F(
" LSB first"));
1708 aSerial->print(F(
", "));
1710 aSerial->print(F(
"Auto-"));
1712 aSerial->print(F(
"Repeat"));
1714 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1715 aSerial->print(F(
", Gap="));
1717 aSerial->print(F(
"us"));
1722 uint16_t tSumOfDurationTicks = 0;
1726 aSerial->print(F(
", Duration="));
1728 aSerial->println(F(
"us"));
1747 aSerial->print(F(
"Protocol="));
1749 #if defined(DECODE_DISTANCE_WIDTH)
1755 aSerial->print(F(
" Address=0x"));
1756 aSerial->print(aIRDataPtr->
address, HEX);
1758 aSerial->print(F(
" Command=0x"));
1759 aSerial->print(aIRDataPtr->
command, HEX);
1761 #if defined(DECODE_DISTANCE_WIDTH)
1768 aSerial->print(
' ');
1770 aSerial->print(F(
" bits"));
1773 aSerial->print(F(
" MSB first"));
1775 aSerial->print(F(
" LSB first"));
1782 aSerial->print(
' ');
1784 aSerial->print(F(
"Auto-"));
1786 aSerial->print(F(
"Repeat"));
1803 (void) aPrintRepeatGap;
1810 aSerial->println(F(
"Overflow"));
1813 aSerial->print(F(
"Protocol="));
1816 #if defined(DECODE_HASH)
1817 aSerial->print(F(
" Hash=0x"));
1818 #if (__INT_WIDTH__ < 32)
1825 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1826 aSerial->print(
' ');
1827 aSerial->print((aIRDataPtr->
rawlen + 1) / 2, DEC);
1828 aSerial->println(F(
" bits (incl. gap and start) received"));
1831 #if defined(DECODE_DISTANCE_WIDTH)
1837 aSerial->print(F(
" Address=0x"));
1838 aSerial->print(aIRDataPtr->
address, HEX);
1840 aSerial->print(F(
" Command=0x"));
1841 aSerial->print(aIRDataPtr->
command, HEX);
1844 aSerial->print(F(
" Extra=0x"));
1845 aSerial->print(aIRDataPtr->
extra, HEX);
1849 aSerial->print(F(
" Parity fail"));
1853 aSerial->print(F(
" Toggle=1"));
1855 #if defined(DECODE_DISTANCE_WIDTH)
1863 aSerial->print(F(
" Raw-Data=0x"));
1864 #if (__INT_WIDTH__ < 32)
1872 aSerial->print(
' ');
1874 aSerial->print(F(
" bits"));
1877 aSerial->print(F(
" MSB first"));
1879 aSerial->print(F(
" LSB first"));
1887 aSerial->print(
' ');
1889 aSerial->print(F(
"Auto-"));
1891 aSerial->print(F(
"Repeat"));
1893 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1894 aSerial->print(F(
" Gap="));
1896 aSerial->println(F(
"us"));
1905 aSerial->print(F(
", "));
1907 aSerial->print(F(
", "));
1909 aSerial->print(F(
", "));
1911 aSerial->print(F(
", "));
1913 aSerial->print(F(
", "));
1922 uint8_t tMaximumTick = 0;
1925 if (tMaximumTick < tTick) {
1926 tMaximumTick = tTick;
1929 return tMaximumTick;
1932 uint8_t tMaximumTick = 0;
1935 if (tMaximumTick < tTick) {
1936 tMaximumTick = tTick;
1939 return tMaximumTick;
1946 uint8_t tMaximumTick = 0;
1948 if (aSearchSpaceInsteadOfMark) {
1955 if (tMaximumTick < tTick) {
1956 tMaximumTick = tTick;
1959 return tMaximumTick;
1963 uint16_t tSumOfDurationTicks = 0;
1995 #if defined(DECODE_DISTANCE_WIDTH)
1996 uint_fast8_t tNumberOfArrayData = 0;
1998 # if __INT_WIDTH__ < 32
1999 aSerial->print(F(
"Send on a 8 bit platform with: "));
2001 if(tNumberOfArrayData > 1) {
2003 aSerial->print(F(
" uint32_t tRawData[]={0x"));
2004 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
2007 aSerial->print(F(
"Send on a 32 bit platform with: "));
2009 if(tNumberOfArrayData > 1) {
2011 aSerial->print(F(
" uint64_t tRawData[]={0x"));
2012 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
2013 PrintULL::print(aSerial,
decodedIRData.decodedRawDataArray[i], HEX);
2015 if (i != tNumberOfArrayData - 1) {
2016 aSerial->print(F(
", 0x"));
2019 aSerial->println(F(
"};"));
2020 aSerial->print(F(
" "));
2023 aSerial->print(F(
"Send with: "));
2027 aSerial->print(F(
" "));
2029 aSerial->print(F(
" "));
2031 aSerial->print(F(
"IrSender.send"));
2034 aSerial->print(F(
"Send with: IrSender.send"));
2035 #endif // #if defined(DECODE_DISTANCE_WIDTH)
2048 aSerial->print(F(
"Raw(rawIRTimings, sizeof(rawIRTimings) / sizeof(rawIRTimings[0]), 38, <RepeatPeriodMillis>, <numberOfRepeats>"));
2050 #if defined(DECODE_DISTANCE_WIDTH)
2055 aSerial->print(F(
"PulseDistanceWidth"));
2056 if(tNumberOfArrayData > 1) {
2057 aSerial->print(F(
"FromArray(38, "));
2059 aSerial->print(F(
"(38, "));
2063 if(tNumberOfArrayData > 1) {
2064 aSerial->print(F(
", &tRawData[0], "));
2066 aSerial->print(F(
", 0x"));
2067 # if (__INT_WIDTH__ < 32)
2072 aSerial->print(F(
", "));
2075 aSerial->print(F(
", PROTOCOL_IS_"));
2078 aSerial->print(
'M');
2080 aSerial->print(
'L');
2082 aSerial->print(F(
"SB_FIRST, <RepeatPeriodMillis>, <numberOfRepeats>"));
2084 #endif // defined(DECODE_DISTANCE_WIDTH)
2090 aSerial->print(F(
"(0x"));
2091 #if defined(DECODE_MAGIQUEST)
2093 # if (__INT_WIDTH__ < 32)
2108 aSerial->print(F(
", 0x"));
2111 aSerial->print(F(
", 2, "));
2114 aSerial->print(F(
", <numberOfRepeats>"));
2118 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO) || defined(DECODE_RC6)
2121 aSerial->print(F(
", 0x"));
2125 aSerial->print(F(
");"));
2138 aSerial->print(F(
"P="));
2141 #if defined(DECODE_HASH)
2142 aSerial->print(F(
" #=0x"));
2143 # if (__INT_WIDTH__ < 32)
2149 aSerial->print(
' ');
2151 aSerial->println(F(
" bits received"));
2156 aSerial->print(F(
" A=0x"));
2159 aSerial->print(F(
" C=0x"));
2162 aSerial->print(F(
" Raw=0x"));
2163 #if (__INT_WIDTH__ < 32)
2170 aSerial->print(F(
" R"));
2179 uint16_t tSumOfDurationTicks = 0;
2183 aSerial->print(F(
"Duration="));
2184 if (aOutputMicrosecondsInsteadOfTicks) {
2186 aSerial->println(F(
"us"));
2189 aSerial->print(tSumOfDurationTicks);
2190 aSerial->println(F(
" ticks"));
2203 aSerial->print(F(
"rawIRTimings["));
2205 aSerial->println(F(
"]: "));
2210 aSerial->print(F(
" -"));
2211 if (aOutputMicrosecondsInsteadOfTicks) {
2218 uint_fast8_t tCounterForNewline = 6;
2221 #if defined(DECODE_DENON) || defined(DECODE_MAGIQUEST)
2230 tCounterForNewline = 0;
2235 uint16_t tSumOfDurationTicks = 0;
2238 if (aOutputMicrosecondsInsteadOfTicks) {
2241 tDuration = tCurrentTicks;
2243 tSumOfDurationTicks += tCurrentTicks;
2246 aSerial->print(
'-');
2248 aSerial->print(F(
" +"));
2252 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 1000) {
2253 aSerial->print(
' ');
2255 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 100) {
2256 aSerial->print(
' ');
2258 if (tDuration < 10) {
2259 aSerial->print(
' ');
2261 aSerial->print(tDuration);
2264 aSerial->print(
',');
2267 tCounterForNewline++;
2268 if ((tCounterForNewline % 8) == 0) {
2274 aSerial->print(F(
"Duration="));
2275 if (aOutputMicrosecondsInsteadOfTicks) {
2277 aSerial->println(F(
"us"));
2280 aSerial->print(tSumOfDurationTicks);
2281 aSerial->println(F(
" ticks"));
2304 if (aOutputMicrosecondsInsteadOfTicks) {
2305 aSerial->print(F(
"uint16_t rawIRTimings["));
2307 aSerial->print(F(
"uint8_t rawTicks["));
2311 aSerial->print(F(
"] = {"));
2317 if (aDoCompensate) {
2326 if (aOutputMicrosecondsInsteadOfTicks) {
2327 aSerial->print(tDuration);
2333 tTicks = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2334 aSerial->print(tTicks);
2337 if (!(i & 1)) aSerial->print(
' ');
2341 aSerial->print(F(
"};"));
2344 aSerial->print(F(
" // "));
2371 *aArrayPtr = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2390 aSerial->print(F(
"uint16_t"));
2391 aSerial->print(F(
" address = 0x"));
2393 aSerial->println(
';');
2395 aSerial->print(F(
"uint16_t"));
2396 aSerial->print(F(
" command = 0x"));
2398 aSerial->println(
';');
2401 #if __INT_WIDTH__ < 32
2402 aSerial->print(F(
"uint32_t rawIRTimings = 0x"));
2404 aSerial->print(F(
"uint64_t rawIRTimings = 0x"));
2406 #if (__INT_WIDTH__ < 32)
2411 aSerial->println(
';');
2415 #if defined(__AVR__)
2453 aResults->
value = 0;
2457 #if defined(DECODE_NEC)
2464 #if defined(DECODE_SONY)
2471 #if defined(DECODE_RC5)
2482 #if defined(DECODE_RC6)
2494 #if defined(DECODE_LG)
2499 #if defined(DECODE_JVC)
2506 #if defined(DECODE_SAMSUNG)
2513 #if defined(DECODE_DENON)
2532 #if defined(_IR_MEASURE_TIMING)
2533 #undef _IR_MEASURE_TIMING
2535 #if defined(LOCAL_TRACE)
2538 #if defined(LOCAL_DEBUG)
2541 #endif // _IR_RECEIVE_HPP