MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / decodeRC5

Method decodeRC5

src/ir_RC5_RC6.hpp:364–388  ·  view source on GitHub ↗

* Try to decode data as RC5 protocol * mark->space => 0 - Inverse of RC6! * space->mark => 1 * _ _ _ _ _ _ _ _ _ _ _ _ _ * Clock _____| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Significant clock edge /sample point for bit value *

Source from the content-addressed store, hash-verified

362 * S 0 T Address
363 */
364bool IRrecv::decodeRC5() {
365 uint8_t tBitIndex;
366 uint32_t tDecodedRawData = 0;
367
368 // Set Biphase decoding start values
369 initBiphaselevel(1, RC5_UNIT); // Skip gap space
370
371 // Check we have the right amount of data (14 to 26). The +1 is for initial gap. +2 for initial gap and mark of last bit which is a 1
372 if (decodedIRData.rawlen < (RC5_BITS + 1) /* 14 */ ||
373#if defined(DECODE_MARANTZ)
374 ((MARANTZ_BITS * 2) + 2) /* 40, the pause is just extended */ < decodedIRData.rawlen
375#else
376 ((RC5_BITS * 2) + 2) /* 28 */ < decodedIRData.rawlen
377#endif
378 ) {
379 // no debug output, since this check is mainly to determine the received protocol
380 DEBUG_PRINT(F("RC5: Data length="));
381 DEBUG_PRINT(decodedIRData.rawlen);
382#if defined(DECODE_MARANTZ)
383 DEBUG_PRINTLN(F(" is not between 14 and 40"));
384#else
385 DEBUG_PRINTLN(F(" is not between 14 and 28"));
386#endif
387 return false;
388 }
389
390 // Check length of first mark / header
391 if (irparams.rawbuf[1] > (((2 * RC5_UNIT) + (RC5_UNIT / 2)) / MICROS_PER_TICK)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected