Go to the documentation of this file.
33 #ifndef _IR_REMOTE_INT_H
34 #define _IR_REMOTE_INT_H
40 #define NO_MARK_OR_SPACE 2 // Used as return value for getBiphaselevel()
43 #define F_CPU 16000000 // definition for a board for which F_CPU is not defined
45 #if defined(F_CPU) // F_CPU is used to generate the receive send timings in some CPU's
46 #define CLOCKS_PER_MICRO (F_CPU / MICROS_IN_ONE_SECOND)
52 #if defined(SYSCLOCK) // allow for processor specific code to define F_CPU
54 #define F_CPU SYSCLOCK // Clock frequency to be used for timing.
69 #if !defined(RAW_BUFFER_LENGTH)
70 # if (defined(RAMEND) && RAMEND <= 0x2FF) || (defined(RAMSIZE) && RAMSIZE < 0x2FF)
72 #define RAW_BUFFER_LENGTH 100
73 # elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
75 #define RAW_BUFFER_LENGTH 200
78 #define RAW_BUFFER_LENGTH 750 // The value for air condition remotes.
81 #if RAW_BUFFER_LENGTH % 2 == 1
82 #error RAW_BUFFER_LENGTH must be even, since the array consists of space / mark pairs.
85 #if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
106 #if !defined(USE_16_BIT_TIMING_BUFFER) // Use uint16_t buffer for timing. Doubles the RAM requirement. this can be used to override our selection of 8 the bit array
116 #define IR_REC_STATE_IDLE 0 // Counting the gap time and waiting for the start bit to arrive
117 #define IR_REC_STATE_MARK 1 // A mark was received and we are counting the duration of it.
118 #define IR_REC_STATE_SPACE 2 // A space was received and we are counting the duration of it. If space is too long, we assume end of frame.
119 #define IR_REC_STATE_STOP 3 // Stopped until set to IR_REC_STATE_IDLE which can only be done by resume()
130 volatile uint8_t *IRReceivePinPortInputRegister;
131 uint8_t IRReceivePinMask;
134 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
137 #if defined(DECODE_RC5) || defined(DECODE_RC6) || defined(DECODE_MARANTZ)
139 uint_fast8_t RawbuffOffsetForNextBiphaseLevel;
140 uint16_t NumberOfTimingIntervalsInCurrentInterval;
141 uint_fast8_t AlreadyUsedTimingIntervalsOfCurrentInterval;
142 uint16_t BiphaseTimeUnit;
150 #if (__INT_WIDTH__ < 32)
152 #define BITS_IN_DECODED_RAW_DATA_TYPE 32
155 #define BITS_IN_DECODED_RAW_DATA_TYPE 64
157 #define DECODED_RAW_DATA_ARRAY_SIZE ((((RAW_BUFFER_LENGTH - 2) - 1) / (2 * BITS_IN_DECODED_RAW_DATA_TYPE)) + 1) // The -2 is for initial gap + stop bit mark, 128 mark + spaces for 64 bit.
168 #if defined(DECODE_DISTANCE_WIDTH)
212 #define USE_DEFAULT_FEEDBACK_LED_PIN 0xFF // we need it here
217 #if defined(SUPPORT_MULTIPLE_RECEIVER_INSTANCES)
218 IRrecv(uint_fast8_t aReceivePin);
219 IRrecv(uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin);
222 uint_fast8_t aReceivePin)
224 IRrecv(uint_fast8_t aReceivePin,
225 uint_fast8_t aFeedbackLEDPin)
229 #if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
237 void begin(uint_fast8_t aReceivePin,
bool aEnableLEDFeedback =
false, uint_fast8_t aFeedbackLEDPin =
242 void restartTimer(uint32_t aMicrosecondsToAddToGapCounter);
267 void printIRDuration(Print *aSerial,
bool aOutputMicrosecondsInsteadOfTicks);
278 bool printIRResultShort(Print *aSerial,
bool aPrintRepeatGap,
bool aCheckForRecordGapsMicros)
279 __attribute__ ((deprecated ("Remove second parameter, it is not supported any
more.")));
290 void printIRResultAsCArray(Print *aSerial,
bool aOutputMicrosecondsInsteadOfTicks =
true,
bool aDoCompensate =
true);
303 #if defined(USE_STRICT_DECODER)
312 uint_fast8_t aNumberOfBits,
IRRawlenType aStartOffset = 3);
315 bool aIsPulseWidthProtocol,
bool aMSBfirst);
318 uint16_t aOneThresholdMicros,
bool aIsPulseWidthProtocol,
bool aMSBfirst);
321 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
bool aMSBfirst);
324 uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst)
325 __attribute__ ((deprecated (
"Please use decodePulseDistanceWidthData() with 6 parameters.")));
328 uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
bool aMSBfirst);
330 #if defined(DECODE_RC5) || defined(DECODE_MARANTZ) || defined(DECODE_RC6)
331 void initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit);
332 static uint8_t getNumberOfUnitsInInterval(uint16_t aCurrentInterval, uint16_t aTimeUnit);
333 uint_fast8_t getBiphaselevel();
350 #if defined(DECODE_RC5) || defined(DECODE_MARANTZ)
353 #if defined(DECODE_RC6)
384 __attribute__ ((deprecated (
"Please use IrReceiver.decode() without a parameter and IrReceiver.decodedIRData.<fieldname> .")));
387 void blink13(uint8_t aEnableLEDFeedback)
388 __attribute__ ((deprecated (
"Please use setLEDFeedback() or enableLEDFeedback() / disableLEDFeedback().")));
394 uint_fast8_t
compare(uint16_t oldval, uint16_t newval);
407 #if defined(DECODE_DISTANCE_WIDTH)
415 __attribute__ ((deprecated ("Remove last parameter, it is not supported any
more.")));
417 __attribute__ ((deprecated ("Use member function or
printIRDataShort() instead.")));
425 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
426 bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros, int16_t aCompensationMicrosForTicks);
427 bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
428 bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros);
433 bool MATCH(uint16_t measured, uint16_t desired);
434 bool MATCH_MARK(uint16_t measured_ticks, uint16_t desired_us);
435 bool MATCH_SPACE(uint16_t measured_ticks, uint16_t desired_us);
444 #define DISABLE_LED_FEEDBACK false
445 #define ENABLE_LED_FEEDBACK true
457 void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__ ((deprecated (
"Please use setLEDFeedback().")));
464 #if !defined(TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT)
465 #define TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT 25 // Relative tolerance (in percent) for matchTicks(), matchMark() and matchSpace() functions used for protocol decoding.
468 #define TICKS(us) ((us)/MICROS_PER_TICK) // (us)/50
469 #if MICROS_PER_TICK == 50 && TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT == 25 // Defaults
470 #define TICKS_LOW(us) ((us)/67 ) // =(us * 0.75 /MICROS_PER_TICK), 67 = MICROS_PER_TICK / ((100-25)/100) = (MICROS_PER_TICK * 100) / (100-25)
471 #define TICKS_HIGH(us) (((us)/40) + 1) // =(us * 1,25 /MICROS_PER_TICK), 40 = MICROS_PER_TICK / ((100+25)/100) = (MICROS_PER_TICK * 100) / (100+25)
475 #define LTOL (100 - TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT)
478 #define UTOL (100 + TOLERANCE_FOR_DECODERS_MARK_OR_SPACE_MATCHING_PERCENT)
479 #define TICKS_LOW(us) ((uint16_t ) ((long) (us) * LTOL / (MICROS_PER_TICK * 100) ))
480 #define TICKS_HIGH(us) ((uint16_t ) ((long) (us) * UTOL / (MICROS_PER_TICK * 100) + 1))
501 #define SEND_REPEAT_COMMAND true
513 #if defined(IR_SEND_PIN)
516 void begin(uint_fast8_t aFeedbackLEDPin);
518 IRsend(uint_fast8_t aSendPin);
519 void begin(uint_fast8_t aSendPin);
522 void begin(uint_fast8_t aSendPin, uint_fast8_t aFeedbackLEDPin);
523 void begin(uint_fast8_t aSendPin,
bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin)
524 # if !defined (DOXYGEN)
525 __attribute__ ((deprecated (
"Use begin(aSendPin, aFeedbackLEDPin) instead.")));
532 #if defined(SEND_PWM_BY_TIMER)
533 void enableHighFrequencyIROut(uint_fast16_t aFrequencyKHz);
540 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
541 IRDecodedRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
544 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
557 IRDecodedRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
561 uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t
aNumberOfRepeats);
568 uint_fast8_t aNumberOfBits);
570 uint_fast8_t aNumberOfBits);
571 void sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
572 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
573 IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
574 int_fast8_t
aNumberOfRepeats,
void (*aSpecialSendRepeatFunction)() =
nullptr);
576 uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
577 IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits,
bool aMSBFirst,
bool aSendStopBit, uint16_t aRepeatPeriodMillis,
578 int_fast8_t
aNumberOfRepeats,
void (*aSpecialSendRepeatFunction)() =
nullptr)
579 __attribute__ ((deprecated ("Since version 4.1.0 parameter aSendStopBit is not longer required.")));
581 uint16_t aZeroSpaceMicros,
IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, uint8_t aFlags);
582 void sendBiphaseData(uint16_t aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits,
bool aSendStartBit = true);
584 void mark(uint16_t aMarkMicros);
585 static
void space(uint16_t aSpaceMicros);
589 void sendRaw(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz);
590 void sendRaw_P(const uint8_t aPGMBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz);
591 void sendRaw(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
593 void sendRaw_P(const uint8_t aPGMBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
597 void sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz);
598 void sendRaw_P(const uint16_t aPGMBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz);
599 void sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
601 void sendRaw_P(const uint16_t aPGMBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz,
608 int8_t aNumberOfHeaderBits = 8);
610 int8_t aNumberOfHeaderBits = 8);
611 void sendBangOlufsenRaw(uint32_t aRawData, int_fast8_t aBits,
bool aBackToBack = false);
613 bool aUseDatalinkTiming = false);
642 #define OpenLASIR_GetMDeviceId(aCommand) (aCommand & 0xFF)
643 #define OpenLASIR_GetMode(aCommand) ((aCommand >> 8) & 0x1F)
644 #define OpenLASIR_GetData(aCommand) (aCommand >> 13)
655 bool aEnableAutomaticToggle =
true);
658 bool aEnableAutomaticToggle =
true);
669 void sendLegoPowerFunctions(uint8_t aChannel, uint8_t tCommand, uint8_t aMode,
bool aDoSend5Times =
true);
699 void sendJVCMSB(
unsigned long data,
int nbits,
bool repeat =
false);
701 void sendLG(
unsigned long data,
710 void sendNECMSB(uint32_t data, uint8_t nbits,
bool repeat =
false);
719 void sendRC6Raw(uint32_t data, uint8_t nbits);
721 void sendRC6Raw(uint64_t data, uint8_t nbits);
725 void sendSharp(uint16_t address, uint16_t command);
738 #if !defined(IR_SEND_PIN)
758 #endif // _IR_REMOTE_INT_H
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
bool decodeHash()
Decodes an arbitrary IR code to a 32-bit value.
void sendShuzu(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
void sendLGRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Here you can put your raw data, even one with "wrong" checksum.
Results returned from old decoders !!!deprecated!!!
void sendApple(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
Apple: Send NEC with fixed 16 bit Apple address 0x87EE.
void decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
void sendSamsungMSB(unsigned long data, int nbits)
void setLEDFeedbackPin(uint8_t aFeedbackLEDPin)
void setFeedbackLED(bool aSwitchLedOn)
Flash LED while receiving or sending IR data.
void sendDish(uint16_t aData)
void sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Sends NEC protocol.
void stop()
Disables the timer for IR reception.
decode_type_t lastDecodedProtocol
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
void printDistanceWidthTimingInfo(Print *aSerial, DistanceWidthTimingInfoStruct *aDistanceWidthTimingInfo)
void int_fast8_t aNumberOfRepeats
void sendJVC(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
The JVC protocol repeats by skipping the header mark and space -> this leads to a poor repeat detecti...
void disableIRIn()
Alias for stop().
void sendBangOlufsenRaw(uint32_t aRawData, int_fast8_t aBits, bool aBackToBack=false)
void sendKaseikyo_Sharp(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with SHARP_VENDOR_ID_CODE.
void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__((deprecated("Please use setLEDFeedback().")))
Old deprecated function name for setLEDFeedback()
void decodePulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
unsigned int IRRawlenType
bool checkHeader_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM)
void enableIRIn()
Alias for start().
void setSendPin(uint_fast8_t aSendPin)
void sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros, uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRDecodedRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
bool checkForRecordGapsMicros(Print *aSerial)
Checks if protocol is not detected and detected space between two transmissions is smaller than known...
void sendBoseWave(uint8_t aCommand, int_fast8_t aNumberOfRepeats=NO_REPEATS)
void sendSony(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t numberOfBits=12)
size_t compensateAndStorePronto(String *aString, uint16_t frequency=38000U)
void registerReceiveCompleteCallback(void(*aReceiveCompleteCallbackFunction)(void))
Sets the function to call if a complete protocol frame has arrived.
void sendSharp2(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
#define NO_REPEATS
Just for better readability of code.
void sendRC6Raw(uint32_t data, uint8_t nbits)
void mark(uint16_t aMarkMicros)
Sends an IR mark for the specified number of microseconds.
bool decodeDistanceWidth()
void sendSamsungLGRepeat()
Send repeat Repeat commands should be sent in a 110 ms raster.
void sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Sends PulseDistance frames and repeats.
constexpr auto disableLEDFeedbackForReceive
void sendSamsung48(uint16_t aAddress, uint32_t aCommand, int_fast8_t aNumberOfRepeats)
Here we send Samsung48 We send 2 x (8 bit command and then ~command)
void sendRC6(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle=true)
Assemble raw data for RC6 from parameters and toggle state and send We do not wait for the minimal tr...
decode_type_t
An enum consisting of all supported formats.
void printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks=true)
Dump out the timings in IrReceiver.irparams.rawbuf[] array 8 values per line.
bool it is not supported any more
void restartAfterSend()
Restarts receiver after send.
void sendRaw_P(const uint8_t aPGMBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
New function using an 8 byte tick (50 us) timing array in FLASH to save program memory Raw data start...
void sendOpenLASIRRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Send raw 32-bit OpenLASIR data.
static void customDelayMicroseconds(unsigned long aMicroseconds)
Custom delay function that circumvents Arduino's delayMicroseconds 16 bit limit and is (mostly) not e...
IRrecv()
Instantiate the IRrecv class.
void blink13(uint8_t aEnableLEDFeedback) __attribute__((deprecated("Please use setLEDFeedback() or enableLEDFeedback() / disableLEDFeedback().")))
Old deprecated function name for setLEDFeedback() or enableLEDFeedback() / disableLEDFeedback()
void sendMagiQuest(uint32_t aWandId, uint16_t aMagnitude)
bool printIRResultShort(Print *aSerial, bool aPrintRepeatGap, bool aCheckForRecordGapsMicros) __attribute__((deprecated("Remove second parameter
Function to print values and flags of IrReceiver.decodedIRData in one line.
__attribute__((deprecated("This old function sends MSB first! Please use sendSamsung().")))
uint32_t computeOpenLASIRRawDataAndChecksum(uint8_t aAddress, uint16_t aCommand)
Compute the raw 32-bit data for an OpenLASIR frame from 8-bit address and 16-bit command.
decode_type_t decode_type
bool matchTicks(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Match function WITHOUT compensating for marks exceeded or spaces shortened by demodulator hardware Ma...
void(* ReceiveCompleteCallbackFunction)(void)
The function to call if a protocol message has arrived, i.e. StateForISR changed to IR_REC_STATE_STOP...
void begin(uint_fast8_t aReceivePin, bool aEnableLEDFeedback=false, uint_fast8_t aFeedbackLEDPin=USE_DEFAULT_FEEDBACK_LED_PIN)
Initializes the receive and feedback pin.
void checkForRepeatSpaceTicksAndSetFlag(uint16_t aMaximumRepeatSpaceTicks)
bool decodeSonyMSB(decode_results *aResults)
Main class for sending IR signals.
This struct contains the data and control used for receiver functions and the ISR (interrupt service ...
bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
void compensateAndPrintIRResultAsPronto(Print *aSerial, uint16_t frequency=38000U)
Print the result (second argument) as Pronto Hex on the Print supplied as argument.
void sendLG2SpecialRepeat()
Static function for sending special repeat frame.
IRData * read()
Returns pointer to IrReceiver.decodedIRData if IR receiver data is available, else nullptr.
bool decodeLGMSB(decode_results *aResults)
uint16_t computeOpenLASIRRawCommand(uint8_t aDeviceID, uint8_t aMode, uint8_t aData)
Compute the raw 32-bit data for an OpenLASIR frame from 8-bit address, 8-bit DeviceID,...
void sendDenon(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t aSendSharpFrameMarker=0)
void sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Here we send Samsung32 If we get a command < 0x100, we send command and then ~command If we get an ad...
void enableLEDFeedbackForSend()
unsigned long sMicrosAtLastStopTimer
bool MATCH_SPACE(uint16_t measured_ticks, uint16_t desired_us)
bool decodeSAMSUNG(decode_results *aResults)
uint32_t IRDecodedRawDataType
bool decodeLegoPowerFunctions()
void uint8_t int_fast8_t bool aEnableAutomaticToggle instead
bool OverflowFlag
Raw buffer OverflowFlag occurred.
void sendRaw(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz)
Sends an 8 byte tick timing array to save program memory.
void sendPulseDistanceWidth_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
#define DECODED_RAW_DATA_ARRAY_SIZE
bool decodePanasonicMSB(decode_results *aResults)
const char * getProtocolString()
IRRawlenType rawlen
counter of entries in rawbuf
Data structure for the user application, available as decodedIRData.
void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap) __attribute__((deprecated("Remove last parameter
void sendSamsung16BitAddressAndCommand(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Maybe no one needs it in the wild...
void sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle) __attribute__((deprecated("Please use sendRC5(uint8_t aAddress
void compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks=true)
Dump out the IrReceiver.irparams.rawbuf[] to be used as C definition for sendRaw().
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
void disableLEDFeedbackForSend()
void printIRResultMinimal(Print *aSerial)
Function to print protocol number, address, command, raw data and repeat flag of IrReceiver....
void sendSamsungLGSpecialRepeat()
Like above, but implemented as a static function Used for sending special repeat frame.
void disableLEDFeedback()
void sendPulseDistanceWidthFromPGMArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros, uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRDecodedRawDataType const *aDecodedRawDataPGMArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
and not your own IRrecv instance
bool MATCH(uint16_t measured, uint16_t desired)
void sendSharp(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
bool checkHeader(PulseDistanceWidthProtocolConstants *aProtocolConstants)
void sendKaseikyo(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats, uint16_t aVendorCode)
Address can be interpreted as sub-device << 4 + 4 bit device.
uint_fast8_t compare(uint16_t oldval, uint16_t newval)
Compare two (tick) values for Hash decoder Use a tolerance of 20% to enable e.g.
void begin(uint_fast8_t aSendPin)
Initializes the send pin and enable LED feedback with board specific LED_BUILTIN pin if it is defined...
void sendNECMSB(uint32_t data, uint8_t nbits, bool repeat=false)
With Send sendNECMSB() you can send your old 32 bit codes.
void sendKaseikyo_JVC(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with JVC_VENDOR_ID_CODE.
static void printActiveIRProtocols(Print *aSerial)
void printActiveIRProtocols(Print *aSerial)
void sendNEC(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
NEC Send frame and special repeats There is NO delay after the last sent repeat!
void nbits is deprecated and may not work as expected ! Use NumberOfRepeats
uint32_t computeLGRawDataAndChecksum(uint8_t aAddress, uint16_t aCommand)
uint16_t periodOnTimeMicros
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
void sendFAST(uint8_t aCommand, int_fast8_t aNumberOfRepeats)
The FAST protocol repeats by skipping the header mark and space -> this leads to a poor repeat detect...
void sendOpenLASIRRepeat()
Send special OpenLASIR repeat frame (same as NEC repeat frame).
IRDecodedRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send<protocol>Raw functions.
void printIRDuration(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks)
void IRReceiveTimerInterruptHandler()
uint8_t getMaximumTicksFromRawData(bool aSearchSpaceInsteadOfMark)
void sendRC5Marantz(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t aMarantzExtension, bool aEnableAutomaticToggle=true)
!!! Not tested, because no Marantz remote was at hand and no receive function was contributed!...
void restartTimerWithTicksToAdd(uint16_t aTicksToAddToGapCounter)
Configures the timer and the state machine for IR reception.
void sendBiphaseData(uint16_t aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits, bool aSendStartBit=true)
Sends Biphase (Manchester) coded data MSB first This function concatenates two marks to one longer ma...
void sendPanasonic(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with PANASONIC_VENDOR_ID_CODE.
void sendPulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits)
void it is not supported any more
int getMarkExcessMicros()
Getter function for MARK_EXCESS_MICROS.
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
void sendBangOlufsen(uint16_t aHeader, uint8_t aData, int_fast8_t aNumberOfRepeats=NO_REPEATS, int8_t aNumberOfHeaderBits=8)
bool MATCH_MARK(uint16_t measured_ticks, uint16_t desired_us)
uint16_t getPulseCorrectionNanos()
volatile uint_fast16_t TickCounterForISR
Counts 50uS ticks. The value is copied into the rawbuf array on every transition. Counting is indepen...
volatile uint8_t StateForISR
State Machine state.
void setReceivePin(uint_fast8_t aReceivePinNumber)
Sets / changes the receiver pin number.
IRRawbufType rawbuf[RAW_BUFFER_LENGTH]
raw data / tick counts per mark/space. With 8 bit we can only store up to 12.7 ms....
bool decodeDenonOld(decode_results *aResults)
void start()
Start the receiving process.
void sendPulseDistanceWidthFromArray_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
uint32_t computeNECRawDataAndChecksum(uint16_t aAddress, uint16_t aCommand)
Convert 16 bit address and 16 bit command to 32 bit NECRaw data If we get a command < 0x100,...
void initDecodedIRData()
Is internally called by decode before calling decoders.
void sendPronto(const __FlashStringHelper *str, int_fast8_t aNumberOfRepeats=NO_REPEATS)
uint16_t lastDecodedCommand
void sendSamsung16BitAddressAnd8BitCommand(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
Maybe no one needs it in the wild...
void sendJVCMSB(unsigned long data, int nbits, bool repeat=false)
With Send sendJVCMSB() you can send your old 32 bit codes.
void sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros, uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats, void(*aSpecialSendRepeatFunction)()=nullptr) __attribute__((deprecated("Since version 4.1.0 parameter aSendStopBit is not longer required.")))
uint8_t getMaximumMarkTicksFromRawData()
void sendSonyMSB(unsigned long data, int nbits)
Old version with MSB first data.
void setLEDFeedback(bool aEnableLEDFeedback)
bool available()
Returns true if IR receiver has received a complete IR frame (detected by timeout after last mark).
uint16_t extra
Contains upper 16 bit of Magiquest WandID, Kaseikyo unknown vendor ID and Distance protocol (HeaderMa...
void printIRResultAsCVariables(Print *aSerial)
Print results as C variables to be used for sendXXX() uint16_t address = 0x44; uint16_t command = 0x1...
uint16_t periodTimeMicros
uint8_t getMaximumSpaceTicksFromRawData()
void sendPulseDistanceWidthFromPGMArray_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType const *aDecodedRawDataPGMArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
static void space(uint16_t aSpaceMicros)
Sends an IR space for the specified number of microseconds.
bool decode_old(decode_results *aResults)
void sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle=true)
constexpr auto enableLEDFeedbackForReceive
bool decodeStrictPulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, bool aMSBfirst)
void sendOpenLASIRSpecialRepeat()
Static function variant of IRsend::sendOpenLASIRRepeat For use in ProtocolConstants.
void sendBangOlufsenRawDataLink(uint64_t aRawData, int_fast8_t aBits, bool aBackToBack=false, bool aUseDatalinkTiming=false)
void sendNEC2(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
NEC2 Send frame !!! and repeat the frame for each requested repeat !!! There is NO delay after the la...
void end()
Alias for stop().
void sendKaseikyo_Mitsubishi(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with MITSUBISHI_VENDOR_ID_CODE.
IRRawlenType rawlen
Counter of entries in rawbuf of last received frame.
bool decodeNECMSB(decode_results *aResults)
bool decodeNEC()
Decodes also Onkyo and Apple.
bool decodeHashOld(decode_results *aResults)
void printIRSendUsage(Print *aSerial)
Function to print values and flags of IrReceiver.decodedIRData in one line.
bool decodeOpenLASIR()
Decode an OpenLASIR frame.
void sendNECRepeat()
Send special NEC repeat frame Repeat commands should be sent in a 110 ms raster.
void sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits)
Sends PulseDistance from data contained in parameter using ProtocolConstants structure for timing etc...
void sendSAMSUNG(unsigned long data, int nbits)
void IRLedOff()
Just switch the IR sending LED off to send an IR space A space is "no output", so the PWM output is d...
void sendWhynter(uint32_t aData, int_fast8_t aNumberOfRepeats)
uint32_t getTotalDurationOfRawData()
bool decode()
The main decode function, attempts to decode the recently receive IR signal.
void sendSharpRaw(unsigned long data, int nbits)
void sendRC6A(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint16_t aCustomer, bool aEnableAutomaticToggle=true)
Assemble raw data for RC6 from parameters and toggle state and send We do not wait for the minimal tr...
#define RAW_BUFFER_LENGTH
The RAW_BUFFER_LENGTH determines the length of the byte buffer where the received IR timing data is s...
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
There is NO delay after the last sent repeat!
void nbits is deprecated and may not work as expected ! Use Command
void sendLegoPowerFunctions(uint8_t aChannel, uint8_t tCommand, uint8_t aMode, bool aDoSend5Times=true)
size_t write(decode_type_t aProtocol, uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Interprets and sends a IRData structure.
void ReceiveInterruptHandler()
#define USE_DEFAULT_FEEDBACK_LED_PIN
Main class for receiving IR signals.
void sendDenonRaw(uint16_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS) __attribute__((deprecated("Please use sendDenon(aAddress
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
void sendOpenLASIR(uint8_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Send an OpenLASIR frame with special NEC-style repeats.
void sendLG(uint8_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
LG uses the NEC repeat.
void printIRDataShort(Print *aSerial, IRData *aIRDataPtr)
void resume()
Restart the ISR (Interrupt Service Routine) state machine, to enable receiving of the next IR frame.
void sendBangOlufsenDataLink(uint32_t aHeader, uint8_t aData, int_fast8_t aNumberOfRepeats=NO_REPEATS, int8_t aNumberOfHeaderBits=8)
uint16_t lastDecodedAddress
void compensateAndStoreIRResultInArray(uint8_t *aArrayPtr)
Store the decodedIRData to be used for sendRaw().
IRrecv IrReceiver
The receiver instance.
uint16_t initialGapTicks
Contains the initial gap (pre 4.4: the value in rawbuf[0]) of the last received frame.
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
void sendKaseikyo_Denon(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with DENON_VENDOR_ID_CODE.
void sendLG2(uint8_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
LG2 uses a special repeat.
void decodeWithThresholdPulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint16_t aOneThresholdMicros, bool aIsPulseWidthProtocol, bool aMSBfirst)
New threshold decoder to be activated by USE_THRESHOLD_DECODER Assumes a 0 for shorter and a 1 for lo...
void printIRResultAsCArray(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks=true, bool aDoCompensate=true)
void sendVelux(uint8_t aCommand, uint8_t aMotorNumber, uint8_t aMotorSet, uint16_t aSecurityCode, int_fast8_t aNumberOfRepeats)
bool decodeJVCMSB(decode_results *aResults)
void sendNECSpecialRepeat()
Static function variant of IRsend::sendNECRepeat For use in ProtocolConstants.
uint_fast8_t IRReceivePin
Pin connected to IR data from detector.
uint16_t initialGapTicks
Tick counts of the length of the gap between previous and current IR frame. Pre 4....