33 #ifndef _IR_RECEIVE_HPP
34 #define _IR_RECEIVE_HPP
42 #if defined(TRACE) && !defined(LOCAL_TRACE)
54 #if !defined(NO_LED_RECEIVE_FEEDBACK_CODE)
55 #define LED_RECEIVE_FEEDBACK_CODE // Resolve the double negative
91 #if defined(LED_RECEIVE_FEEDBACK_CODE)
94 (void) aFeedbackLEDPin;
116 #if defined(ESP8266) || defined(ESP32)
117 #pragma GCC diagnostic push
118 #pragma GCC diagnostic ignored "-Wvolatile"
123 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
128 #if defined(TIMER_REQUIRES_RESET_INTR_PENDING)
134 uint8_t tIRInputLevel = *
irparams.IRReceivePinPortInputRegister &
irparams.IRReceivePinMask;
144 tTickCounterForISR++;
162 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
186 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
189 #if RECORD_GAP_TICKS <= 400
190 if (tTickCounterForISR > UINT8_MAX) {
191 tTickCounterForISR = UINT8_MAX;
227 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
240 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
243 #if RECORD_GAP_TICKS <= 400
244 if (tTickCounterForISR > UINT8_MAX) {
245 tTickCounterForISR = UINT8_MAX;
257 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
266 #if defined(LED_RECEIVE_FEEDBACK_CODE)
272 #ifdef _IR_MEASURE_TIMING
284 #if defined(SUPPORT_MULTIPLE_RECEIVER_INSTANCES)
286 UserIRReceiveTimerInterruptHandler();
294 #if defined(TIMER_INTR_NAME) || defined(ISR)
295 # if defined(TIMER_INTR_NAME)
296 ISR (TIMER_INTR_NAME)
316 void IRrecv::begin(uint_fast8_t aReceivePin,
bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
319 #if defined(LED_RECEIVE_FEEDBACK_CODE)
323 (void) aEnableLEDFeedback;
324 (void) aFeedbackLEDPin;
327 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
339 # if defined(__digitalPinToBit)
340 if (__builtin_constant_p(aReceivePinNumber)) {
341 irparams.IRReceivePinMask = 1UL << (__digitalPinToBit(aReceivePinNumber));
343 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
346 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
348 # if defined(__digitalPinToPINReg)
352 if (__builtin_constant_p(aReceivePinNumber)) {
353 irparams.IRReceivePinPortInputRegister = __digitalPinToPINReg(aReceivePinNumber);
355 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
358 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
363 if (__builtin_constant_p(aReceivePinNumber)) {
370 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
394 #ifdef _IR_MEASURE_TIMING
411 #ifdef _IR_MEASURE_TIMING
436 #ifdef _IR_MEASURE_TIMING
448 #ifdef _IR_MEASURE_TIMING
452 #if defined(ESP8266) || defined(ESP32)
453 #pragma GCC diagnostic push
460 #if defined(SEND_PWM_BY_TIMER) && !defined(SEND_PWM_DOES_NOT_USE_RECEIVE_TIMER)
519 #if defined(LOCAL_DEBUG)
520 Serial.print(F(
"Overflow happened, try to increase the \"RAW_BUFFER_LENGTH\" value of "));
522 Serial.println(F(
" with #define RAW_BUFFER_LENGTH=<biggerValue>"));
590 #if defined(DECODE_NEC) || defined(DECODE_ONKYO)
597 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
604 #if defined(DECODE_DENON)
611 #if defined(DECODE_SONY)
618 #if defined(DECODE_RC5)
625 #if defined(DECODE_RC6)
632 #if defined(DECODE_LG)
639 #if defined(DECODE_JVC)
646 #if defined(DECODE_SAMSUNG)
656 #if defined(DECODE_BEO)
663 #if defined(DECODE_FAST)
670 #if defined(DECODE_WHYNTER)
677 #if defined(DECODE_LEGO_PF)
684 #if defined(DECODE_BOSEWAVE)
691 #if defined(DECODE_MAGIQUEST)
701 #if defined(DECODE_DISTANCE_WIDTH)
711 #if defined(DECODE_HASH)
749 bool aIsPulseWidthProtocol,
bool aMSBfirst) {
751 #if defined(LOCAL_DEBUG)
752 Serial.print(F(
"aOneMicros="));
753 Serial.print(aOneMicros);
754 Serial.print(F(
", 0.75*aOneMicros="));
755 Serial.print((aOneMicros * 3) / 4);
756 Serial.print(F(
", MARK_EXCESS_MICROS=" STR(
MARK_EXCESS_MICROS)
" isPulseWidthProtocol="));
757 Serial.print(aIsPulseWidthProtocol);
765 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
768 uint16_t tCurrentTicks;
769 if (aIsPulseWidthProtocol) {
774 tCurrentTicks = *tRawBufPointer++;
775 tBitValue =
matchMark(tCurrentTicks, aOneMicros);
783 tCurrentTicks = *tRawBufPointer++;
784 tBitValue =
matchSpace(tCurrentTicks, aOneMicros);
796 tDecodedData |= tMask;
829 uint16_t aOneThresholdMicros,
bool aIsPulseWidthProtocol,
bool aMSBfirst) {
831 #if defined(LOCAL_DEBUG)
832 Serial.print(F(
"OneThresholdMicros="));
833 Serial.print(aOneThresholdMicros);
834 Serial.print(F(
" isPulseWidthProtocol="));
835 Serial.print(aIsPulseWidthProtocol);
843 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
845 if (!aIsPulseWidthProtocol) {
849 bool tBitValue = tCurrentMicros > aOneThresholdMicros;
852 if (aIsPulseWidthProtocol) {
865 tDecodedData |= tMask;
883 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
bool aMSBfirst) {
887 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
892 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
894 unsigned int tMarkTicks;
895 unsigned int tSpaceTicks;
898 if (isPulseDistanceProtocol) {
904 tSpaceTicks = *tRawBufPointer++;
905 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
912 tMarkTicks = *tRawBufPointer++;
913 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
926 tDecodedData |= tMask;
942 uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
944 (void) aZeroSpaceMicros;
959 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
963 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
968 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
970 unsigned int tMarkTicks;
971 unsigned int tSpaceTicks;
974 if (isPulseDistanceProtocol) {
979 tMarkTicks = *tRawBufPointer++;
980 tSpaceTicks = *tRawBufPointer++;
981 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
984 if (!
matchMark(tMarkTicks, aOneMarkMicros)) {
985 #if defined(LOCAL_DEBUG)
986 Serial.print(F(
"Mark="));
988 Serial.print(F(
" is not "));
989 Serial.print(aOneMarkMicros);
990 Serial.print(F(
". Index="));
991 Serial.print(aNumberOfBits - i);
998 if (!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)) {
999 #if defined(LOCAL_DEBUG)
1000 Serial.print(F(
"Space="));
1002 Serial.print(F(
" is not "));
1003 Serial.print(aZeroSpaceMicros);
1004 Serial.print(F(
". Index="));
1005 Serial.print(aNumberOfBits - i);
1016 tMarkTicks = *tRawBufPointer++;
1017 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
1018 tSpaceTicks = *tRawBufPointer++;
1021 if ((tBitValue && !
matchSpace(tSpaceTicks, aOneSpaceMicros))
1022 || ((!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)))) {
1023 #if defined(LOCAL_DEBUG)
1024 Serial.print(F(
"Space="));
1026 Serial.print(F(
" is not "));
1027 Serial.print(aOneSpaceMicros);
1028 Serial.print(F(
" or "));
1029 Serial.print(aZeroSpaceMicros);
1030 Serial.print(F(
". Index="));
1031 Serial.print(aNumberOfBits - i);
1036 if (!tBitValue && !
matchMark(tMarkTicks, aZeroMarkMicros)) {
1037 #if defined(LOCAL_DEBUG)
1038 Serial.print(F(
"Mark="));
1040 Serial.print(F(
" is not "));
1041 Serial.print(aZeroMarkMicros);
1042 Serial.print(F(
". Index="));
1043 Serial.print(aNumberOfBits - i);
1059 tDecodedData |= tMask;
1076 #if defined(USE_STRICT_DECODER)
1084 #if defined(USE_STRICT_DECODER)
1091 uint16_t tThresholdMicros;
1093 # if defined(USE_THRESHOLD_DECODER)
1094 if (tIsPulseWidthProtocol) {
1106 if (tIsPulseWidthProtocol) {
1118 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;
1983 #if defined(DECODE_DISTANCE_WIDTH)
1984 uint_fast8_t tNumberOfArrayData = 0;
1986 # if __INT_WIDTH__ < 32
1987 aSerial->print(F(
"Send on a 8 bit platform with: "));
1989 if(tNumberOfArrayData > 1) {
1991 aSerial->print(F(
" uint32_t tRawData[]={0x"));
1993 aSerial->print(F(
"Send on a 32 bit platform with: "));
1995 if(tNumberOfArrayData > 1) {
1997 aSerial->print(F(
" uint64_t tRawData[]={0x"));
1999 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
2000 # if (__INT_WIDTH__ < 32)
2003 PrintULL::print(aSerial,
decodedIRData.decodedRawDataArray[i], HEX);
2005 if (i != tNumberOfArrayData - 1) {
2006 aSerial->print(F(
", 0x"));
2009 aSerial->println(F(
"};"));
2010 aSerial->print(F(
" "));
2013 aSerial->print(F(
"Send with: "));
2015 aSerial->print(F(
"IrSender.send"));
2018 aSerial->print(F(
"Send with: IrSender.send"));
2021 #if defined(DECODE_DISTANCE_WIDTH)
2025 aSerial->print(F(
"(0x"));
2026 #if defined(DECODE_MAGIQUEST)
2028 # if (__INT_WIDTH__ < 32)
2043 aSerial->print(F(
", 0x"));
2046 aSerial->print(F(
", 2, "));
2049 aSerial->print(F(
", <numberOfRepeats>"));
2052 #if defined(DECODE_DISTANCE_WIDTH)
2057 aSerial->print(F(
"PulseDistanceWidth"));
2058 if(tNumberOfArrayData > 1) {
2059 aSerial->print(F(
"FromArray(38, "));
2061 aSerial->print(F(
"(38, "));
2065 if(tNumberOfArrayData > 1) {
2066 aSerial->print(F(
", &tRawData[0], "));
2068 aSerial->print(F(
", 0x"));
2069 # if (__INT_WIDTH__ < 32)
2074 aSerial->print(F(
", "));
2077 aSerial->print(F(
", PROTOCOL_IS_"));
2080 aSerial->print(
'M');
2082 aSerial->print(
'L');
2084 aSerial->print(F(
"SB_FIRST, <RepeatPeriodMillis>, <numberOfRepeats>"));
2087 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO) || defined(DECODE_RC6)
2089 aSerial->print(F(
", 0x"));
2093 aSerial->print(F(
");"));
2105 aSerial->print(F(
"P="));
2108 #if defined(DECODE_HASH)
2109 aSerial->print(F(
" #=0x"));
2110 # if (__INT_WIDTH__ < 32)
2116 aSerial->print(
' ');
2118 aSerial->println(F(
" bits received"));
2123 aSerial->print(F(
" A=0x"));
2126 aSerial->print(F(
" C=0x"));
2129 aSerial->print(F(
" Raw=0x"));
2130 #if (__INT_WIDTH__ < 32)
2137 aSerial->print(F(
" R"));
2146 uint16_t tSumOfDurationTicks = 0;
2150 aSerial->print(F(
"Duration="));
2151 if (aOutputMicrosecondsInsteadOfTicks) {
2153 aSerial->println(F(
"us"));
2156 aSerial->print(tSumOfDurationTicks);
2157 aSerial->println(F(
" ticks"));
2170 aSerial->print(F(
"rawData["));
2172 aSerial->println(F(
"]: "));
2177 aSerial->print(F(
" -"));
2178 if (aOutputMicrosecondsInsteadOfTicks) {
2185 uint_fast8_t tCounterForNewline = 6;
2188 #if defined(DECODE_DENON) || defined(DECODE_MAGIQUEST)
2197 tCounterForNewline = 0;
2202 uint16_t tSumOfDurationTicks = 0;
2205 if (aOutputMicrosecondsInsteadOfTicks) {
2208 tDuration = tCurrentTicks;
2210 tSumOfDurationTicks += tCurrentTicks;
2213 aSerial->print(
'-');
2215 aSerial->print(F(
" +"));
2219 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 1000) {
2220 aSerial->print(
' ');
2222 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 100) {
2223 aSerial->print(
' ');
2225 if (tDuration < 10) {
2226 aSerial->print(
' ');
2228 aSerial->print(tDuration);
2231 aSerial->print(
',');
2234 tCounterForNewline++;
2235 if ((tCounterForNewline % 8) == 0) {
2241 aSerial->print(F(
"Duration="));
2242 if (aOutputMicrosecondsInsteadOfTicks) {
2244 aSerial->println(F(
"us"));
2247 aSerial->print(tSumOfDurationTicks);
2248 aSerial->println(F(
" ticks"));
2271 if (aOutputMicrosecondsInsteadOfTicks) {
2272 aSerial->print(F(
"uint16_t rawData["));
2274 aSerial->print(F(
"uint8_t rawTicks["));
2278 aSerial->print(F(
"] = {"));
2284 if (aDoCompensate) {
2293 if (aOutputMicrosecondsInsteadOfTicks) {
2294 aSerial->print(tDuration);
2300 tTicks = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2301 aSerial->print(tTicks);
2304 if (!(i & 1)) aSerial->print(
' ');
2308 aSerial->print(F(
"};"));
2311 aSerial->print(F(
" // "));
2341 *aArrayPtr = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2360 aSerial->print(F(
"uint16_t"));
2361 aSerial->print(F(
" address = 0x"));
2363 aSerial->println(
';');
2365 aSerial->print(F(
"uint16_t"));
2366 aSerial->print(F(
" command = 0x"));
2368 aSerial->println(
';');
2371 #if __INT_WIDTH__ < 32
2372 aSerial->print(F(
"uint32_t rawData = 0x"));
2374 aSerial->print(F(
"uint64_t rawData = 0x"));
2376 #if (__INT_WIDTH__ < 32)
2381 aSerial->println(
';');
2386 #if defined(__AVR__)
2424 aResults->
value = 0;
2428 #if defined(DECODE_NEC)
2435 #if defined(DECODE_SONY)
2442 #if defined(DECODE_RC5)
2453 #if defined(DECODE_RC6)
2465 #if defined(DECODE_LG)
2470 #if defined(DECODE_JVC)
2477 #if defined(DECODE_SAMSUNG)
2484 #if defined(DECODE_DENON)
2503 #if defined(_IR_MEASURE_TIMING)
2504 #undef _IR_MEASURE_TIMING
2506 #if defined(LOCAL_TRACE)
2509 #if defined(LOCAL_DEBUG)
2512 #endif // _IR_RECEIVE_HPP