1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.113 2012/02/16 10:40:07 fm Exp $
10 * Supported mikrocontrollers:
14 * ATmega8, ATmega16, ATmega32
16 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284
17 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
19 * Typical manufacturers of remote controls:
22 * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers
25 * MATSUSHITA - Matsushita
26 * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")
27 * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba
28 * RC5 - Philips and other European manufacturers
29 * DENON - Denon, Sharp
30 * RC6 - Philips and other European manufacturers
32 * NUBERT - Nubert Subwoofer System
33 * B&O - Bang & Olufsen
34 * PANASONIC - Panasonic (older, yet not implemented)
37 * SIEMENS - Siemens, e.g. Gigaset M740AV
38 * FDC - FDC IR keyboard
39 * RCCAR - IR remote control for RC cars
42 * NIKON - Nikon cameras
45 * LEGO - Lego Power Functions RC
47 *---------------------------------------------------------------------------------------------------------------------------------------------------
52 * frame: 1 start bit + 12-20 data bits + no stop bit
53 * data: 7 command bits + 5 address bits + 0 to 8 additional bits
55 * start bit: data "0": data "1": stop bit:
56 * -----------------_________ ------_____ ------------______
57 * 2400us 600us 600us 600us 1200us 600 us no stop bit
59 *---------------------------------------------------------------------------------------------------------------------------------------------------
62 * -------------------------
64 * frame: 1 start bit + 32 data bits + 1 stop bit
65 * data NEC: 8 address bits + 8 inverted address bits + 8 command bits + 8 inverted command bits
66 * data extended NEC: 16 address bits + 8 command bits + 8 inverted command bits
68 * start bit: data "0": data "1": stop bit:
69 * -----------------_________ ------______ ------________________ ------______....
70 * 9000us 4500us 560us 560us 560us 1690 us 560us
75 * -----------------_________------______ .... ~100ms Pause, then repeat
78 *---------------------------------------------------------------------------------------------------------------------------------------------------
83 * frame: 1 start bit + 16 data(1) bits + 1 sync bit + additional 20 data(2) bits + 1 stop bit
84 * data(1): 16 address bits
85 * data(2): 4 ID bits + 8 command bits + 8 inverted command bits
87 * start bit: data "0": data "1": sync bit: stop bit:
88 * ----------______________ ------______ ------________________ ------______________ ------______....
89 * 4500us 4500us 550us 450us 550us 1450us 550us 4500us 550us
91 *---------------------------------------------------------------------------------------------------------------------------------------------------
96 * frame: 1 start bit + 32 data bits + 1 stop bit
97 * data: 16 address bits + 16 command bits
99 * start bit: data "0": data "1": stop bit:
100 * ----------______________ ------______ ------________________ ------______....
101 * 4500us 4500us 550us 450us 550us 1450us 550us
103 *---------------------------------------------------------------------------------------------------------------------------------------------------
108 * frame: 1 start bit + 24 data bits + 1 stop bit
109 * data: 6 custom bits + 6 command bits + 12 address bits
111 * start bit: data "0": data "1": stop bit:
112 * ----------_________ ------______ ------________________ ------______....
113 * 3488us 3488us 872us 872us 872us 2616us 872us
115 *---------------------------------------------------------------------------------------------------------------------------------------------------
120 * frame: 1 start bit + 48 data bits + 1 stop bit
121 * data: 16 manufacturer bits + 4 parity bits + 4 genre1 bits + 4 genre2 bits + 10 command bits + 2 id bits + 8 parity bits
123 * start bit: data "0": data "1": stop bit:
124 * ----------______ ------______ ------________________ ------______....
125 * 3380us 1690us 423us 423us 423us 1269us 423us
127 *---------------------------------------------------------------------------------------------------------------------------------------------------
132 * frame: 2 start bits + 10 data bits + 1 stop bit
133 * data: 1 toggle bit + 3 address bits + 6 command bits
135 * start bit: data "0": data "1": stop bit:
136 * -----_____________________ -----____________ -----______________ ------_______....
137 * 158us 7432us 158us 4902us 158us 7432us 158us
139 *---------------------------------------------------------------------------------------------------------------------------------------------------
144 * frame: 2 start bits + 11 data bits + 1 stop bit
145 * data: 1 toggle bit + 4 address bits + 6 command bits
147 * start bit: data "0": data "1": stop bit:
148 * -----_____________________ -----____________ -----______________ ------_______....
149 * 158us 3637us 158us 4902us 158us 7432us 158us
151 *---------------------------------------------------------------------------------------------------------------------------------------------------
156 * RC5 frame: 2 start bits + 12 data bits + no stop bit
157 * RC5 data: 1 toggle bit + 5 address bits + 6 command bits
158 * RC5X frame: 1 start bit + 13 data bits + no stop bit
159 * RC5X data: 1 inverted command bit + 1 toggle bit + 5 address bits + 6 command bits
161 * start bit: data "0": data "1":
162 * ______----- ------______ ______------
163 * 889us 889us 889us 889us 889us 889us
165 *---------------------------------------------------------------------------------------------------------------------------------------------------
170 * frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit
171 * data: 5 address bits + 10 command bits
175 * data "0": data "1":
176 * ------________________ ------______________
177 * 275us 775us 275us 1900us
181 * data "0": data "1":
182 * ------________________ ------______________
183 * 310us 745us 310us 1780us
185 *---------------------------------------------------------------------------------------------------------------------------------------------------
190 * RC6 frame: 1 start bit + 1 bit "1" + 3 mode bits + 1 toggle bit + 16 data bits + 2666 us pause
191 * RC6 data: 8 address bits + 8 command bits
193 * start bit toggle bit "0": toggle bit "1": data/mode "0": data/mode "1":
194 * ____________------- _______------- -------_______ _______------- -------_______
195 * 2666us 889us 889us 889us 889us 889us 444us 444us 444us 444us
197 *---------------------------------------------------------------------------------------------------------------------------------------------------
202 * frame: 1 start bit + 32 data bits + 1 stop bit
203 * data: 16 address bits + 11100000 + 8 command bits
205 * start bit: data "0": data "1": stop bit:
206 * -----------------_________ ------______ ------________________ ------______....
207 * 9000us 4500us 560us 560us 560us 1690 us 560us
209 *---------------------------------------------------------------------------------------------------------------------------------------------------
211 * NUBERT (subwoofer system)
212 * -------------------------
214 * frame: 1 start bit + 10 data bits + 1 stop bit
215 * data: 0 address bits + 10 command bits ?
217 * start bit: data "0": data "1": stop bit:
218 * ----------_____ ------______ ------________________ ------______....
219 * 1340us 340us 500us 1300us 1340us 340us 500us
221 *---------------------------------------------------------------------------------------------------------------------------------------------------
226 * frame: 4 start bits + 16 data bits + 1 trailer bit + 1 stop bit
227 * data: 0 address bits + 16 command bits
229 * 1st start bit: 2nd start bit: 3rd start bit: 4th start bit:
230 * -----________ -----________ -----_____________ -----________
231 * 210us 3000us 210us 3000us 210us 15000us 210us 3000us
233 * data "0": data "1": data "repeat bit": trailer bit: stop bit:
234 * -----________ -----_____________ -----___________ -----_____________ -----____...
235 * 210us 3000us 210us 9000us 210us 6000us 210us 12000us 210us
237 *---------------------------------------------------------------------------------------------------------------------------------------------------
242 * packet: 1 start frame + 19,968ms pause + N info frames + 117,76ms pause + 1 stop frame
243 * frame: 1 pre bit + 1 start bit + 9 data bits + no stop bit
244 * pause between info frames: 117,76ms
246 * data of start frame: 9 x 1
247 * data of info frame: 9 command bits
248 * data of stop frame: 9 x 1
250 * pre bit: start bit data "0": data "1":
251 * ------____________ ------______ ______------ ------______
252 * 528us 2639us 528us 528us 528us 528us 528us 528us
254 *---------------------------------------------------------------------------------------------------------------------------------------------------
259 * Timing similar to Grundig, but 16 data bits:
260 * frame: 1 pre bit + 1 start bit + 8 command bits + 8 address bits + no stop bit
262 *---------------------------------------------------------------------------------------------------------------------------------------------------
267 * SIEMENS frame: 1 start bit + 22 data bits + no stop bit
268 * SIEMENS data: 13 address bits + 1 repeat bit + 7 data bits + 1 unknown bit
270 * start bit data "0": data "1":
271 * -------_______ _______------- -------_______
272 * 250us 250us 250us 250us 250us 250us
274 *---------------------------------------------------------------------------------------------------------------------------------------------------
276 * PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)
277 * -----------------------------------------------------------------------------------------
279 * frame: 1 start bit + 22 data bits + 1 stop bit
280 * 22 data bits = 5 custom bits + 6 data bits + 5 inverted custom bits + 6 inverted data bits
282 * European version: T = 456us
283 * USA & Canada version: T = 422us
285 * start bit: data "0": data "1": stop bit:
286 * 8T 8T 2T 2T 2T 6T 2T
287 * -------------____________ ------_____ ------_____________ ------_______....
288 * 3648us 3648us 912us 912us 912us 2736us 912us (Europe)
289 * 3376us 3376us 844us 844us 844us 2532us 844us (US)
291 *---------------------------------------------------------------------------------------------------------------------------------------------------
293 * This program is free software; you can redistribute it and/or modify
294 * it under the terms of the GNU General Public License as published by
295 * the Free Software Foundation; either version 2 of the License, or
296 * (at your option) any later version.
297 *---------------------------------------------------------------------------------------------------------------------------------------------------
301 #define PIC_C18 // Microchip C18 Compiler
304 #if defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC Compiler instead of AVR
305 #define PIC_CCS_COMPILER
308 #ifdef unix // test on linux/unix
313 #include <inttypes.h>
317 #define memcpy_P memcpy
324 typedef unsigned char uint8_t;
325 typedef unsigned short uint16_t;
328 #define memcpy_P memcpy
332 #if defined (PIC_CCS_COMPILER) || defined(PIC_C18)
336 #define memcpy_P memcpy
338 #if defined (PIC_CCS_COMPILER)
339 typedef unsigned int8
uint8_t;
340 typedef unsigned int16
uint16_t;
345 #include <inttypes.h>
349 #include <util/delay.h>
350 #include <avr/pgmspace.h>
352 #endif // PIC_CCS_COMPILER or PIC_C18
357 #ifndef IRMP_USE_AS_LIB
358 #include "irmpconfig.h"
362 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
363 #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
365 #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
368 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
369 #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
371 #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
374 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
375 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
376 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
377 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
378 IRMP_SUPPORT_IR60_PROTOCOL
379 #define IRMP_SUPPORT_MANCHESTER 1
381 #define IRMP_SUPPORT_MANCHESTER 0
384 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
385 #define IRMP_SUPPORT_SERIAL 1
387 #define IRMP_SUPPORT_SERIAL 0
390 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
392 #define MIN_TOLERANCE_00 1.0 // -0%
393 #define MAX_TOLERANCE_00 1.0 // +0%
395 #define MIN_TOLERANCE_05 0.95 // -5%
396 #define MAX_TOLERANCE_05 1.05 // +5%
398 #define MIN_TOLERANCE_10 0.9 // -10%
399 #define MAX_TOLERANCE_10 1.1 // +10%
401 #define MIN_TOLERANCE_15 0.85 // -15%
402 #define MAX_TOLERANCE_15 1.15 // +15%
404 #define MIN_TOLERANCE_20 0.8 // -20%
405 #define MAX_TOLERANCE_20 1.2 // +20%
407 #define MIN_TOLERANCE_30 0.7 // -30%
408 #define MAX_TOLERANCE_30 1.3 // +30%
410 #define MIN_TOLERANCE_40 0.6 // -40%
411 #define MAX_TOLERANCE_40 1.4 // +40%
413 #define MIN_TOLERANCE_50 0.5 // -50%
414 #define MAX_TOLERANCE_50 1.5 // +50%
416 #define MIN_TOLERANCE_60 0.4 // -60%
417 #define MAX_TOLERANCE_60 1.6 // +60%
419 #define MIN_TOLERANCE_70 0.3 // -70%
420 #define MAX_TOLERANCE_70 1.7 // +70%
422 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
423 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
424 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
425 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
426 #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
427 #else // only 5% + 1 to avoid conflict with RC6:
428 #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
430 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
431 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
432 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
433 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
434 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
435 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
437 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
438 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
439 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
440 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
441 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
442 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
443 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
444 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
445 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
446 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
447 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
448 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
449 // autodetect nec repetition frame within 50 msec:
450 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
452 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
454 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
457 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
458 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
459 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
460 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
461 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
462 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
463 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
464 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
465 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
466 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
468 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
469 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
470 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
471 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
472 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
473 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
474 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
475 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
476 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
477 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
479 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
480 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
481 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
482 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
483 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
484 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
485 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
486 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
487 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
488 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
490 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
491 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
492 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
493 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
494 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
495 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
496 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
497 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
498 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
499 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
501 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
502 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
504 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
505 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
507 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
508 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
509 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
510 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
511 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
512 #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
514 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // be more tolerant
516 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
518 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
519 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
520 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
521 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
522 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
523 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
525 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
526 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
527 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
528 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
529 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
530 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
531 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
532 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
533 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
534 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
536 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
537 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
538 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
539 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
540 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
541 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
542 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
543 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
544 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
545 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
547 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
548 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
549 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
550 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
551 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
552 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
553 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
554 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
555 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
556 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
557 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
558 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
560 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
561 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
562 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
563 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
564 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
565 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
566 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
567 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
568 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
569 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
570 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
571 #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
572 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
573 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
574 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
575 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
576 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
577 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
578 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
579 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
580 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
581 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
582 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
583 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
584 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
585 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
587 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
588 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
589 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
590 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
591 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
592 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
593 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
595 #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)
596 #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)
597 #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)
598 #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)
599 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
600 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
601 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
602 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
604 #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
605 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
606 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
607 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
608 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
609 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
610 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
611 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
613 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
615 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
617 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
619 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
620 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
621 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
622 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
623 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
624 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
625 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
626 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
627 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
628 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
630 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
631 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
632 #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!
633 #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!
634 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
635 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
636 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
637 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
638 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
639 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
640 // autodetect JVC repetition frame within 50 msec:
641 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
643 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
644 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
645 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
646 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
647 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
648 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
649 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
650 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
651 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
652 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
653 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
654 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
655 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
657 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
658 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
659 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
660 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
661 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
662 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
663 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
664 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
665 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
666 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
667 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
668 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
669 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
670 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
672 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
673 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
674 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
675 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
676 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
677 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
678 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
679 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
681 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
682 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
683 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
684 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
685 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
686 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
687 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
688 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
689 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
690 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
692 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
695 #define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
696 #define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
697 #define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
698 #define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
700 static int time_counter
;
703 #define ANALYZE_PUTCHAR(a)
704 #define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
705 #define ANALYZE_PRINTF(...)
706 #define ANALYZE_NEWLINE()
709 #if IRMP_USE_CALLBACK == 1
710 static void (*irmp_callback_ptr
) (uint8_t);
711 #endif // IRMP_USE_CALLBACK == 1
713 /*---------------------------------------------------------------------------------------------------------------------------------------------------
715 *---------------------------------------------------------------------------------------------------------------------------------------------------
717 #if IRMP_PROTOCOL_NAMES == 1
719 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
755 /*---------------------------------------------------------------------------------------------------------------------------------------------------
757 *---------------------------------------------------------------------------------------------------------------------------------------------------
759 #if IRMP_LOGGING == 1 // logging via UART
761 #if IRMP_EXT_LOGGING == 1 // use external logging
762 #include "irmpextlog.h"
763 #else // normal UART log (IRMP_EXT_LOGGING == 0)
765 #include <util/setbaud.h>
769 #define UART0_UBRRH UBRR0H
770 #define UART0_UBRRL UBRR0L
771 #define UART0_UCSRA UCSR0A
772 #define UART0_UCSRB UCSR0B
773 #define UART0_UCSRC UCSR0C
774 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
775 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
776 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
778 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
780 #define UART0_URSEL_BIT_VALUE (0)
782 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
783 #define UART0_UDR UDR0
784 #define UART0_U2X U2X0
788 #define UART0_UBRRH UBRRH
789 #define UART0_UBRRL UBRRL
790 #define UART0_UCSRA UCSRA
791 #define UART0_UCSRB UCSRB
792 #define UART0_UCSRC UCSRC
793 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
794 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
795 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
797 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
799 #define UART0_URSEL_BIT_VALUE (0)
801 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
802 #define UART0_UDR UDR
803 #define UART0_U2X U2X
806 #endif //IRMP_EXT_LOGGING
808 /*---------------------------------------------------------------------------------------------------------------------------------------------------
810 * @details Initializes UART
811 *---------------------------------------------------------------------------------------------------------------------------------------------------
814 irmp_uart_init (void)
816 #if (IRMP_EXT_LOGGING == 0) // use UART
817 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
818 UART0_UBRRL
= UBRRL_VALUE
;
821 UART0_UCSRA
|= (1<<UART0_U2X
);
823 UART0_UCSRA
&= ~(1<<UART0_U2X
);
826 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
827 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
828 #else // other log method
830 #endif //IRMP_EXT_LOGGING
833 /*---------------------------------------------------------------------------------------------------------------------------------------------------
835 * @details Sends character
836 * @param ch character to be transmitted
837 *---------------------------------------------------------------------------------------------------------------------------------------------------
840 irmp_uart_putc (unsigned char ch
)
842 #if (IRMP_EXT_LOGGING == 0)
843 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
850 sendextlog(ch
); //Use external log
854 /*---------------------------------------------------------------------------------------------------------------------------------------------------
856 *---------------------------------------------------------------------------------------------------------------------------------------------------
859 #define STARTCYCLES 2 // min count of zeros before start of logging
860 #define ENDBITS 1000 // number of sequenced highbits to detect end
861 #define DATALEN 700 // log buffer size
864 irmp_log (uint8_t val
)
866 static uint8_t buf
[DATALEN
]; // logging buffer
867 static uint16_t buf_idx
; // number of written bits
868 static uint8_t startcycles
; // current number of start-zeros
869 static uint16_t cnt
; // counts sequenced highbits - to detect end
871 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
879 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
881 if (buf_idx
< DATALEN
* 8) // index in range?
885 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
889 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
896 { // if high received then look at log-stop condition
900 { // if stop condition is true, output on uart
903 for (i
= 0; i
< STARTCYCLES
; i
++)
905 irmp_uart_putc ('0'); // the ignored starting zeros
908 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
913 for (j
= 0; j
< 8; j
++)
915 irmp_uart_putc ((d
& 1) + '0');
920 irmp_uart_putc ('\n');
933 #define irmp_log(val)
934 #endif //IRMP_LOGGING
938 uint8_t protocol
; // ir protocol
939 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
940 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
941 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
942 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
943 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
944 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
945 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
946 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
947 uint8_t address_offset
; // address offset
948 uint8_t address_end
; // end of address
949 uint8_t command_offset
; // command offset
950 uint8_t command_end
; // end of command
951 uint8_t complete_len
; // complete length of frame
952 uint8_t stop_bit
; // flag: frame has stop bit
953 uint8_t lsb_first
; // flag: LSB first
954 uint8_t flags
; // some flags
957 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
959 static const PROGMEM IRMP_PARAMETER sircs_param
=
961 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
962 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
963 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
964 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
965 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
966 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
967 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
968 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
969 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
970 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
971 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
972 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
973 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
974 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
975 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
976 SIRCS_LSB
, // lsb_first: flag: LSB first
977 SIRCS_FLAGS
// flags: some flags
982 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
984 static const PROGMEM IRMP_PARAMETER nec_param
=
986 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
987 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
988 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
989 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
990 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
991 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
992 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
993 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
994 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
995 NEC_ADDRESS_OFFSET
, // address_offset: address offset
996 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
997 NEC_COMMAND_OFFSET
, // command_offset: command offset
998 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
999 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1000 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1001 NEC_LSB
, // lsb_first: flag: LSB first
1002 NEC_FLAGS
// flags: some flags
1005 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
1007 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1008 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1009 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1010 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1011 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1012 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1013 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1014 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1015 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1016 0, // address_offset: address offset
1017 0, // address_end: end of address
1018 0, // command_offset: command offset
1019 0, // command_end: end of command
1020 0, // complete_len: complete length of frame
1021 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1022 NEC_LSB
, // lsb_first: flag: LSB first
1023 NEC_FLAGS
// flags: some flags
1028 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1030 static const PROGMEM IRMP_PARAMETER nec42_param
=
1032 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
1033 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1034 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1035 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1036 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1037 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1038 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1039 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1040 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1041 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
1042 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
1043 NEC42_COMMAND_OFFSET
, // command_offset: command offset
1044 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
1045 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1046 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1047 NEC_LSB
, // lsb_first: flag: LSB first
1048 NEC_FLAGS
// flags: some flags
1053 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1055 static const PROGMEM IRMP_PARAMETER samsung_param
=
1057 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
1058 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1059 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1060 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1061 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1062 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1063 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1064 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1065 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1066 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
1067 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
1068 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
1069 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
1070 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1071 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
1072 SAMSUNG_LSB
, // lsb_first: flag: LSB first
1073 SAMSUNG_FLAGS
// flags: some flags
1078 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1080 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1082 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1083 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1084 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1085 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1086 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1087 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1088 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1089 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1090 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1091 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1092 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1093 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1094 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1095 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1096 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1097 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1098 MATSUSHITA_FLAGS
// flags: some flags
1103 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1105 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1107 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1108 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1109 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1110 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1111 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1112 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1113 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1114 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1115 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1116 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1117 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1118 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1119 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1120 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1121 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1122 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1123 KASEIKYO_FLAGS
// flags: some flags
1128 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1130 static const PROGMEM IRMP_PARAMETER recs80_param
=
1132 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1133 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1134 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1135 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1136 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1137 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1138 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1139 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1140 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1141 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1142 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1143 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1144 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1145 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1146 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1147 RECS80_LSB
, // lsb_first: flag: LSB first
1148 RECS80_FLAGS
// flags: some flags
1153 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1155 static const PROGMEM IRMP_PARAMETER rc5_param
=
1157 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1158 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1159 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1160 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1161 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1162 0, // pulse_0_len_min: here: not used
1163 0, // pulse_0_len_max: here: not used
1164 0, // pause_0_len_min: here: not used
1165 0, // pause_0_len_max: here: not used
1166 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1167 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1168 RC5_COMMAND_OFFSET
, // command_offset: command offset
1169 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1170 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1171 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1172 RC5_LSB
, // lsb_first: flag: LSB first
1173 RC5_FLAGS
// flags: some flags
1178 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1180 static const PROGMEM IRMP_PARAMETER denon_param
=
1182 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1183 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1184 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1185 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1186 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1187 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1188 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1189 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1190 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1191 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1192 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1193 DENON_COMMAND_OFFSET
, // command_offset: command offset
1194 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1195 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1196 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1197 DENON_LSB
, // lsb_first: flag: LSB first
1198 DENON_FLAGS
// flags: some flags
1203 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1205 static const PROGMEM IRMP_PARAMETER rc6_param
=
1207 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1209 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1210 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1211 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1212 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1213 0, // pulse_0_len_min: here: not used
1214 0, // pulse_0_len_max: here: not used
1215 0, // pause_0_len_min: here: not used
1216 0, // pause_0_len_max: here: not used
1217 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1218 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1219 RC6_COMMAND_OFFSET
, // command_offset: command offset
1220 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1221 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1222 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1223 RC6_LSB
, // lsb_first: flag: LSB first
1224 RC6_FLAGS
// flags: some flags
1229 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1231 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1233 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1234 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1235 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1236 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1237 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1238 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1239 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1240 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1241 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1242 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1243 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1244 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1245 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1246 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1247 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1248 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1249 RECS80EXT_FLAGS
// flags: some flags
1254 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1256 static const PROGMEM IRMP_PARAMETER nubert_param
=
1258 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1259 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1260 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1261 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1262 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1263 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1264 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1265 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1266 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1267 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1268 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1269 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1270 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1271 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1272 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1273 NUBERT_LSB
, // lsb_first: flag: LSB first
1274 NUBERT_FLAGS
// flags: some flags
1279 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1281 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1283 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1284 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1285 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1286 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1287 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1288 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1289 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1290 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1291 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1292 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1293 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1294 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1295 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1296 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1297 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1298 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1299 BANG_OLUFSEN_FLAGS
// flags: some flags
1304 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1306 static uint8_t first_bit
;
1308 static const PROGMEM IRMP_PARAMETER grundig_param
=
1310 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1312 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1313 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1314 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1315 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1316 0, // pulse_0_len_min: here: not used
1317 0, // pulse_0_len_max: here: not used
1318 0, // pause_0_len_min: here: not used
1319 0, // pause_0_len_max: here: not used
1320 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1321 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1322 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1323 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1324 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1325 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1326 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1327 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1332 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1334 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1336 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1337 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1338 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1339 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1340 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1341 0, // pulse_0_len_min: here: not used
1342 0, // pulse_0_len_max: here: not used
1343 0, // pause_0_len_min: here: not used
1344 0, // pause_0_len_max: here: not used
1345 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1346 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1347 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1348 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1349 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1350 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1351 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1352 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1357 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1359 static const PROGMEM IRMP_PARAMETER fdc_param
=
1361 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1362 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1363 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1364 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1365 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1366 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1367 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1368 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1369 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1370 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1371 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1372 FDC_COMMAND_OFFSET
, // command_offset: command offset
1373 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1374 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1375 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1376 FDC_LSB
, // lsb_first: flag: LSB first
1377 FDC_FLAGS
// flags: some flags
1382 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1384 static const PROGMEM IRMP_PARAMETER rccar_param
=
1386 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1387 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1388 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1389 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1390 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1391 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1392 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1393 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1394 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1395 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1396 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1397 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1398 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1399 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1400 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1401 RCCAR_LSB
, // lsb_first: flag: LSB first
1402 RCCAR_FLAGS
// flags: some flags
1407 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1409 static const PROGMEM IRMP_PARAMETER nikon_param
=
1411 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1412 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1413 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1414 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1415 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1416 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1417 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1418 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1419 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1420 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1421 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1422 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1423 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1424 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1425 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1426 NIKON_LSB
, // lsb_first: flag: LSB first
1427 NIKON_FLAGS
// flags: some flags
1432 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1434 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1436 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1437 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1438 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1439 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1440 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1441 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1442 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1443 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1444 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1445 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1446 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1447 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1448 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1449 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1450 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1451 KATHREIN_LSB
, // lsb_first: flag: LSB first
1452 KATHREIN_FLAGS
// flags: some flags
1457 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1459 static const PROGMEM IRMP_PARAMETER netbox_param
=
1461 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1462 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1463 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1464 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1465 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1466 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1467 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1468 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1469 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1470 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1471 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1472 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1473 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1474 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1475 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1476 NETBOX_LSB
, // lsb_first: flag: LSB first
1477 NETBOX_FLAGS
// flags: some flags
1482 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1484 static const PROGMEM IRMP_PARAMETER lego_param
=
1486 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1487 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1488 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1489 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1490 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1491 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1492 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1493 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1494 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1495 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1496 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1497 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1498 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1499 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1500 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1501 LEGO_LSB
, // lsb_first: flag: LSB first
1502 LEGO_FLAGS
// flags: some flags
1507 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1509 static const PROGMEM IRMP_PARAMETER thomson_param
=
1511 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1512 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1513 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1514 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1515 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1516 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1517 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1518 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1519 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1520 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1521 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1522 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1523 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1524 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1525 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1526 THOMSON_LSB
, // lsb_first: flag: LSB first
1527 THOMSON_FLAGS
// flags: some flags
1532 static uint8_t irmp_bit
; // current bit position
1533 static IRMP_PARAMETER irmp_param
;
1535 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1536 static IRMP_PARAMETER irmp_param2
;
1539 static volatile uint8_t irmp_ir_detected
;
1540 static volatile uint8_t irmp_protocol
;
1541 static volatile uint16_t irmp_address
;
1542 static volatile uint16_t irmp_command
;
1543 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1544 static volatile uint8_t irmp_flags
;
1545 // static volatile uint8_t irmp_busy_flag;
1548 static uint8_t IRMP_PIN
;
1551 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1552 * Initialize IRMP decoder
1553 * @details Configures IRMP input pin
1554 *---------------------------------------------------------------------------------------------------------------------------------------------------
1560 #if !defined(PIC_CCS_COMPILER) && !defined(PIC_C18) // only AVR
1561 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1562 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1565 #if IRMP_LOGGING == 1
1570 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1572 * @details gets decoded IRMP data
1573 * @param pointer in order to store IRMP data
1574 * @return TRUE: successful, FALSE: failed
1575 *---------------------------------------------------------------------------------------------------------------------------------------------------
1578 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1580 uint8_t rtc
= FALSE
;
1582 if (irmp_ir_detected
)
1584 switch (irmp_protocol
)
1586 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1587 case IRMP_SAMSUNG_PROTOCOL
:
1588 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1590 irmp_command
&= 0xff;
1591 irmp_command
|= irmp_id
<< 8;
1596 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1597 case IRMP_NEC_PROTOCOL
:
1598 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1600 irmp_command
&= 0xff;
1603 else if (irmp_address
== 0x87EE)
1605 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1606 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1607 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1608 irmp_command
&= 0x00FF;
1613 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1614 case IRMP_SIEMENS_PROTOCOL
:
1615 case IRMP_RUWIDO_PROTOCOL
:
1616 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1623 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1624 case IRMP_KATHREIN_PROTOCOL
:
1625 if (irmp_command
!= 0x0000)
1631 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1632 case IRMP_RC5_PROTOCOL
:
1633 irmp_address
&= ~0x20; // clear toggle bit
1637 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1638 case IRMP_IR60_PROTOCOL
:
1639 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1645 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1646 case IRMP_RCCAR_PROTOCOL
:
1647 // frame in irmp_data:
1648 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1649 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1650 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1651 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1652 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1653 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1654 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1658 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1659 case IRMP_NETBOX_PROTOCOL
:
1660 if (irmp_command
& 0x1000) // last bit set?
1662 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1665 irmp_command
&= 0x7F;
1668 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1671 irmp_command
|= 0x80;
1676 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1681 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1685 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1686 case IRMP_LEGO_PROTOCOL
:
1688 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1690 if ((irmp_command
& 0x000F) == crc
)
1697 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1709 irmp_data_p
->protocol
= irmp_protocol
;
1710 irmp_data_p
->address
= irmp_address
;
1711 irmp_data_p
->command
= irmp_command
;
1712 irmp_data_p
->flags
= irmp_flags
;
1718 irmp_ir_detected
= FALSE
;
1725 // irmp_is_busy (void)
1727 // return irmp_busy_flag;
1730 #if IRMP_USE_CALLBACK == 1
1732 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1734 irmp_callback_ptr
= cb
;
1736 #endif // IRMP_USE_CALLBACK == 1
1738 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1739 static uint16_t irmp_tmp_address
; // ir address
1740 static uint16_t irmp_tmp_command
; // ir command
1742 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1743 static uint16_t irmp_tmp_address2
; // ir address
1744 static uint16_t irmp_tmp_command2
; // ir command
1747 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1748 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1750 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1751 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1752 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1755 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1757 * @details store bit in temp address or temp command
1758 * @param value to store: 0 or 1
1759 *---------------------------------------------------------------------------------------------------------------------------------------------------
1761 // verhindert, dass irmp_store_bit() inline compiliert wird:
1762 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1765 irmp_store_bit (uint8_t value
)
1767 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1768 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1775 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1777 if (irmp_param
.lsb_first
)
1779 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1783 irmp_tmp_address
<<= 1;
1784 irmp_tmp_address
|= value
;
1787 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1789 if (irmp_param
.lsb_first
)
1791 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1795 irmp_tmp_command
<<= 1;
1796 irmp_tmp_command
|= value
;
1800 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1801 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1803 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1807 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1808 else if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1810 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1814 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1815 else if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1817 if (irmp_bit
>= 20 && irmp_bit
< 24)
1819 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1821 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1823 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1826 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1830 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1834 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1843 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1845 * @details store bit in temp address or temp command
1846 * @param value to store: 0 or 1
1847 *---------------------------------------------------------------------------------------------------------------------------------------------------
1849 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1851 irmp_store_bit2 (uint8_t value
)
1855 if (irmp_param
.protocol
)
1857 irmp_bit2
= irmp_bit
- 2;
1861 irmp_bit2
= irmp_bit
- 1;
1864 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1866 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1868 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1870 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1873 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1875 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1877 * @details ISR routine, called 10000 times per second
1878 *---------------------------------------------------------------------------------------------------------------------------------------------------
1883 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1884 static uint8_t wait_for_space
; // flag: wait for data bit space
1885 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1886 static uint8_t irmp_pulse_time
; // count bit time for pulse
1887 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1888 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1889 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1890 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1891 static uint8_t repetition_frame_number
;
1892 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1893 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1895 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1896 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1898 #if IRMP_SUPPORT_MANCHESTER == 1
1899 static PAUSE_LEN last_pause
; // last pause value
1901 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1902 static uint8_t last_value
; // last bit value
1904 uint8_t irmp_input
; // input value
1910 irmp_input
= input(IRMP_PIN
);
1912 #if IRMP_USE_CALLBACK == 1
1913 if (irmp_callback_ptr
)
1915 static uint8_t last_inverted_input
;
1917 if (last_inverted_input
!= !irmp_input
)
1919 (*irmp_callback_ptr
) (! irmp_input
);
1920 last_inverted_input
= !irmp_input
;
1923 #endif // IRMP_USE_CALLBACK == 1
1925 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1927 if (! irmp_ir_detected
) // ir code already detected?
1929 if (! irmp_start_bit_detected
) // start bit detected?
1931 if (! irmp_input
) // receiving burst?
1933 // irmp_busy_flag = TRUE;
1935 if (! irmp_pulse_time
)
1937 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1940 irmp_pulse_time
++; // increment counter
1944 if (irmp_pulse_time
) // it's dark....
1945 { // set flags for counting the time of darkness...
1946 irmp_start_bit_detected
= 1;
1947 wait_for_start_space
= 1;
1949 irmp_tmp_command
= 0;
1950 irmp_tmp_address
= 0;
1951 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1955 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1956 irmp_tmp_command2
= 0;
1957 irmp_tmp_address2
= 0;
1961 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1962 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1963 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1968 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1977 if (wait_for_start_space
) // we have received start bit...
1978 { // ...and are counting the time of darkness
1979 if (irmp_input
) // still dark?
1981 irmp_pause_time
++; // increment counter
1983 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1984 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
) ||
1985 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1987 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1990 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1991 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1996 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1998 ANALYZE_PRINTF ("%8.3fms error 1: pause after start bit pulse %d too long: %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1999 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2001 // irmp_busy_flag = FALSE;
2002 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2003 irmp_pulse_time
= 0;
2004 irmp_pause_time
= 0;
2008 { // receiving first data pulse!
2009 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
2011 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2012 irmp_param2
.protocol
= 0;
2015 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2017 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2018 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2019 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2021 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2022 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2023 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2024 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
2027 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2029 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2030 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2031 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2032 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2034 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2035 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2036 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2037 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2040 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2042 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2043 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2044 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2046 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2047 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2048 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2049 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2050 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2052 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2053 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2054 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2055 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2059 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2060 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2062 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2063 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2064 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2065 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2066 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2067 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2068 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2071 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2073 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2074 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2075 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2077 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2082 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2083 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2084 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2085 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2086 { // it's JVC repetition type 3
2087 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2088 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2089 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2090 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2093 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2095 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2097 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2098 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2099 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2101 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2102 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2103 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2104 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2107 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2109 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2110 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2111 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2113 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2114 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2115 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2116 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2119 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2121 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2122 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2123 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2124 { // it's MATSUSHITA
2125 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2126 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2127 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2128 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2131 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2133 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2134 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2135 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2137 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2138 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2139 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2140 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2143 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2145 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2146 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2147 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2149 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2150 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2151 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2152 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2155 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2157 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2158 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2159 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2160 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2161 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2163 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2164 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2165 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2167 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2168 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2169 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2170 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2171 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2172 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2173 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2174 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2177 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2179 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2180 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2181 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2183 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2184 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2185 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2186 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2187 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2188 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2189 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2190 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2193 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2195 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2196 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2197 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2198 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2199 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2202 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2203 last_pause
= irmp_pause_time
;
2205 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2206 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2209 rc5_cmd_bit6
= 1<<6;
2217 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2219 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2220 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2221 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2222 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2224 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2225 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2226 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2227 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2228 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2231 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2233 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2234 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2235 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2236 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2238 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2239 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2240 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2241 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2242 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2245 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2247 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2248 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2249 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2251 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2252 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2253 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2254 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2259 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2261 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2262 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2263 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2265 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2266 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2267 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2268 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2271 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2273 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2274 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2275 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2277 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2278 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2279 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2280 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2283 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2285 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2286 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2287 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2288 { // it's BANG_OLUFSEN
2289 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2290 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2291 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2292 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2293 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2294 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2295 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2296 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2297 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2298 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2299 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2300 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2301 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2302 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2306 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2308 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2309 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2310 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2312 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2313 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2314 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2315 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2316 last_pause
= irmp_pause_time
;
2320 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2322 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2323 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2324 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2325 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2326 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2327 { // it's RUWIDO or SIEMENS
2328 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2329 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2330 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2331 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2332 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2333 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2334 last_pause
= irmp_pause_time
;
2338 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2340 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2341 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2342 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2344 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2345 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2346 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2347 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2350 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2352 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2353 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2354 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2356 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2357 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2358 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2359 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2362 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2364 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2365 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2366 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2368 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2369 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2370 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2371 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2374 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2376 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2377 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2378 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2380 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2381 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2382 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2383 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2386 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2388 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2389 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2390 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2392 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2393 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2394 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2395 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2398 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2401 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2402 // irmp_busy_flag = FALSE;
2403 irmp_start_bit_detected
= 0; // wait for another start bit...
2406 if (irmp_start_bit_detected
)
2408 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2411 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2413 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2414 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2418 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2419 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2420 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2421 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2424 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2425 if (irmp_param2
.protocol
)
2427 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2428 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2429 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2430 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2435 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2436 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2438 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2442 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2444 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2445 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2449 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2450 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2451 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2452 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2455 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2456 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2458 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2459 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2463 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2464 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2465 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2466 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2472 #if IRMP_SUPPORT_MANCHESTER == 1
2473 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2474 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2475 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2477 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2479 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2480 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2482 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2484 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2486 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2488 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2490 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2494 #endif // IRMP_SUPPORT_MANCHESTER == 1
2496 #if IRMP_SUPPORT_SERIAL == 1
2497 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2502 #endif // IRMP_SUPPORT_SERIAL == 1
2505 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2506 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2508 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2510 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2511 { // pause timings correct for "1"?
2512 ANALYZE_PUTCHAR ('1'); // yes, store 1
2516 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2517 { // pause timings correct for "0"?
2518 ANALYZE_PUTCHAR ('0'); // yes, store 0
2524 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2525 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2526 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2528 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2530 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2531 { // pause timings correct for "1"?
2532 ANALYZE_PUTCHAR ('1'); // yes, store 1
2536 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2537 { // pause timings correct for "0"?
2538 ANALYZE_PUTCHAR ('0'); // yes, store 0
2544 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2546 ; // else do nothing
2549 irmp_pulse_time
= 1; // set counter to 1, not 0
2550 irmp_pause_time
= 0;
2551 wait_for_start_space
= 0;
2554 else if (wait_for_space
) // the data section....
2555 { // counting the time of darkness....
2556 uint8_t got_light
= FALSE
;
2558 if (irmp_input
) // still dark?
2560 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2563 #if IRMP_SUPPORT_MANCHESTER == 1
2564 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2566 #if IRMP_SUPPORT_SERIAL == 1
2567 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2569 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2572 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2574 ANALYZE_PRINTF ("stop bit detected\n");
2577 irmp_param
.stop_bit
= 0;
2581 ANALYZE_PRINTF ("error: stop bit timing wrong, irmp_bit = %d, irmp_pulse_time = %d, pulse_0_len_min = %d, pulse_0_len_max = %d\n",
2582 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2584 // irmp_busy_flag = FALSE;
2585 irmp_start_bit_detected
= 0; // wait for another start bit...
2586 irmp_pulse_time
= 0;
2587 irmp_pause_time
= 0;
2592 irmp_pause_time
++; // increment counter
2594 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2595 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2596 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2597 irmp_bit
>= 12 - 1) // pause too long?
2598 { // yes, break and close this frame
2599 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2600 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2601 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2602 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2603 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2607 #if IRMP_SUPPORT_SERIAL == 1
2608 // NETBOX generates no stop bit, here is the timeout condition:
2609 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2610 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2612 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2616 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2617 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2619 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& irmp_bit
== 6)
2621 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2622 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2623 irmp_param
.stop_bit
= TRUE
; // set flag
2625 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2626 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2627 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2628 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2629 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2630 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2632 irmp_tmp_command
<<= 1;
2633 irmp_tmp_command
|= first_bit
;
2635 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2636 { // special manchester decoder
2637 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2638 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2639 irmp_param
.stop_bit
= TRUE
; // set flag
2641 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2643 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2644 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2645 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2646 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2647 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2648 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2650 if (irmp_tmp_command
& 0x300)
2652 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2653 irmp_tmp_command
&= 0xFF;
2659 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2660 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2662 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2663 { // special manchester decoder
2664 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2665 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2666 irmp_param
.stop_bit
= TRUE
; // set flag
2668 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2670 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2671 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2672 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2673 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2674 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2675 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2678 // RUWIDO: AAAAAAAAACCCCCCCp
2679 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2680 irmp_tmp_address
<<= 2;
2681 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2682 irmp_tmp_command
&= 0x003F;
2683 irmp_tmp_command
<<= 4;
2684 irmp_tmp_command
|= last_value
;
2689 #if IRMP_SUPPORT_MANCHESTER == 1
2690 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2691 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2692 { // special manchester decoder
2693 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2694 irmp_param
.stop_bit
= TRUE
; // set flag
2697 #endif // IRMP_SUPPORT_MANCHESTER == 1
2698 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2700 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2704 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2705 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2707 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2708 irmp_param
.stop_bit
= TRUE
; // set flag
2709 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2710 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2711 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2712 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2713 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2715 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2717 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2718 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2719 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2721 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2722 irmp_param
.stop_bit
= TRUE
; // set flag
2723 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2724 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2726 // 0123456789ABC0123456789ABC0123456701234567
2727 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2728 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2729 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2730 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2732 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2733 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2734 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2736 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2737 irmp_param
.stop_bit
= TRUE
; // set flag
2738 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2739 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2741 // 0123456789ABC0123456789ABC0123456701234567
2742 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2743 // JVC: AAAACCCCCCCCCCCC
2744 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2745 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2747 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2748 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2751 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2752 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2754 // irmp_busy_flag = FALSE;
2755 irmp_start_bit_detected
= 0; // wait for another start bit...
2756 irmp_pulse_time
= 0;
2757 irmp_pause_time
= 0;
2769 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2771 #if IRMP_SUPPORT_MANCHESTER == 1
2772 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2775 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2776 #else // better, but some IR-RCs use asymmetric timings :-/
2777 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2778 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2781 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2782 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2784 ANALYZE_PUTCHAR ('T');
2785 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2798 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2800 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2801 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2803 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2804 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2806 ANALYZE_PUTCHAR ('T');
2809 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2820 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2822 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2823 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2824 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2825 if (! irmp_param2
.protocol
)
2830 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2834 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2835 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2837 uint8_t manchester_value
;
2839 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2841 manchester_value
= last_value
? 0 : 1;
2842 last_value
= manchester_value
;
2846 manchester_value
= last_value
;
2849 ANALYZE_PUTCHAR (manchester_value
+ '0');
2851 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2852 if (! irmp_param2
.protocol
)
2858 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2859 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2861 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2862 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2863 irmp_param
.address_offset
= 5;
2864 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2865 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2866 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2867 irmp_tmp_address
= 0;
2869 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2871 irmp_store_bit (manchester_value
);
2875 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2876 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2877 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2878 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2879 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2881 ANALYZE_PUTCHAR ('?');
2882 irmp_param
.protocol
= 0; // switch to FDC, see below
2885 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2886 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2887 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2888 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2889 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2890 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2892 ANALYZE_PUTCHAR ('?');
2893 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2896 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2898 ANALYZE_PUTCHAR ('?');
2900 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2901 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2902 // irmp_busy_flag = FALSE;
2903 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2904 irmp_pause_time
= 0;
2908 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2909 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2911 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2913 ANALYZE_PRINTF (" 1 (FDC)\n");
2914 irmp_store_bit2 (1);
2916 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2918 ANALYZE_PRINTF (" 0 (FDC)\n");
2919 irmp_store_bit2 (0);
2922 if (! irmp_param
.protocol
)
2924 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2925 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2926 irmp_param2
.protocol
= 0;
2927 irmp_tmp_address
= irmp_tmp_address2
;
2928 irmp_tmp_command
= irmp_tmp_command2
;
2931 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2932 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2933 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2935 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2937 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2938 irmp_store_bit2 (1);
2940 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2942 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2943 irmp_store_bit2 (0);
2946 if (! irmp_param
.protocol
)
2948 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2949 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2950 irmp_param2
.protocol
= 0;
2951 irmp_tmp_address
= irmp_tmp_address2
;
2952 irmp_tmp_command
= irmp_tmp_command2
;
2955 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2957 last_pause
= irmp_pause_time
;
2961 #endif // IRMP_SUPPORT_MANCHESTER == 1
2963 #if IRMP_SUPPORT_SERIAL == 1
2964 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2966 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2968 ANALYZE_PUTCHAR ('1');
2971 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2973 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2977 irmp_pulse_time
= 0;
2981 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2983 ANALYZE_PUTCHAR ('0');
2986 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2988 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2992 irmp_pause_time
= 0;
2999 #endif // IRMP_SUPPORT_SERIAL == 1
3001 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3002 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3004 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3005 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3007 ANALYZE_PRINTF ("SYNC\n");
3012 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3014 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3015 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3016 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3017 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3019 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3021 ANALYZE_PUTCHAR ('1');
3028 ANALYZE_PUTCHAR ('0');
3034 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3037 { // timing incorrect!
3038 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3039 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3040 // irmp_busy_flag = FALSE;
3041 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3042 irmp_pause_time
= 0;
3046 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3048 #if IRMP_SUPPORT_NEC16_PROTOCOL
3049 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3050 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3051 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3052 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3053 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3054 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3056 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3057 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3058 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3059 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3060 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3061 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3062 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3066 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3068 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3069 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3071 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3073 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3075 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3077 ANALYZE_PRINTF ("3rd start bit\n");
3082 { // timing incorrect!
3083 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
);
3084 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3085 // irmp_busy_flag = FALSE;
3086 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3087 irmp_pause_time
= 0;
3090 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3092 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3094 ANALYZE_PRINTF ("trailer bit\n");
3099 { // timing incorrect!
3100 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
);
3101 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3102 // irmp_busy_flag = FALSE;
3103 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3104 irmp_pause_time
= 0;
3109 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3110 { // pulse & pause timings correct for "1"?
3111 ANALYZE_PUTCHAR ('1');
3117 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3118 { // pulse & pause timings correct for "0"?
3119 ANALYZE_PUTCHAR ('0');
3125 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3127 ANALYZE_PUTCHAR (last_value
+ '0');
3129 irmp_store_bit (last_value
);
3133 { // timing incorrect!
3134 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
);
3135 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3136 // irmp_busy_flag = FALSE;
3137 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3138 irmp_pause_time
= 0;
3143 { // timing incorrect!
3144 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
);
3145 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3146 // irmp_busy_flag = FALSE;
3147 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3148 irmp_pause_time
= 0;
3152 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3154 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3155 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3156 { // pulse & pause timings correct for "1"?
3157 ANALYZE_PUTCHAR ('1');
3162 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3163 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3164 { // pulse & pause timings correct for "0"?
3165 ANALYZE_PUTCHAR ('0');
3171 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3173 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3174 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3175 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3176 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3178 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3184 ANALYZE_PUTCHAR ('S');
3186 irmp_tmp_command
<<= 1;
3190 ANALYZE_PUTCHAR ('S');
3197 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3198 { // timing incorrect!
3199 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3200 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3201 // irmp_busy_flag = FALSE;
3202 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3203 irmp_pause_time
= 0;
3206 irmp_pulse_time
= 1; // set counter to 1, not 0
3210 { // counting the pulse length ...
3211 if (! irmp_input
) // still light?
3213 irmp_pulse_time
++; // increment counter
3217 wait_for_space
= 1; // let's count the time (see above)
3218 irmp_pause_time
= 1; // set pause counter to 1, not 0
3222 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3224 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3226 repetition_frame_number
++;
3230 repetition_frame_number
= 0;
3233 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3234 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3235 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3237 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3238 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3244 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3245 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3246 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3248 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3249 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3255 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3256 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3257 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3259 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3260 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3266 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3267 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3268 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3270 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3271 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3278 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3279 irmp_ir_detected
= TRUE
;
3281 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3282 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3283 { // check for repetition frame
3284 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3286 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3288 irmp_protocol
= irmp_param
.protocol
; // store protocol
3289 irmp_address
= irmp_tmp_address
; // store address
3290 irmp_command
= irmp_tmp_command
; // store command
3294 ANALYZE_PRINTF ("waiting for inverted command repetition\n");
3295 irmp_ir_detected
= FALSE
;
3296 last_irmp_denon_command
= irmp_tmp_command
;
3300 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3302 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3303 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3304 { // Grundig start frame?
3305 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3306 irmp_ir_detected
= FALSE
;
3309 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3311 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3312 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3313 { // Nokia start frame?
3314 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3315 irmp_ir_detected
= FALSE
;
3318 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3320 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3321 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3323 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3325 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3326 irmp_tmp_address
= last_irmp_address
; // address is last address
3327 irmp_tmp_command
= last_irmp_command
; // command is last command
3328 irmp_flags
|= IRMP_FLAG_REPETITION
;
3333 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3334 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3335 irmp_ir_detected
= FALSE
;
3338 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3340 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3341 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3344 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3345 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3347 xor = (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3349 if (xor != (xor_check
[2] & 0x0F))
3351 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check
[2] & 0x0F);
3352 irmp_ir_detected
= FALSE
;
3355 xor = xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3357 if (xor != xor_check
[5])
3359 ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check
[5]);
3360 irmp_ir_detected
= FALSE
;
3363 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3365 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3367 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3368 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3370 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3373 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3375 irmp_protocol
= irmp_param
.protocol
;
3377 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3378 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3380 if (irmp_tmp_command
& 0x000F) // released key?
3382 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3386 irmp_tmp_command
>>= 4; // no, it's a pressed key
3388 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3389 irmp_tmp_address
&= 0x003F;
3393 irmp_address
= irmp_tmp_address
; // store address
3394 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3395 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3397 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3401 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3402 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3404 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3407 irmp_command
= irmp_tmp_command
; // store command
3409 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3410 irmp_id
= irmp_tmp_id
;
3415 if (irmp_ir_detected
)
3417 if (last_irmp_command
== irmp_tmp_command
&&
3418 last_irmp_address
== irmp_tmp_address
&&
3419 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3421 irmp_flags
|= IRMP_FLAG_REPETITION
;
3424 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3425 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3431 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3434 // irmp_busy_flag = FALSE;
3435 irmp_start_bit_detected
= 0; // and wait for next start bit
3436 irmp_tmp_command
= 0;
3437 irmp_pulse_time
= 0;
3438 irmp_pause_time
= 0;
3440 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3441 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3442 { // set pulse time here!
3443 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3445 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3449 return (irmp_ir_detected
);
3454 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3455 * main functions - for Unix/Linux + Windows only!
3459 * Compile it under linux with:
3462 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3468 * -l list pulse/pauses
3470 *---------------------------------------------------------------------------------------------------------------------------------------------------
3474 print_timings (void)
3476 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3477 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3479 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3480 printf ("====================================================================================\n");
3481 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3482 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3483 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3484 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3486 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3487 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3488 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3489 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3491 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3492 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
,
3493 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3494 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3496 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3497 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3498 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3499 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3501 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3502 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3503 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3504 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3506 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3507 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3508 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3509 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3511 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3512 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3513 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3514 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3516 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3517 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3518 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3520 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3521 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3522 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3523 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3525 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3526 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3527 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3528 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3530 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3531 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3532 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3534 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3535 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3536 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3537 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3539 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3540 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3541 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3542 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3544 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3545 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3546 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3548 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3549 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3550 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3552 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3553 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3554 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3556 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3557 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3558 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3560 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3561 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3562 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3564 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3565 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3566 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3567 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3569 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3570 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3571 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3572 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3573 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3574 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3575 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3577 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3578 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3579 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3580 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3582 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3583 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3584 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3585 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3587 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3588 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3589 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3590 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3592 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3593 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3594 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3595 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3600 print_spectrum (char * text
, int * buf
, int is_pulse
)
3613 puts ("-------------------------------------------------------------------------------");
3614 printf ("%s:\n", text
);
3616 for (i
= 0; i
< 256; i
++)
3618 if (buf
[i
] > max_value
)
3624 for (i
= 1; i
< 100; i
++)
3629 value
= (buf
[i
] * 60) / max_value
;
3631 for (j
= 0; j
< value
; j
++)
3635 printf (" %d\n", buf
[i
]);
3646 average
= (float) sum
/ (float) counter
;
3657 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3658 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3659 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3661 tolerance
= (max
- average
);
3663 if (average
- min
> tolerance
)
3665 tolerance
= average
- min
;
3668 tolerance
= tolerance
* 100 / average
;
3669 printf ("tol: %4.1f%%\n", tolerance
);
3679 #define STATE_LEFT_SHIFT 0x01
3680 #define STATE_RIGHT_SHIFT 0x02
3681 #define STATE_LEFT_CTRL 0x04
3682 #define STATE_LEFT_ALT 0x08
3683 #define STATE_RIGHT_ALT 0x10
3685 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3686 #define KEY_MENUE 0x80 // keycode = 0x0070
3687 #define KEY_BACK 0x81 // keycode = 0x0071
3688 #define KEY_FORWARD 0x82 // keycode = 0x0072
3689 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3690 #define KEY_WINDOW 0x84 // keycode = 0x0074
3691 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3692 #define KEY_STOP 0x86 // keycode = 0x0076
3693 #define KEY_MAIL 0x87 // keycode = 0x0077
3694 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3695 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3696 #define KEY_SETUP 0x8A // keycode = 0x007a
3697 #define KEY_FONT 0x8B // keycode = 0x007b
3698 #define KEY_PRINT 0x8C // keycode = 0x007c
3699 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3701 #define KEY_INSERT 0x90 // keycode = 0x004b
3702 #define KEY_DELETE 0x91 // keycode = 0x004c
3703 #define KEY_LEFT 0x92 // keycode = 0x004f
3704 #define KEY_HOME 0x93 // keycode = 0x0050
3705 #define KEY_END 0x94 // keycode = 0x0051
3706 #define KEY_UP 0x95 // keycode = 0x0053
3707 #define KEY_DOWN 0x96 // keycode = 0x0054
3708 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3709 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3710 #define KEY_RIGHT 0x99 // keycode = 0x0059
3711 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3712 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3715 get_fdc_key (uint16_t cmd
)
3717 static uint8_t key_table
[128] =
3719 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3720 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3721 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3722 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3723 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3725 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3726 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3727 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3728 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3730 static uint8_t state
;
3736 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3737 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3738 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3739 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3740 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3741 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3742 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3743 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3744 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3745 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3747 case 0x006e: key
= KEY_ESCAPE
; break;
3748 case 0x004b: key
= KEY_INSERT
; break;
3749 case 0x004c: key
= KEY_DELETE
; break;
3750 case 0x004f: key
= KEY_LEFT
; break;
3751 case 0x0050: key
= KEY_HOME
; break;
3752 case 0x0051: key
= KEY_END
; break;
3753 case 0x0053: key
= KEY_UP
; break;
3754 case 0x0054: key
= KEY_DOWN
; break;
3755 case 0x0055: key
= KEY_PAGE_UP
; break;
3756 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3757 case 0x0059: key
= KEY_RIGHT
; break;
3758 case 0x0400: key
= KEY_MOUSE_1
; break;
3759 case 0x0800: key
= KEY_MOUSE_2
; break;
3763 if (!(cmd
& 0x80)) // pressed key
3765 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3767 key
= cmd
+ 0x10; // 7x -> 8x
3769 else if (cmd
< 64) // key listed in key_table
3771 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3775 case 0x0003: key
= '²'; break;
3776 case 0x0008: key
= '{'; break;
3777 case 0x0009: key
= '['; break;
3778 case 0x000A: key
= ']'; break;
3779 case 0x000B: key
= '}'; break;
3780 case 0x000C: key
= '\\'; break;
3781 case 0x001C: key
= '~'; break;
3782 case 0x002D: key
= '|'; break;
3783 case 0x0034: key
= 0xB5; break; // Mu
3786 else if (state
& (STATE_LEFT_CTRL
))
3788 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3790 key
= key_table
[cmd
] - 'a' + 1;
3794 key
= key_table
[cmd
];
3799 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3803 key
= key_table
[idx
];
3815 static int analyze
= FALSE
;
3816 static int list
= FALSE
;
3817 static IRMP_DATA irmp_data
;
3822 if (! analyze
&& ! list
)
3826 if (irmp_get_data (&irmp_data
))
3830 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3834 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3837 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3839 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3841 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3842 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3844 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3846 char * p
= (char *) NULL
;
3850 case '\t' : p
= "TAB"; break;
3851 case '\r' : p
= "CR"; break;
3852 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3853 case KEY_MENUE
: p
= "MENUE"; break;
3854 case KEY_BACK
: p
= "BACK"; break;
3855 case KEY_FORWARD
: p
= "FORWARD"; break;
3856 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3857 case KEY_WINDOW
: p
= "WINDOW"; break;
3858 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3859 case KEY_STOP
: p
= "STOP"; break;
3860 case KEY_MAIL
: p
= "MAIL"; break;
3861 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3862 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3863 case KEY_SETUP
: p
= "SETUP"; break;
3864 case KEY_FONT
: p
= "FONT"; break;
3865 case KEY_PRINT
: p
= "PRINT"; break;
3866 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3868 case KEY_INSERT
: p
= "INSERT"; break;
3869 case KEY_DELETE
: p
= "DELETE"; break;
3870 case KEY_LEFT
: p
= "LEFT"; break;
3871 case KEY_HOME
: p
= "HOME"; break;
3872 case KEY_END
: p
= "END"; break;
3873 case KEY_UP
: p
= "UP"; break;
3874 case KEY_DOWN
: p
= "DOWN"; break;
3875 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3876 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3877 case KEY_RIGHT
: p
= "RIGHT"; break;
3878 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3879 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3880 default : p
= "<UNKNWON>"; break;
3883 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3884 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3888 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3889 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3894 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3895 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3902 main (int argc
, char ** argv
)
3910 int start_pulses
[256];
3911 int start_pauses
[256];
3915 int first_pulse
= TRUE
;
3916 int first_pause
= TRUE
;
3920 if (! strcmp (argv
[1], "-v"))
3924 else if (! strcmp (argv
[1], "-l"))
3928 else if (! strcmp (argv
[1], "-a"))
3932 else if (! strcmp (argv
[1], "-s"))
3936 else if (! strcmp (argv
[1], "-p"))
3943 for (i
= 0; i
< 256; i
++)
3945 start_pulses
[i
] = 0;
3946 start_pauses
[i
] = 0;
3953 while ((ch
= getchar ()) != EOF
)
3955 if (ch
== '_' || ch
== '0')
3963 printf ("pause: %d\n", pause
);
3972 start_pauses
[pause
]++;
3974 first_pause
= FALSE
;
3990 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3996 printf ("pulse: %d ", pulse
);
4005 start_pulses
[pulse
]++;
4007 first_pulse
= FALSE
;
4023 else if (ch
== '\n')
4027 if (list
&& pause
> 0)
4029 printf ("pause: %d\n", pause
);
4035 for (i
= 0; i
< (int) ((8000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 800 msec
4047 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4054 puts ("-------------------------------------------------------------------");
4057 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4059 if (ch
!= '\r') // ignore CR in DOS/Windows files
4076 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4077 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4078 print_spectrum ("PULSES", pulses
, TRUE
);
4079 print_spectrum ("PAUSES", pauses
, FALSE
);
4080 puts ("-------------------------------------------------------------------------------");