41 #if defined(TRACE) && !defined(LOCAL_TRACE)
56 #if defined(IR_SEND_PIN)
57 #define sendPin IR_SEND_PIN
60 #if !defined(NO_LED_SEND_FEEDBACK_CODE)
61 #define LED_SEND_FEEDBACK_CODE // Resolve the double negative
72 #if !defined(IR_SEND_PIN)
80 #if defined(IR_SEND_PIN)
85 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
98 #else // defined(IR_SEND_PIN)
121 #if defined(IR_SEND_PIN)
127 #if defined(LED_SEND_FEEDBACK_CODE)
130 (void) aFeedbackLEDPin;
133 #endif // defined(IR_SEND_PIN)
136 void IRsend::begin(uint_fast8_t aSendPin,
bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin) {
137 (void) aEnableLEDFeedback;
138 begin(aSendPin, aFeedbackLEDPin);
155 auto tProtocol = aIRSendData->
protocol;
156 auto tAddress = aIRSendData->
address;
157 auto tCommand = aIRSendData->
command;
197 if (tProtocol ==
NEC) {
200 }
else if (tProtocol ==
SAMSUNG) {
209 }
else if (tProtocol ==
SONY) {
215 }
else if (tProtocol ==
DENON) {
218 }
else if (tProtocol ==
SHARP) {
221 }
else if (tProtocol ==
LG) {
224 }
else if (tProtocol ==
JVC) {
227 }
else if (tProtocol ==
RC5) {
230 }
else if (tProtocol ==
RC6) {
245 }
else if (tProtocol ==
NEC2) {
248 }
else if (tProtocol ==
ONKYO) {
251 }
else if (tProtocol ==
APPLE) {
254 #if !defined(EXCLUDE_EXOTIC_PROTOCOLS)
262 }
else if (tProtocol ==
FAST) {
266 }
else if (tProtocol ==
LEGO_PF) {
318 if (aProtocol ==
NEC) {
321 }
else if (aProtocol ==
SAMSUNG) {
330 }
else if (aProtocol ==
SONY) {
336 }
else if (aProtocol ==
DENON) {
339 }
else if (aProtocol ==
SHARP) {
342 }
else if (aProtocol ==
LG) {
345 }
else if (aProtocol ==
JVC) {
348 }
else if (aProtocol ==
RC5) {
351 }
else if (aProtocol ==
RC6) {
366 }
else if (aProtocol ==
NEC2) {
369 }
else if (aProtocol ==
ONKYO) {
372 }
else if (aProtocol ==
APPLE) {
375 #if !defined(EXCLUDE_EXOTIC_PROTOCOLS)
379 }
else if (aProtocol ==
FAST) {
383 }
else if (aProtocol ==
LEGO_PF) {
401 void IRsend::sendRaw(
const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) {
408 for (uint_fast16_t i = 0; i < aLengthOfBuffer; i++) {
411 space(aBufferWithMicroseconds[i]);
413 mark(aBufferWithMicroseconds[i]);
421 void IRsend::sendRaw(
const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
422 uint_fast16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
425 while (tNumberOfCommands > 0) {
426 unsigned long tStartOfFrameMillis = millis();
427 sendRaw(aBufferWithMicroseconds, aLengthOfBuffer, aIRFrequencyKilohertz);
432 if (tNumberOfCommands > 0) {
433 auto tCurrentFrameDurationMillis = millis() - tStartOfFrameMillis;
437 if (aRepeatPeriodMillis > tCurrentFrameDurationMillis) {
438 delay(aRepeatPeriodMillis - tCurrentFrameDurationMillis);
448 void IRsend::sendRaw(
const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) {
452 for (uint_fast16_t i = 0; i < aLengthOfBuffer; i++) {
461 void IRsend::sendRaw(
const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
462 uint_fast16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
465 while (tNumberOfCommands > 0) {
466 unsigned long tStartOfFrameMillis = millis();
467 sendRaw(aBufferWithTicks, aLengthOfBuffer, aIRFrequencyKilohertz);
472 if (tNumberOfCommands > 0) {
473 auto tCurrentFrameDurationMillis = millis() - tStartOfFrameMillis;
477 if (aRepeatPeriodMillis > tCurrentFrameDurationMillis) {
478 delay(aRepeatPeriodMillis - tCurrentFrameDurationMillis);
488 void IRsend::sendRaw_P(
const uint16_t aPGMBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer,
489 uint_fast8_t aIRFrequencyKilohertz) {
490 #if !defined(__AVR__)
491 sendRaw(aPGMBufferWithMicroseconds, aLengthOfBuffer, aIRFrequencyKilohertz);
498 # if defined(LOCAL_DEBUG)
500 Serial.print(F(
"aPGMBufferWithMicroseconds=0x"));
501 Serial.println((uint16_t)aPGMBufferWithMicroseconds,HEX);
504 for (uint_fast16_t i = 0; i < aLengthOfBuffer; i++) {
505 uint16_t duration = pgm_read_word(&aPGMBufferWithMicroseconds[i]);
510 # if defined(LOCAL_DEBUG)
511 Serial.print(F(
"S="));
515 # if defined(LOCAL_DEBUG)
516 Serial.print(F(
"M="));
519 # if defined(LOCAL_DEBUG)
520 Serial.println(duration);
526 void IRsend::sendRaw_P(
const uint16_t aPGMBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer,
527 uint_fast8_t aIRFrequencyKilohertz, uint_fast16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
530 while (tNumberOfCommands > 0) {
531 unsigned long tStartOfFrameMillis = millis();
532 sendRaw_P(aPGMBufferWithMicroseconds, aLengthOfBuffer, aIRFrequencyKilohertz);
537 if (tNumberOfCommands > 0) {
538 auto tCurrentFrameDurationMillis = millis() - tStartOfFrameMillis;
542 if (aRepeatPeriodMillis > tCurrentFrameDurationMillis) {
543 delay(aRepeatPeriodMillis - tCurrentFrameDurationMillis);
553 void IRsend::sendRaw_P(
const uint8_t aPGMBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) {
554 #if !defined(__AVR__)
555 sendRaw(aPGMBufferWithTicks, aLengthOfBuffer, aIRFrequencyKilohertz);
560 for (uint_fast16_t i = 0; i < aLengthOfBuffer; i++) {
561 uint16_t duration = pgm_read_byte(&aPGMBufferWithTicks[i]) * (uint_fast16_t)
MICROS_PER_TICK;
565 # if defined(LOCAL_DEBUG)
566 Serial.print(F(
"S="));
570 # if defined(LOCAL_DEBUG)
571 Serial.print(F(
"M="));
574 # if defined(LOCAL_DEBUG)
575 Serial.println(duration);
580 void IRsend::sendRaw_P(
const uint8_t aPGMBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
581 uint_fast16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
584 while (tNumberOfCommands > 0) {
585 unsigned long tStartOfFrameMillis = millis();
586 sendRaw_P(aPGMBufferWithTicks, aLengthOfBuffer, aIRFrequencyKilohertz);
591 if (tNumberOfCommands > 0) {
592 auto tCurrentFrameDurationMillis = millis() - tStartOfFrameMillis;
596 if (aRepeatPeriodMillis > tCurrentFrameDurationMillis) {
597 delay(aRepeatPeriodMillis - tCurrentFrameDurationMillis);
615 uint16_t aZeroSpaceMicros,
IRRawDataType aData, uint_fast8_t aNumberOfBits, uint8_t aFlags) {
617 #if defined(LOCAL_DEBUG)
618 Serial.print(aData, HEX);
620 Serial.println(aNumberOfBits);
626 for (uint_fast8_t i = aNumberOfBits; i > 0; i--) {
628 #if defined(LOCAL_TRACE)
631 mark(aOneMarkMicros);
632 space(aOneSpaceMicros);
634 #if defined(LOCAL_TRACE)
637 mark(aZeroMarkMicros);
638 space(aZeroSpaceMicros);
651 if ((!(aFlags &
SUPPRESS_STOP_BIT)) && (abs(aOneSpaceMicros - aZeroSpaceMicros) > (aOneSpaceMicros / 4))) {
653 #if defined(LOCAL_TRACE)
656 mark(aOneMarkMicros);
658 #if defined(LOCAL_TRACE)
676 uint_fast8_t aNumberOfBits) {
684 uint_fast8_t aNumberOfBits) {
687 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
688 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
707 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
IRRawDataType aData,
708 uint_fast8_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats,
709 void (*aSpecialSendRepeatFunction)()) {
712 if (aSpecialSendRepeatFunction !=
nullptr) {
713 aSpecialSendRepeatFunction();
724 while (tNumberOfCommands > 0) {
725 unsigned long tStartOfFrameMillis = millis();
727 if (tNumberOfCommands < ((uint_fast8_t)
aNumberOfRepeats + 1) && aSpecialSendRepeatFunction !=
nullptr) {
729 aSpecialSendRepeatFunction();
732 mark(aHeaderMarkMicros);
733 space(aHeaderSpaceMicros);
740 if (tNumberOfCommands > 0) {
744 auto tFrameDurationMillis = millis() - tStartOfFrameMillis;
745 if (aRepeatPeriodMillis > tFrameDurationMillis) {
746 delay(aRepeatPeriodMillis - tFrameDurationMillis);
753 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
754 IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
755 int_fast8_t aNumberOfRepeats) {
763 #if defined(LOCAL_DEBUG)
765 Serial.print(F(
"Data[0]=0x"));
766 Serial.print(aDecodedRawDataArray[0], HEX);
767 if (tNumberOf32Or64BitChunks > 1) {
768 Serial.print(F(
" Data[1]=0x"));
769 Serial.print(aDecodedRawDataArray[1], HEX);
771 Serial.print(F(
" #="));
772 Serial.println(aNumberOfBits);
776 while (tNumberOfCommands > 0) {
777 unsigned long tStartOfFrameMillis = millis();
780 mark(aHeaderMarkMicros);
781 space(aHeaderSpaceMicros);
783 for (uint_fast8_t i = 0; i < tNumberOf32Or64BitChunks; ++i) {
784 uint8_t tNumberOfBitsForOneSend;
788 if (i == (tNumberOf32Or64BitChunks - 1)) {
790 tNumberOfBitsForOneSend = aNumberOfBits;
799 tNumberOfBitsForOneSend, tFlags);
805 if (tNumberOfCommands > 0) {
809 auto tFrameDurationMillis = millis() - tStartOfFrameMillis;
810 if (aRepeatPeriodMillis > tFrameDurationMillis) {
811 delay(aRepeatPeriodMillis - tFrameDurationMillis);
818 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
819 IRRawDataType const *aDecodedRawDataPGMArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
820 int_fast8_t aNumberOfRepeats) {
828 #if defined(LOCAL_DEBUG)
830 Serial.print(F(
"Data[0]=0x"));
831 Serial.print(aDecodedRawDataPGMArray[0], HEX);
832 if (tNumberOf32Or64BitChunks > 1) {
833 Serial.print(F(
" Data[1]=0x"));
834 Serial.print(aDecodedRawDataPGMArray[1], HEX);
836 Serial.print(F(
" #="));
837 Serial.println(aNumberOfBits);
841 while (tNumberOfCommands > 0) {
842 unsigned long tStartOfFrameMillis = millis();
845 mark(aHeaderMarkMicros);
846 space(aHeaderSpaceMicros);
848 for (uint_fast8_t i = 0; i < tNumberOf32Or64BitChunks; ++i) {
849 uint8_t tNumberOfBitsForOneSend;
853 if (i == (tNumberOf32Or64BitChunks - 1)) {
855 tNumberOfBitsForOneSend = aNumberOfBits;
864 #if (__INT_WIDTH__ < 32)
865 tDecodedRawData = pgm_read_dword(&aDecodedRawDataPGMArray[i]);
867 tDecodedRawData = aDecodedRawDataPGMArray[i];
870 tNumberOfBitsForOneSend, tFlags);
876 if (tNumberOfCommands > 0) {
880 auto tFrameDurationMillis = millis() - tStartOfFrameMillis;
881 if (aRepeatPeriodMillis > tFrameDurationMillis) {
882 delay(aRepeatPeriodMillis - tFrameDurationMillis);
900 IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
901 int_fast8_t aNumberOfRepeats) {
905 aDistanceWidthTimingInfo->
ZeroSpaceMicros, aDecodedRawDataArray, aNumberOfBits, aFlags, aRepeatPeriodMillis,
911 uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
914 memcpy_P(&tTemporaryDistanceWidthTimingInfo, aDistanceWidthTimingInfoPGM,
sizeof(tTemporaryDistanceWidthTimingInfo));
931 uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
933 #if defined(LOCAL_DEBUG)
934 Serial.print(F(
"Data=0x"));
935 Serial.print(aData, HEX);
936 Serial.print(F(
" #="));
937 Serial.println(aNumberOfBits);
958 while (tNumberOfCommands > 0) {
959 unsigned long tStartOfFrameMillis = millis();
976 if (tNumberOfCommands > 0) {
977 auto tCurrentFrameDurationMillis = millis() - tStartOfFrameMillis;
998 IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
1012 #if defined(LOCAL_DEBUG)
1014 Serial.print(F(
"Data[0]=0x"));
1015 Serial.print(aDecodedRawDataArray[0], HEX);
1016 if (tNumberOf32Or64BitChunks > 1) {
1017 Serial.print(F(
" Data[1]=0x"));
1018 Serial.print(aDecodedRawDataArray[1], HEX);
1020 Serial.print(F(
" #="));
1021 Serial.println(aNumberOfBits);
1026 while (tNumberOfCommands > 0) {
1027 auto tStartOfFrameMillis = millis();
1028 auto tNumberOfBits = aNumberOfBits;
1033 uint8_t tOriginalFlags = aProtocolConstants->
Flags;
1035 for (uint_fast8_t i = 0; i < tNumberOf32Or64BitChunks; ++i) {
1036 uint8_t tNumberOfBitsForOneSend;
1039 if (i == (tNumberOf32Or64BitChunks - 1)) {
1041 tNumberOfBitsForOneSend = tNumberOfBits;
1042 tFlags = tOriginalFlags;
1057 tNumberOfCommands--;
1059 if (tNumberOfCommands > 0) {
1063 auto tFrameDurationMillis = millis() - tStartOfFrameMillis;
1072 IRRawDataType const *aDecodedRawDataPGMArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
1086 #if defined(LOCAL_DEBUG)
1088 Serial.print(F(
"Data[0]=0x"));
1089 Serial.print(aDecodedRawDataPGMArray[0], HEX);
1090 if (tNumberOf32Or64BitChunks > 1) {
1091 Serial.print(F(
" Data[1]=0x"));
1092 Serial.print(aDecodedRawDataPGMArray[1], HEX);
1094 Serial.print(F(
" #="));
1095 Serial.println(aNumberOfBits);
1100 while (tNumberOfCommands > 0) {
1101 auto tStartOfFrameMillis = millis();
1102 auto tNumberOfBits = aNumberOfBits;
1107 uint8_t tOriginalFlags = aProtocolConstants->
Flags;
1109 for (uint_fast8_t i = 0; i < tNumberOf32Or64BitChunks; ++i) {
1110 uint8_t tNumberOfBitsForOneSend;
1113 if (i == (tNumberOf32Or64BitChunks - 1)) {
1115 tNumberOfBitsForOneSend = tNumberOfBits;
1116 tFlags = tOriginalFlags;
1124 #if (__INT_WIDTH__ < 32)
1125 tDecodedRawData = pgm_read_dword(&aDecodedRawDataPGMArray[i]);
1127 tDecodedRawData = aDecodedRawDataPGMArray[i];
1136 tNumberOfCommands--;
1138 if (tNumberOfCommands > 0) {
1142 auto tFrameDurationMillis = millis() - tStartOfFrameMillis;
1155 IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
1158 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
1159 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
1164 IRRawDataType const *aDecodedRawDataPGMArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
1167 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
1168 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
1174 uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
1176 memcpy_P(&tTemporaryPulseDistanceWidthProtocolConstants, aProtocolConstantsPGM,
1177 sizeof(tTemporaryPulseDistanceWidthProtocolConstants));
1198 #if defined(LOCAL_TRACE)
1205 uint_fast8_t tLastBitValue;
1207 uint8_t tBitsToSend;
1210 tMask = 1UL << aNumberOfBits;
1211 if (aSendStartBit) {
1212 tBitsToSend = aNumberOfBits + 1;
1219 tBitsToSend = aNumberOfBits;
1220 tNextBitIsOne = ((aData & tMask) != 0) ? 1 : 0;
1225 for (uint_fast8_t i = tBitsToSend; i > 0; i--) {
1226 bool tCurrentBitIsOne = tNextBitIsOne;
1228 tNextBitIsOne = ((aData & tMask) != 0) || (i == 1);
1229 if (tCurrentBitIsOne) {
1230 #if defined(LOCAL_TRACE)
1233 space(aBiphaseTimeUnit);
1234 if (tNextBitIsOne) {
1235 mark(aBiphaseTimeUnit);
1238 mark(2 * aBiphaseTimeUnit);
1243 #if defined(LOCAL_TRACE)
1246 if (tLastBitValue == 0) {
1247 mark(aBiphaseTimeUnit);
1249 space(aBiphaseTimeUnit);
1273 #if defined(SEND_PWM_BY_TIMER) || defined(USE_NO_SEND_PWM)
1274 # if defined(LED_SEND_FEEDBACK_CODE)
1279 #if defined(SEND_PWM_BY_TIMER)
1288 #elif defined(USE_NO_SEND_PWM)
1292 # if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && !defined(OUTPUT_OPEN_DRAIN)
1295 # elif defined(USE_ACTIVE_HIGH_OUTPUT_FOR_NO_SEND_PWM) || defined(USE_ACTIVE_HIGH_OUTPUT_FOR_SEND_PIN) // USE_ACTIVE_HIGH_OUTPUT_FOR_SEND_PIN is old and deprecated
1303 # if defined(LED_SEND_FEEDBACK_CODE)
1308 #else // defined(SEND_PWM_BY_TIMER)
1310 unsigned long tMicrosOfEndOfNextPWMPause = micros();
1311 # if defined(LED_SEND_FEEDBACK_CODE)
1312 unsigned long tStartMicros = tMicrosOfEndOfNextPWMPause + (136 / CLOCKS_PER_MICRO);
1313 bool tFeedbackLedIsActive =
false;
1315 unsigned long tStartMicros = tMicrosOfEndOfNextPWMPause + (112 / CLOCKS_PER_MICRO);
1327 # if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) || defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN)
1328 # if defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN) || defined(OUTPUT_OPEN_DRAIN)
1329 if (__builtin_constant_p(
sendPin)) {
1341 if (__builtin_constant_p(
sendPin)) {
1356 # if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) || defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN)
1357 # if defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN) || defined(OUTPUT_OPEN_DRAIN)
1358 if (__builtin_constant_p(
sendPin)) {
1368 if (__builtin_constant_p(
sendPin)) {
1380 # if defined(LED_SEND_FEEDBACK_CODE)
1384 if (!tFeedbackLedIsActive) {
1385 tFeedbackLedIsActive =
true;
1396 #if defined(__AVR__) // micros() for STM sometimes give decreasing values if interrupts are disabled. See https://github.com/stm32duino/Arduino_Core_STM32/issues/1680
1399 unsigned long tMicros;
1401 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
1410 #if defined(_IR_MEASURE_TIMING) && defined(_IR_TIMING_TEST_PIN)
1418 uint16_t tDeltaMicros = tMicros - tStartMicros;
1421 if (tDeltaMicros >= aMarkMicros) {
1422 #if defined(LED_SEND_FEEDBACK_CODE)
1425 #if defined(__AVR__)
1430 }
while (tMicros < tMicrosOfEndOfNextPWMPause);
1441 #if defined(SEND_PWM_BY_TIMER)
1443 #elif defined(USE_NO_SEND_PWM)
1444 # if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && !defined(OUTPUT_OPEN_DRAIN)
1447 # elif defined(USE_ACTIVE_HIGH_OUTPUT_FOR_NO_SEND_PWM) || defined(USE_ACTIVE_HIGH_OUTPUT_FOR_SEND_PIN) // USE_ACTIVE_HIGH_OUTPUT_FOR_SEND_PIN is old and deprecated
1453 # if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) || defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN)
1454 # if defined(USE_ACTIVE_LOW_OUTPUT_FOR_SEND_PIN) || defined(OUTPUT_OPEN_DRAIN)
1455 if (__builtin_constant_p(
sendPin)) {
1464 if (__builtin_constant_p(
sendPin)) {
1472 #if defined(LED_SEND_FEEDBACK_CODE)
1491 #if defined(ESP32) || defined(ESP8266)
1496 if (aMicroseconds > 16383) {
1497 delay(aMicroseconds / 1000UL);
1499 delayMicroseconds(
static_cast<uint16_t
>(aMicroseconds % 1000UL));
1501 delayMicroseconds(aMicroseconds);
1505 # if defined(__AVR__)
1506 unsigned long start = micros() - (64 / clockCyclesPerMicrosecond());
1508 unsigned long start = micros();
1511 while (micros() - start < aMicroseconds) {
1523 #if defined(SEND_PWM_BY_TIMER)
1526 #elif defined(USE_NO_SEND_PWM)
1527 (void) aFrequencyKHz;
1531 # if defined(IR_SEND_PIN)
1537 #endif // defined(SEND_PWM_BY_TIMER)
1539 #if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && defined(OUTPUT_OPEN_DRAIN) // the mode INPUT for mimicking open drain is set at IRLedOff()
1540 # if defined(IR_SEND_PIN)
1549 # if defined(__AVR__) || !defined(SEND_PWM_BY_TIMER)
1550 # if defined(IR_SEND_PIN)
1553 if (__builtin_constant_p(
sendPin)) {
1560 #endif // defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN)
1563 #if defined(SEND_PWM_BY_TIMER)
1565 void IRsend::enableHighFrequencyIROut(uint_fast16_t aFrequencyKHz) {
1569 # if defined(__AVR__)
1570 # if defined(IR_SEND_PIN)
1584 #if defined(_IR_MEASURE_TIMING)
1585 #undef _IR_MEASURE_TIMING
1587 #if defined(LOCAL_TRACE)
1590 #if defined(LOCAL_DEBUG)
1593 #endif // _IR_SEND_HPP