IRremote
ir_RC5_RC6.hpp
Go to the documentation of this file.
1 /*
2  * ir_RC5_RC6.hpp
3  *
4  * Contains functions for receiving and sending RC5, RC5X, RC6 protocols
5  *
6  * This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
7  *
8  ************************************************************************************
9  * MIT License
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a copy
12  * of this software and associated documentation files (the "Software"), to deal
13  * in the Software without restriction, including without limitation the rights
14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  * copies of the Software, and to permit persons to whom the Software is furnished
16  * to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in all
19  * copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
26  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  *
28  ************************************************************************************
29  */
30 #ifndef _IR_RC5_RC6_HPP
31 #define _IR_RC5_RC6_HPP
32 
33 #if defined(DEBUG) && !defined(LOCAL_DEBUG)
34 #define LOCAL_DEBUG
35 #else
36 //#define LOCAL_DEBUG // This enables debug output only for this file
37 #endif
38 
42 uint8_t sLastSendToggleValue = 1; // To start first command with toggle 0
43 //uint8_t sLastReceiveToggleValue = 3; // 3 -> start value
44 
45 //==============================================================================
46 // RRRR CCCC 55555
47 // R R C 5
48 // RRRR C 5555
49 // R R C 5
50 // R R CCCC 5555
51 //==============================================================================
52 /*
53  Protocol=RC5 Address=0x11 Command=0x36 Raw-Data=0x1476 13 bits MSB first
54  + 900,- 900
55  +1800,-1750 +1800,- 850 + 900,- 850 + 900,-1750
56  + 950,- 850 + 900,- 850 +1800,-1750 + 950,- 850
57  +1800
58  Sum: 23100
59 
60  RC5X with 7.th MSB of command set
61  Protocol=RC5 Address=0x11 Command=0x76 Toggle=1 Raw-Data=0xC76 13 bits MSB first
62  +1800,-1750
63  + 850,- 900 +1800,- 850 + 950,- 850 + 900,-1750
64  + 900,- 850 + 950,- 850 +1800,-1750 + 900,- 850
65  +1800
66  Sum: 23050
67  */
68 //
69 // see: https://www.sbprojects.net/knowledge/ir/rc5.php
70 // https://en.wikipedia.org/wiki/Manchester_code
71 // https://forum.arduino.cc/t/sending-rc-5-extended-code-using-irsender/1045841/10 - Protocol Maranz Extended
72 // mark->space => 0
73 // space->mark => 1
74 // MSB first 1 start bit, 1 field bit, 1 toggle bit + 5 bit address + 6 bit command, no stop bit
75 // Field bit is 1 for RC5 and inverted 7. command bit for RC5X. That way the first 64 commands of RC5X remain compatible with the original RC5.
76 // SF TAAA AACC CCCC
77 // IR duty factor is 25%,
78 //
79 #define RC5_ADDRESS_BITS 5
80 #define RC5_COMMAND_BITS 6
81 #define RC5_COMMAND_FIELD_BIT 1
82 #define RC5_TOGGLE_BIT 1
83 
84 #define RC5_BITS (RC5_COMMAND_FIELD_BIT + RC5_TOGGLE_BIT + RC5_ADDRESS_BITS + RC5_COMMAND_BITS) // 13
85 
86 #define RC5_UNIT 889 // 32 periods of 36 kHz (888.8888)
87 
88 #define MIN_RC5_MARKS ((RC5_BITS + 1) / 2) // 7. Divided by 2 to handle the bit sequence of 01010101 which gives one mark and space for each 2 bits
89 
90 #define RC5_DURATION (15L * RC5_UNIT) // 13335
91 #define RC5_REPEAT_PERIOD (128L * RC5_UNIT) // 113792
92 #define RC5_REPEAT_DISTANCE (RC5_REPEAT_PERIOD - RC5_DURATION) // 100 ms
93 #define RC5_MAXIMUM_REPEAT_DISTANCE (RC5_REPEAT_DISTANCE + (RC5_REPEAT_DISTANCE / 4)) // Just a guess
94 
95 /************************************
96  * Start of send and decode functions
97  ************************************/
98 
103 void IRsend::sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) {
104  // Set IR carrier frequency
106 
107  uint16_t tIRData = ((aAddress & 0x1F) << RC5_COMMAND_BITS);
108 
109  if (aCommand < 0x40) {
110  // Auto discovery of RC5X, set field bit to 1
111  tIRData |= 1 << (RC5_TOGGLE_BIT + RC5_ADDRESS_BITS + RC5_COMMAND_BITS);
112  } else {
113  // Mask bit 7 of command and let field bit 0
114  aCommand &= 0x3F;
115  }
116  tIRData |= aCommand;
117 
118  if (aEnableAutomaticToggle) {
119  if (sLastSendToggleValue == 0) {
121  // set toggled bit
122  tIRData |= 1 << (RC5_ADDRESS_BITS + RC5_COMMAND_BITS);
123  } else {
125  }
126  }
127 
128  uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
129  while (tNumberOfCommands > 0) {
130 
131  // start bit is sent by sendBiphaseData
132  sendBiphaseData(RC5_UNIT, tIRData, RC5_BITS);
133 
134  tNumberOfCommands--;
135  // skip last delay!
136  if (tNumberOfCommands > 0) {
137  // send repeated command in a fixed raster
139  }
140  }
141 }
142 
156  uint8_t tBitIndex;
157  uint32_t tDecodedRawData = 0;
158 
159  // Set Biphase decoding start values
160  initBiphaselevel(1, RC5_UNIT); // Skip gap space
161 
162  // Check we have the right amount of data (11 to 26). The +2 is for initial gap and start bit mark.
163  if (decodedIRData.rawlen < ((RC5_BITS + 1) / 2) + 2 && (RC5_BITS + 2) < decodedIRData.rawlen) {
164  // no debug output, since this check is mainly to determine the received protocol
165  IR_DEBUG_PRINT(F("RC5: "));
166  IR_DEBUG_PRINT(F("Data length="));
168  IR_DEBUG_PRINTLN(F(" is not between 9 and 15"));
169  return false;
170  }
171 
172 // Check start bit, the first space is included in the gap
173  if (getBiphaselevel() != MARK) {
174  IR_DEBUG_PRINT(F("RC5: "));
175  IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
176  return false;
177  }
178 
179  /*
180  * Get data bits - MSB first
181  */
182  for (tBitIndex = 0; sBiphaseDecodeRawbuffOffset < decodedIRData.rawlen; tBitIndex++) {
183  // get next 2 levels and check for transition
184  uint8_t tStartLevel = getBiphaselevel();
185  uint8_t tEndLevel = getBiphaselevel();
186 
187  if ((tStartLevel == SPACE) && (tEndLevel == MARK)) {
188  // we have a space to mark transition here
189  tDecodedRawData = (tDecodedRawData << 1) | 1;
190  } else if ((tStartLevel == MARK) && (tEndLevel == SPACE)) {
191  // we have a mark to space transition here
192  tDecodedRawData = (tDecodedRawData << 1) | 0;
193  } else {
194 #if defined(LOCAL_DEBUG)
195  Serial.print(F("RC5: "));
196  Serial.println(F("no transition found, decode failed"));
197 #endif
198  return false;
199  }
200  }
201 
202  // Success
203  decodedIRData.numberOfBits = tBitIndex; // must be RC5_BITS
204 
205  LongUnion tValue;
206  tValue.ULong = tDecodedRawData;
207  decodedIRData.decodedRawData = tDecodedRawData;
208  decodedIRData.command = tValue.UByte.LowByte & 0x3F;
209  decodedIRData.address = (tValue.UWord.LowWord >> RC5_COMMAND_BITS) & 0x1F;
210 
211  // Get the inverted 7. command bit for RC5X, the inverted value is always 1 for RC5 and serves as a second start bit.
212  if ((tValue.UWord.LowWord & (1 << (RC5_TOGGLE_BIT + RC5_ADDRESS_BITS + RC5_COMMAND_BITS))) == 0) {
213  decodedIRData.command += 0x40;
214  }
215 
217  if (tValue.UByte.MidLowByte & 0x8) {
219  }
221 
222  // check for repeat
224 
225  return true;
226 }
227 
228 //+=============================================================================
229 // RRRR CCCC 6666
230 // R R C 6
231 // RRRR C 6666
232 // R R C 6 6
233 // R R CCCC 666
234 //+=============================================================================
235 //
236 /*
237  Protocol=RC6 Address=0xF1 Command=0x76 Raw-Data=0xF176 20 bits MSB first
238  +2650,- 850
239  + 500,- 850 + 500,- 400 + 450,- 450 + 450,- 850
240  +1400,- 400 + 450,- 450 + 450,- 450 + 450,- 900
241  + 450,- 450 + 450,- 400 + 950,- 850 + 900,- 450
242  + 450,- 450 + 450,- 850 + 950,- 400 + 450,- 900
243  + 450
244  Sum: 23150
245  */
246 // Frame RC6: 1 start bit + 1 Bit "1" + 3 mode bits (000) + 1 toggle bit + 8 address + 8 command bits + 2666us pause
247 // Frame RC6A: 1 start bit + 1 Bit "1" + 3 mode bits (110) + 1 toggle bit + "1" + 14 customer bits + 8 system bits + 8 command bits (=31bits) + 2666us pause
248 // !!! toggle bit has another timing :-( !!!
249 // mark->space => 1
250 // space->mark => 0
251 // https://www.sbprojects.net/knowledge/ir/rc6.php
252 // https://www.mikrocontroller.net/articles/IRMP_-_english#RC6_.2B_RC6A
253 // https://en.wikipedia.org/wiki/Manchester_code
254 #define MIN_RC6_SAMPLES 1
255 
256 #define RC6_RPT_LENGTH 46000
257 
258 #define RC6_LEADING_BIT 1
259 #define RC6_MODE_BITS 3 // never seen others than all 0 for Philips TV
260 #define RC6_TOGGLE_BIT 1 // toggles at every key press. Can be used to distinguish repeats from 2 key presses and has another timing :-(.
261 #define RC6_TOGGLE_BIT_INDEX RC6_MODE_BITS // fourth position, index = 3
262 #define RC6_ADDRESS_BITS 8
263 #define RC6_COMMAND_BITS 8
264 
265 #define RC6_BITS (RC6_LEADING_BIT + RC6_MODE_BITS + RC6_TOGGLE_BIT + RC6_ADDRESS_BITS + RC6_COMMAND_BITS) // 21
266 
267 #define RC6_UNIT 444 // 16 periods of 36 kHz (444.4444)
268 
269 #define RC6_HEADER_MARK (6 * RC6_UNIT) // 2666
270 #define RC6_HEADER_SPACE (2 * RC6_UNIT) // 889
271 
272 #define RC6_TRAILING_SPACE (6 * RC6_UNIT) // 2666
273 #define MIN_RC6_MARKS 4 + ((RC6_ADDRESS_BITS + RC6_COMMAND_BITS) / 2) // 12, 4 are for preamble
274 
275 #define RC6_REPEAT_DISTANCE 107000 // just a guess but > 2.666ms
276 #define RC6_MAXIMUM_REPEAT_DISTANCE (RC6_REPEAT_DISTANCE + (RC6_REPEAT_DISTANCE / 4)) // Just a guess
277 
281 void IRsend::sendRC6(uint32_t aRawData, uint8_t aNumberOfBitsToSend) {
282  sendRC6Raw(aRawData, aNumberOfBitsToSend);
283 }
284 void IRsend::sendRC6Raw(uint32_t aRawData, uint8_t aNumberOfBitsToSend) {
285 // Set IR carrier frequency
287 
288 // Header
291 
292 // Start bit
293  mark(RC6_UNIT);
294  space(RC6_UNIT);
295 
296 // Data MSB first
297  uint32_t mask = 1UL << (aNumberOfBitsToSend - 1);
298  for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
299  // The fourth bit we send is the "double width toggle bit"
300  unsigned int t = (i == (RC6_TOGGLE_BIT_INDEX + 1)) ? (RC6_UNIT * 2) : (RC6_UNIT);
301  if (aRawData & mask) {
302  mark(t);
303  space(t);
304  } else {
305  space(t);
306  mark(t);
307  }
308  }
309 }
310 
315 void IRsend::sendRC6(uint64_t aRawData, uint8_t aNumberOfBitsToSend) {
316  sendRC6Raw(aRawData, aNumberOfBitsToSend);
317 }
318 void IRsend::sendRC6Raw(uint64_t aRawData, uint8_t aNumberOfBitsToSend) {
319 // Set IR carrier frequency
321 
322 // Header
325 
326 // Start bit
327  mark(RC6_UNIT);
328  space(RC6_UNIT);
329 
330 // Data MSB first
331  uint64_t mask = 1ULL << (aNumberOfBitsToSend - 1);
332  for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
333  // The fourth bit we send is the "double width toggle bit"
334  unsigned int t = (i == (RC6_TOGGLE_BIT_INDEX + 1)) ? (RC6_UNIT * 2) : (RC6_UNIT);
335  if (aRawData & mask) {
336  mark(t);
337  space(t);
338  } else {
339  space(t);
340  mark(t);
341  }
342  }
343 }
344 
350 void IRsend::sendRC6(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) {
351 
352  LongUnion tIRRawData;
353  tIRRawData.UByte.LowByte = aCommand;
354  tIRRawData.UByte.MidLowByte = aAddress;
355 
356  tIRRawData.UWord.HighWord = 0; // must clear high word
357  if (aEnableAutomaticToggle) {
358  if (sLastSendToggleValue == 0) {
360  // set toggled bit
361  IR_DEBUG_PRINT(F("Set Toggle "));
362  tIRRawData.UByte.MidHighByte = 1; // 3 Mode bits are 0
363  } else {
365  }
366  }
367 
368 #if defined(LOCAL_DEBUG)
369  Serial.print(F("RC6: "));
370  Serial.print(F("sLastSendToggleValue="));
371  Serial.print (sLastSendToggleValue);
372  Serial.print(F(" RawData="));
373  Serial.println(tIRRawData.ULong, HEX);
374 #endif
375 
376  uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
377  while (tNumberOfCommands > 0) {
378 
379  // start and leading bits are sent by sendRC6
380  sendRC6Raw(tIRRawData.ULong, RC6_BITS - 1); // -1 since the leading bit is additionally sent by sendRC6
381 
382  tNumberOfCommands--;
383  // skip last delay!
384  if (tNumberOfCommands > 0) {
385  // send repeated command in a fixed raster
387  }
388  }
389 }
390 
395  uint8_t tBitIndex;
396  uint32_t tDecodedRawData = 0;
397 
398  // Check we have the right amount of data (). The +3 for initial gap, start bit mark and space
400  IR_DEBUG_PRINT(F("RC6: "));
401  IR_DEBUG_PRINT(F("Data length="));
403  IR_DEBUG_PRINTLN(F(" is not between 15 and 25"));
404  return false;
405  }
406 
407  // Check header "mark" and "space", this must be done for repeat and data
410  // no debug output, since this check is mainly to determine the received protocol
411  IR_DEBUG_PRINT(F("RC6: "));
412  IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
413  return false;
414  }
415 
416  // Set Biphase decoding start values
417  initBiphaselevel(3, RC6_UNIT); // Skip gap-space and start-bit mark + space
418 
419 // Process first bit, which is known to be a 1 (mark->space)
420  if (getBiphaselevel() != MARK) {
421  IR_DEBUG_PRINT(F("RC6: "));
422  IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
423  return false;
424  }
425  if (getBiphaselevel() != SPACE) {
426  IR_DEBUG_PRINT(F("RC6: "));
427  IR_DEBUG_PRINTLN(F("second getBiphaselevel() is not SPACE"));
428  return false;
429  }
430 
431  for (tBitIndex = 0; sBiphaseDecodeRawbuffOffset < decodedIRData.rawlen; tBitIndex++) {
432  uint8_t tStartLevel; // start level of coded bit
433  uint8_t tEndLevel; // end level of coded bit
434 
435  tStartLevel = getBiphaselevel();
436  if (tBitIndex == RC6_TOGGLE_BIT_INDEX) {
437  // Toggle bit is double wide; make sure second half is equal first half
438  if (tStartLevel != getBiphaselevel()) {
439 #if defined(LOCAL_DEBUG)
440  Serial.print(F("RC6: "));
441  Serial.println(F("Toggle mark or space length is wrong"));
442 #endif
443  return false;
444  }
445  }
446 
447  tEndLevel = getBiphaselevel();
448  if (tBitIndex == RC6_TOGGLE_BIT_INDEX) {
449  // Toggle bit is double wide; make sure second half matches
450  if (tEndLevel != getBiphaselevel()) {
451 #if defined(LOCAL_DEBUG)
452  Serial.print(F("RC6: "));
453  Serial.println(F("Toggle mark or space length is wrong"));
454 #endif
455  return false;
456  }
457  }
458 
459  /*
460  * Determine tDecodedRawData bit value by checking the transition type
461  */
462  if ((tStartLevel == MARK) && (tEndLevel == SPACE)) {
463  // we have a mark to space transition here
464  tDecodedRawData = (tDecodedRawData << 1) | 1; // inverted compared to RC5
465  } else if ((tStartLevel == SPACE) && (tEndLevel == MARK)) {
466  // we have a space to mark transition here
467  tDecodedRawData = (tDecodedRawData << 1) | 0;
468  } else {
469 #if defined(LOCAL_DEBUG)
470  Serial.print(F("RC6: "));
471  Serial.println(F("Decode failed"));
472 #endif
473  // we have no transition here or one level is -1 -> error
474  return false; // Error
475  }
476  }
477 
478 // Success
479  decodedIRData.numberOfBits = tBitIndex;
480 
481  LongUnion tValue;
482  tValue.ULong = tDecodedRawData;
483  decodedIRData.decodedRawData = tDecodedRawData;
484 
485  if (tBitIndex < 36) {
486  // RC6 8 address bits, 8 command bits
490  // Check for toggle flag
491  if ((tValue.UByte.MidHighByte & 1) != 0) {
493  }
494  if (tBitIndex > 20) {
496  }
497  } else {
498  // RC6A - 32 bits
500  if ((tValue.UByte.MidLowByte & 0x80) != 0) {
502  }
503  tValue.UByte.MidLowByte &= 0x87F; // mask toggle bit
506  }
507 
508  // check for repeat, do not check toggle bit yet
510 
512  return true;
513 }
514 
515 /*********************************************************************************
516  * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials
517  *********************************************************************************/
518 
522 void IRsend::sendRC5(uint32_t data, uint8_t nbits) {
523  // Set IR carrier frequency
525 
526  // Start
527  mark(RC5_UNIT);
528  space(RC5_UNIT);
529  mark(RC5_UNIT);
530 
531  // Data - Biphase code MSB first
532  for (uint32_t mask = 1UL << (nbits - 1); mask; mask >>= 1) {
533  if (data & mask) {
534  space(RC5_UNIT); // 1 is space, then mark
535  mark(RC5_UNIT);
536  } else {
537  mark(RC5_UNIT);
538  space(RC5_UNIT);
539  }
540  }
541 }
542 
543 /*
544  * Not longer required, use sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) instead
545  */
546 void IRsend::sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle) {
547 // Set IR carrier frequency
549 
550  uint8_t addressBits = 5;
551  uint8_t commandBits = 7;
552 // unsigned long nbits = addressBits + commandBits;
553 
554 // Start
555  mark(RC5_UNIT);
556 
557 // Bit #6 of the command part, but inverted!
558  uint8_t cmdBit6 = (1UL << (commandBits - 1)) & cmd;
559  if (cmdBit6) {
560  // Inverted (1 -> 0 = mark-to-space)
561  mark(RC5_UNIT);
562  space(RC5_UNIT);
563  } else {
564  space(RC5_UNIT);
565  mark(RC5_UNIT);
566  }
567  commandBits--;
568 
569 // Toggle bit
570  static int toggleBit = 1;
571  if (toggle) {
572  if (toggleBit == 0) {
573  toggleBit = 1;
574  } else {
575  toggleBit = 0;
576  }
577  }
578  if (toggleBit) {
579  space(RC5_UNIT);
580  mark(RC5_UNIT);
581  } else {
582  mark(RC5_UNIT);
583  space(RC5_UNIT);
584  }
585 
586 // Address
587  for (uint_fast8_t mask = 1UL << (addressBits - 1); mask; mask >>= 1) {
588  if (addr & mask) {
589  space(RC5_UNIT); // 1 is space, then mark
590  mark(RC5_UNIT);
591  } else {
592  mark(RC5_UNIT);
593  space(RC5_UNIT);
594  }
595  }
596 
597 // Command
598  for (uint_fast8_t mask = 1UL << (commandBits - 1); mask; mask >>= 1) {
599  if (cmd & mask) {
600  space(RC5_UNIT); // 1 is space, then mark
601  mark(RC5_UNIT);
602  } else {
603  mark(RC5_UNIT);
604  space(RC5_UNIT);
605  }
606  }
607 }
608 
610 #if defined(LOCAL_DEBUG)
611 #undef LOCAL_DEBUG
612 #endif
613 #endif // _IR_RC5_RC6_HPP
IRData::address
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
Definition: IRProtocol.h:109
MICROS_PER_TICK
#define MICROS_PER_TICK
microseconds per clock interrupt tick
Definition: IRremote.hpp:249
LongUnion
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
Definition: LongUnion.h:59
RC5_RC6_KHZ
#define RC5_RC6_KHZ
Definition: IRProtocol.h:165
IRData::numberOfBits
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
Definition: IRProtocol.h:118
IRsend::aNumberOfRepeats
void int_fast8_t aNumberOfRepeats
Definition: IRremoteInt.h:520
MICROS_IN_ONE_MILLI
#define MICROS_IN_ONE_MILLI
Definition: IRremote.hpp:254
LongUnion::UByte
struct LongUnion::@4 UByte
IRsend::sendRC6Raw
void sendRC6Raw(uint32_t data, uint8_t nbits)
Definition: ir_RC5_RC6.hpp:284
IRsend::mark
void mark(uint16_t aMarkMicros)
Sends an IR mark for the specified number of microseconds.
Definition: IRSend.hpp:969
IRData::rawlen
uint_fast8_t rawlen
counter of entries in rawbuf
Definition: IRProtocol.h:123
IRsend::sendRC6
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...
Definition: ir_RC5_RC6.hpp:350
sLastSendToggleValue
uint8_t sLastSendToggleValue
Definition: ir_RC5_RC6.hpp:42
sBiphaseDecodeRawbuffOffset
uint_fast8_t sBiphaseDecodeRawbuffOffset
Definition: IRReceive.hpp:856
RC5_UNIT
#define RC5_UNIT
Definition: ir_RC5_RC6.hpp:86
LongUnion::LowByte
uint8_t LowByte
Definition: LongUnion.h:61
RC6_BITS
#define RC6_BITS
Definition: ir_RC5_RC6.hpp:265
irparams_struct::rawbuf
uint16_t rawbuf[RAW_BUFFER_LENGTH]
raw data / tick counts per mark/space, first entry is the length of the gap between previous and curr...
Definition: IRremoteInt.h:113
RC5_REPEAT_DISTANCE
#define RC5_REPEAT_DISTANCE
Definition: ir_RC5_RC6.hpp:92
IRData::rawDataPtr
irparams_struct * rawDataPtr
Pointer of the raw timing data to be decoded. Mainly the OverflowFlag and the data buffer filled by r...
Definition: IRProtocol.h:129
IRData::decodedRawData
IRRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send functions.
Definition: IRProtocol.h:112
IRrecv::checkForRepeatSpaceTicksAndSetFlag
void checkForRepeatSpaceTicksAndSetFlag(uint16_t aMaximumRepeatSpaceTicks)
Definition: IRReceive.hpp:1042
IR_DEBUG_PRINT
#define IR_DEBUG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
Definition: IRremoteInt.h:137
LongUnion::LowWord
uint16_t LowWord
Definition: LongUnion.h:80
matchSpace
bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
Definition: IRReceive.hpp:1116
IRrecv::getBiphaselevel
uint_fast8_t getBiphaselevel()
Gets the level of one time interval (aBiphaseTimeUnit) at a time from the raw buffer.
Definition: IRReceive.hpp:883
RC5_ADDRESS_BITS
#define RC5_ADDRESS_BITS
Definition: ir_RC5_RC6.hpp:79
RC6_HEADER_SPACE
#define RC6_HEADER_SPACE
Definition: ir_RC5_RC6.hpp:270
LongUnion::MidLowByte
uint8_t MidLowByte
Definition: LongUnion.h:62
MIN_RC6_MARKS
#define MIN_RC6_MARKS
Definition: ir_RC5_RC6.hpp:273
LongUnion::HighWord
uint16_t HighWord
Definition: LongUnion.h:81
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:321
IRDATA_FLAGS_EXTRA_INFO
#define IRDATA_FLAGS_EXTRA_INFO
There is extra info not contained in address and data (e.g. Kaseikyo unknown vendor ID,...
Definition: IRProtocol.h:96
IRData::flags
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
Definition: IRProtocol.h:119
IRsend::sendRC5ext
void sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle)
Definition: ir_RC5_RC6.hpp:546
RC5_COMMAND_BITS
#define RC5_COMMAND_BITS
Definition: ir_RC5_RC6.hpp:80
RC6_HEADER_MARK
#define RC6_HEADER_MARK
Definition: ir_RC5_RC6.hpp:269
RC5_BITS
#define RC5_BITS
Definition: ir_RC5_RC6.hpp:84
IRData::command
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
Definition: IRProtocol.h:110
RC6_MAXIMUM_REPEAT_DISTANCE
#define RC6_MAXIMUM_REPEAT_DISTANCE
Definition: ir_RC5_RC6.hpp:276
matchMark
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
Definition: IRReceive.hpp:1083
RC5_TOGGLE_BIT
#define RC5_TOGGLE_BIT
Definition: ir_RC5_RC6.hpp:82
LongUnion::ULong
uint32_t ULong
Definition: LongUnion.h:95
IRDATA_FLAGS_IS_MSB_FIRST
#define IRDATA_FLAGS_IS_MSB_FIRST
Value is mainly determined by the (known) protocol.
Definition: IRProtocol.h:99
IRrecv::decodeRC5
bool decodeRC5()
Try to decode data as RC5 protocol.
Definition: ir_RC5_RC6.hpp:155
RC6_REPEAT_DISTANCE
#define RC6_REPEAT_DISTANCE
Definition: ir_RC5_RC6.hpp:275
IRDATA_FLAGS_TOGGLE_BIT
#define IRDATA_FLAGS_TOGGLE_BIT
Is set if RC5 or RC6 toggle bit is set.
Definition: IRProtocol.h:94
RC5
@ RC5
Definition: IRProtocol.h:58
RC6_TOGGLE_BIT_INDEX
#define RC6_TOGGLE_BIT_INDEX
Definition: ir_RC5_RC6.hpp:261
IRsend::space
static void space(uint16_t aSpaceMicros)
Sends an IR space for the specified number of microseconds.
Definition: IRSend.hpp:1165
IRsend::sendRC5
void sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle=true)
Definition: ir_RC5_RC6.hpp:103
IRrecv::initBiphaselevel
void initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit)
Definition: IRReceive.hpp:861
SPACE
#define SPACE
Definition: IRremoteInt.h:39
LongUnion::MidHighByte
uint8_t MidHighByte
Definition: LongUnion.h:63
RC6
@ RC6
Definition: IRProtocol.h:59
LongUnion::UWord
struct LongUnion::@6 UWord
RC6_UNIT
#define RC6_UNIT
Definition: ir_RC5_RC6.hpp:267
IR_DEBUG_PRINTLN
#define IR_DEBUG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
Definition: IRremoteInt.h:141
IRData::protocol
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
Definition: IRProtocol.h:108
IRrecv::decodeRC6
bool decodeRC6()
Try to decode data as RC6 protocol.
Definition: ir_RC5_RC6.hpp:394
IRsend::sendBiphaseData
void sendBiphaseData(uint16_t aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits)
Sends Biphase data MSB first Always send start bit, do not send the trailing space of the start bit 0...
Definition: IRSend.hpp:909
MARK
#define MARK
Definition: IRremoteInt.h:38
IRsend::aCommand
void aCommand
Definition: IRremoteInt.h:582
RC5_MAXIMUM_REPEAT_DISTANCE
#define RC5_MAXIMUM_REPEAT_DISTANCE
Definition: ir_RC5_RC6.hpp:93
IRsend::enableIROut
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
Definition: IRSend.hpp:1205