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 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 // 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
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 
94 /************************************
95  * Start of send and decode functions
96  ************************************/
97 
102 void IRsend::sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) {
103  // Set IR carrier frequency
105 
106  uint16_t tIRData = ((aAddress & 0x1F) << RC5_COMMAND_BITS);
107 
108  if (aCommand < 0x40) {
109  // Auto discovery of RC5X, set field bit to 1
110  tIRData |= 1 << (RC5_TOGGLE_BIT + RC5_ADDRESS_BITS + RC5_COMMAND_BITS);
111  } else {
112  // Mask bit 7 of command and let field bit 0
113  aCommand &= 0x3F;
114  }
115  tIRData |= aCommand;
116 
117  if (aEnableAutomaticToggle) {
118  if (sLastSendToggleValue == 0) {
120  // set toggled bit
121  tIRData |= 1 << (RC5_ADDRESS_BITS + RC5_COMMAND_BITS);
122  } else {
124  }
125  }
126 
127  uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
128  while (tNumberOfCommands > 0) {
129 
130  // start bit is sent by sendBiphaseData
131  sendBiphaseData(RC5_UNIT, tIRData, RC5_BITS);
132 
133  tNumberOfCommands--;
134  // skip last delay!
135  if (tNumberOfCommands > 0) {
136  // send repeated command in a fixed raster
138  }
139  }
140 #if !defined(DISABLE_CODE_FOR_RECEIVER)
142 #endif
143 }
144 
158  uint8_t tBitIndex;
159  uint32_t tDecodedRawData = 0;
160 
161  // Set Biphase decoding start values
162  initBiphaselevel(1, RC5_UNIT); // Skip gap space
163 
164  // Check we have the right amount of data (11 to 26). The +2 is for initial gap and start bit mark.
166  // no debug output, since this check is mainly to determine the received protocol
167  IR_DEBUG_PRINT(F("RC5: "));
168  IR_DEBUG_PRINT(F("Data length="));
170  IR_DEBUG_PRINTLN(F(" is not between 11 and 26"));
171  return false;
172  }
173 
174 // Check start bit, the first space is included in the gap
175  if (getBiphaselevel() != MARK) {
176  IR_DEBUG_PRINT(F("RC5: "));
177  IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
178  return false;
179  }
180 
181  /*
182  * Get data bits - MSB first
183  */
184  for (tBitIndex = 0; sBiphaseDecodeRawbuffOffset < decodedIRData.rawDataPtr->rawlen; tBitIndex++) {
185  // get next 2 levels and check for transition
186  uint8_t tStartLevel = getBiphaselevel();
187  uint8_t tEndLevel = getBiphaselevel();
188 
189  if ((tStartLevel == SPACE) && (tEndLevel == MARK)) {
190  // we have a space to mark transition here
191  tDecodedRawData = (tDecodedRawData << 1) | 1;
192  } else if ((tStartLevel == MARK) && (tEndLevel == SPACE)) {
193  // we have a mark to space transition here
194  tDecodedRawData = (tDecodedRawData << 1) | 0;
195  } else {
196 #if defined(LOCAL_DEBUG)
197  Serial.print(F("RC5: "));
198  Serial.println(F("no transition found, decode failed"));
199 #endif
200  return false;
201  }
202  }
203 
204  // Success
205  decodedIRData.numberOfBits = tBitIndex; // must be RC5_BITS
206 
207  LongUnion tValue;
208  tValue.ULong = tDecodedRawData;
209  decodedIRData.decodedRawData = tDecodedRawData;
210  decodedIRData.command = tValue.UByte.LowByte & 0x3F;
211  decodedIRData.address = (tValue.UWord.LowWord >> RC5_COMMAND_BITS) & 0x1F;
212 
213  // Get the inverted 7. command bit for RC5X, the inverted value is always 1 for RC5 and serves as a second start bit.
214  if ((tValue.UWord.LowWord & (1 << (RC5_TOGGLE_BIT + RC5_ADDRESS_BITS + RC5_COMMAND_BITS))) == 0) {
215  decodedIRData.command += 0x40;
216  }
217 
219  if (tValue.UByte.MidLowByte & 0x8) {
221  }
223 
224  // check for repeat
226 
227  return true;
228 }
229 
230 //+=============================================================================
231 // RRRR CCCC 6666
232 // R R C 6
233 // RRRR C 6666
234 // R R C 6 6
235 // R R CCCC 666
236 //+=============================================================================
237 //
238 /*
239  Protocol=RC6 Address=0xF1 Command=0x76 Raw-Data=0xF176 20 bits MSB first
240  +2650,- 850
241  + 500,- 850 + 500,- 400 + 450,- 450 + 450,- 850
242  +1400,- 400 + 450,- 450 + 450,- 450 + 450,- 900
243  + 450,- 450 + 450,- 400 + 950,- 850 + 900,- 450
244  + 450,- 450 + 450,- 850 + 950,- 400 + 450,- 900
245  + 450
246  Sum: 23150
247  */
248 // Frame RC6: 1 start bit + 1 Bit "1" + 3 mode bits (000) + 1 toggle bit + 8 address + 8 command bits + 2666us pause
249 // 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
250 // !!! toggle bit has another timing :-( !!!
251 // mark->space => 1
252 // space->mark => 0
253 // https://www.sbprojects.net/knowledge/ir/rc6.php
254 // https://www.mikrocontroller.net/articles/IRMP_-_english#RC6_.2B_RC6A
255 // https://en.wikipedia.org/wiki/Manchester_code
256 #define MIN_RC6_SAMPLES 1
257 
258 #define RC6_RPT_LENGTH 46000
259 
260 #define RC6_LEADING_BIT 1
261 #define RC6_MODE_BITS 3 // never seen others than all 0 for Philips TV
262 #define RC6_TOGGLE_BIT 1 // toggles at every key press. Can be used to distinguish repeats from 2 key presses and has another timing :-(.
263 #define RC6_TOGGLE_BIT_INDEX RC6_MODE_BITS // fourth position, index = 3
264 #define RC6_ADDRESS_BITS 8
265 #define RC6_COMMAND_BITS 8
266 
267 #define RC6_BITS (RC6_LEADING_BIT + RC6_MODE_BITS + RC6_TOGGLE_BIT + RC6_ADDRESS_BITS + RC6_COMMAND_BITS) // 13
268 
269 #define RC6_UNIT 444 // 16 periods of 36 kHz (444.4444)
270 
271 #define RC6_HEADER_MARK (6 * RC6_UNIT) // 2666
272 #define RC6_HEADER_SPACE (2 * RC6_UNIT) // 889
273 
274 #define RC6_TRAILING_SPACE (6 * RC6_UNIT) // 2666
275 #define MIN_RC6_MARKS 4 + ((RC6_ADDRESS_BITS + RC6_COMMAND_BITS) / 2) // 12, 4 are for preamble
276 
277 #define RC6_REPEAT_DISTANCE 107000 // just a guess but > 2.666ms
278 
282 void IRsend::sendRC6(uint32_t aRawData, uint8_t aNumberOfBitsToSend) {
283  sendRC6Raw(aRawData, aNumberOfBitsToSend);
284 }
285 void IRsend::sendRC6Raw(uint32_t aRawData, uint8_t aNumberOfBitsToSend) {
286 // Set IR carrier frequency
288 
289 // Header
292 
293 // Start bit
294  mark(RC6_UNIT);
295  space(RC6_UNIT);
296 
297 // Data MSB first
298  uint32_t mask = 1UL << (aNumberOfBitsToSend - 1);
299  for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
300  // The fourth bit we send is the "double width toggle bit"
301  unsigned int t = (i == (RC6_TOGGLE_BIT_INDEX + 1)) ? (RC6_UNIT * 2) : (RC6_UNIT);
302  if (aRawData & mask) {
303  mark(t);
304  space(t);
305  } else {
306  space(t);
307  mark(t);
308  }
309  }
310 #if !defined(DISABLE_CODE_FOR_RECEIVER)
312 #endif
313 }
314 
319 void IRsend::sendRC6(uint64_t aRawData, uint8_t aNumberOfBitsToSend) {
320  sendRC6Raw(aRawData, aNumberOfBitsToSend);
321 }
322 void IRsend::sendRC6Raw(uint64_t aRawData, uint8_t aNumberOfBitsToSend) {
323 // Set IR carrier frequency
325 
326 // Header
329 
330 // Start bit
331  mark(RC6_UNIT);
332  space(RC6_UNIT);
333 
334 // Data MSB first
335  uint64_t mask = 1ULL << (aNumberOfBitsToSend - 1);
336  for (uint_fast8_t i = 1; mask; i++, mask >>= 1) {
337  // The fourth bit we send is the "double width toggle bit"
338  unsigned int t = (i == (RC6_TOGGLE_BIT_INDEX + 1)) ? (RC6_UNIT * 2) : (RC6_UNIT);
339  if (aRawData & mask) {
340  mark(t);
341  space(t);
342  } else {
343  space(t);
344  mark(t);
345  }
346  }
347 #if !defined(DISABLE_CODE_FOR_RECEIVER)
349 #endif
350 }
351 
357 void IRsend::sendRC6(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) {
358 
359  LongUnion tIRRawData;
360  tIRRawData.UByte.LowByte = aCommand;
361  tIRRawData.UByte.MidLowByte = aAddress;
362 
363  tIRRawData.UWord.HighWord = 0; // must clear high word
364  if (aEnableAutomaticToggle) {
365  if (sLastSendToggleValue == 0) {
367  // set toggled bit
368  IR_DEBUG_PRINT(F("Set Toggle "));
369  tIRRawData.UByte.MidHighByte = 1; // 3 Mode bits are 0
370  } else {
372  }
373  }
374 
375 #if defined(LOCAL_DEBUG)
376  Serial.print(F("RC6: "));
377  Serial.print(F("sLastSendToggleValue="));
378  Serial.print (sLastSendToggleValue);
379  Serial.print(F(" RawData="));
380  Serial.println(tIRRawData.ULong, HEX);
381 #endif
382 
383  uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
384  while (tNumberOfCommands > 0) {
385 
386  // start and leading bits are sent by sendRC6
387  sendRC6Raw(tIRRawData.ULong, RC6_BITS - 1); // -1 since the leading bit is additionally sent by sendRC6
388 
389  tNumberOfCommands--;
390  // skip last delay!
391  if (tNumberOfCommands > 0) {
392  // send repeated command in a fixed raster
394  }
395  }
396 }
397 
402  uint8_t tBitIndex;
403  uint32_t tDecodedRawData = 0;
404 
405  // Check we have the right amount of data (). The +3 for initial gap, start bit mark and space
407  IR_DEBUG_PRINT(F("RC6: "));
408  IR_DEBUG_PRINT(F("Data length="));
410  IR_DEBUG_PRINTLN(F(" is not between 15 and 45"));
411  return false;
412  }
413 
414  // Check header "mark" and "space", this must be done for repeat and data
417  // no debug output, since this check is mainly to determine the received protocol
418  IR_DEBUG_PRINT(F("RC6: "));
419  IR_DEBUG_PRINTLN(F("Header mark or space length is wrong"));
420  return false;
421  }
422 
423  // Set Biphase decoding start values
424  initBiphaselevel(3, RC6_UNIT); // Skip gap-space and start-bit mark + space
425 
426 // Process first bit, which is known to be a 1 (mark->space)
427  if (getBiphaselevel() != MARK) {
428  IR_DEBUG_PRINT(F("RC6: "));
429  IR_DEBUG_PRINTLN(F("first getBiphaselevel() is not MARK"));
430  return false;
431  }
432  if (getBiphaselevel() != SPACE) {
433  IR_DEBUG_PRINT(F("RC6: "));
434  IR_DEBUG_PRINTLN(F("second getBiphaselevel() is not SPACE"));
435  return false;
436  }
437 
438  for (tBitIndex = 0; sBiphaseDecodeRawbuffOffset < decodedIRData.rawDataPtr->rawlen; tBitIndex++) {
439  uint8_t tStartLevel; // start level of coded bit
440  uint8_t tEndLevel; // end level of coded bit
441 
442  tStartLevel = getBiphaselevel();
443  if (tBitIndex == RC6_TOGGLE_BIT_INDEX) {
444  // Toggle bit is double wide; make sure second half is equal first half
445  if (tStartLevel != getBiphaselevel()) {
446 #if defined(LOCAL_DEBUG)
447  Serial.print(F("RC6: "));
448  Serial.println(F("Toggle mark or space length is wrong"));
449 #endif
450  return false;
451  }
452  }
453 
454  tEndLevel = getBiphaselevel();
455  if (tBitIndex == RC6_TOGGLE_BIT_INDEX) {
456  // Toggle bit is double wide; make sure second half matches
457  if (tEndLevel != getBiphaselevel()) {
458 #if defined(LOCAL_DEBUG)
459  Serial.print(F("RC6: "));
460  Serial.println(F("Toggle mark or space length is wrong"));
461 #endif
462  return false;
463  }
464  }
465 
466  /*
467  * Determine tDecodedRawData bit value by checking the transition type
468  */
469  if ((tStartLevel == MARK) && (tEndLevel == SPACE)) {
470  // we have a mark to space transition here
471  tDecodedRawData = (tDecodedRawData << 1) | 1; // inverted compared to RC5
472  } else if ((tStartLevel == SPACE) && (tEndLevel == MARK)) {
473  // we have a space to mark transition here
474  tDecodedRawData = (tDecodedRawData << 1) | 0;
475  } else {
476 #if defined(LOCAL_DEBUG)
477  Serial.print(F("RC6: "));
478  Serial.println(F("Decode failed"));
479 #endif
480  // we have no transition here or one level is -1 -> error
481  return false; // Error
482  }
483  }
484 
485 // Success
486  decodedIRData.numberOfBits = tBitIndex;
487 
488  LongUnion tValue;
489  tValue.ULong = tDecodedRawData;
490  decodedIRData.decodedRawData = tDecodedRawData;
491 
492  if (tBitIndex < 36) {
493  // RC6 8 address bits, 8 command bits
497  // Check for toggle flag
498  if ((tValue.UByte.MidHighByte & 1) != 0) {
500  }
501  if (tBitIndex > 20) {
503  }
504  } else {
505  // RC6A - 32 bits
507  if ((tValue.UByte.MidLowByte & 0x80) != 0) {
509  }
510  tValue.UByte.MidLowByte &= 0x87F; // mask toggle bit
513  }
514 
515  // check for repeat, do not check toggle bit yet
518  }
519 
521  return true;
522 }
523 
524 /*********************************************************************************
525  * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials
526  *********************************************************************************/
527 
531 void IRsend::sendRC5(uint32_t data, uint8_t nbits) {
532  // Set IR carrier frequency
534 
535  // Start
536  mark(RC5_UNIT);
537  space(RC5_UNIT);
538  mark(RC5_UNIT);
539 
540  // Data - Biphase code MSB first
541  for (uint32_t mask = 1UL << (nbits - 1); mask; mask >>= 1) {
542  if (data & mask) {
543  space(RC5_UNIT); // 1 is space, then mark
544  mark(RC5_UNIT);
545  } else {
546  mark(RC5_UNIT);
547  space(RC5_UNIT);
548  }
549  }
550 #if !defined(DISABLE_CODE_FOR_RECEIVER)
552 #endif
553 }
554 
555 /*
556  * Not longer required, use sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) instead
557  */
558 void IRsend::sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle) {
559 // Set IR carrier frequency
561 
562  uint8_t addressBits = 5;
563  uint8_t commandBits = 7;
564 // unsigned long nbits = addressBits + commandBits;
565 
566 // Start
567  mark(RC5_UNIT);
568 
569 // Bit #6 of the command part, but inverted!
570  uint8_t cmdBit6 = (1UL << (commandBits - 1)) & cmd;
571  if (cmdBit6) {
572  // Inverted (1 -> 0 = mark-to-space)
573  mark(RC5_UNIT);
574  space(RC5_UNIT);
575  } else {
576  space(RC5_UNIT);
577  mark(RC5_UNIT);
578  }
579  commandBits--;
580 
581 // Toggle bit
582  static int toggleBit = 1;
583  if (toggle) {
584  if (toggleBit == 0) {
585  toggleBit = 1;
586  } else {
587  toggleBit = 0;
588  }
589  }
590  if (toggleBit) {
591  space(RC5_UNIT);
592  mark(RC5_UNIT);
593  } else {
594  mark(RC5_UNIT);
595  space(RC5_UNIT);
596  }
597 
598 // Address
599  for (uint_fast8_t mask = 1UL << (addressBits - 1); mask; mask >>= 1) {
600  if (addr & mask) {
601  space(RC5_UNIT); // 1 is space, then mark
602  mark(RC5_UNIT);
603  } else {
604  mark(RC5_UNIT);
605  space(RC5_UNIT);
606  }
607  }
608 
609 // Command
610  for (uint_fast8_t mask = 1UL << (commandBits - 1); mask; mask >>= 1) {
611  if (cmd & mask) {
612  space(RC5_UNIT); // 1 is space, then mark
613  mark(RC5_UNIT);
614  } else {
615  mark(RC5_UNIT);
616  space(RC5_UNIT);
617  }
618  }
619 #if !defined(DISABLE_CODE_FOR_RECEIVER)
621 #endif
622 }
623 
625 #if defined(LOCAL_DEBUG)
626 #undef LOCAL_DEBUG
627 #endif
628 #endif // _IR_RC5_RC6_HPP
IRData::address
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
Definition: IRProtocol.h:117
MICROS_PER_TICK
#define MICROS_PER_TICK
microseconds per clock interrupt tick
Definition: IRremote.hpp:258
LongUnion
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
Definition: LongUnion.h:57
RC5_RC6_KHZ
#define RC5_RC6_KHZ
Definition: IRProtocol.h:146
IRData::numberOfBits
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
Definition: IRProtocol.h:120
IRsend::aNumberOfRepeats
void uint8_t int_fast8_t aNumberOfRepeats
Definition: IRremoteInt.h:474
MICROS_IN_ONE_MILLI
#define MICROS_IN_ONE_MILLI
Definition: IRremote.hpp:263
LongUnion::UByte
struct LongUnion::@4 UByte
IRsend::mark
void mark(unsigned int aMarkMicros)
Sends an IR mark for the specified number of microseconds.
Definition: IRSend.hpp:757
IRsend::sendRC6Raw
void sendRC6Raw(uint32_t data, uint8_t nbits)
Definition: ir_RC5_RC6.hpp:285
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:357
IRDATA_FLAGS_IS_REPEAT
#define IRDATA_FLAGS_IS_REPEAT
Definition: IRProtocol.h:94
sLastSendToggleValue
uint8_t sLastSendToggleValue
Definition: ir_RC5_RC6.hpp:42
IRrecv::restartAfterSend
void restartAfterSend()
Restarts receiver after send.
Definition: IRReceive.hpp:346
sBiphaseDecodeRawbuffOffset
uint_fast8_t sBiphaseDecodeRawbuffOffset
Definition: IRReceive.hpp:779
RC5_UNIT
#define RC5_UNIT
Definition: ir_RC5_RC6.hpp:86
LongUnion::LowByte
uint8_t LowByte
Definition: LongUnion.h:59
RC6_BITS
#define RC6_BITS
Definition: ir_RC5_RC6.hpp:267
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:126
IRrecv::initBiphaselevel
void initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, unsigned int aBiphaseTimeUnit)
Definition: IRReceive.hpp:784
IRData::decodedRawData
IRRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send functions.
Definition: IRProtocol.h:122
IR_DEBUG_PRINT
#define IR_DEBUG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
Definition: IRremoteInt.h:133
LongUnion::LowWord
uint16_t LowWord
Definition: LongUnion.h:78
IRsend::sendBiphaseData
void sendBiphaseData(unsigned int 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:706
IRrecv::getBiphaselevel
uint_fast8_t getBiphaselevel()
Gets the level of one time interval (aBiphaseTimeUnit) at a time from the raw buffer.
Definition: IRReceive.hpp:806
irparams_struct::rawlen
uint_fast8_t rawlen
counter of entries in rawbuf
Definition: IRremoteInt.h:109
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:272
LongUnion::MidLowByte
uint8_t MidLowByte
Definition: LongUnion.h:60
MIN_RC6_MARKS
#define MIN_RC6_MARKS
Definition: ir_RC5_RC6.hpp:275
LongUnion::HighWord
uint16_t HighWord
Definition: LongUnion.h:79
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:305
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:98
matchSpace
bool matchSpace(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
Definition: IRReceive.hpp:1033
IRData::flags
uint8_t flags
See IRDATA_FLAGS_* definitions above.
Definition: IRProtocol.h:121
IRsend::sendRC5ext
void sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle)
Definition: ir_RC5_RC6.hpp:558
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:271
IRrecv::checkForRepeatSpaceAndSetFlag
void checkForRepeatSpaceAndSetFlag(unsigned int aMediumRepeatSpaceMicros)
Definition: IRReceive.hpp:962
irparams_struct::rawbuf
unsigned int 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_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:118
RC5_TOGGLE_BIT
#define RC5_TOGGLE_BIT
Definition: ir_RC5_RC6.hpp:82
LongUnion::ULong
uint32_t ULong
Definition: LongUnion.h:93
IRDATA_FLAGS_IS_MSB_FIRST
#define IRDATA_FLAGS_IS_MSB_FIRST
Value is mainly determined by the (known) protocol.
Definition: IRProtocol.h:100
IRsend::space
static void space(unsigned int aSpaceMicros)
Sends an IR space for the specified number of microseconds.
Definition: IRSend.hpp:927
IRrecv::decodeRC5
bool decodeRC5()
Try to decode data as RC5 protocol.
Definition: ir_RC5_RC6.hpp:157
RC6_REPEAT_DISTANCE
#define RC6_REPEAT_DISTANCE
Definition: ir_RC5_RC6.hpp:277
IRDATA_FLAGS_TOGGLE_BIT
#define IRDATA_FLAGS_TOGGLE_BIT
is set if RC5 or RC6 toggle bit is set
Definition: IRProtocol.h:97
RC5
@ RC5
Definition: IRProtocol.h:58
RC6_TOGGLE_BIT_INDEX
#define RC6_TOGGLE_BIT_INDEX
Definition: ir_RC5_RC6.hpp:263
IRsend::sendRC5
void sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle=true)
Definition: ir_RC5_RC6.hpp:102
SPACE
#define SPACE
Definition: IRremoteInt.h:39
LongUnion::MidHighByte
uint8_t MidHighByte
Definition: LongUnion.h:61
RC6
@ RC6
Definition: IRProtocol.h:59
LongUnion::UWord
struct LongUnion::@6 UWord
RC6_UNIT
#define RC6_UNIT
Definition: ir_RC5_RC6.hpp:269
IR_DEBUG_PRINTLN
#define IR_DEBUG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
Definition: IRremoteInt.h:137
matchMark
bool matchMark(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
Definition: IRReceive.hpp:1000
IRData::protocol
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
Definition: IRProtocol.h:116
IRrecv::decodeRC6
bool decodeRC6()
Try to decode data as RC6 protocol.
Definition: ir_RC5_RC6.hpp:401
MARK
#define MARK
Definition: IRremoteInt.h:38
IRsend::aCommand
void uint8_t aCommand
Definition: IRremoteInt.h:474
IrReceiver
IRrecv IrReceiver
The receiver instance.
Definition: IRReceive.hpp:59
IRsend::enableIROut
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
Definition: IRSend.hpp:961
MIN_RC5_MARKS
#define MIN_RC5_MARKS
Definition: ir_RC5_RC6.hpp:88