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.97 2011/02/25 15:24:06 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 µs 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_NEC16_PROTOCOL == 1
962 static PROGMEM IRMP_PARAMETER nec16_param
=
964 IRMP_NEC16_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 NEC16_ADDRESS_OFFSET
, // address_offset: address offset
974 NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
, // address_end: end of address
975 NEC16_COMMAND_OFFSET
, // command_offset: command offset
976 NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
, // command_end: end of command
977 NEC16_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
978 NEC16_STOP_BIT
, // stop_bit: flag: frame has stop bit
979 NEC16_LSB
, // lsb_first: flag: LSB first
980 NEC16_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)
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_SAMSUNG_PROTOCOL == 1
1670 else if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1672 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1676 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1677 else if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& irmp_bit
>= 20 && irmp_bit
< 24)
1679 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits in upper nibble with LSB first
1682 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1686 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1690 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1699 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1701 * @details store bit in temp address or temp command
1702 * @param value to store: 0 or 1
1703 *---------------------------------------------------------------------------------------------------------------------------------------------------
1705 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1707 irmp_store_bit2 (uint8_t value
)
1711 if (irmp_param
.protocol
)
1713 irmp_bit2
= irmp_bit
- 2;
1717 irmp_bit2
= irmp_bit
- 1;
1720 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1722 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1724 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1726 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1729 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1731 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1733 * @details ISR routine, called 10000 times per second
1734 *---------------------------------------------------------------------------------------------------------------------------------------------------
1739 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1740 static uint8_t wait_for_space
; // flag: wait for data bit space
1741 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1742 static uint8_t irmp_pulse_time
; // count bit time for pulse
1743 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1744 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1745 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1746 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1747 static uint8_t repetition_frame_number
;
1748 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1749 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1751 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1752 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1754 #if IRMP_SUPPORT_MANCHESTER == 1
1755 static PAUSE_LEN last_pause
; // last pause value
1757 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1758 static uint8_t last_value
; // last bit value
1760 uint8_t irmp_input
; // input value
1766 irmp_input
= input(IRMP_PIN
);
1768 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1770 if (! irmp_ir_detected
) // ir code already detected?
1772 if (! irmp_start_bit_detected
) // start bit detected?
1774 if (! irmp_input
) // receiving burst?
1777 if (! irmp_pulse_time
)
1779 ANALYZE_PRINTF("%8d [starting pulse]\n", time_counter
);
1782 irmp_pulse_time
++; // increment counter
1786 if (irmp_pulse_time
) // it's dark....
1787 { // set flags for counting the time of darkness...
1788 irmp_start_bit_detected
= 1;
1789 wait_for_start_space
= 1;
1791 irmp_tmp_command
= 0;
1792 irmp_tmp_address
= 0;
1794 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1795 irmp_tmp_command2
= 0;
1796 irmp_tmp_address2
= 0;
1800 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1801 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1802 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1807 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1816 if (wait_for_start_space
) // we have received start bit...
1817 { // ...and are counting the time of darkness
1818 if (irmp_input
) // still dark?
1820 irmp_pause_time
++; // increment counter
1822 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1823 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
) ||
1824 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1826 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1829 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1830 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1835 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1837 ANALYZE_PRINTF ("%8d error 1: pause after start bit pulse %d too long: %d\n", time_counter
, irmp_pulse_time
, irmp_pause_time
);
1838 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1840 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1841 irmp_pulse_time
= 0;
1842 irmp_pause_time
= 0;
1846 { // receiving first data pulse!
1847 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1849 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1850 irmp_param2
.protocol
= 0;
1853 ANALYZE_PRINTF ("%8d [start-bit: pulse = %2d, pause = %2d]\n", time_counter
, irmp_pulse_time
, irmp_pause_time
);
1855 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1856 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1857 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1859 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1860 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1861 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1862 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1865 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1867 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1868 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1869 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1870 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1872 ANALYZE_PRINTF ("protocol = NEC or JVC repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1873 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1874 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1875 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
; // tricky: use nec parameters
1878 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1880 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1881 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1882 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1884 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1885 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1886 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1887 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1889 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1890 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1892 ANALYZE_PRINTF ("protocol = NEC (repetition frame), 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_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1896 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
1899 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1901 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1902 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1903 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1905 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1906 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1907 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1908 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1911 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1913 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1914 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1915 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1917 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1918 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
1919 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
1920 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
1923 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1925 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1926 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
1927 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
1928 { // it's MATSUSHITA
1929 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1930 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
1931 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
1932 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
1935 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1937 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1938 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
1939 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
1941 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1942 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
1943 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
1944 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
1947 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1949 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1950 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
1951 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
1953 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1954 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
1955 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
1956 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
1959 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
1961 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1962 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
1963 (irmp_pulse_time
>= RC5_START_BIT_LEN_MIN_2
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX_2
)) &&
1964 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
1965 (irmp_pause_time
>= RC5_START_BIT_LEN_MIN_2
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX_2
)))
1967 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1968 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
1969 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
1971 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
1972 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1973 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
1974 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
1975 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1976 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1977 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1978 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
1981 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
1983 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1984 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
1985 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
1987 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
1988 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1989 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
1990 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
1991 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1992 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1993 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1994 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
1997 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1999 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2000 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2001 RC5_START_BIT_LEN_MIN_2
, RC5_START_BIT_LEN_MAX_2
,
2002 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2003 RC5_START_BIT_LEN_MIN_2
, RC5_START_BIT_LEN_MAX_2
);
2006 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2007 last_pause
= irmp_pause_time
;
2009 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX_2
) ||
2010 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX_2
))
2013 rc5_cmd_bit6
= 1<<6;
2021 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2023 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2024 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2025 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2026 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2028 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2029 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2030 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2031 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2032 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2035 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2037 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2038 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2039 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2041 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2042 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2043 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2044 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2049 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2051 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2052 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2053 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2055 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2056 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2057 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2058 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2061 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2063 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2064 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2065 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2067 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2068 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2069 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2070 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2073 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2075 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2076 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2077 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2078 { // it's BANG_OLUFSEN
2079 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2080 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2081 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2082 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2083 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2084 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2085 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2086 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2087 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2088 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2089 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2090 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2091 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2092 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2096 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2098 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2099 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2100 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2102 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2103 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2104 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2105 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2106 last_pause
= irmp_pause_time
;
2110 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2112 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2113 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2114 (irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2
)) &&
2115 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2116 (irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2
)))
2117 { // it's RUWIDO or SIEMENS
2118 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2119 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2120 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2
,
2121 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2122 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2
);
2123 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2124 last_pause
= irmp_pause_time
;
2128 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2130 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2131 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2132 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2134 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2135 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2136 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2137 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2140 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2142 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2143 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2144 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2146 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2147 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2148 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2149 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2152 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2154 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2155 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2156 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2158 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2159 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2160 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2161 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2164 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2166 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2167 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2168 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2170 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2171 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2172 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2173 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2176 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2178 #if IRMP_SUPPORT_IMON_PROTOCOL == 1
2179 if (irmp_pulse_time
>= IMON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= IMON_START_BIT_PULSE_LEN_MAX
&&
2180 irmp_pause_time
>= IMON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= IMON_START_BIT_PAUSE_LEN_MAX
)
2182 ANALYZE_PRINTF ("protocol = IMON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2183 IMON_START_BIT_PULSE_LEN_MIN
, IMON_START_BIT_PULSE_LEN_MAX
,
2184 IMON_START_BIT_PAUSE_LEN_MIN
, IMON_START_BIT_PAUSE_LEN_MAX
);
2185 irmp_param_p
= (IRMP_PARAMETER
*) &imon_param
;
2188 #endif // IRMP_SUPPORT_IMON_PROTOCOL == 1
2191 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2192 irmp_start_bit_detected
= 0; // wait for another start bit...
2195 if (irmp_start_bit_detected
)
2197 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2200 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2202 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2203 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2207 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2208 irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2209 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2210 irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2213 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2214 if (irmp_param2
.protocol
)
2216 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2217 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2218 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2219 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2224 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2225 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2227 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2231 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2233 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2234 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2237 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2238 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2240 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2241 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2245 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2246 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2247 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2248 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2254 #if IRMP_SUPPORT_MANCHESTER == 1
2255 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2256 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2257 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2259 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= irmp_param
.pulse_0_len_max
) // XXXXXXXX!!!
2261 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2262 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2264 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2266 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2268 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2270 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2272 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2276 #endif // IRMP_SUPPORT_MANCHESTER == 1
2278 #if IRMP_SUPPORT_SERIAL == 1
2279 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2284 #endif // IRMP_SUPPORT_SERIAL == 1
2287 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2288 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2290 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2292 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2293 { // pause timings correct for "1"?
2294 ANALYZE_PUTCHAR ('1'); // yes, store 1
2298 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2299 { // pause timings correct for "0"?
2300 ANALYZE_PUTCHAR ('0'); // yes, store 0
2306 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2308 ; // else do nothing
2311 irmp_pulse_time
= 1; // set counter to 1, not 0
2312 irmp_pause_time
= 0;
2313 wait_for_start_space
= 0;
2316 else if (wait_for_space
) // the data section....
2317 { // counting the time of darkness....
2318 uint8_t got_light
= FALSE
;
2320 if (irmp_input
) // still dark?
2322 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2325 #if IRMP_SUPPORT_MANCHESTER == 1
2326 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2328 #if IRMP_SUPPORT_SERIAL == 1
2329 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2331 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2334 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2336 ANALYZE_PRINTF ("stop bit detected\n");
2339 irmp_param
.stop_bit
= 0;
2343 ANALYZE_PRINTF ("error: stop bit timing wrong\n");
2345 irmp_start_bit_detected
= 0; // wait for another start bit...
2346 irmp_pulse_time
= 0;
2347 irmp_pause_time
= 0;
2352 irmp_pause_time
++; // increment counter
2354 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2355 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2356 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2357 irmp_bit
>= 12 - 1) // pause too long?
2358 { // yes, break and close this frame
2359 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2360 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2361 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2362 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2363 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2367 #if IRMP_SUPPORT_SERIAL == 1
2368 // NETBOX generates no stop bit, here is the timeout condition:
2369 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2370 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2372 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2376 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2377 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2379 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& irmp_bit
== 6)
2381 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2382 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2383 irmp_param
.stop_bit
= TRUE
; // set flag
2385 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2386 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2387 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2388 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2389 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2390 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2392 irmp_tmp_command
<<= 1;
2393 irmp_tmp_command
|= first_bit
;
2395 else if (irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2396 { // special manchester decoder
2397 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2398 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2399 irmp_param
.stop_bit
= TRUE
; // set flag
2401 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2403 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2404 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2405 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2406 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2407 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2408 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2410 if (irmp_tmp_command
& 0x300)
2412 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2413 irmp_tmp_command
&= 0xFF;
2419 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2420 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2422 if (irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2423 { // special manchester decoder
2424 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2425 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2426 irmp_param
.stop_bit
= TRUE
; // set flag
2428 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2430 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2431 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2432 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2433 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2434 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2435 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2438 // RUWIDO: AAAAAAAAACCCCCCCp
2439 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2440 irmp_tmp_address
<<= 2;
2441 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2442 irmp_tmp_command
&= 0x003F;
2443 irmp_tmp_command
<<= 4;
2444 irmp_tmp_command
|= last_value
;
2449 #if IRMP_SUPPORT_MANCHESTER == 1
2450 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2451 irmp_pause_time
>= irmp_param
.pause_0_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2452 { // special manchester decoder
2453 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2454 irmp_param
.stop_bit
= TRUE
; // set flag
2457 #endif // IRMP_SUPPORT_MANCHESTER == 1
2458 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2460 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2464 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2465 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2467 ANALYZE_PRINTF ("Switching to JVC protocol\n");
2468 irmp_param
.stop_bit
= TRUE
; // set flag
2469 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2470 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2471 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2472 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2473 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2475 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2478 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2479 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2481 irmp_start_bit_detected
= 0; // wait for another start bit...
2482 irmp_pulse_time
= 0;
2483 irmp_pause_time
= 0;
2495 ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2497 #if IRMP_SUPPORT_MANCHESTER == 1
2498 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2501 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= irmp_param.pulse_0_len_max */)
2503 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2504 irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2507 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2508 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2510 ANALYZE_PUTCHAR ('T');
2511 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2524 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2526 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2527 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2529 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2530 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2532 ANALYZE_PUTCHAR ('T');
2535 if (irmp_pause_time
> irmp_param
.pause_0_len_max
)
2546 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2548 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2549 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2550 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2551 if (! irmp_param2
.protocol
)
2556 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2560 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
/* &&
2561 irmp_pause_time <= irmp_param.pause_0_len_max */)
2563 uint8_t manchester_value
;
2565 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= irmp_param
.pause_0_len_max
)
2567 manchester_value
= last_value
? 0 : 1;
2568 last_value
= manchester_value
;
2572 manchester_value
= last_value
;
2575 ANALYZE_PUTCHAR (manchester_value
+ '0');
2577 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2578 if (! irmp_param2
.protocol
)
2584 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2585 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2587 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2588 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2589 irmp_param
.address_offset
= 5;
2590 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2591 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2592 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2593 irmp_tmp_address
= 0;
2595 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2597 irmp_store_bit (manchester_value
);
2601 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2602 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2603 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2604 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2605 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2607 ANALYZE_PUTCHAR ('?');
2608 irmp_param
.protocol
= 0; // switch to FDC, see below
2611 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2612 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2613 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2614 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2615 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2616 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2618 ANALYZE_PUTCHAR ('?');
2619 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2622 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2624 ANALYZE_PUTCHAR ('?');
2626 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2627 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2628 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2629 irmp_pause_time
= 0;
2633 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2634 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2636 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2638 ANALYZE_PRINTF (" 1 (FDC)\n");
2639 irmp_store_bit2 (1);
2641 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2643 ANALYZE_PRINTF (" 0 (FDC)\n");
2644 irmp_store_bit2 (0);
2647 if (! irmp_param
.protocol
)
2649 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2650 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2651 irmp_param2
.protocol
= 0;
2652 irmp_tmp_address
= irmp_tmp_address2
;
2653 irmp_tmp_command
= irmp_tmp_command2
;
2656 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2657 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2658 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2660 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2662 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2663 irmp_store_bit2 (1);
2665 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2667 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2668 irmp_store_bit2 (0);
2671 if (! irmp_param
.protocol
)
2673 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2674 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2675 irmp_param2
.protocol
= 0;
2676 irmp_tmp_address
= irmp_tmp_address2
;
2677 irmp_tmp_command
= irmp_tmp_command2
;
2680 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2682 last_pause
= irmp_pause_time
;
2686 #endif // IRMP_SUPPORT_MANCHESTER == 1
2688 #if IRMP_SUPPORT_SERIAL == 1
2689 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2691 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2693 ANALYZE_PUTCHAR ('1');
2696 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2698 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2702 irmp_pulse_time
= 0;
2706 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2708 ANALYZE_PUTCHAR ('0');
2711 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2713 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2717 irmp_pause_time
= 0;
2724 #endif // IRMP_SUPPORT_SERIAL == 1
2726 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2727 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2729 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2730 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2732 ANALYZE_PRINTF ("SYNC\n");
2737 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2739 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2740 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2741 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2742 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2744 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2746 ANALYZE_PUTCHAR ('1');
2753 ANALYZE_PUTCHAR ('0');
2759 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2762 { // timing incorrect!
2763 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2764 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2765 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2766 irmp_pause_time
= 0;
2770 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2772 #if IRMP_SUPPORT_NEC16_PROTOCOL
2773 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 8 &&
2774 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2776 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2777 memcpy_P (&irmp_param
, &nec16_param
, sizeof (IRMP_PARAMETER
));
2781 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2783 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2784 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2786 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2788 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2790 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2792 ANALYZE_PRINTF ("3rd start bit\n");
2797 { // timing incorrect!
2798 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
);
2799 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2800 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2801 irmp_pause_time
= 0;
2804 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2806 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2808 ANALYZE_PRINTF ("trailer bit\n");
2813 { // timing incorrect!
2814 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
);
2815 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2816 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2817 irmp_pause_time
= 0;
2822 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
2823 { // pulse & pause timings correct for "1"?
2824 ANALYZE_PUTCHAR ('1');
2830 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
2831 { // pulse & pause timings correct for "0"?
2832 ANALYZE_PUTCHAR ('0');
2838 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
2840 ANALYZE_PUTCHAR (last_value
+ '0');
2842 irmp_store_bit (last_value
);
2846 { // timing incorrect!
2847 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
);
2848 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2849 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2850 irmp_pause_time
= 0;
2855 { // timing incorrect!
2856 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
);
2857 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2858 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2859 irmp_pause_time
= 0;
2863 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
2865 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
2866 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
2867 { // pulse & pause timings correct for "1"?
2868 ANALYZE_PUTCHAR ('1');
2873 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2874 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2875 { // pulse & pause timings correct for "0"?
2876 ANALYZE_PUTCHAR ('0');
2882 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
2884 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
2885 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
2886 (((irmp_bit
== 8 || irmp_bit
== 6) &&
2887 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
2889 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
2895 ANALYZE_PUTCHAR ('S');
2897 irmp_tmp_command
<<= 1;
2901 ANALYZE_PUTCHAR ('S');
2908 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
2909 { // timing incorrect!
2910 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2911 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2912 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2913 irmp_pause_time
= 0;
2916 irmp_pulse_time
= 1; // set counter to 1, not 0
2920 { // counting the pulse length ...
2921 if (! irmp_input
) // still light?
2923 irmp_pulse_time
++; // increment counter
2927 wait_for_space
= 1; // let's count the time (see above)
2928 irmp_pause_time
= 1; // set pause counter to 1, not 0
2932 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
2934 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
2936 repetition_frame_number
++;
2940 repetition_frame_number
= 0;
2943 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2944 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
2945 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
2947 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2948 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2954 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2955 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
2956 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
2958 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2959 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2965 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2966 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2967 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
2969 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2970 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2976 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2977 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2978 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
2980 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2981 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2988 ANALYZE_PRINTF ("%8d code detected, length = %d\n", time_counter
, irmp_bit
);
2989 irmp_ir_detected
= TRUE
;
2991 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2992 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2993 { // check for repetition frame
2994 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
2996 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
2998 irmp_protocol
= irmp_param
.protocol
; // store protocol
2999 irmp_address
= irmp_tmp_address
; // store address
3000 irmp_command
= irmp_tmp_command
; // store command
3004 ANALYZE_PRINTF ("waiting for inverted command repetition\n");
3005 irmp_ir_detected
= FALSE
;
3006 last_irmp_denon_command
= irmp_tmp_command
;
3010 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3012 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3013 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3014 { // Grundig start frame?
3015 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3016 irmp_ir_detected
= FALSE
;
3019 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3021 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3022 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3023 { // Nokia start frame?
3024 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3025 irmp_ir_detected
= FALSE
;
3028 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3030 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3031 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3033 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3035 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3036 irmp_tmp_address
= last_irmp_address
; // address is last address
3037 irmp_tmp_command
= last_irmp_command
; // command is last command
3038 irmp_flags
|= IRMP_FLAG_REPETITION
;
3043 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3044 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3045 irmp_ir_detected
= FALSE
;
3048 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3050 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3051 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3054 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3055 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3057 xor = (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3059 if (xor != (xor_check
[2] & 0x0F))
3061 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check
[2] & 0x0F);
3062 irmp_ir_detected
= FALSE
;
3065 xor = xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3067 if (xor != xor_check
[5])
3069 ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check
[5]);
3070 irmp_ir_detected
= FALSE
;
3073 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3075 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3076 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3078 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3081 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3083 irmp_protocol
= irmp_param
.protocol
;
3085 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3086 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3088 if (irmp_tmp_command
& 0x000F) // released key?
3090 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3094 irmp_tmp_command
>>= 4; // no, it's a pressed key
3096 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3097 irmp_tmp_address
&= 0x003F;
3101 irmp_address
= irmp_tmp_address
; // store address
3102 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3103 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3106 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3107 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3109 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3112 irmp_command
= irmp_tmp_command
; // store command
3114 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3115 irmp_id
= irmp_tmp_id
;
3120 if (irmp_ir_detected
)
3122 if (last_irmp_command
== irmp_command
&&
3123 last_irmp_address
== irmp_address
&&
3124 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3126 irmp_flags
|= IRMP_FLAG_REPETITION
;
3129 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3130 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3136 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3139 irmp_start_bit_detected
= 0; // and wait for next start bit
3140 irmp_tmp_command
= 0;
3141 irmp_pulse_time
= 0;
3142 irmp_pause_time
= 0;
3144 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3145 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3146 { // set pulse time here!
3147 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3149 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3153 return (irmp_ir_detected
);
3158 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3159 * main functions - for Unix/Linux + Windows only!
3163 * Compile it under linux with:
3166 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3172 * -l list pulse/pauses
3174 *---------------------------------------------------------------------------------------------------------------------------------------------------
3178 print_timings (void)
3180 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3181 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3183 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3184 printf ("====================================================================================\n");
3185 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3186 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3187 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3188 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3190 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3191 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3192 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3193 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3195 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3196 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
,
3197 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3198 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3200 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3201 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3202 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3203 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3205 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3206 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3207 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3208 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3210 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3211 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3212 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3213 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3215 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3216 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3217 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3218 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3220 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3221 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3222 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3224 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3225 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3226 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3227 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3229 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3230 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3231 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3233 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3234 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3235 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3236 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3238 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3239 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3240 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3241 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3243 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3244 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3245 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3247 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3248 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3249 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3251 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3252 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3253 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3255 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3256 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3257 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3259 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3260 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3261 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3263 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3264 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3265 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3266 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3268 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3269 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3270 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3271 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3272 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3273 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2
,
3274 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2
);
3276 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3277 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3278 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3279 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3281 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3282 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3283 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3284 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3286 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3287 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3288 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3289 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3293 print_spectrum (char * text
, int * buf
, int is_pulse
)
3306 puts ("-------------------------------------------------------------------------------");
3307 printf ("%s:\n", text
);
3309 for (i
= 0; i
< 256; i
++)
3311 if (buf
[i
] > max_value
)
3317 for (i
= 1; i
< 100; i
++)
3322 value
= (buf
[i
] * 60) / max_value
;
3324 for (j
= 0; j
< value
; j
++)
3328 printf (" %d\n", buf
[i
]);
3339 average
= (float) sum
/ (float) counter
;
3350 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3351 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3352 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3354 tolerance
= (max
- average
);
3356 if (average
- min
> tolerance
)
3358 tolerance
= average
- min
;
3361 tolerance
= tolerance
* 100 / average
;
3362 printf ("tol: %4.1f%%\n", tolerance
);
3372 #define STATE_LEFT_SHIFT 0x01
3373 #define STATE_RIGHT_SHIFT 0x02
3374 #define STATE_LEFT_CTRL 0x04
3375 #define STATE_LEFT_ALT 0x08
3376 #define STATE_RIGHT_ALT 0x10
3378 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3379 #define KEY_MENUE 0x80 // keycode = 0x0070
3380 #define KEY_BACK 0x81 // keycode = 0x0071
3381 #define KEY_FORWARD 0x82 // keycode = 0x0072
3382 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3383 #define KEY_WINDOW 0x84 // keycode = 0x0074
3384 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3385 #define KEY_STOP 0x86 // keycode = 0x0076
3386 #define KEY_MAIL 0x87 // keycode = 0x0077
3387 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3388 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3389 #define KEY_SETUP 0x8A // keycode = 0x007a
3390 #define KEY_FONT 0x8B // keycode = 0x007b
3391 #define KEY_PRINT 0x8C // keycode = 0x007c
3392 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3394 #define KEY_INSERT 0x90 // keycode = 0x004b
3395 #define KEY_DELETE 0x91 // keycode = 0x004c
3396 #define KEY_LEFT 0x92 // keycode = 0x004f
3397 #define KEY_HOME 0x93 // keycode = 0x0050
3398 #define KEY_END 0x94 // keycode = 0x0051
3399 #define KEY_UP 0x95 // keycode = 0x0053
3400 #define KEY_DOWN 0x96 // keycode = 0x0054
3401 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3402 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3403 #define KEY_RIGHT 0x99 // keycode = 0x0059
3404 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3405 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3408 get_fdc_key (uint16_t cmd
)
3410 static uint8_t key_table
[128] =
3412 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3413 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3414 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3415 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3416 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3418 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3419 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3420 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3421 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3423 static uint8_t state
;
3429 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3430 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3431 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3432 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3433 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3434 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3435 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3436 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3437 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3438 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3440 case 0x006e: key
= KEY_ESCAPE
; break;
3441 case 0x004b: key
= KEY_INSERT
; break;
3442 case 0x004c: key
= KEY_DELETE
; break;
3443 case 0x004f: key
= KEY_LEFT
; break;
3444 case 0x0050: key
= KEY_HOME
; break;
3445 case 0x0051: key
= KEY_END
; break;
3446 case 0x0053: key
= KEY_UP
; break;
3447 case 0x0054: key
= KEY_DOWN
; break;
3448 case 0x0055: key
= KEY_PAGE_UP
; break;
3449 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3450 case 0x0059: key
= KEY_RIGHT
; break;
3451 case 0x0400: key
= KEY_MOUSE_1
; break;
3452 case 0x0800: key
= KEY_MOUSE_2
; break;
3456 if (!(cmd
& 0x80)) // pressed key
3458 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3460 key
= cmd
+ 0x10; // 7x -> 8x
3462 else if (cmd
< 64) // key listed in key_table
3464 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3468 case 0x0003: key
= '²'; break;
3469 case 0x0008: key
= '{'; break;
3470 case 0x0009: key
= '['; break;
3471 case 0x000A: key
= ']'; break;
3472 case 0x000B: key
= '}'; break;
3473 case 0x000C: key
= '\\'; break;
3474 case 0x001C: key
= '~'; break;
3475 case 0x002D: key
= '|'; break;
3476 case 0x0034: key
= 'µ'; break;
3479 else if (state
& (STATE_LEFT_CTRL
))
3481 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3483 key
= key_table
[cmd
] - 'a' + 1;
3487 key
= key_table
[cmd
];
3492 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3496 key
= key_table
[idx
];
3508 static int analyze
= FALSE
;
3509 static int list
= FALSE
;
3510 static IRMP_DATA irmp_data
;
3515 if (! analyze
&& ! list
)
3519 if (irmp_get_data (&irmp_data
))
3523 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3527 printf ("%8d ", time_counter
);
3530 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3532 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3534 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3535 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3537 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3539 char * p
= (char *) NULL
;
3543 case '\t' : p
= "TAB"; break;
3544 case '\r' : p
= "CR"; break;
3545 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3546 case KEY_MENUE
: p
= "MENUE"; break;
3547 case KEY_BACK
: p
= "BACK"; break;
3548 case KEY_FORWARD
: p
= "FORWARD"; break;
3549 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3550 case KEY_WINDOW
: p
= "WINDOW"; break;
3551 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3552 case KEY_STOP
: p
= "STOP"; break;
3553 case KEY_MAIL
: p
= "MAIL"; break;
3554 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3555 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3556 case KEY_SETUP
: p
= "SETUP"; break;
3557 case KEY_FONT
: p
= "FONT"; break;
3558 case KEY_PRINT
: p
= "PRINT"; break;
3559 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3561 case KEY_INSERT
: p
= "INSERT"; break;
3562 case KEY_DELETE
: p
= "DELETE"; break;
3563 case KEY_LEFT
: p
= "LEFT"; break;
3564 case KEY_HOME
: p
= "HOME"; break;
3565 case KEY_END
: p
= "END"; break;
3566 case KEY_UP
: p
= "UP"; break;
3567 case KEY_DOWN
: p
= "DOWN"; break;
3568 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3569 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3570 case KEY_RIGHT
: p
= "RIGHT"; break;
3571 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3572 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3573 default : p
= "<UNKNWON>"; break;
3576 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3577 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3581 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3582 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3587 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3588 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3595 main (int argc
, char ** argv
)
3603 int start_pulses
[256];
3604 int start_pauses
[256];
3608 int first_pulse
= TRUE
;
3609 int first_pause
= TRUE
;
3613 if (! strcmp (argv
[1], "-v"))
3617 else if (! strcmp (argv
[1], "-l"))
3621 else if (! strcmp (argv
[1], "-a"))
3625 else if (! strcmp (argv
[1], "-s"))
3629 else if (! strcmp (argv
[1], "-p"))
3636 for (i
= 0; i
< 256; i
++)
3638 start_pulses
[i
] = 0;
3639 start_pauses
[i
] = 0;
3646 while ((ch
= getchar ()) != EOF
)
3648 if (ch
== '_' || ch
== '0')
3656 printf ("pause: %d\n", pause
);
3665 start_pauses
[pause
]++;
3667 first_pause
= FALSE
;
3683 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3689 printf ("pulse: %d ", pulse
);
3698 start_pulses
[pulse
]++;
3700 first_pulse
= FALSE
;
3716 else if (ch
== '\n')
3720 if (list
&& pause
> 0)
3722 printf ("pause: %d\n", pause
);
3728 for (i
= 0; i
< (int) ((8000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 800 msec
3740 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3747 puts ("-------------------------------------------------------------------");
3750 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3752 if (ch
!= '\r') // ignore CR in DOS/Windows files
3769 print_spectrum ("START PULSES", start_pulses
, TRUE
);
3770 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
3771 print_spectrum ("PULSES", pulses
, TRUE
);
3772 print_spectrum ("PAUSES", pauses
, FALSE
);
3773 puts ("-------------------------------------------------------------------------------");