33 #ifndef _IR_RECEIVE_HPP
34 #define _IR_RECEIVE_HPP
45 #if !defined(NO_LED_RECEIVE_FEEDBACK_CODE)
46 #define LED_RECEIVE_FEEDBACK_CODE // Resolve the double negative
78 #if defined(LED_RECEIVE_FEEDBACK_CODE)
81 (void) aFeedbackLEDPin;
103 #if defined(ESP8266) || defined(ESP32)
104 #pragma GCC diagnostic push
105 #pragma GCC diagnostic ignored "-Wvolatile"
110 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
115 #if defined(TIMER_REQUIRES_RESET_INTR_PENDING)
121 uint8_t tIRInputLevel = *
irparams.IRReceivePinPortInputRegister &
irparams.IRReceivePinMask;
131 tTickCounterForISR++;
149 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
173 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
176 #if !defined(USE_16_BIT_TIMING_BUFFER)
178 if (tTickCounterForISR > UINT8_MAX) {
179 tTickCounterForISR = UINT8_MAX;
215 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
220 #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
231 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
234 #if !defined(USE_16_BIT_TIMING_BUFFER)
236 if (tTickCounterForISR > UINT8_MAX) {
237 tTickCounterForISR = UINT8_MAX;
249 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
258 #if defined(LED_RECEIVE_FEEDBACK_CODE)
264 #ifdef _IR_MEASURE_TIMING
274 #if defined(ESP8266) || defined(ESP32)
279 #if defined(SUPPORT_MULTIPLE_RECEIVER_INSTANCES)
281 UserIRReceiveTimerInterruptHandler();
289 #if defined(TIMER_INTR_NAME) || defined(ISR)
290 # if defined(TIMER_INTR_NAME)
291 ISR (TIMER_INTR_NAME)
311 void IRrecv::begin(uint_fast8_t aReceivePin,
bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
314 #if defined(LED_RECEIVE_FEEDBACK_CODE)
318 (void) aEnableLEDFeedback;
319 (void) aFeedbackLEDPin;
322 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
334 # if defined(__digitalPinToBit)
335 if (__builtin_constant_p(aReceivePinNumber)) {
336 irparams.IRReceivePinMask = 1UL << (__digitalPinToBit(aReceivePinNumber));
338 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
341 irparams.IRReceivePinMask = digitalPinToBitMask(aReceivePinNumber);
343 # if defined(__digitalPinToPINReg)
347 if (__builtin_constant_p(aReceivePinNumber)) {
348 irparams.IRReceivePinPortInputRegister = __digitalPinToPINReg(aReceivePinNumber);
350 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
353 irparams.IRReceivePinPortInputRegister = portInputRegister(digitalPinToPort(aReceivePinNumber));
358 if (__builtin_constant_p(aReceivePinNumber)) {
365 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
389 #ifdef _IR_MEASURE_TIMING
406 #ifdef _IR_MEASURE_TIMING
431 #ifdef _IR_MEASURE_TIMING
443 #ifdef _IR_MEASURE_TIMING
447 #if defined(ESP8266) || defined(ESP32)
448 #pragma GCC diagnostic push
455 #if defined(SEND_PWM_BY_TIMER) && !defined(SEND_PWM_DOES_NOT_USE_RECEIVE_TIMER)
507 DEBUG_PRINT(F(
"Overflow happened, try to increase the \"RAW_BUFFER_LENGTH\" value of "));
509 DEBUG_PRINTLN(F(
" with #define RAW_BUFFER_LENGTH=<biggerValue>"));
583 #if defined(DECODE_NEC) || defined(DECODE_ONKYO)
590 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
597 #if defined(DECODE_DENON)
604 #if defined(DECODE_SONY)
611 #if defined(DECODE_RC5) || defined(DECODE_MARANTZ)
612 # if defined(DECODE_RC5) && !defined(DECODE_MARANTZ)
614 # elif !defined(DECODE_RC5) && defined(DECODE_MARANTZ)
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)
697 #if defined(DECODE_OPENLASIR)
707 #if defined(DECODE_DISTANCE_WIDTH)
708 TRACE_PRINTLN(F(
"Attempting universal Distance Width decode"));
717 #if defined(DECODE_HASH)
756 bool aIsPulseWidthProtocol,
bool aMSBfirst) {
770 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
773 uint16_t tCurrentTicks;
774 if (aIsPulseWidthProtocol) {
779 tCurrentTicks = *tRawBufPointer++;
780 tBitValue =
matchMark(tCurrentTicks, aOneMicros);
788 tCurrentTicks = *tRawBufPointer++;
789 tBitValue =
matchSpace(tCurrentTicks, aOneMicros);
801 tDecodedData |= tMask;
834 uint16_t aOneThresholdMicros,
bool aIsPulseWidthProtocol,
bool aMSBfirst) {
846 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
848 if (!aIsPulseWidthProtocol) {
852 bool tBitValue = tCurrentMicros > aOneThresholdMicros;
855 if (aIsPulseWidthProtocol) {
868 tDecodedData |= tMask;
886 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
bool aMSBfirst) {
890 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
895 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
897 unsigned int tMarkTicks;
898 unsigned int tSpaceTicks;
901 if (isPulseDistanceProtocol) {
907 tSpaceTicks = *tRawBufPointer++;
908 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
915 tMarkTicks = *tRawBufPointer++;
916 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
929 tDecodedData |= tMask;
945 uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
947 (void) aZeroSpaceMicros;
962 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst) {
966 bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros);
971 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
973 unsigned int tMarkTicks;
974 unsigned int tSpaceTicks;
977 if (isPulseDistanceProtocol) {
982 tMarkTicks = *tRawBufPointer++;
983 tSpaceTicks = *tRawBufPointer++;
984 tBitValue =
matchSpace(tSpaceTicks, aOneSpaceMicros);
987 if (!
matchMark(tMarkTicks, aOneMarkMicros)) {
999 if (!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)) {
1015 tMarkTicks = *tRawBufPointer++;
1016 tBitValue =
matchMark(tMarkTicks, aOneMarkMicros);
1017 tSpaceTicks = *tRawBufPointer++;
1020 if ((tBitValue && !
matchSpace(tSpaceTicks, aOneSpaceMicros))
1021 || ((!tBitValue && !
matchSpace(tSpaceTicks, aZeroSpaceMicros)))) {
1033 if (!tBitValue && !
matchMark(tMarkTicks, aZeroMarkMicros)) {
1054 tDecodedData |= tMask;
1071 #if defined(USE_STRICT_DECODER)
1079 #if defined(USE_STRICT_DECODER)
1086 uint16_t tThresholdMicros;
1088 # if defined(USE_THRESHOLD_DECODER)
1089 if (tIsPulseWidthProtocol) {
1101 if (tIsPulseWidthProtocol) {
1113 uint_fast8_t aNumberOfBits,
IRRawlenType aStartOffset) {
1116 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
1117 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
1125 #define FNV_PRIME_32 16777619
1126 #define FNV_BASIS_32 2166136261
1134 if (newval * 10 < oldval * 8) {
1137 if (oldval * 10 < newval * 8) {
1188 if (aResults->
rawlen < 6) {
1192 for (uint8_t i = 3; i < aResults->
rawlen; i++) {
1198 aResults->
value = hash;
1199 aResults->
bits = 32;
1250 #
if defined(ENABLE_COMPLETE_REPEAT_CHECK)
1264 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1266 uint16_t tMatchValueMicrosQuarter = aMatchValueMicros / 4;
1279 bool passed = (tMeasuredMicros >= (tMatchValueMicrosQuarter * 3) && tMeasuredMicros <= (tMatchValueMicrosQuarter * 5));
1280 #if defined(LOCAL_TRACE)
1282 Serial.println(F(
" => passed"));
1284 Serial.println(F(
" => FAILED"));
1294 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros, int16_t aCompensationMicrosForTicks) {
1295 uint16_t tMeasuredMicros = (aMeasuredTicks *
MICROS_PER_TICK) + aCompensationMicrosForTicks;
1296 uint16_t tMatchValueMicrosQuarter = aMatchValueMicros / 4;
1309 bool passed = (tMeasuredMicros > (tMatchValueMicrosQuarter * 3) && tMeasuredMicros <= (tMatchValueMicrosQuarter * 5));
1310 #if defined(LOCAL_TRACE)
1312 Serial.println(F(
" => passed"));
1314 Serial.println(F(
" => FAILED"));
1319 bool MATCH(uint16_t measured_ticks, uint16_t desired_us) {
1320 return matchTicks(measured_ticks, desired_us);
1327 bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1328 #if (MARK_EXCESS_MICROS == 0)
1329 return matchTicks(aMeasuredTicks, aMatchValueMicros);
1332 # if !defined(USE_OLD_MATCH_FUNCTIONS)
1339 TRACE_PRINT(F(
"Testing mark (actual vs desired): "));
1354 bool passed = ((aMeasuredTicks >=
TICKS_LOW(aMatchValueMicros))
1355 && (aMeasuredTicks <=
TICKS_HIGH(aMatchValueMicros)));
1356 # if defined(LOCAL_TRACE)
1358 Serial.println(F(
" => passed"));
1360 Serial.println(F(
" => FAILED"));
1368 return matchMark(measured_ticks, desired_us);
1375 bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1376 #if (MARK_EXCESS_MICROS == 0)
1377 return matchTicks(aMeasuredTicks, aMatchValueMicros);
1379 # if !defined(USE_OLD_MATCH_FUNCTIONS)
1385 TRACE_PRINT(F(
"Testing space (actual vs desired): "));
1400 bool passed = ((aMeasuredTicks >=
TICKS_LOW(aMatchValueMicros))
1401 && (aMeasuredTicks <=
TICKS_HIGH(aMatchValueMicros)));
1402 # if defined(LOCAL_TRACE)
1404 Serial.println(F(
" => passed"));
1406 Serial.println(F(
" => FAILED"));
1414 return matchSpace(measured_ticks, desired_us);
1437 aSerial->print(F(
"Space of "));
1439 aSerial->print(F(
" us between two detected transmission is smaller than the minimal gap of "));
1441 aSerial->println(F(
" us known for implemented protocols like NEC, Sony, RC5 etc.."));
1442 aSerial->println(F(
"But it can be OK for some yet unsupported protocols, and especially for repeats."));
1443 aSerial->println(F(
"If you get unexpected results, try to increase the RECORD_GAP_MICROS in IRremote.h."));
1463 #if defined(DECODE_ONKYO)
1464 aSerial->print(F(
"Onkyo, "));
1465 #elif defined(DECODE_NEC)
1466 aSerial->print(F(
"NEC/NEC2/Onkyo/Apple, "));
1468 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
1469 aSerial->print(F(
"Panasonic/Kaseikyo, "));
1471 #if defined(DECODE_DENON)
1472 aSerial->print(F(
"Denon/Sharp, "));
1474 #if defined(DECODE_SONY)
1475 aSerial->print(F(
"Sony, "));
1477 #if defined(DECODE_RC5)
1478 aSerial->print(F(
"RC5, "));
1480 #if defined(DECODE_RC6)
1481 aSerial->print(F(
"RC6, "));
1483 #if defined(DECODE_LG)
1484 aSerial->print(F(
"LG, "));
1486 #if defined(DECODE_JVC)
1487 aSerial->print(F(
"JVC, "));
1489 #if defined(DECODE_SAMSUNG)
1490 aSerial->print(F(
"Samsung, "));
1495 #if defined(DECODE_BEO)
1496 aSerial->print(F(
"Bang & Olufsen, "));
1498 #if defined(DECODE_FAST)
1499 aSerial->print(F(
"FAST, "));
1501 #if defined(DECODE_WHYNTER)
1502 aSerial->print(F(
"Whynter, "));
1504 #if defined(DECODE_LEGO_PF)
1505 aSerial->print(F(
"Lego Power Functions, "));
1507 #if defined(DECODE_BOSEWAVE)
1508 aSerial->print(F(
"Bosewave, "));
1510 #if defined(DECODE_MAGIQUEST)
1511 aSerial->print(F(
"MagiQuest, "));
1513 #if defined(DECODE_OPENLASIR)
1514 aSerial->print(F(
"OpenLASIR, "));
1516 #if defined(DECODE_DISTANCE_WIDTH)
1517 aSerial->print(F(
"Universal Pulse Distance Width, "));
1519 #if defined(DECODE_HASH)
1520 aSerial->print(F(
"Hash "));
1522 #if defined(NO_DECODER) // for sending raw only
1543 (void) aPrintRepeatGap;
1550 aSerial->println(F(
"Overflow"));
1552 aSerial->print(F(
"Protocol="));
1555 #if defined(DECODE_HASH)
1556 aSerial->print(F(
" Hash=0x"));
1557 #if (__INT_WIDTH__ < 32)
1564 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1565 aSerial->print(
' ');
1567 aSerial->println(F(
" bits (incl. gap and start) received"));
1570 #if defined(DECODE_DISTANCE_WIDTH)
1576 aSerial->print(F(
" Address=0x"));
1579 aSerial->print(F(
", Command=0x"));
1583 aSerial->print(F(
", Extra=0x"));
1588 aSerial->print(F(
", Parity fail"));
1592 aSerial->print(F(
", Toggle=1"));
1594 #if defined(DECODE_DISTANCE_WIDTH)
1602 aSerial->print(F(
", Raw-Data=0x"));
1603 #if (__INT_WIDTH__ < 32)
1608 aSerial->print(F(
", "));
1614 aSerial->print(F(
" bits,"));
1617 aSerial->print(F(
" MSB first"));
1619 aSerial->print(F(
" LSB first"));
1627 aSerial->print(F(
", "));
1629 aSerial->print(F(
"Auto-"));
1631 aSerial->print(F(
"Repeat"));
1633 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1634 aSerial->print(F(
", Gap="));
1636 aSerial->print(F(
"us"));
1641 uint16_t tSumOfDurationTicks = 0;
1645 aSerial->print(F(
", Duration="));
1647 aSerial->println(F(
"us"));
1666 aSerial->print(F(
"Protocol="));
1668 #if defined(DECODE_DISTANCE_WIDTH)
1674 aSerial->print(F(
" Address=0x"));
1675 aSerial->print(aIRDataPtr->
address, HEX);
1677 aSerial->print(F(
" Command=0x"));
1678 aSerial->print(aIRDataPtr->
command, HEX);
1680 #if defined(DECODE_DISTANCE_WIDTH)
1687 aSerial->print(
' ');
1689 aSerial->print(F(
" bits"));
1692 aSerial->print(F(
" MSB first"));
1694 aSerial->print(F(
" LSB first"));
1701 aSerial->print(
' ');
1703 aSerial->print(F(
"Auto-"));
1705 aSerial->print(F(
"Repeat"));
1722 (void) aPrintRepeatGap;
1729 aSerial->println(F(
"Overflow"));
1732 aSerial->print(F(
"Protocol="));
1735 #if defined(DECODE_HASH)
1736 aSerial->print(F(
" Hash=0x"));
1737 #if (__INT_WIDTH__ < 32)
1744 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1745 aSerial->print(
' ');
1746 aSerial->print((aIRDataPtr->
rawlen + 1) / 2, DEC);
1747 aSerial->println(F(
" bits (incl. gap and start) received"));
1750 #if defined(DECODE_DISTANCE_WIDTH)
1756 aSerial->print(F(
" Address=0x"));
1757 aSerial->print(aIRDataPtr->
address, HEX);
1759 aSerial->print(F(
" Command=0x"));
1760 aSerial->print(aIRDataPtr->
command, HEX);
1763 aSerial->print(F(
" Extra=0x"));
1764 aSerial->print(aIRDataPtr->
extra, HEX);
1768 aSerial->print(F(
" Parity fail"));
1772 aSerial->print(F(
" Toggle=1"));
1774 #if defined(DECODE_DISTANCE_WIDTH)
1782 aSerial->print(F(
" Raw-Data=0x"));
1783 #if (__INT_WIDTH__ < 32)
1791 aSerial->print(
' ');
1793 aSerial->print(F(
" bits"));
1796 aSerial->print(F(
" MSB first"));
1798 aSerial->print(F(
" LSB first"));
1806 aSerial->print(
' ');
1808 aSerial->print(F(
"Auto-"));
1810 aSerial->print(F(
"Repeat"));
1812 #if !defined(DISABLE_CODE_FOR_RECEIVER)
1813 aSerial->print(F(
" Gap="));
1815 aSerial->println(F(
"us"));
1824 aSerial->print(F(
", "));
1826 aSerial->print(F(
", "));
1828 aSerial->print(F(
", "));
1830 aSerial->print(F(
", "));
1832 aSerial->print(F(
", "));
1841 uint8_t tMaximumTick = 0;
1844 if (tMaximumTick < tTick) {
1845 tMaximumTick = tTick;
1848 return tMaximumTick;
1851 uint8_t tMaximumTick = 0;
1854 if (tMaximumTick < tTick) {
1855 tMaximumTick = tTick;
1858 return tMaximumTick;
1865 uint8_t tMaximumTick = 0;
1867 if (aSearchSpaceInsteadOfMark) {
1874 if (tMaximumTick < tTick) {
1875 tMaximumTick = tTick;
1878 return tMaximumTick;
1882 uint16_t tSumOfDurationTicks = 0;
1893 aSerial->print(F(
", <numberOfRepeats>"));
1918 #if defined(DECODE_DISTANCE_WIDTH)
1919 uint_fast8_t tNumberOfArrayData = 0;
1921 # if __INT_WIDTH__ < 32
1922 aSerial->print(F(
"Send on a 8 bit platform with: "));
1924 if(tNumberOfArrayData > 1) {
1926 aSerial->print(F(
" uint32_t tRawData[]={0x"));
1927 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
1930 aSerial->print(F(
"Send on a 32 bit platform with: "));
1932 if(tNumberOfArrayData > 1) {
1934 aSerial->print(F(
" uint64_t tRawData[]={0x"));
1935 for (uint_fast8_t i = 0; i < tNumberOfArrayData; ++i) {
1936 PrintULL::print(aSerial,
decodedIRData.decodedRawDataArray[i], HEX);
1938 if (i != tNumberOfArrayData - 1) {
1939 aSerial->print(F(
", 0x"));
1942 aSerial->println(F(
"};"));
1943 aSerial->print(F(
" "));
1946 aSerial->print(F(
"Send with: "));
1950 aSerial->print(F(
" "));
1952 aSerial->print(F(
" "));
1954 aSerial->print(F(
"IrSender.send"));
1957 aSerial->print(F(
"Send with: IrSender.send"));
1958 #endif // #if defined(DECODE_DISTANCE_WIDTH)
1971 aSerial->print(F(
"Raw(rawIRTimings, sizeof(rawIRTimings) / sizeof(rawIRTimings[0]), 38, <RepeatPeriodMillis>"));
1974 #if defined(DECODE_DISTANCE_WIDTH)
1979 aSerial->print(F(
"PulseDistanceWidth"));
1980 if(tNumberOfArrayData > 1) {
1981 aSerial->print(F(
"FromArray(38, "));
1983 aSerial->print(F(
"(38, "));
1987 if(tNumberOfArrayData > 1) {
1988 aSerial->print(F(
", &tRawData[0], "));
1990 aSerial->print(F(
", 0x"));
1991 # if (__INT_WIDTH__ < 32)
1996 aSerial->print(F(
", "));
1999 aSerial->print(F(
", PROTOCOL_IS_"));
2002 aSerial->print(
'M');
2004 aSerial->print(
'L');
2006 aSerial->print(F(
"SB_FIRST, <RepeatPeriodMillis>"));
2010 #endif // defined(DECODE_DISTANCE_WIDTH)
2016 aSerial->print(F(
"(0x"));
2017 #if defined(DECODE_MAGIQUEST)
2019 # if (__INT_WIDTH__ < 32)
2034 aSerial->print(F(
", 0x"));
2038 aSerial->print(F(
", "));
2046 #if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO) || defined(DECODE_RC6) || defined(DECODE_MARANTZ)
2049 aSerial->print(F(
", 0x"));
2053 aSerial->print(F(
");"));
2066 aSerial->print(F(
"P="));
2069 #if defined(DECODE_HASH)
2070 aSerial->print(F(
" #=0x"));
2071 # if (__INT_WIDTH__ < 32)
2077 aSerial->print(
' ');
2079 aSerial->println(F(
" bits received"));
2084 aSerial->print(F(
" A=0x"));
2087 aSerial->print(F(
" C=0x"));
2090 aSerial->print(F(
" Raw=0x"));
2091 #if (__INT_WIDTH__ < 32)
2098 aSerial->print(F(
" R"));
2107 uint16_t tSumOfDurationTicks = 0;
2111 aSerial->print(F(
"Duration="));
2112 if (aOutputMicrosecondsInsteadOfTicks) {
2114 aSerial->println(F(
"us"));
2117 aSerial->print(tSumOfDurationTicks);
2118 aSerial->println(F(
" ticks"));
2131 aSerial->print(F(
"rawIRTimings["));
2133 aSerial->println(F(
"]: "));
2138 aSerial->print(F(
" -"));
2139 if (aOutputMicrosecondsInsteadOfTicks) {
2146 uint_fast8_t tCounterForNewline = 6;
2149 #if defined(DECODE_DENON) || defined(DECODE_MAGIQUEST)
2158 tCounterForNewline = 0;
2163 uint16_t tSumOfDurationTicks = 0;
2166 if (aOutputMicrosecondsInsteadOfTicks) {
2169 tDuration = tCurrentTicks;
2171 tSumOfDurationTicks += tCurrentTicks;
2174 aSerial->print(
'-');
2176 aSerial->print(F(
" +"));
2180 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 1000) {
2181 aSerial->print(
' ');
2183 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 100) {
2184 aSerial->print(
' ');
2186 if (tDuration < 10) {
2187 aSerial->print(
' ');
2189 aSerial->print(tDuration);
2192 aSerial->print(
',');
2195 tCounterForNewline++;
2196 if ((tCounterForNewline % 8) == 0) {
2202 aSerial->print(F(
"Duration="));
2203 if (aOutputMicrosecondsInsteadOfTicks) {
2205 aSerial->println(F(
"us"));
2208 aSerial->print(tSumOfDurationTicks);
2209 aSerial->println(F(
" ticks"));
2232 if (aOutputMicrosecondsInsteadOfTicks) {
2233 aSerial->print(F(
"uint16_t rawIRTimings["));
2235 aSerial->print(F(
"uint8_t rawTicks["));
2239 aSerial->print(F(
"] = {"));
2245 if (aDoCompensate) {
2254 if (aOutputMicrosecondsInsteadOfTicks) {
2255 aSerial->print(tDuration);
2261 tTicks = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2262 aSerial->print(tTicks);
2265 if (!(i & 1)) aSerial->print(
' ');
2269 aSerial->print(F(
"};"));
2272 aSerial->print(F(
" // "));
2298 *aArrayPtr = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks;
2317 aSerial->print(F(
"uint16_t"));
2318 aSerial->print(F(
" address = 0x"));
2320 aSerial->println(
';');
2322 aSerial->print(F(
"uint16_t"));
2323 aSerial->print(F(
" command = 0x"));
2325 aSerial->println(
';');
2328 #if __INT_WIDTH__ < 32
2329 aSerial->print(F(
"uint32_t rawIRTimings = 0x"));
2331 aSerial->print(F(
"uint64_t rawIRTimings = 0x"));
2333 #if (__INT_WIDTH__ < 32)
2338 aSerial->println(
';');
2342 #if defined(__AVR__)
2380 aResults->
value = 0;
2384 #if defined(DECODE_NEC)
2391 #if defined(DECODE_SONY)
2398 #if defined(DECODE_RC5)
2409 #if defined(DECODE_RC6)
2421 #if defined(DECODE_LG)
2426 #if defined(DECODE_JVC)
2433 #if defined(DECODE_SAMSUNG)
2440 #if defined(DECODE_DENON)
2459 #if defined(_IR_MEASURE_TIMING)
2460 #undef _IR_MEASURE_TIMING
2464 #endif // _IR_RECEIVE_HPP