IRremote
|
Functions | |
const char * | getProtocolString (decode_type_t aProtocol) |
void | printIRResultShort (Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap) |
Function to print decoded result and flags in one line. More... | |
uint8_t | bitreverseOneByte (uint8_t aValue) |
uint32_t | bitreverse32Bit (uint32_t aInput) |
if (irparams.TickCounterForISR< UINT16_MAX) | |
if (irparams.StateForISR==IR_REC_STATE_IDLE) | |
if (FeedbackLEDControl.LedFeedbackEnabled==LED_FEEDBACK_ENABLED_FOR_RECEIVE) | |
bool | matchTicks (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) |
Match function without compensating for marks exceeded or spaces shortened by demodulator hardware Currently not used. More... | |
bool | MATCH (unsigned int measured_ticks, unsigned int desired_us) |
bool | matchMark (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) |
Compensate for marks exceeded by demodulator hardware. More... | |
bool | MATCH_MARK (unsigned int measured_ticks, unsigned int desired_us) |
bool | matchSpace (unsigned int aMeasuredTicks, unsigned int aMatchValueMicros) |
Compensate for spaces shortened by demodulator hardware. More... | |
bool | MATCH_SPACE (unsigned int measured_ticks, unsigned int desired_us) |
int | getMarkExcessMicros () |
Getter function for MARK_EXCESS_MICROS. More... | |
void | printActiveIRProtocols (Print *aSerial) |
IRrecv::IRrecv () | |
Instantiate the IRrecv class. More... | |
IRrecv::IRrecv (uint_fast8_t aReceivePin) | |
IRrecv::IRrecv (uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin) | |
Instantiate the IRrecv class. More... | |
void | IRrecv::begin (uint_fast8_t aReceivePin, bool aEnableLEDFeedback=false, uint_fast8_t aFeedbackLEDPin=USE_DEFAULT_FEEDBACK_LED_PIN) |
Initializes the receive and feedback pin. More... | |
void | IRrecv::setReceivePin (uint_fast8_t aReceivePinNumber) |
Sets / changes the receiver pin number. More... | |
void | IRrecv::registerReceiveCompleteCallback (void(*aReceiveCompleteCallbackFunction)(void)) |
Sets the function to call if a protocol message has arrived. More... | |
void | IRrecv::start () |
Start the receiving process. More... | |
void | IRrecv::enableIRIn () |
Alias for start(). More... | |
void | IRrecv::start (uint32_t aMicrosecondsToAddToGapCounter) |
Configures the timer and the state machine for IR reception. More... | |
void | IRrecv::startWithTicksToAdd (uint16_t aTicksToAddToGapCounter) |
void | IRrecv::restartAfterSend () |
Restarts receiver after send. More... | |
void | IRrecv::stop () |
Disables the timer for IR reception. More... | |
void | IRrecv::disableIRIn () |
Alias for stop(). More... | |
void | IRrecv::end () |
Alias for stop(). More... | |
bool | IRrecv::isIdle () |
Returns status of reception. More... | |
void | IRrecv::resume () |
Restart the ISR (Interrupt Service Routine) state machine, to enable receiving of the next IR frame. More... | |
void | IRrecv::initDecodedIRData () |
Is internally called by decode before calling decoders. More... | |
bool | IRrecv::available () |
Returns true if IR receiver data is available. More... | |
IRData * | IRrecv::read () |
If IR receiver data is available, returns pointer to IrReceiver.decodedIRData, else NULL. More... | |
bool | IRrecv::decode () |
The main decode function, attempts to decode the recently receive IR signal. More... | |
bool | IRrecv::decodePulseDistanceWidthData (uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, unsigned int aOneMarkMicros, unsigned int aZeroMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroSpaceMicros, bool aMSBfirst) |
Decode pulse distance width protocols. More... | |
bool | IRrecv::decodePulseDistanceWidthData (PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset=3) |
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants. More... | |
void | IRrecv::initBiphaselevel (uint_fast8_t aRCDecodeRawbuffOffset, unsigned int aBiphaseTimeUnit) |
uint_fast8_t | IRrecv::getBiphaselevel () |
Gets the level of one time interval (aBiphaseTimeUnit) at a time from the raw buffer. More... | |
bool | IRrecv::checkHeader (PulseDistanceWidthProtocolConstants *aProtocolConstants) |
void | IRrecv::checkForRepeatSpaceAndSetFlag (unsigned int aMediumRepeatSpaceMicros) |
bool | IRrecv::checkForRecordGapsMicros (Print *aSerial) |
static void | IRrecv::printActiveIRProtocols (Print *aSerial) |
bool | IRrecv::printIRResultShort (Print *aSerial, bool aPrintRepeatGap=true, bool aCheckForRecordGapsMicros=true) |
Function to print values and flags of IrReceiver.decodedIRData in one line. More... | |
void | IRrecv::printIRSendUsage (Print *aSerial) |
Function to print values and flags of IrReceiver.decodedIRData in one line. More... | |
void | IRrecv::printIRResultMinimal (Print *aSerial) |
Function to print protocol number, address, command, raw data and repeat flag of IrReceiver.decodedIRData in one short line. More... | |
void | IRrecv::printIRResultRawFormatted (Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks=true) |
Dump out the timings in IrReceiver.decodedIRData.rawDataPtr->rawbuf[] array 8 values per line. More... | |
void | IRrecv::compensateAndPrintIRResultAsCArray (Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks=true) |
Dump out the IrReceiver.decodedIRData.rawDataPtr->rawbuf[] to be used as C definition for sendRaw(). More... | |
void | IRrecv::compensateAndStoreIRResultInArray (uint8_t *aArrayPtr) |
Store the decodedIRData to be used for sendRaw(). More... | |
void | IRrecv::printIRResultAsCVariables (Print *aSerial) |
Print results as C variables to be used for sendXXX() More... | |
const char * | IRrecv::getProtocolString () |
bool | IRrecv::decode (decode_results *aResults) __attribute__((deprecated("Please use IrReceiver.decode() without a parameter and IrReceiver.decodedIRData.<fieldname> ."))) |
Variables | |
const char string_Unknown[] | PROGMEM = "UNKNOWN" |
IRrecv | IrReceiver |
The receiver instance. More... | |
struct irparams_struct | irparams |
uint_fast8_t | sBiphaseDecodeRawbuffOffset |
unsigned int | sBiphaseCurrentTimingIntervals |
uint_fast8_t | sBiphaseUsedTimingIntervals |
unsigned int | sBiphaseTimeUnit |
IRrecv::IRrecv | ( | ) |
Instantiate the IRrecv class.
Multiple instantiation is not supported.
IRReceivePin | Arduino pin to use. No sanity check is made. |
Definition at line 70 of file IRReceive.hpp.
IRrecv::IRrecv | ( | uint_fast8_t | aReceivePin | ) |
Definition at line 78 of file IRReceive.hpp.
IRrecv::IRrecv | ( | uint_fast8_t | aReceivePin, |
uint_fast8_t | aFeedbackLEDPin | ||
) |
Instantiate the IRrecv class.
Multiple instantiation is not supported.
aReceivePin | Arduino pin to use, where a demodulating IR receiver is connected. |
aFeedbackLEDPin | if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions |
Definition at line 91 of file IRReceive.hpp.
bool IRrecv::available | ( | ) |
Returns true if IR receiver data is available.
Definition at line 427 of file IRReceive.hpp.
void IRrecv::begin | ( | uint_fast8_t | aReceivePin, |
bool | aEnableLEDFeedback = false , |
||
uint_fast8_t | aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN |
||
) |
Initializes the receive and feedback pin.
aReceivePin | The Arduino pin number, where a demodulating IR receiver is connected. |
aEnableLEDFeedback | if true / ENABLE_LED_FEEDBACK, then let the feedback led blink on receiving IR signal |
aFeedbackLEDPin | if 0 / USE_DEFAULT_FEEDBACK_LED_PIN, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions |
Definition at line 263 of file IRReceive.hpp.
uint32_t bitreverse32Bit | ( | uint32_t | aInput | ) |
Definition at line 274 of file IRProtocol.hpp.
uint8_t bitreverseOneByte | ( | uint8_t | aValue | ) |
Definition at line 261 of file IRProtocol.hpp.
bool IRrecv::checkForRecordGapsMicros | ( | Print * | aSerial | ) |
Definition at line 1075 of file IRReceive.hpp.
void IRrecv::checkForRepeatSpaceAndSetFlag | ( | unsigned int | aMediumRepeatSpaceMicros | ) |
Definition at line 962 of file IRReceive.hpp.
bool IRrecv::checkHeader | ( | PulseDistanceWidthProtocolConstants * | aProtocolConstants | ) |
Definition at line 943 of file IRReceive.hpp.
void IRrecv::compensateAndPrintIRResultAsCArray | ( | Print * | aSerial, |
bool | aOutputMicrosecondsInsteadOfTicks = true |
||
) |
Dump out the IrReceiver.decodedIRData.rawDataPtr->rawbuf[] to be used as C definition for sendRaw().
Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding! Print ticks in 8 bit format to save space. Maximum is 255*50 microseconds = 12750 microseconds = 12.75 ms, which hardly ever occurs inside an IR sequence. Recording of IRremote anyway stops at a gap of RECORD_GAP_MICROS (5 ms).
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
aOutputMicrosecondsInsteadOfTicks | Output the (rawbuf_values * MICROS_PER_TICK) for better readability. |
Definition at line 1467 of file IRReceive.hpp.
void IRrecv::compensateAndStoreIRResultInArray | ( | uint8_t * | aArrayPtr | ) |
Store the decodedIRData to be used for sendRaw().
Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding and store it in an array provided.
Maximum for uint8_t is 255*50 microseconds = 12750 microseconds = 12.75 ms, which hardly ever occurs inside an IR sequence. Recording of IRremote anyway stops at a gap of RECORD_GAP_MICROS (5 ms).
aArrayPtr | Address of an array provided by the caller. |
Definition at line 1527 of file IRReceive.hpp.
bool IRrecv::decode | ( | ) |
The main decode function, attempts to decode the recently receive IR signal.
The set of decoders used is determined by active definitions of the DECODE_<PROTOCOL> macros. Results of decoding are stored in IrReceiver.decodedIRData.* like e.g. IrReceiver.decodedIRData.command.
Definition at line 451 of file IRReceive.hpp.
bool IRrecv::decode | ( | decode_results * | aResults | ) |
Definition at line 1606 of file IRReceive.hpp.
bool IRrecv::decodePulseDistanceWidthData | ( | PulseDistanceWidthProtocolConstants * | aProtocolConstants, |
uint_fast8_t | aNumberOfBits, | ||
uint_fast8_t | aStartOffset = 3 |
||
) |
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
Definition at line 768 of file IRReceive.hpp.
bool IRrecv::decodePulseDistanceWidthData | ( | uint_fast8_t | aNumberOfBits, |
uint_fast8_t | aStartOffset, | ||
unsigned int | aOneMarkMicros, | ||
unsigned int | aZeroMarkMicros, | ||
unsigned int | aOneSpaceMicros, | ||
unsigned int | aZeroSpaceMicros, | ||
bool | aMSBfirst | ||
) |
Decode pulse distance width protocols.
We can have the following protocol timings Pulse distance: Pulses/marks are constant, pause/spaces have different length, like NEC. Pulse width: Pulses/marks have different length, pause/spaces are constant, like Sony. Pulse distance width: Pulses/marks and pause/spaces have different length, often the bit length is constant, like MagiQuest. Pulse distance width can be decoded like pulse width decoder, if this decoder does not check the length of pause/spaces.
Input is IrReceiver.decodedIRData.rawDataPtr->rawbuf[] Output is IrReceiver.decodedIRData.decodedRawData
Assume pulse distance if aOneMarkMicros == aZeroMarkMicros
aNumberOfBits | Number of bits to decode from decodedIRData.rawDataPtr->rawbuf[] array. |
aStartOffset | Offset in decodedIRData.rawDataPtr->rawbuf[] to start decoding. Must point to a mark. |
aOneMarkMicros | Taken as constant BitMarkMicros for pulse distance. |
aZeroMarkMicros | Not required if DECODE_STRICT_CHECKS is not defined. |
aOneSpaceMicros | Taken as (constant) BitSpaceMicros for pulse width. |
aZeroSpaceMicros | Not required if DECODE_STRICT_CHECKS is not defined. |
aMSBfirst | If true send Most Significant Bit first, else send Least Significant Bit (lowest bit) first. |
Definition at line 622 of file IRReceive.hpp.
void IRrecv::disableIRIn | ( | ) |
Alias for stop().
Definition at line 361 of file IRReceive.hpp.
void IRrecv::enableIRIn | ( | ) |
Alias for start().
Definition at line 325 of file IRReceive.hpp.
void IRrecv::end | ( | ) |
Alias for stop().
Definition at line 367 of file IRReceive.hpp.
uint_fast8_t IRrecv::getBiphaselevel | ( | ) |
Gets the level of one time interval (aBiphaseTimeUnit) at a time from the raw buffer.
The RC5/6 decoding is easier if the data is broken into time intervals. E.g. if the buffer has mark for 2 time intervals and space for 1, successive calls to getBiphaselevel will return 1, 1, 0.
_ _ _ _ _ _ _ _ _ _ _ _ _ _____| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Significant clock edge _ _ _ ___ _ ___ ___ _ - Mark
Data _____| |___| |_| |_| |_| |___| |___| |_| | - Data starts with a mark->space bit 1 0 0 0 1 1 0 1 0 1 1 - Space A mark to space at a significant clock edge results in a 1 A space to mark at a significant clock edge results in a 0 (for RC6) Returns current level [MARK or SPACE] or -1 for error (measured time interval is not a multiple of sBiphaseTimeUnit).
Definition at line 806 of file IRReceive.hpp.
int getMarkExcessMicros | ( | ) |
Getter function for MARK_EXCESS_MICROS.
Definition at line 1066 of file IRReceive.hpp.
const char * IRrecv::getProtocolString | ( | ) |
Definition at line 1593 of file IRReceive.hpp.
const char* getProtocolString | ( | decode_type_t | aProtocol | ) |
Definition at line 100 of file IRProtocol.hpp.
if | ( | FeedbackLEDControl. | LedFeedbackEnabled = = LED_FEEDBACK_ENABLED_FOR_RECEIVE | ) |
Definition at line 244 of file IRReceive.hpp.
else if | ( | irparams. | StateForISR = = IR_REC_STATE_IDLE | ) |
Definition at line 157 of file IRReceive.hpp.
if | ( | ) |
Definition at line 147 of file IRReceive.hpp.
void IRrecv::initBiphaselevel | ( | uint_fast8_t | aRCDecodeRawbuffOffset, |
unsigned int | aBiphaseTimeUnit | ||
) |
Definition at line 784 of file IRReceive.hpp.
void IRrecv::initDecodedIRData | ( | ) |
Is internally called by decode before calling decoders.
Must be used to setup data, if you call decoders manually.
Definition at line 396 of file IRReceive.hpp.
bool IRrecv::isIdle | ( | ) |
Returns status of reception.
Definition at line 375 of file IRReceive.hpp.
bool MATCH | ( | unsigned int | measured_ticks, |
unsigned int | desired_us | ||
) |
Definition at line 993 of file IRReceive.hpp.
bool MATCH_MARK | ( | unsigned int | measured_ticks, |
unsigned int | desired_us | ||
) |
Definition at line 1026 of file IRReceive.hpp.
bool MATCH_SPACE | ( | unsigned int | measured_ticks, |
unsigned int | desired_us | ||
) |
Definition at line 1059 of file IRReceive.hpp.
bool matchMark | ( | unsigned int | aMeasuredTicks, |
unsigned int | aMatchValueMicros | ||
) |
Compensate for marks exceeded by demodulator hardware.
Definition at line 1000 of file IRReceive.hpp.
bool matchSpace | ( | unsigned int | aMeasuredTicks, |
unsigned int | aMatchValueMicros | ||
) |
Compensate for spaces shortened by demodulator hardware.
Definition at line 1033 of file IRReceive.hpp.
bool matchTicks | ( | unsigned int | aMeasuredTicks, |
unsigned int | aMatchValueMicros | ||
) |
Match function without compensating for marks exceeded or spaces shortened by demodulator hardware Currently not used.
Definition at line 973 of file IRReceive.hpp.
|
static |
Definition at line 1100 of file IRReceive.hpp.
void printActiveIRProtocols | ( | Print * | aSerial | ) |
Definition at line 1104 of file IRReceive.hpp.
void IRrecv::printIRResultAsCVariables | ( | Print * | aSerial | ) |
Print results as C variables to be used for sendXXX()
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
Definition at line 1554 of file IRReceive.hpp.
void IRrecv::printIRResultMinimal | ( | Print * | aSerial | ) |
Function to print protocol number, address, command, raw data and repeat flag of IrReceiver.decodedIRData in one short line.
Does not print a Newline / does not end with println().
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
Definition at line 1326 of file IRReceive.hpp.
void IRrecv::printIRResultRawFormatted | ( | Print * | aSerial, |
bool | aOutputMicrosecondsInsteadOfTicks = true |
||
) |
Dump out the timings in IrReceiver.decodedIRData.rawDataPtr->rawbuf[] array 8 values per line.
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
aOutputMicrosecondsInsteadOfTicks | Output the (rawbuf_values * MICROS_PER_TICK) for better readability. |
Definition at line 1370 of file IRReceive.hpp.
bool IRrecv::printIRResultShort | ( | Print * | aSerial, |
bool | aPrintRepeatGap = true , |
||
bool | aCheckForRecordGapsMicros = true |
||
) |
Function to print values and flags of IrReceiver.decodedIRData in one line.
Ends with println().
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
aPrintRepeatGap | If true also print the gap before repeats. |
aCheckForRecordGapsMicros | If true, call CheckForRecordGapsMicros() which may do a long printout, which in turn may block the proper detection of repeats.* |
Definition at line 1171 of file IRReceive.hpp.
void printIRResultShort | ( | Print * | aSerial, |
IRData * | aIRDataPtr, | ||
bool | aPrintRepeatGap | ||
) |
Function to print decoded result and flags in one line.
A static function to be able to print data to send or copied received data. Ends with println().
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
aIRDataPtr | Pointer to the data to be printed. |
aPrintRepeatGap | If true also print the gap before repeats. |
Definition at line 166 of file IRProtocol.hpp.
void IRrecv::printIRSendUsage | ( | Print * | aSerial | ) |
Function to print values and flags of IrReceiver.decodedIRData in one line.
Ends with println().
aSerial | The Print object on which to write, for Arduino you can use &Serial. |
Definition at line 1186 of file IRReceive.hpp.
IRData * IRrecv::read | ( | ) |
If IR receiver data is available, returns pointer to IrReceiver.decodedIRData, else NULL.
Definition at line 434 of file IRReceive.hpp.
void IRrecv::registerReceiveCompleteCallback | ( | void(*)(void) | aReceiveCompleteCallbackFunction | ) |
Sets the function to call if a protocol message has arrived.
Definition at line 299 of file IRReceive.hpp.
void IRrecv::restartAfterSend | ( | ) |
Restarts receiver after send.
Is a NOP if sending does not require a timer
Definition at line 346 of file IRReceive.hpp.
void IRrecv::resume | ( | ) |
Restart the ISR (Interrupt Service Routine) state machine, to enable receiving of the next IR frame.
Definition at line 382 of file IRReceive.hpp.
void IRrecv::setReceivePin | ( | uint_fast8_t | aReceivePinNumber | ) |
Sets / changes the receiver pin number.
Definition at line 286 of file IRReceive.hpp.
void IRrecv::start | ( | ) |
Start the receiving process.
This configures the timer and the state machine for IR reception and enables the receive sample timer interrupt which consumes a small amount of CPU every 50 us.
Definition at line 308 of file IRReceive.hpp.
void IRrecv::start | ( | uint32_t | aMicrosecondsToAddToGapCounter | ) |
Configures the timer and the state machine for IR reception.
The tick counter value is already at 100 when decode() gets true, because of the 5000 us minimal gap defined in RECORD_GAP_MICROS.
aMicrosecondsToAddToGapCounter | To compensate for the amount of microseconds the timer was stopped / disabled. |
Definition at line 334 of file IRReceive.hpp.
void IRrecv::startWithTicksToAdd | ( | uint16_t | aTicksToAddToGapCounter | ) |
Definition at line 338 of file IRReceive.hpp.
void IRrecv::stop | ( | ) |
Disables the timer for IR reception.
Definition at line 355 of file IRReceive.hpp.
struct irparams_struct irparams |
Definition at line 59 of file IRReceive.hpp.
IRrecv IrReceiver |
The receiver instance.
Definition at line 59 of file IRReceive.hpp.
const char* const ProtocolNames [] PROGMEM = "UNKNOWN" |
Definition at line 51 of file IRProtocol.hpp.
unsigned int sBiphaseCurrentTimingIntervals |
Definition at line 780 of file IRReceive.hpp.
uint_fast8_t sBiphaseDecodeRawbuffOffset |
Definition at line 779 of file IRReceive.hpp.
unsigned int sBiphaseTimeUnit |
Definition at line 782 of file IRReceive.hpp.
uint_fast8_t sBiphaseUsedTimingIntervals |
Definition at line 781 of file IRReceive.hpp.