1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.99 2011/03/10 12:29:13 fm Exp $
10 * Typical manufacturers:
13 * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers
16 * MATSUSHITA - Matsushita
17 * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")
18 * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba
19 * RC5 - Philips and other European manufacturers
20 * DENON - Denon, Sharp
21 * RC6 - Philips and other European manufacturers
23 * NUBERT - Nubert Subwoofer System
24 * B&O - Bang & Olufsen
25 * PANASONIC - Panasonic (older, yet not implemented)
28 * SIEMENS - Siemens, e.g. Gigaset M740AV
29 * FDC - FDC IR keyboard
30 * RCCAR - IR remote control for RC cars
32 * NIKON - Nikon cameras
36 *---------------------------------------------------------------------------------------------------------------------------------------------------
41 * frame: 1 start bit + 12-20 data bits + no stop bit
42 * data: 7 command bits + 5 address bits + 0 to 8 additional bits
44 * start bit: data "0": data "1": stop bit:
45 * -----------------_________ ------_____ ------------______
46 * 2400us 600us 600us 600us 1200us 600 us no stop bit
48 *---------------------------------------------------------------------------------------------------------------------------------------------------
51 * -------------------------
53 * frame: 1 start bit + 32 data bits + 1 stop bit
54 * data NEC: 8 address bits + 8 inverted address bits + 8 command bits + 8 inverted command bits
55 * data extended NEC: 16 address bits + 8 command bits + 8 inverted command bits
57 * start bit: data "0": data "1": stop bit:
58 * -----------------_________ ------______ ------________________ ------______....
59 * 9000us 4500us 560us 560us 560us 1690 us 560us
64 * -----------------_________------______ .... ~100ms Pause, then repeat
67 *---------------------------------------------------------------------------------------------------------------------------------------------------
72 * frame: 1 start bit + 16 data(1) bits + 1 sync bit + additional 20 data(2) bits + 1 stop bit
73 * data(1): 16 address bits
74 * data(2): 4 ID bits + 8 command bits + 8 inverted command bits
76 * start bit: data "0": data "1": sync bit: stop bit:
77 * ----------______________ ------______ ------________________ ------______________ ------______....
78 * 4500us 4500us 550us 450us 550us 1450us 550us 4500us 550us
80 *---------------------------------------------------------------------------------------------------------------------------------------------------
85 * frame: 1 start bit + 32 data bits + 1 stop bit
86 * data: 16 address bits + 16 command bits
88 * start bit: data "0": data "1": stop bit:
89 * ----------______________ ------______ ------________________ ------______....
90 * 4500us 4500us 550us 450us 550us 1450us 550us
92 *---------------------------------------------------------------------------------------------------------------------------------------------------
97 * frame: 1 start bit + 24 data bits + 1 stop bit
98 * data: 6 custom bits + 6 command bits + 12 address bits
100 * start bit: data "0": data "1": stop bit:
101 * ----------_________ ------______ ------________________ ------______....
102 * 3488us 3488us 872us 872us 872us 2616us 872us
104 *---------------------------------------------------------------------------------------------------------------------------------------------------
109 * frame: 1 start bit + 48 data bits + 1 stop bit
110 * data: 16 manufacturer bits + 4 parity bits + 4 genre1 bits + 4 genre2 bits + 10 command bits + 2 id bits + 8 parity bits
112 * start bit: data "0": data "1": stop bit:
113 * ----------______ ------______ ------________________ ------______....
114 * 3380us 1690us 423us 423us 423us 1269us 423us
116 *---------------------------------------------------------------------------------------------------------------------------------------------------
121 * frame: 2 start bits + 10 data bits + 1 stop bit
122 * data: 1 toggle bit + 3 address bits + 6 command bits
124 * start bit: data "0": data "1": stop bit:
125 * -----_____________________ -----____________ -----______________ ------_______....
126 * 158us 7432us 158us 4902us 158us 7432us 158us
128 *---------------------------------------------------------------------------------------------------------------------------------------------------
133 * frame: 2 start bits + 11 data bits + 1 stop bit
134 * data: 1 toggle bit + 4 address bits + 6 command bits
136 * start bit: data "0": data "1": stop bit:
137 * -----_____________________ -----____________ -----______________ ------_______....
138 * 158us 3637us 158us 4902us 158us 7432us 158us
140 *---------------------------------------------------------------------------------------------------------------------------------------------------
145 * RC5 frame: 2 start bits + 12 data bits + no stop bit
146 * RC5 data: 1 toggle bit + 5 address bits + 6 command bits
147 * RC5X frame: 1 start bit + 13 data bits + no stop bit
148 * RC5X data: 1 inverted command bit + 1 toggle bit + 5 address bits + 6 command bits
150 * start bit: data "0": data "1":
151 * ______----- ------______ ______------
152 * 889us 889us 889us 889us 889us 889us
154 *---------------------------------------------------------------------------------------------------------------------------------------------------
159 * frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit
160 * data: 5 address bits + 10 command bits
164 * data "0": data "1":
165 * ------________________ ------______________
166 * 275us 775us 275us 1900us
170 * data "0": data "1":
171 * ------________________ ------______________
172 * 310us 745us 310us 1780us
174 *---------------------------------------------------------------------------------------------------------------------------------------------------
179 * RC6 frame: 1 start bit + 1 bit "1" + 3 mode bits + 1 toggle bit + 16 data bits + 2666 us pause
180 * RC6 data: 8 address bits + 8 command bits
182 * start bit toggle bit "0": toggle bit "1": data/mode "0": data/mode "1":
183 * ____________------- _______------- -------_______ _______------- -------_______
184 * 2666us 889us 889us 889us 889us 889us 444us 444us 444us 444us
186 *---------------------------------------------------------------------------------------------------------------------------------------------------
191 * frame: 1 start bit + 32 data bits + 1 stop bit
192 * data: 16 address bits + 11100000 + 8 command bits
194 * start bit: data "0": data "1": stop bit:
195 * -----------------_________ ------______ ------________________ ------______....
196 * 9000us 4500us 560us 560us 560us 1690 us 560us
198 *---------------------------------------------------------------------------------------------------------------------------------------------------
200 * NUBERT (subwoofer system)
201 * -------------------------
203 * frame: 1 start bit + 10 data bits + 1 stop bit
204 * data: 0 address bits + 10 command bits ?
206 * start bit: data "0": data "1": stop bit:
207 * ----------_____ ------______ ------________________ ------______....
208 * 1340us 340us 500us 1300us 1340us 340us 500us
210 *---------------------------------------------------------------------------------------------------------------------------------------------------
215 * frame: 4 start bits + 16 data bits + 1 trailer bit + 1 stop bit
216 * data: 0 address bits + 16 command bits
218 * 1st start bit: 2nd start bit: 3rd start bit: 4th start bit:
219 * -----________ -----________ -----_____________ -----________
220 * 210us 3000us 210us 3000us 210us 15000us 210us 3000us
222 * data "0": data "1": data "repeat bit": trailer bit: stop bit:
223 * -----________ -----_____________ -----___________ -----_____________ -----____...
224 * 210us 3000us 210us 9000us 210us 6000us 210us 12000us 210us
226 *---------------------------------------------------------------------------------------------------------------------------------------------------
231 * packet: 1 start frame + 19,968ms pause + N info frames + 117,76ms pause + 1 stop frame
232 * frame: 1 pre bit + 1 start bit + 9 data bits + no stop bit
233 * pause between info frames: 117,76ms
235 * data of start frame: 9 x 1
236 * data of info frame: 9 command bits
237 * data of stop frame: 9 x 1
239 * pre bit: start bit data "0": data "1":
240 * ------____________ ------______ ______------ ------______
241 * 528us 2639us 528us 528us 528us 528us 528us 528us
243 *---------------------------------------------------------------------------------------------------------------------------------------------------
248 * Timing similar to Grundig, but 16 data bits:
249 * frame: 1 pre bit + 1 start bit + 8 command bits + 8 address bits + no stop bit
251 *---------------------------------------------------------------------------------------------------------------------------------------------------
256 * SIEMENS frame: 1 start bit + 22 data bits + no stop bit
257 * SIEMENS data: 13 address bits + 1 repeat bit + 7 data bits + 1 unknown bit
259 * start bit data "0": data "1":
260 * -------_______ _______------- -------_______
261 * 250us 250us 250us 250us 250us 250us
263 *---------------------------------------------------------------------------------------------------------------------------------------------------
265 * PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)
266 * -----------------------------------------------------------------------------------------
268 * frame: 1 start bit + 22 data bits + 1 stop bit
269 * 22 data bits = 5 custom bits + 6 data bits + 5 inverted custom bits + 6 inverted data bits
271 * European version: T = 456us
272 * USA & Canada version: T = 422us
274 * start bit: data "0": data "1": stop bit:
275 * 8T 8T 2T 2T 2T 6T 2T
276 * -------------____________ ------_____ ------_____________ ------_______....
277 * 3648us 3648us 912us 912us 912us 2736us 912us (Europe)
278 * 3376us 3376us 844us 844us 844us 2532us 844us (US)
280 *---------------------------------------------------------------------------------------------------------------------------------------------------
282 * This program is free software; you can redistribute it and/or modify
283 * it under the terms of the GNU General Public License as published by
284 * the Free Software Foundation; either version 2 of the License, or
285 * (at your option) any later version.
286 *---------------------------------------------------------------------------------------------------------------------------------------------------
289 #if defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC Compiler instead of AVR
290 #define PIC_CCS_COMPILER
293 #ifdef unix // test on linux/unix
298 #include <inttypes.h>
302 #define memcpy_P memcpy
309 typedef unsigned char uint8_t;
310 typedef unsigned short uint16_t;
313 #define memcpy_P memcpy
319 #ifdef PIC_CCS_COMPILER
322 typedef unsigned int8
uint8_t;
323 typedef unsigned int16
uint16_t;
325 #define memcpy_P memcpy
329 #include <inttypes.h>
333 #include <util/delay.h>
334 #include <avr/pgmspace.h>
336 #endif // PIC_CCS_COMPILER
342 #ifndef IRMP_USE_AS_LIB
343 #include "irmpconfig.h"
347 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
348 #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
350 #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
353 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
354 #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
356 #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
359 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
360 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
361 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
362 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
363 IRMP_SUPPORT_IR60_PROTOCOL
364 #define IRMP_SUPPORT_MANCHESTER 1
366 #define IRMP_SUPPORT_MANCHESTER 0
369 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 || \
370 IRMP_SUPPORT_IMON_PROTOCOL == 1
371 #define IRMP_SUPPORT_SERIAL 1
373 #define IRMP_SUPPORT_SERIAL 0
376 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
378 #define MIN_TOLERANCE_00 1.0 // -0%
379 #define MAX_TOLERANCE_00 1.0 // +0%
381 #define MIN_TOLERANCE_05 0.95 // -5%
382 #define MAX_TOLERANCE_05 1.05 // +5%
384 #define MIN_TOLERANCE_10 0.9 // -10%
385 #define MAX_TOLERANCE_10 1.1 // +10%
387 #define MIN_TOLERANCE_15 0.85 // -15%
388 #define MAX_TOLERANCE_15 1.15 // +15%
390 #define MIN_TOLERANCE_20 0.8 // -20%
391 #define MAX_TOLERANCE_20 1.2 // +20%
393 #define MIN_TOLERANCE_30 0.7 // -30%
394 #define MAX_TOLERANCE_30 1.3 // +30%
396 #define MIN_TOLERANCE_40 0.6 // -40%
397 #define MAX_TOLERANCE_40 1.4 // +40%
399 #define MIN_TOLERANCE_50 0.5 // -50%
400 #define MAX_TOLERANCE_50 1.5 // +50%
402 #define MIN_TOLERANCE_60 0.4 // -60%
403 #define MAX_TOLERANCE_60 1.6 // +60%
405 #define MIN_TOLERANCE_70 0.3 // -70%
406 #define MAX_TOLERANCE_70 1.7 // +70%
408 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
409 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
410 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
411 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
412 #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
413 #else // only 5% + 1 to avoid conflict with RC6:
414 #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
416 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
417 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
418 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
419 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
420 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
421 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
423 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
424 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
425 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
426 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
427 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
428 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
429 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
430 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
431 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
432 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
433 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
434 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
435 // autodetect nec repetition frame within 50 msec:
436 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
438 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
440 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
443 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
444 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
445 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
446 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
447 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
448 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
449 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
450 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
451 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
452 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
454 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
455 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
456 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
457 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
458 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
459 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
460 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
461 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
462 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
463 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
465 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
466 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
467 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
468 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
469 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
470 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
471 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
472 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
473 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
474 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
476 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
477 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
478 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
479 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
480 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
481 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
482 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
483 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
484 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
485 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
487 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
488 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
489 #define RC5_START_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
490 #define RC5_START_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
491 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
492 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
493 #define RC5_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
494 #define RC5_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
496 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
497 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
498 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
499 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
500 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
501 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)) // no -1, avoid conflict with RUWIDO
503 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // be more tolerant
505 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
507 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
508 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
509 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
510 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
511 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
512 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
513 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
514 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_30 + 0.5) + 1) // pulses: 300 - 700
515 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // pauses: 300 - 600
516 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
518 #define RC6_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
519 #define RC6_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 600 - 1400
520 #define RC6_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // pauses: 600 - 1200
521 #define RC6_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1)
523 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
524 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
525 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
526 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
527 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
528 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
529 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
530 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
531 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
532 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
534 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
535 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
536 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
537 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
538 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
539 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
540 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
541 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
542 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
543 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
544 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
545 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
547 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
548 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
549 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
550 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
551 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
552 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
553 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
554 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
555 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
556 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
557 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
558 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((PAUSE_LEN)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // value must be below IRMP_TIMEOUT
559 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
560 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
561 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
562 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
563 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
564 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
565 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
566 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
567 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
568 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
569 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
570 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
571 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
572 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
574 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
575 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
576 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
577 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
578 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
579 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
580 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
581 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
582 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
584 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
585 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
586 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
587 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
588 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
589 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
590 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
591 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
592 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
593 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
594 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
595 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
596 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME_2 * MIN_TOLERANCE_10 + 0.5) - 1)
597 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME_2 * MAX_TOLERANCE_60 + 0.5) + 1)
598 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MIN_TOLERANCE_10 + 0.5) - 1)
599 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MAX_TOLERANCE_60 + 0.5) + 1)
601 #define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
602 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
603 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
604 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
605 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
606 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
607 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
608 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
610 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
612 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
614 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
616 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
617 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
618 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
619 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
620 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
621 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
622 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
623 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
624 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
625 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
627 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
628 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
629 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
630 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!
631 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
632 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
633 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
634 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
635 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
636 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
637 // autodetect JVC repetition frame within 50 msec:
638 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
640 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
641 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
642 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
643 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
644 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
645 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
646 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
647 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
648 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
649 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
650 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
651 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
652 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
654 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
655 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
656 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
657 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
658 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
659 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
660 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
661 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
662 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
663 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
664 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
665 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
666 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
667 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
669 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
670 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
671 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
672 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
673 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
674 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
675 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
676 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
678 #define IMON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
679 #define IMON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
680 #define IMON_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
681 #define IMON_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
682 #define IMON_PULSE_LEN ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME))
683 #define IMON_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME))
684 #define IMON_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME / 4))
685 #define IMON_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME / 4))
687 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
690 #define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
691 #define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
692 #define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
693 #define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
695 static int time_counter
;
698 #define ANALYZE_PUTCHAR(a)
699 #define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
700 #define ANALYZE_PRINTF(...)
701 #define ANALYZE_NEWLINE()
704 #if IRMP_LOGGING == 1
706 #include <util/setbaud.h>
710 #define UART0_UBRRH UBRR0H
711 #define UART0_UBRRL UBRR0L
712 #define UART0_UCSRA UCSR0A
713 #define UART0_UCSRB UCSR0B
714 #define UART0_UCSRC UCSR0C
715 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
716 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
717 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
719 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
721 #define UART0_URSEL_BIT_VALUE (0)
723 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
724 #define UART0_UDR UDR0
725 #define UART0_U2X U2X0
729 #define UART0_UBRRH UBRRH
730 #define UART0_UBRRL UBRRL
731 #define UART0_UCSRA UCSRA
732 #define UART0_UCSRB UCSRB
733 #define UART0_UCSRC UCSRC
734 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
735 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
736 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
738 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
740 #define UART0_URSEL_BIT_VALUE (0)
742 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
743 #define UART0_UDR UDR
744 #define UART0_U2X U2X
748 /*---------------------------------------------------------------------------------------------------------------------------------------------------
750 * @details Initializes UART
751 *---------------------------------------------------------------------------------------------------------------------------------------------------
754 irmp_uart_init (void)
756 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
757 UART0_UBRRL
= UBRRL_VALUE
;
760 UART0_UCSRA
|= (1<<UART0_U2X
);
762 UART0_UCSRA
&= ~(1<<UART0_U2X
);
765 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
766 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
769 /*---------------------------------------------------------------------------------------------------------------------------------------------------
771 * @details Sends character
772 * @param ch character to be transmitted
773 *---------------------------------------------------------------------------------------------------------------------------------------------------
776 irmp_uart_putc (unsigned char ch
)
778 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
786 /*---------------------------------------------------------------------------------------------------------------------------------------------------
788 *---------------------------------------------------------------------------------------------------------------------------------------------------
791 #define STARTCYCLES 2 // min count of zeros before start of logging
792 #define ENDBITS 1000 // number of sequenced highbits to detect end
793 #define DATALEN 700 // log buffer size
796 irmp_log (uint8_t val
)
798 static uint8_t buf
[DATALEN
]; // logging buffer
799 static uint16_t buf_idx
; // number of written bits
800 static uint8_t startcycles
; // current number of start-zeros
801 static uint16_t cnt
; // counts sequenced highbits - to detect end
803 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
811 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
813 if (buf_idx
< DATALEN
* 8) // index in range?
817 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
821 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
828 { // if high received then look at log-stop condition
832 { // if stop condition is true, output on uart
835 for (i
= 0; i
< STARTCYCLES
; i
++)
837 irmp_uart_putc ('0'); // the ignored starting zeros
840 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
845 for (j
= 0; j
< 8; j
++)
847 irmp_uart_putc ((d
& 1) + '0');
852 irmp_uart_putc ('\n');
865 #define irmp_log(val)
870 uint8_t protocol
; // ir protocol
871 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
872 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
873 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
874 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
875 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
876 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
877 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
878 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
879 uint8_t address_offset
; // address offset
880 uint8_t address_end
; // end of address
881 uint8_t command_offset
; // command offset
882 uint8_t command_end
; // end of command
883 uint8_t complete_len
; // complete length of frame
884 uint8_t stop_bit
; // flag: frame has stop bit
885 uint8_t lsb_first
; // flag: LSB first
886 uint8_t flags
; // some flags
889 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
891 static PROGMEM IRMP_PARAMETER sircs_param
=
893 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
894 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
895 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
896 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
897 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
898 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
899 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
900 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
901 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
902 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
903 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
904 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
905 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
906 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
907 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
908 SIRCS_LSB
, // lsb_first: flag: LSB first
909 SIRCS_FLAGS
// flags: some flags
914 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
916 static PROGMEM IRMP_PARAMETER nec_param
=
918 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
919 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
920 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
921 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
922 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
923 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
924 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
925 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
926 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
927 NEC_ADDRESS_OFFSET
, // address_offset: address offset
928 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
929 NEC_COMMAND_OFFSET
, // command_offset: command offset
930 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
931 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
932 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
933 NEC_LSB
, // lsb_first: flag: LSB first
934 NEC_FLAGS
// flags: some flags
937 static PROGMEM IRMP_PARAMETER nec_rep_param
=
939 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
940 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
941 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
942 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
943 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
944 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
945 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
946 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
947 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
948 0, // address_offset: address offset
949 0, // address_end: end of address
950 0, // command_offset: command offset
951 0, // command_end: end of command
952 0, // complete_len: complete length of frame
953 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
954 NEC_LSB
, // lsb_first: flag: LSB first
955 NEC_FLAGS
// flags: some flags
960 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
962 static PROGMEM IRMP_PARAMETER nec42_param
=
964 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
965 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
966 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
967 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
968 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
969 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
970 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
971 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
972 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
973 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
974 NEC42_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
975 NEC42_COMMAND_OFFSET
, // command_offset: command offset
976 NEC42_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
977 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
978 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
979 NEC_LSB
, // lsb_first: flag: LSB first
980 NEC_FLAGS
// flags: some flags
985 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
987 static PROGMEM IRMP_PARAMETER samsung_param
=
989 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
990 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
991 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
992 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
993 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
994 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
995 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
996 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
997 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
998 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
999 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
1000 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
1001 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
1002 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1003 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
1004 SAMSUNG_LSB
, // lsb_first: flag: LSB first
1005 SAMSUNG_FLAGS
// flags: some flags
1010 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1012 static PROGMEM IRMP_PARAMETER matsushita_param
=
1014 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1015 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1016 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1017 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1018 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1019 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1020 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1021 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1022 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1023 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1024 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1025 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1026 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1027 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1028 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1029 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1030 MATSUSHITA_FLAGS
// flags: some flags
1035 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1037 static PROGMEM IRMP_PARAMETER kaseikyo_param
=
1039 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1040 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1041 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1042 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1043 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1044 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1045 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1046 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1047 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1048 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1049 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1050 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1051 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1052 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1053 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1054 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1055 KASEIKYO_FLAGS
// flags: some flags
1060 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1062 static PROGMEM IRMP_PARAMETER recs80_param
=
1064 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1065 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1066 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1067 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1068 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1069 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1070 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1071 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1072 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1073 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1074 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1075 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1076 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1077 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1078 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1079 RECS80_LSB
, // lsb_first: flag: LSB first
1080 RECS80_FLAGS
// flags: some flags
1085 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1087 static PROGMEM IRMP_PARAMETER rc5_param
=
1089 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1090 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1091 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1092 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1093 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1094 RC5_BIT_LEN_MIN_2
, // pulse_0_len_min: here: minimum length of long pulse
1095 RC5_BIT_LEN_MAX_2
, // pulse_0_len_max: here: maximum length of long pulse
1096 RC5_BIT_LEN_MIN_2
, // pause_0_len_min: here: minimum length of long pause
1097 RC5_BIT_LEN_MAX_2
, // pause_0_len_max: here: maximum length of long pause
1098 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1099 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1100 RC5_COMMAND_OFFSET
, // command_offset: command offset
1101 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1102 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1103 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1104 RC5_LSB
, // lsb_first: flag: LSB first
1105 RC5_FLAGS
// flags: some flags
1110 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1112 static PROGMEM IRMP_PARAMETER denon_param
=
1114 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1115 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1116 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1117 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1118 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1119 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1120 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1121 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1122 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1123 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1124 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1125 DENON_COMMAND_OFFSET
, // command_offset: command offset
1126 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1127 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1128 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1129 DENON_LSB
, // lsb_first: flag: LSB first
1130 DENON_FLAGS
// flags: some flags
1135 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1137 static PROGMEM IRMP_PARAMETER rc6_param
=
1139 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1141 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1142 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1143 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1144 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1145 RC6_BIT_PULSE_LEN_MIN_2
, // pulse_0_len_min: here: minimum length of long pulse
1146 RC6_BIT_PULSE_LEN_MAX_2
, // pulse_0_len_max: here: maximum length of long pulse
1147 RC6_BIT_PAUSE_LEN_MIN_2
, // pause_0_len_min: here: minimum length of long pause
1148 RC6_BIT_PAUSE_LEN_MAX_2
, // pause_0_len_max: here: maximum length of long pause
1149 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1150 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1151 RC6_COMMAND_OFFSET
, // command_offset: command offset
1152 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1153 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1154 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1155 RC6_LSB
, // lsb_first: flag: LSB first
1156 RC6_FLAGS
// flags: some flags
1161 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1163 static PROGMEM IRMP_PARAMETER recs80ext_param
=
1165 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1166 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1167 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1168 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1169 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1170 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1171 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1172 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1173 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1174 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1175 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1176 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1177 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1178 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1179 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1180 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1181 RECS80EXT_FLAGS
// flags: some flags
1186 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1188 static PROGMEM IRMP_PARAMETER nubert_param
=
1190 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1191 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1192 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1193 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1194 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1195 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1196 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1197 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1198 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1199 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1200 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1201 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1202 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1203 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1204 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1205 NUBERT_LSB
, // lsb_first: flag: LSB first
1206 NUBERT_FLAGS
// flags: some flags
1211 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1213 static PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1215 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1216 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1217 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1218 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1219 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1220 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1221 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1222 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1223 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1224 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1225 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1226 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1227 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1228 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1229 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1230 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1231 BANG_OLUFSEN_FLAGS
// flags: some flags
1236 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1238 static uint8_t first_bit
;
1240 static PROGMEM IRMP_PARAMETER grundig_param
=
1242 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1244 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1245 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1246 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1247 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1248 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2
, // pulse_0_len_min: here: minimum length of long pulse
1249 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2
, // pulse_0_len_max: here: maximum length of long pulse
1250 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2
, // pause_0_len_min: here: minimum length of long pause
1251 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2
, // pause_0_len_max: here: maximum length of long pause
1253 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1254 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1255 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1256 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1257 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1258 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1259 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1260 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1265 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1267 static PROGMEM IRMP_PARAMETER ruwido_param
=
1269 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1270 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1271 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1272 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1273 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1274 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2
, // pulse_0_len_min: here: minimum length of long pulse
1275 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2
, // pulse_0_len_max: here: maximum length of long pulse
1276 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2
, // pause_0_len_min: here: minimum length of long pause
1277 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2
, // pause_0_len_max: here: maximum length of long pause
1278 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1279 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1280 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1281 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1282 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1283 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1284 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1285 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1290 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1292 static PROGMEM IRMP_PARAMETER fdc_param
=
1294 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1295 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1296 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1297 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1298 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1299 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1300 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1301 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1302 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1303 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1304 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1305 FDC_COMMAND_OFFSET
, // command_offset: command offset
1306 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1307 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1308 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1309 FDC_LSB
, // lsb_first: flag: LSB first
1310 FDC_FLAGS
// flags: some flags
1315 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1317 static PROGMEM IRMP_PARAMETER rccar_param
=
1319 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1320 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1321 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1322 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1323 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1324 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1325 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1326 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1327 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1328 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1329 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1330 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1331 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1332 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1333 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1334 RCCAR_LSB
, // lsb_first: flag: LSB first
1335 RCCAR_FLAGS
// flags: some flags
1340 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1342 static PROGMEM IRMP_PARAMETER nikon_param
=
1344 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1345 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1346 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1347 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1348 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1349 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1350 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1351 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1352 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1353 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1354 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1355 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1356 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1357 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1358 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1359 NIKON_LSB
, // lsb_first: flag: LSB first
1360 NIKON_FLAGS
// flags: some flags
1365 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1367 static PROGMEM IRMP_PARAMETER kathrein_param
=
1369 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1370 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1371 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1372 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1373 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1374 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1375 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1376 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1377 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1378 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1379 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1380 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1381 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1382 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1383 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1384 KATHREIN_LSB
, // lsb_first: flag: LSB first
1385 KATHREIN_FLAGS
// flags: some flags
1390 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1392 static PROGMEM IRMP_PARAMETER netbox_param
=
1394 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1395 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1396 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1397 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1398 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1399 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1400 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1401 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1402 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1403 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1404 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1405 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1406 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1407 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1408 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1409 NETBOX_LSB
, // lsb_first: flag: LSB first
1410 NETBOX_FLAGS
// flags: some flags
1415 #if IRMP_SUPPORT_IMON_PROTOCOL == 1
1417 static PROGMEM IRMP_PARAMETER imon_param
=
1419 IRMP_IMON_PROTOCOL
, // protocol: ir protocol
1420 IMON_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1421 IMON_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1
1422 IMON_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1
1423 IMON_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1
1424 IMON_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1425 IMON_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0
1426 IMON_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0
1427 IMON_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0
1428 IMON_ADDRESS_OFFSET
, // address_offset: address offset
1429 IMON_ADDRESS_OFFSET
+ IMON_ADDRESS_LEN
, // address_end: end of address
1430 IMON_COMMAND_OFFSET
, // command_offset: command offset
1431 IMON_COMMAND_OFFSET
+ IMON_COMMAND_LEN
, // command_end: end of command
1432 IMON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1433 IMON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1434 IMON_LSB
, // lsb_first: flag: LSB first
1435 IMON_FLAGS
// flags: some flags
1440 static uint8_t irmp_bit
; // current bit position
1441 static IRMP_PARAMETER irmp_param
;
1443 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1444 static IRMP_PARAMETER irmp_param2
;
1447 static volatile uint8_t irmp_ir_detected
;
1448 static volatile uint8_t irmp_protocol
;
1449 static volatile uint16_t irmp_address
;
1450 static volatile uint16_t irmp_command
;
1451 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1452 static volatile uint8_t irmp_flags
;
1455 static uint8_t IRMP_PIN
;
1458 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1459 * Initialize IRMP decoder
1460 * @details Configures IRMP input pin
1461 *---------------------------------------------------------------------------------------------------------------------------------------------------
1467 #ifndef PIC_CCS_COMPILER
1468 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1469 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1470 #endif // PIC_CCS_COMPILER
1472 #if IRMP_LOGGING == 1
1477 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1479 * @details gets decoded IRMP data
1480 * @param pointer in order to store IRMP data
1481 * @return TRUE: successful, FALSE: failed
1482 *---------------------------------------------------------------------------------------------------------------------------------------------------
1485 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1487 uint8_t rtc
= FALSE
;
1489 if (irmp_ir_detected
)
1491 switch (irmp_protocol
)
1493 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1494 case IRMP_SAMSUNG_PROTOCOL
:
1495 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1497 irmp_command
&= 0xff;
1498 irmp_command
|= irmp_id
<< 8;
1503 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1504 case IRMP_NEC_PROTOCOL
:
1505 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1507 irmp_command
&= 0xff;
1510 else if (irmp_address
== 0x87EE)
1512 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1513 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1514 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1515 irmp_command
&= 0x00FF;
1520 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1521 case IRMP_SIEMENS_PROTOCOL
:
1522 case IRMP_RUWIDO_PROTOCOL
:
1523 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1530 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1531 case IRMP_KATHREIN_PROTOCOL
:
1532 if (irmp_command
!= 0x0000)
1538 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1539 case IRMP_IR60_PROTOCOL
:
1540 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1546 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1547 case IRMP_RCCAR_PROTOCOL
:
1548 // frame in irmp_data:
1549 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1550 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1551 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1552 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1553 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1554 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1555 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1558 #if 1 // squeeze code to 8 bit, upper bit indicates release-key
1559 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1560 case IRMP_NETBOX_PROTOCOL
:
1561 if (irmp_command
& 0x1000) // last bit set?
1563 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1566 irmp_command
&= 0x7F;
1569 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1572 irmp_command
|= 0x80;
1577 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1582 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1593 irmp_data_p
->protocol
= irmp_protocol
;
1594 irmp_data_p
->address
= irmp_address
;
1595 irmp_data_p
->command
= irmp_command
;
1596 irmp_data_p
->flags
= irmp_flags
;
1602 irmp_ir_detected
= FALSE
;
1608 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1609 static uint16_t irmp_tmp_address
; // ir address
1610 static uint16_t irmp_tmp_command
; // ir command
1612 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1613 static uint16_t irmp_tmp_address2
; // ir address
1614 static uint16_t irmp_tmp_command2
; // ir command
1617 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1618 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1620 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1621 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1624 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1626 * @details store bit in temp address or temp command
1627 * @param value to store: 0 or 1
1628 *---------------------------------------------------------------------------------------------------------------------------------------------------
1630 // verhindert, dass irmp_store_bit() inline compiliert wird:
1631 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1634 irmp_store_bit (uint8_t value
)
1636 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1637 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1644 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1646 if (irmp_param
.lsb_first
)
1648 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1652 irmp_tmp_address
<<= 1;
1653 irmp_tmp_address
|= value
;
1656 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1658 if (irmp_param
.lsb_first
)
1660 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1664 irmp_tmp_command
<<= 1;
1665 irmp_tmp_command
|= value
;
1669 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1670 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1672 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1676 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1677 else if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1679 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1683 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1684 else if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& irmp_bit
>= 20 && irmp_bit
< 24)
1686 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits in upper nibble with LSB first
1689 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1693 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1697 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1706 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1708 * @details store bit in temp address or temp command
1709 * @param value to store: 0 or 1
1710 *---------------------------------------------------------------------------------------------------------------------------------------------------
1712 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1714 irmp_store_bit2 (uint8_t value
)
1718 if (irmp_param
.protocol
)
1720 irmp_bit2
= irmp_bit
- 2;
1724 irmp_bit2
= irmp_bit
- 1;
1727 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1729 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1731 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1733 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1736 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1738 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1740 * @details ISR routine, called 10000 times per second
1741 *---------------------------------------------------------------------------------------------------------------------------------------------------
1746 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1747 static uint8_t wait_for_space
; // flag: wait for data bit space
1748 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1749 static uint8_t irmp_pulse_time
; // count bit time for pulse
1750 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1751 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1752 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1753 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1754 static uint8_t repetition_frame_number
;
1755 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1756 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1758 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1759 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1761 #if IRMP_SUPPORT_MANCHESTER == 1
1762 static PAUSE_LEN last_pause
; // last pause value
1764 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1765 static uint8_t last_value
; // last bit value
1767 uint8_t irmp_input
; // input value
1773 irmp_input
= input(IRMP_PIN
);
1775 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1777 if (! irmp_ir_detected
) // ir code already detected?
1779 if (! irmp_start_bit_detected
) // start bit detected?
1781 if (! irmp_input
) // receiving burst?
1784 if (! irmp_pulse_time
)
1786 ANALYZE_PRINTF("%8d [starting pulse]\n", time_counter
);
1789 irmp_pulse_time
++; // increment counter
1793 if (irmp_pulse_time
) // it's dark....
1794 { // set flags for counting the time of darkness...
1795 irmp_start_bit_detected
= 1;
1796 wait_for_start_space
= 1;
1798 irmp_tmp_command
= 0;
1799 irmp_tmp_address
= 0;
1801 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1802 irmp_tmp_command2
= 0;
1803 irmp_tmp_address2
= 0;
1807 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1808 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1809 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1814 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1823 if (wait_for_start_space
) // we have received start bit...
1824 { // ...and are counting the time of darkness
1825 if (irmp_input
) // still dark?
1827 irmp_pause_time
++; // increment counter
1829 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1830 if (((irmp_pulse_time
< NIKON_START_BIT_PULSE_LEN_MIN
|| irmp_pulse_time
> NIKON_START_BIT_PULSE_LEN_MAX
) && irmp_pause_time
> IRMP_TIMEOUT_LEN
) ||
1831 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1833 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1836 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1837 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1842 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1844 ANALYZE_PRINTF ("%8d error 1: pause after start bit pulse %d too long: %d\n", time_counter
, irmp_pulse_time
, irmp_pause_time
);
1845 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1847 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1848 irmp_pulse_time
= 0;
1849 irmp_pause_time
= 0;
1853 { // receiving first data pulse!
1854 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1856 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1857 irmp_param2
.protocol
= 0;
1860 ANALYZE_PRINTF ("%8d [start-bit: pulse = %2d, pause = %2d]\n", time_counter
, irmp_pulse_time
, irmp_pause_time
);
1862 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1863 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1864 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1866 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1867 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1868 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1869 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1872 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1874 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1875 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1876 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1877 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1879 ANALYZE_PRINTF ("protocol = NEC or JVC repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1880 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1881 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1882 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1885 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1887 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1888 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1889 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1891 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1892 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1893 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1894 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1895 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1897 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1898 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1899 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1900 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1904 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1905 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1907 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1908 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1909 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1911 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
1914 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1916 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1917 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1918 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1920 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1921 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1922 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1923 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1926 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1928 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1929 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1930 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1932 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1933 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
1934 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
1935 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
1938 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1940 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1941 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
1942 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
1943 { // it's MATSUSHITA
1944 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1945 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
1946 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
1947 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
1950 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1952 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1953 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
1954 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
1956 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1957 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
1958 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
1959 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
1962 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1964 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1965 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
1966 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
1968 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1969 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
1970 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
1971 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
1974 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
1976 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1977 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
1978 (irmp_pulse_time
>= RC5_START_BIT_LEN_MIN_2
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX_2
)) &&
1979 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
1980 (irmp_pause_time
>= RC5_START_BIT_LEN_MIN_2
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX_2
)))
1982 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1983 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
1984 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
1986 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
1987 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1988 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
1989 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
1990 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1991 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1992 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1993 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
1996 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
1998 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1999 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2000 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2002 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2003 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2004 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2005 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2006 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2007 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2008 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2009 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2012 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2014 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2015 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2016 RC5_START_BIT_LEN_MIN_2
, RC5_START_BIT_LEN_MAX_2
,
2017 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2018 RC5_START_BIT_LEN_MIN_2
, RC5_START_BIT_LEN_MAX_2
);
2021 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2022 last_pause
= irmp_pause_time
;
2024 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX_2
) ||
2025 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX_2
))
2028 rc5_cmd_bit6
= 1<<6;
2036 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2038 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2039 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2040 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2041 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2043 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2044 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2045 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2046 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2047 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2050 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2052 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2053 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2054 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2056 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2057 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2058 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2059 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2064 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2066 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2067 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2068 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2070 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2071 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2072 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2073 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2076 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2078 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2079 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2080 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2082 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2083 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2084 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2085 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2088 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2090 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2091 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2092 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2093 { // it's BANG_OLUFSEN
2094 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2095 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2096 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2097 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2098 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2099 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2100 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2101 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2102 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2103 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2104 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2105 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2106 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2107 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2111 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2113 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2114 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2115 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2117 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2118 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2119 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2120 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2121 last_pause
= irmp_pause_time
;
2125 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2127 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2128 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2129 (irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2
)) &&
2130 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2131 (irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2
)))
2132 { // it's RUWIDO or SIEMENS
2133 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2134 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2135 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2
,
2136 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2137 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2
);
2138 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2139 last_pause
= irmp_pause_time
;
2143 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2145 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2146 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2147 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2149 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2150 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2151 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2152 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2155 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2157 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2158 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2159 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2161 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2162 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2163 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2164 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2167 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2169 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2170 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2171 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2173 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2174 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2175 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2176 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2179 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2181 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2182 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2183 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2185 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2186 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2187 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2188 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2191 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2193 #if IRMP_SUPPORT_IMON_PROTOCOL == 1
2194 if (irmp_pulse_time
>= IMON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= IMON_START_BIT_PULSE_LEN_MAX
&&
2195 irmp_pause_time
>= IMON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= IMON_START_BIT_PAUSE_LEN_MAX
)
2197 ANALYZE_PRINTF ("protocol = IMON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2198 IMON_START_BIT_PULSE_LEN_MIN
, IMON_START_BIT_PULSE_LEN_MAX
,
2199 IMON_START_BIT_PAUSE_LEN_MIN
, IMON_START_BIT_PAUSE_LEN_MAX
);
2200 irmp_param_p
= (IRMP_PARAMETER
*) &imon_param
;
2203 #endif // IRMP_SUPPORT_IMON_PROTOCOL == 1
2206 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2207 irmp_start_bit_detected
= 0; // wait for another start bit...
2210 if (irmp_start_bit_detected
)
2212 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2215 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2217 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2218 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2222 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2223 irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2224 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2225 irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2228 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2229 if (irmp_param2
.protocol
)
2231 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2232 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2233 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2234 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2239 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2240 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2242 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2246 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2248 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2249 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2252 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2253 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2255 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2256 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2260 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2261 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2262 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2263 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2269 #if IRMP_SUPPORT_MANCHESTER == 1
2270 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2271 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2272 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2274 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= irmp_param
.pulse_0_len_max
) // XXXXXXXX!!!
2276 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2277 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2279 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2281 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2283 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2285 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2287 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2291 #endif // IRMP_SUPPORT_MANCHESTER == 1
2293 #if IRMP_SUPPORT_SERIAL == 1
2294 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2299 #endif // IRMP_SUPPORT_SERIAL == 1
2302 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2303 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2305 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2307 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2308 { // pause timings correct for "1"?
2309 ANALYZE_PUTCHAR ('1'); // yes, store 1
2313 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2314 { // pause timings correct for "0"?
2315 ANALYZE_PUTCHAR ('0'); // yes, store 0
2321 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2323 ; // else do nothing
2326 irmp_pulse_time
= 1; // set counter to 1, not 0
2327 irmp_pause_time
= 0;
2328 wait_for_start_space
= 0;
2331 else if (wait_for_space
) // the data section....
2332 { // counting the time of darkness....
2333 uint8_t got_light
= FALSE
;
2335 if (irmp_input
) // still dark?
2337 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2340 #if IRMP_SUPPORT_MANCHESTER == 1
2341 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2343 #if IRMP_SUPPORT_SERIAL == 1
2344 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2346 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2349 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2351 ANALYZE_PRINTF ("stop bit detected\n");
2354 irmp_param
.stop_bit
= 0;
2358 ANALYZE_PRINTF ("error: stop bit timing wrong\n");
2360 irmp_start_bit_detected
= 0; // wait for another start bit...
2361 irmp_pulse_time
= 0;
2362 irmp_pause_time
= 0;
2367 irmp_pause_time
++; // increment counter
2369 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2370 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2371 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2372 irmp_bit
>= 12 - 1) // pause too long?
2373 { // yes, break and close this frame
2374 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2375 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2376 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2377 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2378 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2382 #if IRMP_SUPPORT_SERIAL == 1
2383 // NETBOX generates no stop bit, here is the timeout condition:
2384 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2385 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2387 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2391 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2392 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2394 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& irmp_bit
== 6)
2396 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2397 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2398 irmp_param
.stop_bit
= TRUE
; // set flag
2400 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2401 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2402 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2403 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2404 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2405 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2407 irmp_tmp_command
<<= 1;
2408 irmp_tmp_command
|= first_bit
;
2410 else if (irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2411 { // special manchester decoder
2412 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2413 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2414 irmp_param
.stop_bit
= TRUE
; // set flag
2416 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2418 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2419 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2420 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2421 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2422 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2423 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2425 if (irmp_tmp_command
& 0x300)
2427 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2428 irmp_tmp_command
&= 0xFF;
2434 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2435 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2437 if (irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2438 { // special manchester decoder
2439 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2440 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2441 irmp_param
.stop_bit
= TRUE
; // set flag
2443 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2445 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2446 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2447 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2448 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2449 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2450 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2453 // RUWIDO: AAAAAAAAACCCCCCCp
2454 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2455 irmp_tmp_address
<<= 2;
2456 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2457 irmp_tmp_command
&= 0x003F;
2458 irmp_tmp_command
<<= 4;
2459 irmp_tmp_command
|= last_value
;
2464 #if IRMP_SUPPORT_MANCHESTER == 1
2465 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2466 irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2467 { // special manchester decoder
2468 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2469 irmp_param
.stop_bit
= TRUE
; // set flag
2472 #endif // IRMP_SUPPORT_MANCHESTER == 1
2473 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2475 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2479 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2480 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2482 ANALYZE_PRINTF ("Switching to JVC protocol\n");
2483 irmp_param
.stop_bit
= TRUE
; // set flag
2484 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2485 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2486 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2487 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2488 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2490 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2492 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2493 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2494 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2496 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2497 irmp_param
.stop_bit
= TRUE
; // set flag
2498 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2499 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2501 // 0123456789ABC0123456789ABC0123456701234567
2502 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2503 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2504 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 12;
2505 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2507 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2508 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2509 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 16) // it was a JVC stop bit
2511 ANALYZE_PRINTF ("Switching to JVC protocol\n");
2512 irmp_param
.stop_bit
= TRUE
; // set flag
2513 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2514 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2516 // 0123456789ABC0123456789ABC0123456701234567
2517 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2518 // JVC: AAAACCCCCCCCCCCC
2519 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2520 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2522 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2523 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2526 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2527 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2529 irmp_start_bit_detected
= 0; // wait for another start bit...
2530 irmp_pulse_time
= 0;
2531 irmp_pause_time
= 0;
2543 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2545 #if IRMP_SUPPORT_MANCHESTER == 1
2546 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2549 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= irmp_param.pulse_0_len_max */)
2551 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2552 irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2555 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2556 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2558 ANALYZE_PUTCHAR ('T');
2559 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2572 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2574 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2575 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2577 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2578 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2580 ANALYZE_PUTCHAR ('T');
2583 if (irmp_pause_time
> irmp_param
.pause_0_len_max
)
2594 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2596 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2597 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2598 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2599 if (! irmp_param2
.protocol
)
2604 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2608 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
/* &&
2609 irmp_pause_time <= irmp_param.pause_0_len_max */)
2611 uint8_t manchester_value
;
2613 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= irmp_param
.pause_0_len_max
)
2615 manchester_value
= last_value
? 0 : 1;
2616 last_value
= manchester_value
;
2620 manchester_value
= last_value
;
2623 ANALYZE_PUTCHAR (manchester_value
+ '0');
2625 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2626 if (! irmp_param2
.protocol
)
2632 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2633 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2635 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2636 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2637 irmp_param
.address_offset
= 5;
2638 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2639 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2640 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2641 irmp_tmp_address
= 0;
2643 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2645 irmp_store_bit (manchester_value
);
2649 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2650 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2651 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2652 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2653 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2655 ANALYZE_PUTCHAR ('?');
2656 irmp_param
.protocol
= 0; // switch to FDC, see below
2659 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2660 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2661 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2662 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2663 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2664 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2666 ANALYZE_PUTCHAR ('?');
2667 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2670 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2672 ANALYZE_PUTCHAR ('?');
2674 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2675 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2676 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2677 irmp_pause_time
= 0;
2681 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2682 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2684 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2686 ANALYZE_PRINTF (" 1 (FDC)\n");
2687 irmp_store_bit2 (1);
2689 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2691 ANALYZE_PRINTF (" 0 (FDC)\n");
2692 irmp_store_bit2 (0);
2695 if (! irmp_param
.protocol
)
2697 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2698 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2699 irmp_param2
.protocol
= 0;
2700 irmp_tmp_address
= irmp_tmp_address2
;
2701 irmp_tmp_command
= irmp_tmp_command2
;
2704 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2705 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2706 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2708 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2710 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2711 irmp_store_bit2 (1);
2713 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2715 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2716 irmp_store_bit2 (0);
2719 if (! irmp_param
.protocol
)
2721 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2722 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2723 irmp_param2
.protocol
= 0;
2724 irmp_tmp_address
= irmp_tmp_address2
;
2725 irmp_tmp_command
= irmp_tmp_command2
;
2728 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2730 last_pause
= irmp_pause_time
;
2734 #endif // IRMP_SUPPORT_MANCHESTER == 1
2736 #if IRMP_SUPPORT_SERIAL == 1
2737 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2739 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2741 ANALYZE_PUTCHAR ('1');
2744 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2746 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2750 irmp_pulse_time
= 0;
2754 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2756 ANALYZE_PUTCHAR ('0');
2759 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2761 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2765 irmp_pause_time
= 0;
2772 #endif // IRMP_SUPPORT_SERIAL == 1
2774 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2775 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2777 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2778 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2780 ANALYZE_PRINTF ("SYNC\n");
2785 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2787 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2788 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2789 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2790 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2792 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2794 ANALYZE_PUTCHAR ('1');
2801 ANALYZE_PUTCHAR ('0');
2807 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2810 { // timing incorrect!
2811 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2812 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2813 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2814 irmp_pause_time
= 0;
2818 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2820 #if IRMP_SUPPORT_NEC16_PROTOCOL
2821 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2822 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
2823 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
2824 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
2825 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2826 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2828 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2829 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
2830 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
2831 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
2832 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
2833 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
2834 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
2838 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2840 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2841 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2843 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2845 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2847 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2849 ANALYZE_PRINTF ("3rd start bit\n");
2854 { // timing incorrect!
2855 ANALYZE_PRINTF ("error 3a B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2856 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2857 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2858 irmp_pause_time
= 0;
2861 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2863 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2865 ANALYZE_PRINTF ("trailer bit\n");
2870 { // timing incorrect!
2871 ANALYZE_PRINTF ("error 3b B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2872 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2873 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2874 irmp_pause_time
= 0;
2879 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
2880 { // pulse & pause timings correct for "1"?
2881 ANALYZE_PUTCHAR ('1');
2887 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
2888 { // pulse & pause timings correct for "0"?
2889 ANALYZE_PUTCHAR ('0');
2895 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
2897 ANALYZE_PUTCHAR (last_value
+ '0');
2899 irmp_store_bit (last_value
);
2903 { // timing incorrect!
2904 ANALYZE_PRINTF ("error 3c B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2905 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2906 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2907 irmp_pause_time
= 0;
2912 { // timing incorrect!
2913 ANALYZE_PRINTF ("error 3d B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2914 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2915 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2916 irmp_pause_time
= 0;
2920 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
2922 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
2923 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
2924 { // pulse & pause timings correct for "1"?
2925 ANALYZE_PUTCHAR ('1');
2930 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2931 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2932 { // pulse & pause timings correct for "0"?
2933 ANALYZE_PUTCHAR ('0');
2939 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
2941 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
2942 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
2943 (((irmp_bit
== 8 || irmp_bit
== 6) &&
2944 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
2946 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
2952 ANALYZE_PUTCHAR ('S');
2954 irmp_tmp_command
<<= 1;
2958 ANALYZE_PUTCHAR ('S');
2965 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
2966 { // timing incorrect!
2967 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2968 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2969 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2970 irmp_pause_time
= 0;
2973 irmp_pulse_time
= 1; // set counter to 1, not 0
2977 { // counting the pulse length ...
2978 if (! irmp_input
) // still light?
2980 irmp_pulse_time
++; // increment counter
2984 wait_for_space
= 1; // let's count the time (see above)
2985 irmp_pause_time
= 1; // set pause counter to 1, not 0
2989 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
2991 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
2993 repetition_frame_number
++;
2997 repetition_frame_number
= 0;
3000 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3001 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3002 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3004 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3005 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3011 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3012 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3013 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3015 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3016 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3022 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3023 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3024 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3026 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3027 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3033 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3034 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3035 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3037 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3038 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3045 ANALYZE_PRINTF ("%8d code detected, length = %d\n", time_counter
, irmp_bit
);
3046 irmp_ir_detected
= TRUE
;
3048 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3049 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3050 { // check for repetition frame
3051 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3053 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3055 irmp_protocol
= irmp_param
.protocol
; // store protocol
3056 irmp_address
= irmp_tmp_address
; // store address
3057 irmp_command
= irmp_tmp_command
; // store command
3061 ANALYZE_PRINTF ("waiting for inverted command repetition\n");
3062 irmp_ir_detected
= FALSE
;
3063 last_irmp_denon_command
= irmp_tmp_command
;
3067 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3069 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3070 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3071 { // Grundig start frame?
3072 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3073 irmp_ir_detected
= FALSE
;
3076 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3078 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3079 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3080 { // Nokia start frame?
3081 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3082 irmp_ir_detected
= FALSE
;
3085 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3087 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3088 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3090 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3092 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3093 irmp_tmp_address
= last_irmp_address
; // address is last address
3094 irmp_tmp_command
= last_irmp_command
; // command is last command
3095 irmp_flags
|= IRMP_FLAG_REPETITION
;
3100 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3101 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3102 irmp_ir_detected
= FALSE
;
3105 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3107 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3108 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3111 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3112 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3114 xor = (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3116 if (xor != (xor_check
[2] & 0x0F))
3118 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check
[2] & 0x0F);
3119 irmp_ir_detected
= FALSE
;
3122 xor = xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3124 if (xor != xor_check
[5])
3126 ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check
[5]);
3127 irmp_ir_detected
= FALSE
;
3130 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3132 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3133 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3135 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3138 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3140 irmp_protocol
= irmp_param
.protocol
;
3142 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3143 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3145 if (irmp_tmp_command
& 0x000F) // released key?
3147 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3151 irmp_tmp_command
>>= 4; // no, it's a pressed key
3153 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3154 irmp_tmp_address
&= 0x003F;
3158 irmp_address
= irmp_tmp_address
; // store address
3159 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3160 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3163 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3164 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3166 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3169 irmp_command
= irmp_tmp_command
; // store command
3171 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3172 irmp_id
= irmp_tmp_id
;
3177 if (irmp_ir_detected
)
3179 if (last_irmp_command
== irmp_command
&&
3180 last_irmp_address
== irmp_address
&&
3181 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3183 irmp_flags
|= IRMP_FLAG_REPETITION
;
3186 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3187 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3193 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3196 irmp_start_bit_detected
= 0; // and wait for next start bit
3197 irmp_tmp_command
= 0;
3198 irmp_pulse_time
= 0;
3199 irmp_pause_time
= 0;
3201 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3202 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3203 { // set pulse time here!
3204 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3206 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3210 return (irmp_ir_detected
);
3215 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3216 * main functions - for Unix/Linux + Windows only!
3220 * Compile it under linux with:
3223 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3229 * -l list pulse/pauses
3231 *---------------------------------------------------------------------------------------------------------------------------------------------------
3235 print_timings (void)
3237 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3238 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3240 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3241 printf ("====================================================================================\n");
3242 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3243 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3244 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3245 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3247 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3248 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3249 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3250 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3252 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3253 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
,
3254 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3255 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3257 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3258 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3259 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3260 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3262 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3263 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3264 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3265 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3267 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3268 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3269 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3270 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3272 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3273 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3274 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3275 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3277 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3278 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3279 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3281 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3282 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3283 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3284 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3286 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3287 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3288 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3290 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3291 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3292 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3293 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3295 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3296 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3297 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3298 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3300 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3301 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3302 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3304 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3305 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3306 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3308 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3309 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3310 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3312 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3313 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3314 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3316 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3317 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3318 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3320 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3321 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3322 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3323 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3325 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3326 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3327 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3328 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3329 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3330 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2
,
3331 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2
);
3333 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3334 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3335 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3336 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3338 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3339 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3340 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3341 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3343 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3344 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3345 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3346 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3350 print_spectrum (char * text
, int * buf
, int is_pulse
)
3363 puts ("-------------------------------------------------------------------------------");
3364 printf ("%s:\n", text
);
3366 for (i
= 0; i
< 256; i
++)
3368 if (buf
[i
] > max_value
)
3374 for (i
= 1; i
< 100; i
++)
3379 value
= (buf
[i
] * 60) / max_value
;
3381 for (j
= 0; j
< value
; j
++)
3385 printf (" %d\n", buf
[i
]);
3396 average
= (float) sum
/ (float) counter
;
3407 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3408 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3409 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3411 tolerance
= (max
- average
);
3413 if (average
- min
> tolerance
)
3415 tolerance
= average
- min
;
3418 tolerance
= tolerance
* 100 / average
;
3419 printf ("tol: %4.1f%%\n", tolerance
);
3429 #define STATE_LEFT_SHIFT 0x01
3430 #define STATE_RIGHT_SHIFT 0x02
3431 #define STATE_LEFT_CTRL 0x04
3432 #define STATE_LEFT_ALT 0x08
3433 #define STATE_RIGHT_ALT 0x10
3435 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3436 #define KEY_MENUE 0x80 // keycode = 0x0070
3437 #define KEY_BACK 0x81 // keycode = 0x0071
3438 #define KEY_FORWARD 0x82 // keycode = 0x0072
3439 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3440 #define KEY_WINDOW 0x84 // keycode = 0x0074
3441 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3442 #define KEY_STOP 0x86 // keycode = 0x0076
3443 #define KEY_MAIL 0x87 // keycode = 0x0077
3444 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3445 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3446 #define KEY_SETUP 0x8A // keycode = 0x007a
3447 #define KEY_FONT 0x8B // keycode = 0x007b
3448 #define KEY_PRINT 0x8C // keycode = 0x007c
3449 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3451 #define KEY_INSERT 0x90 // keycode = 0x004b
3452 #define KEY_DELETE 0x91 // keycode = 0x004c
3453 #define KEY_LEFT 0x92 // keycode = 0x004f
3454 #define KEY_HOME 0x93 // keycode = 0x0050
3455 #define KEY_END 0x94 // keycode = 0x0051
3456 #define KEY_UP 0x95 // keycode = 0x0053
3457 #define KEY_DOWN 0x96 // keycode = 0x0054
3458 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3459 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3460 #define KEY_RIGHT 0x99 // keycode = 0x0059
3461 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3462 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3465 get_fdc_key (uint16_t cmd
)
3467 static uint8_t key_table
[128] =
3469 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3470 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3471 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3472 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3473 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3475 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3476 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3477 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3478 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3480 static uint8_t state
;
3486 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3487 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3488 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3489 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3490 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3491 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3492 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3493 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3494 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3495 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3497 case 0x006e: key
= KEY_ESCAPE
; break;
3498 case 0x004b: key
= KEY_INSERT
; break;
3499 case 0x004c: key
= KEY_DELETE
; break;
3500 case 0x004f: key
= KEY_LEFT
; break;
3501 case 0x0050: key
= KEY_HOME
; break;
3502 case 0x0051: key
= KEY_END
; break;
3503 case 0x0053: key
= KEY_UP
; break;
3504 case 0x0054: key
= KEY_DOWN
; break;
3505 case 0x0055: key
= KEY_PAGE_UP
; break;
3506 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3507 case 0x0059: key
= KEY_RIGHT
; break;
3508 case 0x0400: key
= KEY_MOUSE_1
; break;
3509 case 0x0800: key
= KEY_MOUSE_2
; break;
3513 if (!(cmd
& 0x80)) // pressed key
3515 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3517 key
= cmd
+ 0x10; // 7x -> 8x
3519 else if (cmd
< 64) // key listed in key_table
3521 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3525 case 0x0003: key
= '²'; break;
3526 case 0x0008: key
= '{'; break;
3527 case 0x0009: key
= '['; break;
3528 case 0x000A: key
= ']'; break;
3529 case 0x000B: key
= '}'; break;
3530 case 0x000C: key
= '\\'; break;
3531 case 0x001C: key
= '~'; break;
3532 case 0x002D: key
= '|'; break;
3533 case 0x0034: key
= 0xB5; break; // Mu
3536 else if (state
& (STATE_LEFT_CTRL
))
3538 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3540 key
= key_table
[cmd
] - 'a' + 1;
3544 key
= key_table
[cmd
];
3549 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3553 key
= key_table
[idx
];
3565 static int analyze
= FALSE
;
3566 static int list
= FALSE
;
3567 static IRMP_DATA irmp_data
;
3572 if (! analyze
&& ! list
)
3576 if (irmp_get_data (&irmp_data
))
3580 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3584 printf ("%8d ", time_counter
);
3587 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3589 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3591 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3592 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3594 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3596 char * p
= (char *) NULL
;
3600 case '\t' : p
= "TAB"; break;
3601 case '\r' : p
= "CR"; break;
3602 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3603 case KEY_MENUE
: p
= "MENUE"; break;
3604 case KEY_BACK
: p
= "BACK"; break;
3605 case KEY_FORWARD
: p
= "FORWARD"; break;
3606 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3607 case KEY_WINDOW
: p
= "WINDOW"; break;
3608 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3609 case KEY_STOP
: p
= "STOP"; break;
3610 case KEY_MAIL
: p
= "MAIL"; break;
3611 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3612 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3613 case KEY_SETUP
: p
= "SETUP"; break;
3614 case KEY_FONT
: p
= "FONT"; break;
3615 case KEY_PRINT
: p
= "PRINT"; break;
3616 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3618 case KEY_INSERT
: p
= "INSERT"; break;
3619 case KEY_DELETE
: p
= "DELETE"; break;
3620 case KEY_LEFT
: p
= "LEFT"; break;
3621 case KEY_HOME
: p
= "HOME"; break;
3622 case KEY_END
: p
= "END"; break;
3623 case KEY_UP
: p
= "UP"; break;
3624 case KEY_DOWN
: p
= "DOWN"; break;
3625 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3626 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3627 case KEY_RIGHT
: p
= "RIGHT"; break;
3628 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3629 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3630 default : p
= "<UNKNWON>"; break;
3633 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3634 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3638 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3639 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3644 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3645 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3652 main (int argc
, char ** argv
)
3660 int start_pulses
[256];
3661 int start_pauses
[256];
3665 int first_pulse
= TRUE
;
3666 int first_pause
= TRUE
;
3670 if (! strcmp (argv
[1], "-v"))
3674 else if (! strcmp (argv
[1], "-l"))
3678 else if (! strcmp (argv
[1], "-a"))
3682 else if (! strcmp (argv
[1], "-s"))
3686 else if (! strcmp (argv
[1], "-p"))
3693 for (i
= 0; i
< 256; i
++)
3695 start_pulses
[i
] = 0;
3696 start_pauses
[i
] = 0;
3703 while ((ch
= getchar ()) != EOF
)
3705 if (ch
== '_' || ch
== '0')
3713 printf ("pause: %d\n", pause
);
3722 start_pauses
[pause
]++;
3724 first_pause
= FALSE
;
3740 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3746 printf ("pulse: %d ", pulse
);
3755 start_pulses
[pulse
]++;
3757 first_pulse
= FALSE
;
3773 else if (ch
== '\n')
3777 if (list
&& pause
> 0)
3779 printf ("pause: %d\n", pause
);
3785 for (i
= 0; i
< (int) ((8000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 800 msec
3797 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3804 puts ("-------------------------------------------------------------------");
3807 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3809 if (ch
!= '\r') // ignore CR in DOS/Windows files
3826 print_spectrum ("START PULSES", start_pulses
, TRUE
);
3827 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
3828 print_spectrum ("PULSES", pulses
, TRUE
);
3829 print_spectrum ("PAUSES", pauses
, FALSE
);
3830 puts ("-------------------------------------------------------------------------------");