IRremote
ir_NEC.hpp
Go to the documentation of this file.
1 /*
2  * ir_NEC.hpp
3  *
4  * Contains functions for receiving and sending NEC IR Protocol in "raw" and standard format with 16 or 8 bit address and 8 bit command
5  *
6  * This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
7  *
8  ************************************************************************************
9  * MIT License
10  *
11  * Copyright (c) 2020-2025 Armin Joachimsmeyer
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is furnished
18  * to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in all
21  * copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
24  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
25  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
28  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29  *
30  ************************************************************************************
31  */
32 #ifndef _IR_NEC_HPP
33 #define _IR_NEC_HPP
34 
35 // This block must be located after the includes of other *.hpp files
36 //#define LOCAL_DEBUG // This enables debug output only for this file - only for development
37 #include "LocalDebugLevelStart.h"
38 
42 //==============================================================================
43 // N N EEEEE CCCC
44 // NN N E C
45 // N N N EEE C
46 // N NN E C
47 // N N EEEEE CCCC
48 //==============================================================================
49 /*
50  Protocol=NEC Address=0x4 Command=0x8 Raw-Data=0xF708FB04 32 bits LSB first
51  +8950,-4450
52  + 600,- 500 + 650,- 500 + 600,-1650 + 600,- 550
53  + 600,- 500 + 600,- 500 + 650,- 500 + 600,- 500
54  + 650,-1650 + 600,-1600 + 650,- 500 + 600,-1650
55  + 600,-1650 + 600,-1650 + 600,-1600 + 650,-1600
56  + 650,- 500 + 600,- 550 + 600,- 500 + 600,-1650
57  + 600,- 550 + 600,- 500 + 600,- 550 + 600,- 500
58  + 600,-1650 + 600,-1650 + 600,-1650 + 600,- 550
59  + 600,-1650 + 600,-1650 + 600,-1650 + 600,-1600
60  + 650
61  Sum: 68000
62 
63  Protocol=NEC Address=0x8 Command=0x7 Repeat gap=40900us
64  rawData[4]:
65  -40900
66  +10450,-2250
67  + 700
68  Sum: 13400
69  */
70 // http://www.hifi-remote.com/wiki/index.php/NEC
71 // https://www.sbprojects.net/knowledge/ir/nec.php
72 // NEC: LSB first, <start bit><address:16> (or <address:8><inverted address:8>) <command:16><command:8><inverted command:8><stop bit>.
73 // ONKYO (sometimes called NECext): like NEC but force to 16 independent address and 16 bit command bits: <start bit><address:16><command:16><stop bit>
74 // Standard NEC sends a special fixed repeat frame.
75 // NEC2: like NEC, but for repeat, the same full frame is sent after the 110 ms. I have a DVD remote with NEC2.
76 // NEC and NEC 2 only differ in the repeat frames, so the protocol can only be detected correctly after the first repeat.
77 // PIONEER (not implemented) is NEC2 with 40 kHz
78 //
79 // For Apple see https://en.wikipedia.org/wiki/Apple_Remote - <start bit><0x87EE:16><device ID:8><command:7><parity><stop bit> - not implemented!
80 // The parity is not implemented, so we get: <start bit><0x87EE:16><device ID:8><command:8><stop bit>
81 //
82 // IRP notation:
83 // IRP: NEC {38.0k,564}<1,-1|1,-3>(16,-8,D:8,S:8,F:8,~F:8,1,^108m,(16,-4,1,^108m)*) ==> "*" means send special repeat frames o ore more times
84 // IRP: NEC2 {38.0k,564}<1,-1|1,-3>(16,-8,D:8,S:8,F:8,~F:8,1,^108m)+ ==> "+" means send frame 1 or more times (special repeat is missing here!)
85 // Interpretation of IRP notation:
86 // {38.0k,564} ==> 38.0k -> Frequency , 564 -> unit in microseconds (we use 560), no "msb", so "lsb" is assumed
87 // <1,-1|1,-3> ==> Zero is 1 unit mark and space | One is 1 unit mark and 3 units space
88 // 16,-8 ==> Start bit durations
89 // D:8,S:8,F:8,~F:8 ==> D:8 -> 8 bit bitfield for Device, S:8 -> 8 bit bitfield for Subdevice, F:8 -> 8 bit bitfield for Function, ~F:8 -> 8 bit inverted bitfield for Function
90 // 1,^108m ==> 1 -> unit mark Stop bit, ^108m -> wait until 108 milliseconds after start of protocol (we use 110)
91 //
92 #define NEC_ADDRESS_BITS 16 // 16 bit address or 8 bit address and 8 bit inverted address
93 #define NEC_COMMAND_BITS 16 // Command and inverted command
94 
95 #define NEC_BITS (NEC_ADDRESS_BITS + NEC_COMMAND_BITS)
96 #define NEC_UNIT 560 // 21.28 periods of 38 kHz, 11.2 ticks TICKS_LOW = 8.358 TICKS_HIGH = 15.0
97 
98 #define NEC_HEADER_MARK (16 * NEC_UNIT) // 9000 | 180
99 #define NEC_HEADER_SPACE (8 * NEC_UNIT) // 4500 | 90
100 
101 #define NEC_BIT_MARK NEC_UNIT
102 #define NEC_ONE_SPACE (3 * NEC_UNIT) // 1690 | 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
103 #define NEC_ZERO_SPACE NEC_UNIT
104 
105 #define NEC_REPEAT_HEADER_SPACE (4 * NEC_UNIT) // 2250
106 
107 #define NEC_AVERAGE_DURATION 62000 // NEC_HEADER_MARK + NEC_HEADER_SPACE + 32 * 2,5 * NEC_UNIT + NEC_UNIT // 2.5 because we assume more zeros than ones
108 #define NEC_MINIMAL_DURATION 49900 // NEC_HEADER_MARK + NEC_HEADER_SPACE + 32 * 2 * NEC_UNIT + NEC_UNIT // 2.5 because we assume more zeros than ones
109 #define NEC_REPEAT_DURATION (NEC_HEADER_MARK + NEC_REPEAT_HEADER_SPACE + NEC_BIT_MARK) // 12 ms
110 #define NEC_REPEAT_PERIOD 110000 // Commands are repeated every 110 ms (measured from start to start) for as long as the key on the remote control is held down.
111 #define NEC_REPEAT_DISTANCE (NEC_REPEAT_PERIOD - NEC_AVERAGE_DURATION) // 48 ms
112 #define NEC_MAXIMUM_REPEAT_DISTANCE (NEC_REPEAT_PERIOD - NEC_MINIMAL_DURATION + 10000) // 70 ms
113 
114 #define APPLE_ADDRESS 0x87EE
115 
119 
120 // Like NEC but repeats are full frames instead of special NEC repeats
123 
124 /************************************
125  * Start of send and decode functions
126  ************************************/
127 
133  enableIROut (NEC_KHZ); // 38 kHz
134  mark(NEC_HEADER_MARK); // + 9000
135  space(NEC_REPEAT_HEADER_SPACE); // - 2250
136  mark(NEC_BIT_MARK); // + 560
137 }
138 
144  IrSender.enableIROut(NEC_KHZ); // 38 kHz
145  IrSender.mark(NEC_HEADER_MARK); // + 9000
147  IrSender.mark(NEC_BIT_MARK); // + 560
148 }
149 
157 uint32_t IRsend::computeNECRawDataAndChecksum(uint16_t aAddress, uint16_t aCommand) {
158  LongUnion tRawData;
159 
160  // Address 16 bit LSB first
161  if ((aAddress & 0xFF00) == 0) {
162  // assume 8 bit address -> send 8 address bits and then 8 inverted address bits LSB first
163  tRawData.UByte.LowByte = aAddress;
164  tRawData.UByte.MidLowByte = ~tRawData.UByte.LowByte;
165  } else {
166  tRawData.UWord.LowWord = aAddress;
167  }
168 
169  // send 8 command bits and then 8 inverted command bits LSB first
170  tRawData.UByte.MidHighByte = aCommand;
171  tRawData.UByte.HighByte = ~aCommand;
172  return tRawData.ULong;
173 }
174 
180 void IRsend::sendNEC(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
182 }
183 
189 void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
190  sendPulseDistanceWidth_P(&NECProtocolConstants, (uint32_t) aCommand << 16 | aAddress, NEC_BITS, aNumberOfRepeats);
191 }
192 
198 void IRsend::sendNEC2(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
200 }
201 
210 void IRsend::sendApple(uint8_t aDeviceId, uint8_t aCommand, int_fast8_t aNumberOfRepeats) {
211  LongUnion tRawData;
212 
213  // Address 16 bit LSB first fixed value of 0x87EE
214  tRawData.UWord.LowWord = APPLE_ADDRESS;
215 
216  // send Apple code and then 8 command bits LSB first
217  tRawData.UByte.MidHighByte = aCommand;
218  tRawData.UByte.HighByte = aDeviceId; // e.g. 0xD7
219 
220  sendPulseDistanceWidth_P(&NECProtocolConstants, tRawData.ULong, NEC_BITS, aNumberOfRepeats);
221 }
222 
228 void IRsend::sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats) {
229  sendPulseDistanceWidth_P(&NECProtocolConstants, aRawData, NEC_BITS, aNumberOfRepeats);
230 }
231 
236  /*
237  * First check for right data length
238  * Next check start bit
239  * Next try the decode
240  */
241  // Check we have the right amount of data (68). The +4 is for initial gap, start bit mark and space + stop bit mark.
242  if (decodedIRData.rawlen != ((2 * NEC_BITS) + 4) && (decodedIRData.rawlen != 4)) {
243  DEBUG_PRINT(F("NEC: Data length="));
245  DEBUG_PRINTLN(F(" is not 68 or 4"));
246  return false;
247  }
248 
249  // Check header "mark" this must be done for repeat and data
251  return false;
252  }
253 
254  // Check for repeat - here we have another header space length
255  if (decodedIRData.rawlen == 4) {
262  return true;
263  }
264  return false;
265  }
266 
267  // Check command header space
269  DEBUG_PRINTLN(F("NEC: Header space length is wrong"));
270  return false;
271  }
272 
273  // Decode as NEC protocol
274  decodePulseDistanceWidthData_P(&NECProtocolConstants, NEC_BITS);
275 
276  // Success
277 // decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value
278  LongUnion tValue;
280  decodedIRData.command = tValue.UByte.MidHighByte; // 8 bit
281 
282 #if defined(DECODE_ONKYO)
283  // Here only Onkyo protocol is supported -> force 16 bit address and command decoding. No NEC decoding possible!
284  decodedIRData.address = tValue.UWord.LowWord; // first 16 bit
286  decodedIRData.command = tValue.UWord.HighWord; // 16 bit command
287 #else
288  // Address
289  if (tValue.UWord.LowWord == APPLE_ADDRESS) {
290  /*
291  * Apple
292  */
295 
296  } else {
297  /*
298  * NEC LSB first, so first sent bit is also LSB of decodedIRData.decodedRawData
299  */
300  if (tValue.UByte.LowByte == (uint8_t)(~tValue.UByte.MidLowByte)) {
301  // standard 8 bit address NEC protocol
302  decodedIRData.address = tValue.UByte.LowByte; // first 8 bit
303  } else {
304  // extended NEC protocol
305  decodedIRData.address = tValue.UWord.LowWord; // first 16 bit
306  }
307  // Check for command if it is 8 bit NEC or 16 bit ONKYO
308  if (tValue.UByte.MidHighByte == (uint8_t)(~tValue.UByte.HighByte)) {
310  } else {
312  decodedIRData.command = tValue.UWord.HighWord; // 16 bit command
313  }
314  }
315 #endif
316 
318 
319  // check for NEC2 repeat, do not check for same content ;-)
324  }
325  return true;
326 }
327 
328 /*********************************************************************************
329  * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials
330  *********************************************************************************/
331 
333  unsigned int offset = 1; // Index in to results; Skip first space.
334 
335 // Check header "mark"
336  if (!matchMark(aResults->rawbuf[offset], NEC_HEADER_MARK)) {
337  return false;
338  }
339  offset++;
340 
341 // Check for repeat
342  if ((aResults->rawlen == 4) && matchSpace(aResults->rawbuf[offset], NEC_REPEAT_HEADER_SPACE)
343  && matchMark(aResults->rawbuf[offset + 1], NEC_BIT_MARK)) {
344  aResults->bits = 0;
345  aResults->value = 0xFFFFFFFF;
348  return true;
349  }
350 
351  // Check we have the right amount of data (32). +4 for initial gap, start bit mark and space + stop bit mark
352  if (aResults->rawlen != (2 * NEC_BITS) + 4) {
353  DEBUG_PRINT(F("NEC MSB: Data length="));
354  DEBUG_PRINT(aResults->rawlen);
355  DEBUG_PRINTLN(F(" is not 68"));
356  return false;
357  }
358 
359 // Check header "space"
360  if (!matchSpace(aResults->rawbuf[offset], NEC_HEADER_SPACE)) {
361  DEBUG_PRINTLN(F("NEC MSB: Header space length is wrong"));
362  return false;
363  }
364  offset++;
365 
367 
368  // Stop bit
369  if (!matchMark(aResults->rawbuf[offset + (2 * NEC_BITS)], NEC_BIT_MARK)) {
370  DEBUG_PRINTLN(F("NEC MSB: Stop bit mark length is wrong"));
371  return false;
372  }
373 
374 // Success
375  aResults->value = decodedIRData.decodedRawData;
376  aResults->bits = NEC_BITS;
377  aResults->decode_type = NEC;
379 
380  return true;
381 }
382 
394 void IRsend::sendNECMSB(uint32_t data, uint8_t nbits, bool repeat) {
395  // Set IR carrier frequency
397 
398  if (data == 0xFFFFFFFF || repeat) {
399  sendNECRepeat();
400  return;
401  }
402 
403  // Header
406 
407  // Old version with MSB first Data + stop bit
409 }
410 
412 #include "LocalDebugLevelEnd.h"
413 
414 #endif // _IR_NEC_HPP
IRData::address
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
Definition: IRremoteInt.h:164
MICROS_PER_TICK
#define MICROS_PER_TICK
microseconds per clock interrupt tick
Definition: IRremote.hpp:133
NEC_BITS
#define NEC_BITS
Definition: ir_NEC.hpp:95
LongUnion
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
Definition: LongUnion.h:59
decode_results
Results returned from old decoders !!!deprecated!!!
Definition: IRremoteInt.h:193
ONKYO
@ ONKYO
Definition: IRProtocol.h:99
decode_results::rawbuf
uint16_t * rawbuf
Definition: IRremoteInt.h:204
IRsend::sendApple
void sendApple(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
Apple: Send NEC with fixed 16 bit Apple address 0x87EE.
Definition: ir_NEC.hpp:210
IRrecv::decodePulseDistanceWidthData
void decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
Definition: IRReceive.hpp:1076
PROTOCOL_IS_MSB_FIRST
#define PROTOCOL_IS_MSB_FIRST
Definition: IRProtocol.h:156
IRsend::sendNECRaw
void sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Sends NEC protocol.
Definition: ir_NEC.hpp:228
IRrecv::lastDecodedProtocol
decode_type_t lastDecodedProtocol
Definition: IRremoteInt.h:404
IRData::numberOfBits
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
Definition: IRremoteInt.h:173
DEBUG_PRINT
#define DEBUG_PRINT(...)
Definition: LocalDebugLevelStart.h:79
IRsend::aNumberOfRepeats
void int_fast8_t aNumberOfRepeats
Definition: IRremoteInt.h:528
IRrecv::decodePulseDistanceWidthData_P
void decodePulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Definition: IRReceive.hpp:1112
MICROS_IN_ONE_MILLI
#define MICROS_IN_ONE_MILLI
Definition: IRremote.hpp:217
LongUnion::UByte
struct LongUnion::@4 UByte
PROTOCOL_IS_PULSE_DISTANCE
#define PROTOCOL_IS_PULSE_DISTANCE
Definition: IRProtocol.h:151
NEC_BIT_MARK
#define NEC_BIT_MARK
Definition: ir_NEC.hpp:101
IRsend::mark
void mark(uint16_t aMarkMicros)
Sends an IR mark for the specified number of microseconds.
Definition: IRSend.hpp:1247
IRDATA_FLAGS_IS_REPEAT
#define IRDATA_FLAGS_IS_REPEAT
The gap between the preceding frame is as smaller than the maximum gap expected for a repeat....
Definition: IRProtocol.h:125
LongUnion::LowByte
uint8_t LowByte
Definition: LongUnion.h:61
LongUnion::HighByte
uint8_t HighByte
Definition: LongUnion.h:64
decode_results::bits
uint8_t bits
Definition: IRremoteInt.h:199
decode_results::decode_type
decode_type_t decode_type
Definition: IRremoteInt.h:196
IRrecv::checkForRepeatSpaceTicksAndSetFlag
void checkForRepeatSpaceTicksAndSetFlag(uint16_t aMaximumRepeatSpaceTicks)
Definition: IRReceive.hpp:1248
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:1375
NEC2
@ NEC2
Definition: IRProtocol.h:98
LocalDebugLevelStart.h
decode_results::value
uint32_t value
Definition: IRremoteInt.h:198
LongUnion::MidLowByte
uint8_t MidLowByte
Definition: LongUnion.h:62
PulseDistanceWidthProtocolConstants
Definition: IRProtocol.h:139
IRsend::sendPulseDistanceWidth_P
void sendPulseDistanceWidth_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Definition: IRSend.hpp:1158
LongUnion::HighWord
uint16_t HighWord
Definition: LongUnion.h:81
NEC_ONE_SPACE
#define NEC_ONE_SPACE
Definition: ir_NEC.hpp:102
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:401
IRData::flags
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
Definition: IRremoteInt.h:174
PROTOCOL_IS_LSB_FIRST
#define PROTOCOL_IS_LSB_FIRST
Definition: IRProtocol.h:157
IRDATA_FLAGS_IS_PROTOCOL_WITH_DIFFERENT_REPEAT
#define IRDATA_FLAGS_IS_PROTOCOL_WITH_DIFFERENT_REPEAT
Here we have a repeat of type NEC2 or SamsungLG.
Definition: IRProtocol.h:131
IRsend::sendNECMSB
void sendNECMSB(uint32_t data, uint8_t nbits, bool repeat=false)
With Send sendNECMSB() you can send your old 32 bit codes.
Definition: ir_NEC.hpp:394
IRsend::sendNEC
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!
Definition: ir_NEC.hpp:180
IRData::command
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
Definition: IRremoteInt.h:165
NEC
@ NEC
Definition: IRProtocol.h:98
IRData::decodedRawData
IRDecodedRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send<protocol>Raw functions.
Definition: IRremoteInt.h:167
APPLE
@ APPLE
Definition: IRProtocol.h:98
matchMark
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
Definition: IRReceive.hpp:1327
NEC_KHZ
#define NEC_KHZ
Definition: IRProtocol.h:171
irparams_struct::rawbuf
IRRawbufType rawbuf[RAW_BUFFER_LENGTH]
raw data / tick counts per mark/space. With 8 bit we can only store up to 12.7 ms....
Definition: IRremoteInt.h:147
IRsend::computeNECRawDataAndChecksum
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,...
Definition: ir_NEC.hpp:157
LongUnion::ULong
uint32_t ULong
Definition: LongUnion.h:95
IRrecv::irparams
irparams_struct irparams
Definition: IRremoteInt.h:400
APPLE_ADDRESS
#define APPLE_ADDRESS
Definition: ir_NEC.hpp:114
IRrecv::lastDecodedCommand
uint16_t lastDecodedCommand
Definition: IRremoteInt.h:406
DEBUG_PRINTLN
#define DEBUG_PRINTLN(...)
Definition: LocalDebugLevelStart.h:80
IrSender
IRsend IrSender
Definition: IRSend.hpp:62
IRDATA_FLAGS_IS_LSB_FIRST
#define IRDATA_FLAGS_IS_LSB_FIRST
Definition: IRProtocol.h:134
NEC_ZERO_SPACE
#define NEC_ZERO_SPACE
Definition: ir_NEC.hpp:103
NEC_HEADER_SPACE
#define NEC_HEADER_SPACE
Definition: ir_NEC.hpp:99
IRsend::space
static void space(uint16_t aSpaceMicros)
Sends an IR space for the specified number of microseconds.
Definition: IRSend.hpp:1458
PROGMEM
struct PulseDistanceWidthProtocolConstants const NECProtocolConstants PROGMEM
Definition: ir_NEC.hpp:116
NEC_REPEAT_HEADER_SPACE
#define NEC_REPEAT_HEADER_SPACE
Definition: ir_NEC.hpp:105
IRsend::sendNEC2
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...
Definition: ir_NEC.hpp:198
IRData::rawlen
IRRawlenType rawlen
Counter of entries in rawbuf of last received frame.
Definition: IRremoteInt.h:182
IRrecv::decodeNECMSB
bool decodeNECMSB(decode_results *aResults)
Definition: ir_NEC.hpp:332
IRrecv::decodeNEC
bool decodeNEC()
Decodes also Onkyo and Apple.
Definition: ir_NEC.hpp:235
LongUnion::MidHighByte
uint8_t MidHighByte
Definition: LongUnion.h:63
IRsend::sendNECRepeat
void sendNECRepeat()
Send special NEC repeat frame Repeat commands should be sent in a 110 ms raster.
Definition: ir_NEC.hpp:132
IRsend::sendPulseDistanceWidthData
void sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits)
Sends PulseDistance from data contained in parameter using ProtocolConstants structure for timing etc...
Definition: IRSend.hpp:662
NEC_REPEAT_PERIOD
#define NEC_REPEAT_PERIOD
Definition: ir_NEC.hpp:110
LongUnion::UWord
struct LongUnion::@6 UWord
NEC_HEADER_MARK
#define NEC_HEADER_MARK
Definition: ir_NEC.hpp:98
IRsend::sendOnkyo
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
There is NO delay after the last sent repeat!
Definition: ir_NEC.hpp:189
decode_results::rawlen
uint_fast8_t rawlen
Definition: IRremoteInt.h:205
IRData::protocol
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
Definition: IRremoteInt.h:163
IRrecv::lastDecodedAddress
uint16_t lastDecodedAddress
Definition: IRremoteInt.h:405
IRsend::aCommand
void aCommand
Definition: IRremoteInt.h:617
IRsend::enableIROut
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
Definition: IRSend.hpp:1498
LocalDebugLevelEnd.h
sendNECSpecialRepeat
void sendNECSpecialRepeat()
Static function variant of IRsend::sendNECRepeat For use in ProtocolConstants.
Definition: ir_NEC.hpp:143
NEC_MAXIMUM_REPEAT_DISTANCE
#define NEC_MAXIMUM_REPEAT_DISTANCE
Definition: ir_NEC.hpp:112