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-2022 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 #if defined(DEBUG) && !defined(LOCAL_DEBUG)
36 #define LOCAL_DEBUG
37 #else
38 //#define LOCAL_DEBUG // This enables debug output only for this file
39 #endif
40 
44 //==============================================================================
45 // N N EEEEE CCCC
46 // NN N E C
47 // N N N EEE C
48 // N NN E C
49 // N N EEEEE CCCC
50 //==============================================================================
51 /*
52  Protocol=NEC Address=0x4 Command=0x8 Raw-Data=0xF708FB04 32 bits LSB first
53  +8950,-4450
54  + 600,- 500 + 650,- 500 + 600,-1650 + 600,- 550
55  + 600,- 500 + 600,- 500 + 650,- 500 + 600,- 500
56  + 650,-1650 + 600,-1600 + 650,- 500 + 600,-1650
57  + 600,-1650 + 600,-1650 + 600,-1600 + 650,-1600
58  + 650,- 500 + 600,- 550 + 600,- 500 + 600,-1650
59  + 600,- 550 + 600,- 500 + 600,- 550 + 600,- 500
60  + 600,-1650 + 600,-1650 + 600,-1650 + 600,- 550
61  + 600,-1650 + 600,-1650 + 600,-1650 + 600,-1600
62  + 650
63  Sum: 68000
64  */
65 // http://www.hifi-remote.com/wiki/index.php/NEC
66 // https://www.sbprojects.net/knowledge/ir/nec.php
67 // for Apple see https://en.wikipedia.org/wiki/Apple_Remote
68 // ONKYO like NEC but 16 independent command bits
69 // PIONEER (not implemented) is NEC2 with 40 kHz
70 // LSB first, 1 start bit + 16 bit address (or 8 bit address and 8 bit inverted address) + 8 bit command + 8 bit inverted command + 1 stop bit.
71 // Standard NEC (or NEC1) sends a special fixed repeat frame, but I have a DVD remote with NEC2, which send the same full frame after the 110 ms.
72 // 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
73 // 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!)
74 // {38.0k,564} ==> 38.0k -> Frequency , 564 -> unit in microseconds (we use 560), no "msb", so "lsb" is assumed
75 // <1,-1|1,-3> ==> Zero is 1 unit mark and space | One is 1 unit mark and 3 units space
76 // 16,-8 ==> Start bit durations
77 // 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
78 // 1,^108m ==> 1 -> unit mark Stop bit, ^108m -> wait until 108 milliseconds after start of protocol (we use 110)
79 //
80 #define NEC_ADDRESS_BITS 16 // 16 bit address or 8 bit address and 8 bit inverted address
81 #define NEC_COMMAND_BITS 16 // Command and inverted command
82 
83 #define NEC_BITS (NEC_ADDRESS_BITS + NEC_COMMAND_BITS)
84 #define NEC_UNIT 560 // 21.28 periods of 38 kHz, 11.2 ticks TICKS_LOW = 8.358 TICKS_HIGH = 15.0
85 
86 #define NEC_HEADER_MARK (16 * NEC_UNIT) // 9000 | 180
87 #define NEC_HEADER_SPACE (8 * NEC_UNIT) // 4500 | 90
88 
89 #define NEC_BIT_MARK NEC_UNIT
90 #define NEC_ONE_SPACE (3 * NEC_UNIT) // 1690 | 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
91 #define NEC_ZERO_SPACE NEC_UNIT
92 
93 #define NEC_REPEAT_HEADER_SPACE (4 * NEC_UNIT) // 2250
94 
95 #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
96 #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
97 #define NEC_REPEAT_DURATION (NEC_HEADER_MARK + NEC_REPEAT_HEADER_SPACE + NEC_BIT_MARK) // 12 ms
98 #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.
99 #define NEC_REPEAT_DISTANCE (NEC_REPEAT_PERIOD - NEC_AVERAGE_DURATION) // 48 ms
100 #define NEC_MAXIMUM_REPEAT_DISTANCE (NEC_REPEAT_PERIOD - NEC_MINIMAL_DURATION + 5) // 65 ms
101 
102 #define APPLE_ADDRESS 0x87EE
103 
107 
108 // Like NEC but repeats are full frames instead of special NEC repeats
111 
112 /************************************
113  * Start of send and decode functions
114  ************************************/
115 
121  enableIROut (NEC_KHZ); // 38 kHz
122  mark(NEC_HEADER_MARK); // + 9000
123  space(NEC_REPEAT_HEADER_SPACE); // - 2250
124  mark(NEC_BIT_MARK); // + 560
125 #if !defined(DISABLE_CODE_FOR_RECEIVER)
127 #endif
128 }
129 
135  IrSender.enableIROut(NEC_KHZ); // 38 kHz
136  IrSender.mark(NEC_HEADER_MARK); // + 9000
138  IrSender.mark(NEC_BIT_MARK); // + 560
139 #if !defined(DISABLE_CODE_FOR_RECEIVER)
141 #endif
142 }
143 
144 uint32_t IRsend::computeNECRawDataAndChecksum(uint16_t aAddress, uint16_t aCommand) {
145  LongUnion tRawData;
146 
147  // Address 16 bit LSB first
148  if ((aAddress & 0xFF00) == 0) {
149  // assume 8 bit address -> send 8 address bits and then 8 inverted address bits LSB first
150  tRawData.UByte.LowByte = aAddress;
151  tRawData.UByte.MidLowByte = ~tRawData.UByte.LowByte;
152  } else {
153  tRawData.UWord.LowWord = aAddress;
154  }
155 
156  // send 8 command bits and then 8 inverted command bits LSB first
157  tRawData.UByte.MidHighByte = aCommand;
158  tRawData.UByte.HighByte = ~aCommand;
159  return tRawData.ULong;
160 }
161 
168 void IRsend::sendNEC(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats) {
170 }
171 
172 /*
173  * NEC2 Send frame and repeat the frame for each requested repeat
174  * There is NO delay after the last sent repeat!
175  * @param aNumberOfRepeats If < 0 then nothing is sent.
176  */
177 void IRsend::sendNEC2(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats) {
179 }
180 
181 /*
182  * Repeat commands should be sent in a 110 ms raster.
183  * There is NO delay after the last sent repeat!
184  * @param aNumberOfRepeats If < 0 then only a special repeat frame without leading and trailing space
185  * will be sent by calling NECProtocolConstants.SpecialSendRepeatFunction().
186  */
187 void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
189 }
190 
191 /*
192  * Repeat commands should be sent in a 110 ms raster.
193  * There is NO delay after the last sent repeat!
194  * https://en.wikipedia.org/wiki/Apple_Remote
195  * https://gist.github.com/darconeous/4437f79a34e3b6441628
196  * @param aAddress is the DeviceId*
197  * @param aNumberOfRepeats If < 0 then only a special repeat frame without leading and trailing space
198  * will be sent by calling NECProtocolConstants.SpecialSendRepeatFunction().
199  */
200 void IRsend::sendApple(uint8_t aDeviceId, uint8_t aCommand, int_fast8_t aNumberOfRepeats) {
201  LongUnion tRawData;
202 
203  // Address 16 bit LSB first
204  tRawData.UWord.LowWord = APPLE_ADDRESS;
205 
206  // send Apple code and then 8 command bits LSB first
207  tRawData.UByte.MidHighByte = aCommand;
208  tRawData.UByte.HighByte = aDeviceId; // e.g. 0xD7
209 
211 }
212 
213 /*
214  * Sends NEC1 protocol
215  * @param aNumberOfRepeats If < 0 then only a special repeat frame without leading and trailing space
216  * will be sent by calling NECProtocolConstants.SpecialSendRepeatFunction().
217  */
218 void IRsend::sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats) {
220 }
221 
226  /*
227  * First check for right data length
228  * Next check start bit
229  * Next try the decode
230  */
231  // Check we have the right amount of data (68). The +4 is for initial gap, start bit mark and space + stop bit mark.
232  if (decodedIRData.rawDataPtr->rawlen != ((2 * NEC_BITS) + 4) && (decodedIRData.rawDataPtr->rawlen != 4)) {
233  IR_DEBUG_PRINT(F("NEC: "));
234  IR_DEBUG_PRINT(F("Data length="));
236  IR_DEBUG_PRINTLN(F(" is not 68 or 4"));
237  return false;
238  }
239 
240  // Check header "mark" this must be done for repeat and data
242  return false;
243  }
244 
245  // Check for repeat - here we have another header space length
246  if (decodedIRData.rawDataPtr->rawlen == 4) {
253  return true;
254  }
255  return false;
256  }
257 
258  // Check command header space
260 #if defined(LOCAL_DEBUG)
261  Serial.print(F("NEC: "));
262  Serial.println(F("Header space length is wrong"));
263 #endif
264  return false;
265  }
266 
267  // Try to decode as NEC protocol
269 #if defined(LOCAL_DEBUG)
270  Serial.print(F("NEC: "));
271  Serial.println(F("Decode failed"));
272 #endif
273  return false;
274  }
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  // Address
282  if (tValue.UWord.LowWord == APPLE_ADDRESS) {
283  /*
284  * Apple
285  */
288 
289  } else {
290  /*
291  * NEC LSB first, so first sent bit is also LSB of decodedIRData.decodedRawData
292  */
293  if (tValue.UByte.LowByte == (uint8_t)(~tValue.UByte.MidLowByte)) {
294  // standard 8 bit address NEC protocol
295  decodedIRData.address = tValue.UByte.LowByte; // first 8 bit
296  } else {
297  // extended NEC protocol
298  decodedIRData.address = tValue.UWord.LowWord; // first 16 bit
299  }
300  // Check for command if it is 8 bit NEC or 16 bit ONKYO
301  if (tValue.UByte.MidHighByte == (uint8_t)(~tValue.UByte.HighByte)) {
303  } else {
305  decodedIRData.command = tValue.UWord.HighWord; // 16 bit command
306  }
307  }
309 
310  // check for NEC2 repeat, do not check for same content ;-)
314  }
315 
316  return true;
317 }
318 
319 /*********************************************************************************
320  * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials
321  *********************************************************************************/
322 
324  unsigned int offset = 1; // Index in to results; Skip first space.
325 
326 // Check header "mark"
327  if (!matchMark(aResults->rawbuf[offset], NEC_HEADER_MARK)) {
328  return false;
329  }
330  offset++;
331 
332 // Check for repeat
333  if ((aResults->rawlen == 4) && matchSpace(aResults->rawbuf[offset], NEC_REPEAT_HEADER_SPACE)
334  && matchMark(aResults->rawbuf[offset + 1], NEC_BIT_MARK)) {
335  aResults->bits = 0;
336  aResults->value = 0xFFFFFFFF;
339  return true;
340  }
341 
342  // Check we have the right amount of data (32). +4 for initial gap, start bit mark and space + stop bit mark
343  if (aResults->rawlen != (2 * NEC_BITS) + 4) {
344  IR_DEBUG_PRINT(F("NEC MSB: "));
345  IR_DEBUG_PRINT(F("Data length="));
346  IR_DEBUG_PRINT(aResults->rawlen);
347  IR_DEBUG_PRINTLN(F(" is not 68"));
348  return false;
349  }
350 
351 // Check header "space"
352  if (!matchSpace(aResults->rawbuf[offset], NEC_HEADER_SPACE)) {
353 #if defined(LOCAL_DEBUG)
354  Serial.print(F("NEC MSB: "));
355  Serial.println(F("Header space length is wrong"));
356 #endif
357  return false;
358  }
359  offset++;
360 
362 #if defined(LOCAL_DEBUG)
363  Serial.print(F("NEC MSB: "));
364  Serial.println(F("Decode failed"));
365 #endif
366  return false;
367  }
368 
369  // Stop bit
370  if (!matchMark(aResults->rawbuf[offset + (2 * NEC_BITS)], NEC_BIT_MARK)) {
371 #if defined(LOCAL_DEBUG)
372  Serial.print(F("NEC MSB: "));
373  Serial.println(F("Stop bit mark length is wrong"));
374 #endif
375  return false;
376  }
377 
378 // Success
379  aResults->value = decodedIRData.decodedRawData;
380  aResults->bits = NEC_BITS;
381  aResults->decode_type = NEC;
383 
384  return true;
385 }
386 
397 void IRsend::sendNECMSB(uint32_t data, uint8_t nbits, bool repeat) {
398  // Set IR carrier frequency
400 
401  if (data == 0xFFFFFFFF || repeat) {
402  sendNECRepeat();
403  return;
404  }
405 
406  // Header
409 
410  // Old version with MSB first Data + stop bit
412  SEND_STOP_BIT);
413 #if !defined(DISABLE_CODE_FOR_RECEIVER)
415 #endif
416 }
417 
419 #if defined(LOCAL_DEBUG)
420 #undef LOCAL_DEBUG
421 #endif
422 #endif // _IR_NEC_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
NEC_BITS
#define NEC_BITS
Definition: ir_NEC.hpp:83
LongUnion
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
Definition: LongUnion.h:57
decode_results
Results returned from old decoders !!!deprecated!!!
Definition: IRremoteInt.h:155
ONKYO
@ ONKYO
Definition: IRProtocol.h:51
IRsend::sendApple
void sendApple(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
Definition: ir_NEC.hpp:200
PROTOCOL_IS_MSB_FIRST
#define PROTOCOL_IS_MSB_FIRST
Definition: IRProtocol.h:130
IRsend::sendNECRaw
void sendNECRaw(uint32_t aRawData, int_fast8_t aNumberOfRepeats=NO_REPEATS)
Definition: ir_NEC.hpp:218
IRrecv::lastDecodedProtocol
decode_type_t lastDecodedProtocol
Definition: IRremoteInt.h:308
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
NEC2ProtocolConstants
struct PulseDistanceWidthProtocolConstants NEC2ProtocolConstants
Definition: ir_NEC.hpp:109
NEC_BIT_MARK
#define NEC_BIT_MARK
Definition: ir_NEC.hpp:89
IRsend::mark
void mark(unsigned int aMarkMicros)
Sends an IR mark for the specified number of microseconds.
Definition: IRSend.hpp:757
IRDATA_FLAGS_IS_REPEAT
#define IRDATA_FLAGS_IS_REPEAT
Definition: IRProtocol.h:94
IRrecv::restartAfterSend
void restartAfterSend()
Restarts receiver after send.
Definition: IRReceive.hpp:346
IRsend::sendPulseDistanceWidth
void sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Sends PulseDistance frames and repeats.
Definition: IRSend.hpp:532
LongUnion::LowByte
uint8_t LowByte
Definition: LongUnion.h:59
LongUnion::HighByte
uint8_t HighByte
Definition: LongUnion.h:62
decode_results::rawbuf
unsigned int * rawbuf
Definition: IRremoteInt.h:166
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
decode_results::bits
uint8_t bits
Definition: IRremoteInt.h:161
decode_results::decode_type
decode_type_t decode_type
Definition: IRremoteInt.h:158
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
NEC2
@ NEC2
Definition: IRProtocol.h:50
irparams_struct::rawlen
uint_fast8_t rawlen
counter of entries in rawbuf
Definition: IRremoteInt.h:109
IRrecv::decodePulseDistanceWidthData
bool decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
Definition: IRReceive.hpp:768
decode_results::value
uint32_t value
Definition: IRremoteInt.h:160
IRsend::sendNEC2
void sendNEC2(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats)
Definition: ir_NEC.hpp:177
LongUnion::MidLowByte
uint8_t MidLowByte
Definition: LongUnion.h:60
PulseDistanceWidthProtocolConstants
Definition: IRProtocol.h:74
LongUnion::HighWord
uint16_t HighWord
Definition: LongUnion.h:79
NEC_ONE_SPACE
#define NEC_ONE_SPACE
Definition: ir_NEC.hpp:90
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:305
matchSpace
bool matchSpace(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
Definition: IRReceive.hpp:1033
SEND_STOP_BIT
#define SEND_STOP_BIT
Definition: IRremoteInt.h:393
IRData::flags
uint8_t flags
See IRDATA_FLAGS_* definitions above.
Definition: IRProtocol.h:121
PROTOCOL_IS_LSB_FIRST
#define PROTOCOL_IS_LSB_FIRST
Definition: IRProtocol.h:129
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
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:397
IRData::command
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
Definition: IRProtocol.h:118
NEC
@ NEC
Definition: IRProtocol.h:49
APPLE
@ APPLE
Definition: IRProtocol.h:44
NEC_KHZ
#define NEC_KHZ
Definition: IRProtocol.h:143
IRsend::computeNECRawDataAndChecksum
uint32_t computeNECRawDataAndChecksum(uint16_t aAddress, uint16_t aCommand)
Definition: ir_NEC.hpp:144
LongUnion::ULong
uint32_t ULong
Definition: LongUnion.h:93
APPLE_ADDRESS
#define APPLE_ADDRESS
Definition: ir_NEC.hpp:102
IrSender
IRsend IrSender
Definition: IRSend.hpp:59
IRrecv::lastDecodedCommand
uint32_t lastDecodedCommand
Definition: IRremoteInt.h:310
IRsend::space
static void space(unsigned int aSpaceMicros)
Sends an IR space for the specified number of microseconds.
Definition: IRSend.hpp:927
IRDATA_FLAGS_IS_LSB_FIRST
#define IRDATA_FLAGS_IS_LSB_FIRST
Definition: IRProtocol.h:101
NEC_ZERO_SPACE
#define NEC_ZERO_SPACE
Definition: ir_NEC.hpp:91
NEC_HEADER_SPACE
#define NEC_HEADER_SPACE
Definition: ir_NEC.hpp:87
NEC_REPEAT_HEADER_SPACE
#define NEC_REPEAT_HEADER_SPACE
Definition: ir_NEC.hpp:93
IRrecv::decodeNECMSB
bool decodeNECMSB(decode_results *aResults)
Definition: ir_NEC.hpp:323
IRrecv::decodeNEC
bool decodeNEC()
Decodes also Onkyo and Apple.
Definition: ir_NEC.hpp:225
LongUnion::MidHighByte
uint8_t MidHighByte
Definition: LongUnion.h:61
IRsend::sendNECRepeat
void sendNECRepeat()
Send special NEC repeat frame Repeat commands should be sent in a 110 ms raster.
Definition: ir_NEC.hpp:120
NEC_REPEAT_PERIOD
#define NEC_REPEAT_PERIOD
Definition: ir_NEC.hpp:98
LongUnion::UWord
struct LongUnion::@6 UWord
IRsend::sendPulseDistanceWidthData
void sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits)
Sends PulseDistance data The output always ends with a space Each additional call costs 16 bytes prog...
Definition: IRSend.hpp:643
IRrecv::lastDecodedAddress
uint32_t lastDecodedAddress
Definition: IRremoteInt.h:309
NEC_HEADER_MARK
#define NEC_HEADER_MARK
Definition: ir_NEC.hpp:86
IRsend::sendOnkyo
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Definition: ir_NEC.hpp:187
NECProtocolConstants
struct PulseDistanceWidthProtocolConstants NECProtocolConstants
Definition: ir_NEC.hpp:104
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
decode_results::rawlen
uint_fast8_t rawlen
Definition: IRremoteInt.h:167
IRData::protocol
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
Definition: IRProtocol.h:116
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
sendNECSpecialRepeat
void sendNECSpecialRepeat()
Static function for sending special repeat frame.
Definition: ir_NEC.hpp:134
NEC_MAXIMUM_REPEAT_DISTANCE
#define NEC_MAXIMUM_REPEAT_DISTANCE
Definition: ir_NEC.hpp:100
IRsend::sendNEC
void sendNEC(uint16_t aAddress, uint8_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:168