]>
Commit | Line | Data |
---|---|---|
4225a882 | 1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
2 | * irmp.c - infrared multi-protocol decoder, supports several remote control protocols\r | |
3 | *\r | |
f50e01e7 | 4 | * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de\r |
4225a882 | 5 | *\r |
f60c4644 | 6 | * $Id: irmp.c,v 1.116 2012/02/24 11:40:41 fm Exp $\r |
cb8474cc | 7 | *\r |
4225a882 | 8 | * ATMEGA88 @ 8 MHz\r |
9 | *\r | |
7644ac04 | 10 | * Supported mikrocontrollers:\r |
11 | *\r | |
476267f4 | 12 | * ATtiny45, ATtiny85\r |
13 | * ATtiny84\r | |
7644ac04 | 14 | * ATmega8, ATmega16, ATmega32\r |
15 | * ATmega162\r | |
16 | * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284\r | |
17 | * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P\r | |
18 | *\r | |
19 | * Typical manufacturers of remote controls:\r | |
4225a882 | 20 | *\r |
a42d1ee6 | 21 | * SIRCS - Sony\r |
22 | * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers\r | |
23 | * SAMSUNG - Samsung\r | |
24 | * SAMSUNG32 - Samsung\r | |
25 | * MATSUSHITA - Matsushita\r | |
26 | * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")\r | |
27 | * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba\r | |
28 | * RC5 - Philips and other European manufacturers\r | |
29 | * DENON - Denon, Sharp\r | |
30 | * RC6 - Philips and other European manufacturers\r | |
31 | * APPLE - Apple\r | |
32 | * NUBERT - Nubert Subwoofer System\r | |
33 | * B&O - Bang & Olufsen\r | |
34 | * PANASONIC - Panasonic (older, yet not implemented)\r | |
35 | * GRUNDIG - Grundig\r | |
36 | * NOKIA - Nokia\r | |
37 | * SIEMENS - Siemens, e.g. Gigaset M740AV\r | |
38 | * FDC - FDC IR keyboard\r | |
39 | * RCCAR - IR remote control for RC cars\r | |
40 | * JVC - JVC\r | |
beda975f | 41 | * THOMSON - Thomson\r |
a42d1ee6 | 42 | * NIKON - Nikon cameras\r |
43 | * RUWIDO - T-Home\r | |
44 | * KATHREIN - Kathrein\r | |
f50e01e7 | 45 | * LEGO - Lego Power Functions RC\r |
4225a882 | 46 | *\r |
47 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
48 | *\r | |
49 | * SIRCS\r | |
50 | * -----\r | |
51 | *\r | |
52 | * frame: 1 start bit + 12-20 data bits + no stop bit\r | |
53 | * data: 7 command bits + 5 address bits + 0 to 8 additional bits\r | |
54 | *\r | |
55 | * start bit: data "0": data "1": stop bit:\r | |
56 | * -----------------_________ ------_____ ------------______\r | |
57 | * 2400us 600us 600us 600us 1200us 600 us no stop bit\r | |
58 | *\r | |
59 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
60 | *\r | |
61 | * NEC + extended NEC\r | |
62 | * -------------------------\r | |
63 | *\r | |
64 | * frame: 1 start bit + 32 data bits + 1 stop bit\r | |
65 | * data NEC: 8 address bits + 8 inverted address bits + 8 command bits + 8 inverted command bits\r | |
66 | * data extended NEC: 16 address bits + 8 command bits + 8 inverted command bits\r | |
67 | *\r | |
68 | * start bit: data "0": data "1": stop bit:\r | |
69 | * -----------------_________ ------______ ------________________ ------______....\r | |
70 | * 9000us 4500us 560us 560us 560us 1690 us 560us\r | |
71 | *\r | |
72 | *\r | |
73 | * Repetition frame:\r | |
74 | *\r | |
75 | * -----------------_________------______ .... ~100ms Pause, then repeat\r | |
76 | * 9000us 2250us 560us\r | |
77 | *\r | |
78 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
79 | *\r | |
80 | * SAMSUNG\r | |
81 | * -------\r | |
82 | *\r | |
83 | * frame: 1 start bit + 16 data(1) bits + 1 sync bit + additional 20 data(2) bits + 1 stop bit\r | |
84 | * data(1): 16 address bits\r | |
85 | * data(2): 4 ID bits + 8 command bits + 8 inverted command bits\r | |
86 | *\r | |
87 | * start bit: data "0": data "1": sync bit: stop bit:\r | |
88 | * ----------______________ ------______ ------________________ ------______________ ------______....\r | |
89 | * 4500us 4500us 550us 450us 550us 1450us 550us 4500us 550us\r | |
90 | *\r | |
91 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
92 | *\r | |
93 | * SAMSUNG32\r | |
94 | * ----------\r | |
95 | *\r | |
96 | * frame: 1 start bit + 32 data bits + 1 stop bit\r | |
97 | * data: 16 address bits + 16 command bits\r | |
98 | *\r | |
99 | * start bit: data "0": data "1": stop bit:\r | |
100 | * ----------______________ ------______ ------________________ ------______....\r | |
101 | * 4500us 4500us 550us 450us 550us 1450us 550us\r | |
102 | *\r | |
103 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
104 | *\r | |
105 | * MATSUSHITA\r | |
106 | * ----------\r | |
107 | *\r | |
108 | * frame: 1 start bit + 24 data bits + 1 stop bit\r | |
109 | * data: 6 custom bits + 6 command bits + 12 address bits\r | |
110 | *\r | |
111 | * start bit: data "0": data "1": stop bit:\r | |
112 | * ----------_________ ------______ ------________________ ------______....\r | |
113 | * 3488us 3488us 872us 872us 872us 2616us 872us\r | |
114 | *\r | |
115 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
116 | *\r | |
117 | * KASEIKYO\r | |
118 | * --------\r | |
119 | *\r | |
120 | * frame: 1 start bit + 48 data bits + 1 stop bit\r | |
121 | * data: 16 manufacturer bits + 4 parity bits + 4 genre1 bits + 4 genre2 bits + 10 command bits + 2 id bits + 8 parity bits\r | |
122 | *\r | |
123 | * start bit: data "0": data "1": stop bit:\r | |
124 | * ----------______ ------______ ------________________ ------______....\r | |
125 | * 3380us 1690us 423us 423us 423us 1269us 423us\r | |
126 | *\r | |
127 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
128 | *\r | |
129 | * RECS80\r | |
130 | * ------\r | |
131 | *\r | |
132 | * frame: 2 start bits + 10 data bits + 1 stop bit\r | |
133 | * data: 1 toggle bit + 3 address bits + 6 command bits\r | |
134 | *\r | |
135 | * start bit: data "0": data "1": stop bit:\r | |
136 | * -----_____________________ -----____________ -----______________ ------_______....\r | |
137 | * 158us 7432us 158us 4902us 158us 7432us 158us\r | |
138 | *\r | |
139 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
140 | *\r | |
141 | * RECS80EXT\r | |
142 | * ---------\r | |
143 | *\r | |
144 | * frame: 2 start bits + 11 data bits + 1 stop bit\r | |
145 | * data: 1 toggle bit + 4 address bits + 6 command bits\r | |
146 | *\r | |
147 | * start bit: data "0": data "1": stop bit:\r | |
148 | * -----_____________________ -----____________ -----______________ ------_______....\r | |
149 | * 158us 3637us 158us 4902us 158us 7432us 158us\r | |
150 | *\r | |
151 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
152 | *\r | |
153 | * RC5 + RC5X\r | |
154 | * ----------\r | |
155 | *\r | |
156 | * RC5 frame: 2 start bits + 12 data bits + no stop bit\r | |
157 | * RC5 data: 1 toggle bit + 5 address bits + 6 command bits\r | |
158 | * RC5X frame: 1 start bit + 13 data bits + no stop bit\r | |
159 | * RC5X data: 1 inverted command bit + 1 toggle bit + 5 address bits + 6 command bits\r | |
160 | *\r | |
161 | * start bit: data "0": data "1":\r | |
162 | * ______----- ------______ ______------\r | |
163 | * 889us 889us 889us 889us 889us 889us\r | |
164 | *\r | |
165 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
166 | *\r | |
167 | * DENON\r | |
168 | * -----\r | |
169 | *\r | |
170 | * frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit\r | |
171 | * data: 5 address bits + 10 command bits\r | |
172 | *\r | |
53c11f07 | 173 | * Theory:\r |
174 | *\r | |
4225a882 | 175 | * data "0": data "1":\r |
176 | * ------________________ ------______________\r | |
b5ea7869 | 177 | * 275us 775us 275us 1900us\r |
4225a882 | 178 | *\r |
53c11f07 | 179 | * Practice:\r |
180 | *\r | |
181 | * data "0": data "1":\r | |
182 | * ------________________ ------______________\r | |
183 | * 310us 745us 310us 1780us\r | |
184 | *\r | |
4225a882 | 185 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r |
186 | *\r | |
187 | * RC6\r | |
188 | * ---\r | |
189 | *\r | |
35213800 | 190 | * RC6 frame: 1 start bit + 1 bit "1" + 3 mode bits + 1 toggle bit + 16 data bits + 2666 us pause\r |
4225a882 | 191 | * RC6 data: 8 address bits + 8 command bits\r |
192 | *\r | |
193 | * start bit toggle bit "0": toggle bit "1": data/mode "0": data/mode "1":\r | |
194 | * ____________------- _______------- -------_______ _______------- -------_______\r | |
195 | * 2666us 889us 889us 889us 889us 889us 444us 444us 444us 444us\r | |
196 | *\r | |
197 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
198 | *\r | |
199 | * APPLE\r | |
200 | * -----\r | |
201 | *\r | |
202 | * frame: 1 start bit + 32 data bits + 1 stop bit\r | |
203 | * data: 16 address bits + 11100000 + 8 command bits\r | |
204 | *\r | |
205 | * start bit: data "0": data "1": stop bit:\r | |
206 | * -----------------_________ ------______ ------________________ ------______....\r | |
207 | * 9000us 4500us 560us 560us 560us 1690 us 560us\r | |
208 | *\r | |
209 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
210 | *\r | |
211 | * NUBERT (subwoofer system)\r | |
212 | * -------------------------\r | |
213 | *\r | |
214 | * frame: 1 start bit + 10 data bits + 1 stop bit\r | |
215 | * data: 0 address bits + 10 command bits ?\r | |
216 | *\r | |
217 | * start bit: data "0": data "1": stop bit:\r | |
218 | * ----------_____ ------______ ------________________ ------______....\r | |
219 | * 1340us 340us 500us 1300us 1340us 340us 500us\r | |
220 | *\r | |
221 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
222 | *\r | |
504d9df9 | 223 | * BANG_OLUFSEN\r |
224 | * ------------\r | |
225 | *\r | |
226 | * frame: 4 start bits + 16 data bits + 1 trailer bit + 1 stop bit\r | |
227 | * data: 0 address bits + 16 command bits\r | |
228 | *\r | |
229 | * 1st start bit: 2nd start bit: 3rd start bit: 4th start bit:\r | |
230 | * -----________ -----________ -----_____________ -----________\r | |
231 | * 210us 3000us 210us 3000us 210us 15000us 210us 3000us\r | |
232 | *\r | |
233 | * data "0": data "1": data "repeat bit": trailer bit: stop bit:\r | |
234 | * -----________ -----_____________ -----___________ -----_____________ -----____...\r | |
235 | * 210us 3000us 210us 9000us 210us 6000us 210us 12000us 210us\r | |
236 | *\r | |
237 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
238 | *\r | |
d155e9ab | 239 | * GRUNDIG\r |
592411d1 | 240 | * -------\r |
241 | *\r | |
d155e9ab | 242 | * packet: 1 start frame + 19,968ms pause + N info frames + 117,76ms pause + 1 stop frame\r |
243 | * frame: 1 pre bit + 1 start bit + 9 data bits + no stop bit\r | |
244 | * pause between info frames: 117,76ms\r | |
245 | *\r | |
246 | * data of start frame: 9 x 1\r | |
247 | * data of info frame: 9 command bits\r | |
248 | * data of stop frame: 9 x 1\r | |
592411d1 | 249 | *\r |
250 | * pre bit: start bit data "0": data "1":\r | |
251 | * ------____________ ------______ ______------ ------______ \r | |
252 | * 528us 2639us 528us 528us 528us 528us 528us 528us\r | |
253 | *\r | |
254 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
255 | *\r | |
d155e9ab | 256 | * NOKIA:\r |
257 | * ------\r | |
258 | *\r | |
259 | * Timing similar to Grundig, but 16 data bits:\r | |
260 | * frame: 1 pre bit + 1 start bit + 8 command bits + 8 address bits + no stop bit\r | |
261 | *\r | |
262 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
263 | *\r | |
12948cf3 | 264 | * SIEMENS or RUWIDO:\r |
265 | * ------------------\r | |
2eab5ec9 | 266 | *\r |
267 | * SIEMENS frame: 1 start bit + 22 data bits + no stop bit\r | |
268 | * SIEMENS data: 13 address bits + 1 repeat bit + 7 data bits + 1 unknown bit\r | |
269 | *\r | |
270 | * start bit data "0": data "1":\r | |
271 | * -------_______ _______------- -------_______\r | |
272 | * 250us 250us 250us 250us 250us 250us\r | |
273 | *\r | |
274 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
275 | *\r | |
4225a882 | 276 | * PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)\r |
277 | * -----------------------------------------------------------------------------------------\r | |
278 | *\r | |
279 | * frame: 1 start bit + 22 data bits + 1 stop bit\r | |
280 | * 22 data bits = 5 custom bits + 6 data bits + 5 inverted custom bits + 6 inverted data bits\r | |
281 | *\r | |
282 | * European version: T = 456us\r | |
283 | * USA & Canada version: T = 422us\r | |
284 | *\r | |
285 | * start bit: data "0": data "1": stop bit:\r | |
286 | * 8T 8T 2T 2T 2T 6T 2T\r | |
287 | * -------------____________ ------_____ ------_____________ ------_______....\r | |
288 | * 3648us 3648us 912us 912us 912us 2736us 912us (Europe)\r | |
289 | * 3376us 3376us 844us 844us 844us 2532us 844us (US)\r | |
290 | *\r | |
291 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
292 | *\r | |
293 | * This program is free software; you can redistribute it and/or modify\r | |
294 | * it under the terms of the GNU General Public License as published by\r | |
295 | * the Free Software Foundation; either version 2 of the License, or\r | |
296 | * (at your option) any later version.\r | |
297 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
298 | */\r | |
299 | \r | |
93ba2e01 | 300 | #if defined(__18CXX)\r |
301 | #define PIC_C18 // Microchip C18 Compiler\r | |
302 | #endif\r | |
303 | \r | |
4225a882 | 304 | #if defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC Compiler instead of AVR\r |
305 | #define PIC_CCS_COMPILER\r | |
306 | #endif\r | |
307 | \r | |
308 | #ifdef unix // test on linux/unix\r | |
309 | #include <stdio.h>\r | |
310 | #include <unistd.h>\r | |
311 | #include <stdlib.h>\r | |
312 | #include <string.h>\r | |
313 | #include <inttypes.h>\r | |
314 | \r | |
48664931 | 315 | #define ANALYZE\r |
4225a882 | 316 | #define PROGMEM\r |
317 | #define memcpy_P memcpy\r | |
318 | \r | |
319 | #else // not unix:\r | |
320 | \r | |
321 | #ifdef WIN32\r | |
322 | #include <stdio.h>\r | |
323 | #include <string.h>\r | |
324 | typedef unsigned char uint8_t;\r | |
325 | typedef unsigned short uint16_t;\r | |
48664931 | 326 | #define ANALYZE\r |
4225a882 | 327 | #define PROGMEM\r |
328 | #define memcpy_P memcpy\r | |
329 | \r | |
330 | #else\r | |
331 | \r | |
93ba2e01 | 332 | #if defined (PIC_CCS_COMPILER) || defined(PIC_C18)\r |
4225a882 | 333 | \r |
334 | #include <string.h>\r | |
4225a882 | 335 | #define PROGMEM\r |
336 | #define memcpy_P memcpy\r | |
337 | \r | |
93ba2e01 | 338 | #if defined (PIC_CCS_COMPILER)\r |
339 | typedef unsigned int8 uint8_t;\r | |
340 | typedef unsigned int16 uint16_t;\r | |
341 | #endif\r | |
342 | \r | |
4225a882 | 343 | #else // AVR:\r |
344 | \r | |
345 | #include <inttypes.h>\r | |
346 | #include <stdio.h>\r | |
347 | #include <string.h>\r | |
348 | #include <avr/io.h>\r | |
349 | #include <util/delay.h>\r | |
350 | #include <avr/pgmspace.h>\r | |
351 | \r | |
93ba2e01 | 352 | #endif // PIC_CCS_COMPILER or PIC_C18\r |
4225a882 | 353 | \r |
354 | #endif // windows\r | |
355 | #endif // unix\r | |
356 | \r | |
d823e852 | 357 | #ifndef IRMP_USE_AS_LIB\r |
cb8474cc | 358 | #include "irmpconfig.h"\r |
d823e852 | 359 | #endif\r |
f5ca0147 | 360 | #include "irmp.h"\r |
4225a882 | 361 | \r |
89e8cafb | 362 | #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1\r |
363 | #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1\r | |
d155e9ab | 364 | #else\r |
89e8cafb | 365 | #define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0\r |
d155e9ab | 366 | #endif\r |
367 | \r | |
12948cf3 | 368 | #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r |
369 | #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1\r | |
370 | #else\r | |
371 | #define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0\r | |
372 | #endif\r | |
373 | \r | |
deba2a0a | 374 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \\r |
375 | IRMP_SUPPORT_RC6_PROTOCOL == 1 || \\r | |
376 | IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \\r | |
377 | IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \\r | |
89e8cafb | 378 | IRMP_SUPPORT_IR60_PROTOCOL\r |
77f488bb | 379 | #define IRMP_SUPPORT_MANCHESTER 1\r |
380 | #else\r | |
381 | #define IRMP_SUPPORT_MANCHESTER 0\r | |
382 | #endif\r | |
383 | \r | |
93570cd9 | 384 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
deba2a0a | 385 | #define IRMP_SUPPORT_SERIAL 1\r |
386 | #else\r | |
387 | #define IRMP_SUPPORT_SERIAL 0\r | |
388 | #endif\r | |
389 | \r | |
6db2522c | 390 | #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec\r |
4225a882 | 391 | \r |
fef942f6 | 392 | #define MIN_TOLERANCE_00 1.0 // -0%\r |
393 | #define MAX_TOLERANCE_00 1.0 // +0%\r | |
394 | \r | |
395 | #define MIN_TOLERANCE_05 0.95 // -5%\r | |
396 | #define MAX_TOLERANCE_05 1.05 // +5%\r | |
397 | \r | |
4225a882 | 398 | #define MIN_TOLERANCE_10 0.9 // -10%\r |
399 | #define MAX_TOLERANCE_10 1.1 // +10%\r | |
400 | \r | |
fef942f6 | 401 | #define MIN_TOLERANCE_15 0.85 // -15%\r |
402 | #define MAX_TOLERANCE_15 1.15 // +15%\r | |
403 | \r | |
4225a882 | 404 | #define MIN_TOLERANCE_20 0.8 // -20%\r |
405 | #define MAX_TOLERANCE_20 1.2 // +20%\r | |
406 | \r | |
407 | #define MIN_TOLERANCE_30 0.7 // -30%\r | |
408 | #define MAX_TOLERANCE_30 1.3 // +30%\r | |
409 | \r | |
410 | #define MIN_TOLERANCE_40 0.6 // -40%\r | |
411 | #define MAX_TOLERANCE_40 1.4 // +40%\r | |
412 | \r | |
413 | #define MIN_TOLERANCE_50 0.5 // -50%\r | |
414 | #define MAX_TOLERANCE_50 1.5 // +50%\r | |
415 | \r | |
416 | #define MIN_TOLERANCE_60 0.4 // -60%\r | |
417 | #define MAX_TOLERANCE_60 1.6 // +60%\r | |
418 | \r | |
9405f84a | 419 | #define MIN_TOLERANCE_70 0.3 // -70%\r |
420 | #define MAX_TOLERANCE_70 1.7 // +70%\r | |
421 | \r | |
fef942f6 | 422 | #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
423 | #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
424 | #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
deba2a0a | 425 | #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:\r |
426 | #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r | |
427 | #else // only 5% + 1 to avoid conflict with RC6:\r | |
428 | #define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r | |
429 | #endif\r | |
fef942f6 | 430 | #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
431 | #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
432 | #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
433 | #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
434 | #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
435 | #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
436 | \r | |
93ba2e01 | 437 | #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r |
438 | #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
439 | #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
440 | #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
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)\r | |
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)\r | |
443 | #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
444 | #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
445 | #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
446 | #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
447 | #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
448 | #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
6db2522c | 449 | // autodetect nec repetition frame within 50 msec:\r |
450 | // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms\r | |
451 | #if 0\r | |
452 | #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
453 | #else\r | |
454 | #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)\r | |
455 | #endif\r | |
fef942f6 | 456 | \r |
457 | #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
458 | #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
459 | #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
460 | #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
5b437ff6 | 461 | #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r |
462 | #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
463 | #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
464 | #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
465 | #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
466 | #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
fef942f6 | 467 | \r |
468 | #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
469 | #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
470 | #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
471 | #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
472 | #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
473 | #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
474 | #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
475 | #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
476 | #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
477 | #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
478 | \r | |
479 | #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
480 | #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
481 | #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
482 | #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
483 | #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r | |
770a1a9d | 484 | #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r |
485 | #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
486 | #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
fef942f6 | 487 | #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r |
488 | #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r | |
489 | \r | |
490 | #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r | |
491 | #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
492 | #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
493 | #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
494 | #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
495 | #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
496 | #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
497 | #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
498 | #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
499 | #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
500 | \r | |
02dbaeff | 501 | #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
502 | #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
31c1f035 | 503 | \r |
02dbaeff | 504 | #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
505 | #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
fef942f6 | 506 | \r |
b5ea7869 | 507 | #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
508 | #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
509 | #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
510 | #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
12948cf3 | 511 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
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\r | |
513 | #else\r | |
514 | #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // be more tolerant\r | |
515 | #endif\r | |
b5ea7869 | 516 | #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r |
fef942f6 | 517 | \r |
beda975f | 518 | #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
519 | #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
520 | #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
521 | #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
522 | #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
523 | #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
524 | \r | |
fef942f6 | 525 | #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
526 | #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
527 | #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
528 | #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
529 | #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
530 | #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
c7a47e89 | 531 | #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
31c1f035 | 532 | #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800\r |
533 | #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
534 | #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600\r | |
1aee56bc | 535 | \r |
fef942f6 | 536 | #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r |
537 | #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)\r | |
538 | #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r | |
539 | #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r | |
540 | #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
541 | #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
542 | #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
543 | #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
544 | #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
545 | #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
546 | \r | |
547 | #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
548 | #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
549 | #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
550 | #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
551 | #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
552 | #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
553 | #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
554 | #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
555 | #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
556 | #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
557 | #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
558 | #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
559 | \r | |
b5ea7869 | 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)\r |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
2eab5ec9 | 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\r |
b5ea7869 | 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)\r |
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)\r | |
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)\r | |
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)\r | |
576 | #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
577 | #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
578 | #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
579 | #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
580 | #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
581 | #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
582 | #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
583 | #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
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)\r | |
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)\r | |
504d9df9 | 586 | \r |
89e8cafb | 587 | #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))\r |
f60c4644 | 588 | #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
589 | #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
590 | #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
591 | #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
89e8cafb | 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)\r |
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)\r | |
594 | \r | |
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)\r | |
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)\r | |
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)\r | |
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)\r | |
89e8cafb | 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)\r |
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)\r | |
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)\r | |
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)\r | |
592411d1 | 603 | \r |
a42d1ee6 | 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\r |
605 | #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))\r | |
606 | #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r | |
607 | #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r | |
6f750020 | 608 | #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
609 | #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r | |
610 | #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
611 | #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
612 | #if 0\r | |
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\r | |
614 | #else\r | |
615 | #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1\r | |
616 | #endif\r | |
617 | #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
b5ea7869 | 618 | \r |
9e16d699 | 619 | #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
620 | #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
621 | #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
622 | #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
48664931 | 623 | #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r |
624 | #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
625 | #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
626 | #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
627 | #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
628 | #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
9e16d699 | 629 | \r |
770a1a9d | 630 | #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
631 | #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
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!\r | |
9405f84a | 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!\r |
770a1a9d | 634 | #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
635 | #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
636 | #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
637 | #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
638 | #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
639 | #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
640 | // autodetect JVC repetition frame within 50 msec:\r | |
641 | #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
642 | \r | |
9405f84a | 643 | #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r |
644 | #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
645 | #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
646 | #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
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)\r | |
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)\r | |
649 | #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
650 | #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
651 | #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
652 | #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
653 | #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
654 | #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
655 | #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
656 | \r | |
111d6191 | 657 | #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
658 | #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
659 | #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
660 | #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
661 | #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
662 | #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
663 | #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
664 | #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
665 | #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
666 | #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
667 | #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
668 | #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
669 | #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
670 | #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
671 | \r | |
deba2a0a | 672 | #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
673 | #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
674 | #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
675 | #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
676 | #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))\r | |
677 | #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))\r | |
678 | #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))\r | |
679 | #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))\r | |
680 | \r | |
f50e01e7 | 681 | #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
682 | #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
683 | #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
684 | #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
685 | #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
686 | #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
687 | #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
688 | #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
689 | #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
690 | #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
691 | \r | |
d155e9ab | 692 | #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!\r |
4225a882 | 693 | \r |
48664931 | 694 | #ifdef ANALYZE\r |
7644ac04 | 695 | #define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }\r |
696 | #define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }\r | |
697 | #define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }\r | |
698 | #define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }\r | |
699 | static int silent;\r | |
700 | static int time_counter;\r | |
701 | static int verbose;\r | |
4225a882 | 702 | #else\r |
48664931 | 703 | #define ANALYZE_PUTCHAR(a)\r |
704 | #define ANALYZE_ONLY_NORMAL_PUTCHAR(a)\r | |
705 | #define ANALYZE_PRINTF(...)\r | |
706 | #define ANALYZE_NEWLINE()\r | |
4225a882 | 707 | #endif\r |
708 | \r | |
7644ac04 | 709 | #if IRMP_USE_CALLBACK == 1\r |
710 | static void (*irmp_callback_ptr) (uint8_t);\r | |
711 | #endif // IRMP_USE_CALLBACK == 1\r | |
712 | \r | |
1f54e86c | 713 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
714 | * Protocol names\r | |
715 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
716 | */\r | |
717 | #if IRMP_PROTOCOL_NAMES == 1\r | |
718 | char *\r | |
719 | irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =\r | |
720 | {\r | |
721 | "UNKNOWN",\r | |
722 | "SIRCS",\r | |
723 | "NEC",\r | |
724 | "SAMSUNG",\r | |
725 | "MATSUSH",\r | |
726 | "KASEIKYO",\r | |
727 | "RECS80",\r | |
728 | "RC5",\r | |
729 | "DENON",\r | |
730 | "RC6",\r | |
731 | "SAMSG32",\r | |
732 | "APPLE",\r | |
733 | "RECS80EX",\r | |
734 | "NUBERT",\r | |
735 | "BANG OLU",\r | |
736 | "GRUNDIG",\r | |
737 | "NOKIA",\r | |
738 | "SIEMENS",\r | |
739 | "FDC",\r | |
740 | "RCCAR",\r | |
741 | "JVC",\r | |
742 | "RC6A",\r | |
743 | "NIKON",\r | |
744 | "RUWIDO",\r | |
745 | "IR60",\r | |
746 | "KATHREIN",\r | |
747 | "NETBOX",\r | |
748 | "NEC16",\r | |
749 | "NEC42",\r | |
750 | "LEGO",\r | |
93570cd9 | 751 | "THOMSON"\r |
1f54e86c | 752 | };\r |
753 | #endif\r | |
754 | \r | |
755 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
756 | * Logging\r | |
757 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
758 | */\r | |
6c3c57e6 | 759 | #if IRMP_LOGGING == 1 // logging via UART\r |
760 | \r | |
761 | #if IRMP_EXT_LOGGING == 1 // use external logging\r | |
762 | #include "irmpextlog.h"\r | |
763 | #else // normal UART log (IRMP_EXT_LOGGING == 0)\r | |
879b06c2 | 764 | #define BAUD 9600L\r |
765 | #include <util/setbaud.h>\r | |
766 | \r | |
767 | #ifdef UBRR0H\r | |
768 | \r | |
769 | #define UART0_UBRRH UBRR0H\r | |
770 | #define UART0_UBRRL UBRR0L\r | |
771 | #define UART0_UCSRA UCSR0A\r | |
772 | #define UART0_UCSRB UCSR0B\r | |
773 | #define UART0_UCSRC UCSR0C\r | |
774 | #define UART0_UDRE_BIT_VALUE (1<<UDRE0)\r | |
775 | #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)\r | |
776 | #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)\r | |
777 | #ifdef URSEL0\r | |
778 | #define UART0_URSEL_BIT_VALUE (1<<URSEL0)\r | |
779 | #else\r | |
780 | #define UART0_URSEL_BIT_VALUE (0)\r | |
781 | #endif\r | |
782 | #define UART0_TXEN_BIT_VALUE (1<<TXEN0)\r | |
e92413eb | 783 | #define UART0_UDR UDR0\r |
c7a47e89 | 784 | #define UART0_U2X U2X0\r |
cea96148 | 785 | \r |
879b06c2 | 786 | #else\r |
4225a882 | 787 | \r |
879b06c2 | 788 | #define UART0_UBRRH UBRRH\r |
789 | #define UART0_UBRRL UBRRL\r | |
790 | #define UART0_UCSRA UCSRA\r | |
791 | #define UART0_UCSRB UCSRB\r | |
792 | #define UART0_UCSRC UCSRC\r | |
793 | #define UART0_UDRE_BIT_VALUE (1<<UDRE)\r | |
794 | #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)\r | |
795 | #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)\r | |
796 | #ifdef URSEL\r | |
797 | #define UART0_URSEL_BIT_VALUE (1<<URSEL)\r | |
798 | #else\r | |
799 | #define UART0_URSEL_BIT_VALUE (0)\r | |
800 | #endif\r | |
801 | #define UART0_TXEN_BIT_VALUE (1<<TXEN)\r | |
e92413eb | 802 | #define UART0_UDR UDR\r |
c7a47e89 | 803 | #define UART0_U2X U2X\r |
4225a882 | 804 | \r |
6c3c57e6 | 805 | #endif //UBRR0H\r |
806 | #endif //IRMP_EXT_LOGGING\r | |
4225a882 | 807 | \r |
4225a882 | 808 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
809 | * Initialize UART\r | |
810 | * @details Initializes UART\r | |
811 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
812 | */\r | |
813 | void\r | |
814 | irmp_uart_init (void)\r | |
815 | {\r | |
6c3c57e6 | 816 | #if (IRMP_EXT_LOGGING == 0) // use UART\r |
879b06c2 | 817 | UART0_UBRRH = UBRRH_VALUE; // set baud rate\r |
818 | UART0_UBRRL = UBRRL_VALUE;\r | |
819 | \r | |
820 | #if USE_2X\r | |
c7a47e89 | 821 | UART0_UCSRA |= (1<<UART0_U2X);\r |
879b06c2 | 822 | #else\r |
c7a47e89 | 823 | UART0_UCSRA &= ~(1<<UART0_U2X);\r |
879b06c2 | 824 | #endif\r |
825 | \r | |
826 | UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;\r | |
827 | UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX\r | |
6c3c57e6 | 828 | #else // other log method\r |
cea96148 | 829 | initextlog(); \r |
6c3c57e6 | 830 | #endif //IRMP_EXT_LOGGING\r |
4225a882 | 831 | }\r |
832 | \r | |
833 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
834 | * Send character\r | |
835 | * @details Sends character\r | |
836 | * @param ch character to be transmitted\r | |
837 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
838 | */\r | |
839 | void\r | |
840 | irmp_uart_putc (unsigned char ch)\r | |
841 | {\r | |
6c3c57e6 | 842 | #if (IRMP_EXT_LOGGING == 0)\r |
879b06c2 | 843 | while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))\r |
4225a882 | 844 | {\r |
845 | ;\r | |
846 | }\r | |
847 | \r | |
879b06c2 | 848 | UART0_UDR = ch;\r |
6c3c57e6 | 849 | #else\r |
850 | sendextlog(ch); //Use external log\r | |
851 | #endif\r | |
4225a882 | 852 | }\r |
853 | \r | |
854 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
855 | * Log IR signal\r | |
856 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
857 | */\r | |
d155e9ab | 858 | \r |
859 | #define STARTCYCLES 2 // min count of zeros before start of logging\r | |
860 | #define ENDBITS 1000 // number of sequenced highbits to detect end\r | |
861 | #define DATALEN 700 // log buffer size\r | |
4225a882 | 862 | \r |
863 | static void\r | |
d155e9ab | 864 | irmp_log (uint8_t val)\r |
4225a882 | 865 | {\r |
d155e9ab | 866 | static uint8_t buf[DATALEN]; // logging buffer\r |
867 | static uint16_t buf_idx; // number of written bits\r | |
868 | static uint8_t startcycles; // current number of start-zeros\r | |
869 | static uint16_t cnt; // counts sequenced highbits - to detect end\r | |
4225a882 | 870 | \r |
d155e9ab | 871 | if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging\r |
4225a882 | 872 | {\r |
d155e9ab | 873 | startcycles++;\r |
4225a882 | 874 | }\r |
875 | else\r | |
876 | {\r | |
d155e9ab | 877 | startcycles = 0;\r |
4225a882 | 878 | \r |
d155e9ab | 879 | if (! val || (val && buf_idx != 0)) // start or continue logging on "0", "1" cannot init logging\r |
4225a882 | 880 | {\r |
d155e9ab | 881 | if (buf_idx < DATALEN * 8) // index in range?\r |
882 | { // yes\r | |
883 | if (val)\r | |
884 | {\r | |
885 | buf[(buf_idx / 8)] |= (1<<(buf_idx % 8)); // set bit\r | |
886 | }\r | |
887 | else\r | |
888 | {\r | |
889 | buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8)); // reset bit\r | |
890 | }\r | |
4225a882 | 891 | \r |
d155e9ab | 892 | buf_idx++;\r |
893 | }\r | |
4225a882 | 894 | \r |
895 | if (val)\r | |
46dd89b7 | 896 | { // if high received then look at log-stop condition\r |
d155e9ab | 897 | cnt++;\r |
4225a882 | 898 | \r |
d155e9ab | 899 | if (cnt > ENDBITS)\r |
900 | { // if stop condition is true, output on uart\r | |
4225a882 | 901 | uint16_t i;\r |
902 | \r | |
d155e9ab | 903 | for (i = 0; i < STARTCYCLES; i++)\r |
4225a882 | 904 | {\r |
46dd89b7 | 905 | irmp_uart_putc ('0'); // the ignored starting zeros\r |
4225a882 | 906 | }\r |
907 | \r | |
d155e9ab | 908 | for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++) // transform bitset into uart chars\r |
4225a882 | 909 | {\r |
d155e9ab | 910 | uint8_t d = buf[i];\r |
4225a882 | 911 | uint8_t j;\r |
912 | \r | |
d155e9ab | 913 | for (j = 0; j < 8; j++)\r |
4225a882 | 914 | {\r |
915 | irmp_uart_putc ((d & 1) + '0');\r | |
916 | d >>= 1;\r | |
917 | }\r | |
918 | }\r | |
919 | \r | |
920 | irmp_uart_putc ('\n');\r | |
d155e9ab | 921 | buf_idx = 0;\r |
4225a882 | 922 | }\r |
923 | }\r | |
924 | else\r | |
925 | {\r | |
d155e9ab | 926 | cnt = 0;\r |
4225a882 | 927 | }\r |
928 | }\r | |
929 | }\r | |
930 | }\r | |
931 | \r | |
932 | #else\r | |
d155e9ab | 933 | #define irmp_log(val)\r |
6c3c57e6 | 934 | #endif //IRMP_LOGGING\r |
4225a882 | 935 | \r |
936 | typedef struct\r | |
937 | {\r | |
938 | uint8_t protocol; // ir protocol\r | |
939 | uint8_t pulse_1_len_min; // minimum length of pulse with bit value 1\r | |
940 | uint8_t pulse_1_len_max; // maximum length of pulse with bit value 1\r | |
941 | uint8_t pause_1_len_min; // minimum length of pause with bit value 1\r | |
942 | uint8_t pause_1_len_max; // maximum length of pause with bit value 1\r | |
943 | uint8_t pulse_0_len_min; // minimum length of pulse with bit value 0\r | |
944 | uint8_t pulse_0_len_max; // maximum length of pulse with bit value 0\r | |
945 | uint8_t pause_0_len_min; // minimum length of pause with bit value 0\r | |
946 | uint8_t pause_0_len_max; // maximum length of pause with bit value 0\r | |
947 | uint8_t address_offset; // address offset\r | |
948 | uint8_t address_end; // end of address\r | |
949 | uint8_t command_offset; // command offset\r | |
950 | uint8_t command_end; // end of command\r | |
951 | uint8_t complete_len; // complete length of frame\r | |
952 | uint8_t stop_bit; // flag: frame has stop bit\r | |
953 | uint8_t lsb_first; // flag: LSB first\r | |
77f488bb | 954 | uint8_t flags; // some flags\r |
4225a882 | 955 | } IRMP_PARAMETER;\r |
956 | \r | |
957 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
958 | \r | |
63b94f48 | 959 | static const PROGMEM IRMP_PARAMETER sircs_param =\r |
4225a882 | 960 | {\r |
d155e9ab | 961 | IRMP_SIRCS_PROTOCOL, // protocol: ir protocol\r |
962 | SIRCS_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
963 | SIRCS_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
964 | SIRCS_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
965 | SIRCS_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
966 | SIRCS_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
967 | SIRCS_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
968 | SIRCS_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
969 | SIRCS_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
970 | SIRCS_ADDRESS_OFFSET, // address_offset: address offset\r | |
971 | SIRCS_ADDRESS_OFFSET + SIRCS_ADDRESS_LEN, // address_end: end of address\r | |
972 | SIRCS_COMMAND_OFFSET, // command_offset: command offset\r | |
973 | SIRCS_COMMAND_OFFSET + SIRCS_COMMAND_LEN, // command_end: end of command\r | |
974 | SIRCS_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
975 | SIRCS_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 976 | SIRCS_LSB, // lsb_first: flag: LSB first\r |
977 | SIRCS_FLAGS // flags: some flags\r | |
4225a882 | 978 | };\r |
979 | \r | |
980 | #endif\r | |
981 | \r | |
982 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
983 | \r | |
63b94f48 | 984 | static const PROGMEM IRMP_PARAMETER nec_param =\r |
4225a882 | 985 | {\r |
d155e9ab | 986 | IRMP_NEC_PROTOCOL, // protocol: ir protocol\r |
987 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
988 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
989 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
990 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
991 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
992 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
993 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
994 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
995 | NEC_ADDRESS_OFFSET, // address_offset: address offset\r | |
996 | NEC_ADDRESS_OFFSET + NEC_ADDRESS_LEN, // address_end: end of address\r | |
997 | NEC_COMMAND_OFFSET, // command_offset: command offset\r | |
998 | NEC_COMMAND_OFFSET + NEC_COMMAND_LEN, // command_end: end of command\r | |
999 | NEC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1000 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1001 | NEC_LSB, // lsb_first: flag: LSB first\r |
1002 | NEC_FLAGS // flags: some flags\r | |
4225a882 | 1003 | };\r |
1004 | \r | |
63b94f48 | 1005 | static const PROGMEM IRMP_PARAMETER nec_rep_param =\r |
46dd89b7 | 1006 | {\r |
d155e9ab | 1007 | IRMP_NEC_PROTOCOL, // protocol: ir protocol\r |
1008 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1009 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1010 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1011 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1012 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1013 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1014 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1015 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1016 | 0, // address_offset: address offset\r | |
1017 | 0, // address_end: end of address\r | |
1018 | 0, // command_offset: command offset\r | |
1019 | 0, // command_end: end of command\r | |
1020 | 0, // complete_len: complete length of frame\r | |
1021 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1022 | NEC_LSB, // lsb_first: flag: LSB first\r |
1023 | NEC_FLAGS // flags: some flags\r | |
46dd89b7 | 1024 | };\r |
1025 | \r | |
4225a882 | 1026 | #endif\r |
1027 | \r | |
35213800 | 1028 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
fc80d688 | 1029 | \r |
63b94f48 | 1030 | static const PROGMEM IRMP_PARAMETER nec42_param =\r |
fc80d688 | 1031 | {\r |
35213800 | 1032 | IRMP_NEC42_PROTOCOL, // protocol: ir protocol\r |
fc80d688 | 1033 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r |
1034 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1035 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1036 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1037 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1038 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1039 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1040 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
35213800 | 1041 | NEC42_ADDRESS_OFFSET, // address_offset: address offset\r |
7644ac04 | 1042 | NEC42_ADDRESS_OFFSET + NEC42_ADDRESS_LEN, // address_end: end of address\r |
35213800 | 1043 | NEC42_COMMAND_OFFSET, // command_offset: command offset\r |
7644ac04 | 1044 | NEC42_COMMAND_OFFSET + NEC42_COMMAND_LEN, // command_end: end of command\r |
35213800 | 1045 | NEC42_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r |
1046 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1047 | NEC_LSB, // lsb_first: flag: LSB first\r | |
1048 | NEC_FLAGS // flags: some flags\r | |
fc80d688 | 1049 | };\r |
1050 | \r | |
1051 | #endif\r | |
1052 | \r | |
4225a882 | 1053 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
1054 | \r | |
63b94f48 | 1055 | static const PROGMEM IRMP_PARAMETER samsung_param =\r |
4225a882 | 1056 | {\r |
d155e9ab | 1057 | IRMP_SAMSUNG_PROTOCOL, // protocol: ir protocol\r |
1058 | SAMSUNG_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1059 | SAMSUNG_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1060 | SAMSUNG_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1061 | SAMSUNG_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1062 | SAMSUNG_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1063 | SAMSUNG_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1064 | SAMSUNG_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1065 | SAMSUNG_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1066 | SAMSUNG_ADDRESS_OFFSET, // address_offset: address offset\r | |
1067 | SAMSUNG_ADDRESS_OFFSET + SAMSUNG_ADDRESS_LEN, // address_end: end of address\r | |
1068 | SAMSUNG_COMMAND_OFFSET, // command_offset: command offset\r | |
1069 | SAMSUNG_COMMAND_OFFSET + SAMSUNG_COMMAND_LEN, // command_end: end of command\r | |
1070 | SAMSUNG_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1071 | SAMSUNG_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1072 | SAMSUNG_LSB, // lsb_first: flag: LSB first\r |
1073 | SAMSUNG_FLAGS // flags: some flags\r | |
4225a882 | 1074 | };\r |
1075 | \r | |
1076 | #endif\r | |
1077 | \r | |
1078 | #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
1079 | \r | |
63b94f48 | 1080 | static const PROGMEM IRMP_PARAMETER matsushita_param =\r |
4225a882 | 1081 | {\r |
d155e9ab | 1082 | IRMP_MATSUSHITA_PROTOCOL, // protocol: ir protocol\r |
1083 | MATSUSHITA_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1084 | MATSUSHITA_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1085 | MATSUSHITA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1086 | MATSUSHITA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1087 | MATSUSHITA_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1088 | MATSUSHITA_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1089 | MATSUSHITA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1090 | MATSUSHITA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1091 | MATSUSHITA_ADDRESS_OFFSET, // address_offset: address offset\r | |
1092 | MATSUSHITA_ADDRESS_OFFSET + MATSUSHITA_ADDRESS_LEN, // address_end: end of address\r | |
1093 | MATSUSHITA_COMMAND_OFFSET, // command_offset: command offset\r | |
1094 | MATSUSHITA_COMMAND_OFFSET + MATSUSHITA_COMMAND_LEN, // command_end: end of command\r | |
1095 | MATSUSHITA_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1096 | MATSUSHITA_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1097 | MATSUSHITA_LSB, // lsb_first: flag: LSB first\r |
1098 | MATSUSHITA_FLAGS // flags: some flags\r | |
4225a882 | 1099 | };\r |
1100 | \r | |
1101 | #endif\r | |
1102 | \r | |
1103 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
1104 | \r | |
63b94f48 | 1105 | static const PROGMEM IRMP_PARAMETER kaseikyo_param =\r |
4225a882 | 1106 | {\r |
d155e9ab | 1107 | IRMP_KASEIKYO_PROTOCOL, // protocol: ir protocol\r |
1108 | KASEIKYO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1109 | KASEIKYO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1110 | KASEIKYO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1111 | KASEIKYO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1112 | KASEIKYO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1113 | KASEIKYO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1114 | KASEIKYO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1115 | KASEIKYO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1116 | KASEIKYO_ADDRESS_OFFSET, // address_offset: address offset\r | |
1117 | KASEIKYO_ADDRESS_OFFSET + KASEIKYO_ADDRESS_LEN, // address_end: end of address\r | |
1118 | KASEIKYO_COMMAND_OFFSET, // command_offset: command offset\r | |
1119 | KASEIKYO_COMMAND_OFFSET + KASEIKYO_COMMAND_LEN, // command_end: end of command\r | |
1120 | KASEIKYO_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1121 | KASEIKYO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1122 | KASEIKYO_LSB, // lsb_first: flag: LSB first\r |
1123 | KASEIKYO_FLAGS // flags: some flags\r | |
4225a882 | 1124 | };\r |
1125 | \r | |
1126 | #endif\r | |
1127 | \r | |
1128 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
1129 | \r | |
63b94f48 | 1130 | static const PROGMEM IRMP_PARAMETER recs80_param =\r |
4225a882 | 1131 | {\r |
d155e9ab | 1132 | IRMP_RECS80_PROTOCOL, // protocol: ir protocol\r |
1133 | RECS80_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1134 | RECS80_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1135 | RECS80_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1136 | RECS80_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1137 | RECS80_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1138 | RECS80_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1139 | RECS80_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1140 | RECS80_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1141 | RECS80_ADDRESS_OFFSET, // address_offset: address offset\r | |
1142 | RECS80_ADDRESS_OFFSET + RECS80_ADDRESS_LEN, // address_end: end of address\r | |
1143 | RECS80_COMMAND_OFFSET, // command_offset: command offset\r | |
1144 | RECS80_COMMAND_OFFSET + RECS80_COMMAND_LEN, // command_end: end of command\r | |
1145 | RECS80_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1146 | RECS80_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1147 | RECS80_LSB, // lsb_first: flag: LSB first\r |
1148 | RECS80_FLAGS // flags: some flags\r | |
4225a882 | 1149 | };\r |
1150 | \r | |
1151 | #endif\r | |
1152 | \r | |
1153 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
1154 | \r | |
63b94f48 | 1155 | static const PROGMEM IRMP_PARAMETER rc5_param =\r |
4225a882 | 1156 | {\r |
d155e9ab | 1157 | IRMP_RC5_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 1158 | RC5_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r |
1159 | RC5_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
1160 | RC5_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
1161 | RC5_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1162 | 0, // pulse_0_len_min: here: not used\r |
1163 | 0, // pulse_0_len_max: here: not used\r | |
1164 | 0, // pause_0_len_min: here: not used\r | |
1165 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 1166 | RC5_ADDRESS_OFFSET, // address_offset: address offset\r |
1167 | RC5_ADDRESS_OFFSET + RC5_ADDRESS_LEN, // address_end: end of address\r | |
1168 | RC5_COMMAND_OFFSET, // command_offset: command offset\r | |
1169 | RC5_COMMAND_OFFSET + RC5_COMMAND_LEN, // command_end: end of command\r | |
1170 | RC5_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1171 | RC5_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1172 | RC5_LSB, // lsb_first: flag: LSB first\r |
1173 | RC5_FLAGS // flags: some flags\r | |
4225a882 | 1174 | };\r |
1175 | \r | |
1176 | #endif\r | |
1177 | \r | |
1178 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
1179 | \r | |
63b94f48 | 1180 | static const PROGMEM IRMP_PARAMETER denon_param =\r |
4225a882 | 1181 | {\r |
d155e9ab | 1182 | IRMP_DENON_PROTOCOL, // protocol: ir protocol\r |
1183 | DENON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1184 | DENON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1185 | DENON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1186 | DENON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1187 | DENON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1188 | DENON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1189 | DENON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1190 | DENON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1191 | DENON_ADDRESS_OFFSET, // address_offset: address offset\r | |
1192 | DENON_ADDRESS_OFFSET + DENON_ADDRESS_LEN, // address_end: end of address\r | |
1193 | DENON_COMMAND_OFFSET, // command_offset: command offset\r | |
1194 | DENON_COMMAND_OFFSET + DENON_COMMAND_LEN, // command_end: end of command\r | |
1195 | DENON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1196 | DENON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1197 | DENON_LSB, // lsb_first: flag: LSB first\r |
1198 | DENON_FLAGS // flags: some flags\r | |
4225a882 | 1199 | };\r |
1200 | \r | |
1201 | #endif\r | |
1202 | \r | |
1203 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
1204 | \r | |
63b94f48 | 1205 | static const PROGMEM IRMP_PARAMETER rc6_param =\r |
4225a882 | 1206 | {\r |
d155e9ab | 1207 | IRMP_RC6_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 1208 | \r |
1209 | RC6_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r | |
1210 | RC6_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
1211 | RC6_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
1212 | RC6_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1213 | 0, // pulse_0_len_min: here: not used\r |
1214 | 0, // pulse_0_len_max: here: not used\r | |
1215 | 0, // pause_0_len_min: here: not used\r | |
1216 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 1217 | RC6_ADDRESS_OFFSET, // address_offset: address offset\r |
1218 | RC6_ADDRESS_OFFSET + RC6_ADDRESS_LEN, // address_end: end of address\r | |
1219 | RC6_COMMAND_OFFSET, // command_offset: command offset\r | |
1220 | RC6_COMMAND_OFFSET + RC6_COMMAND_LEN, // command_end: end of command\r | |
1221 | RC6_COMPLETE_DATA_LEN_SHORT, // complete_len: complete length of frame\r | |
1222 | RC6_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1223 | RC6_LSB, // lsb_first: flag: LSB first\r |
1224 | RC6_FLAGS // flags: some flags\r | |
4225a882 | 1225 | };\r |
1226 | \r | |
1227 | #endif\r | |
1228 | \r | |
1229 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
1230 | \r | |
63b94f48 | 1231 | static const PROGMEM IRMP_PARAMETER recs80ext_param =\r |
4225a882 | 1232 | {\r |
d155e9ab | 1233 | IRMP_RECS80EXT_PROTOCOL, // protocol: ir protocol\r |
1234 | RECS80EXT_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1235 | RECS80EXT_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1236 | RECS80EXT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1237 | RECS80EXT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1238 | RECS80EXT_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1239 | RECS80EXT_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1240 | RECS80EXT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1241 | RECS80EXT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1242 | RECS80EXT_ADDRESS_OFFSET, // address_offset: address offset\r | |
1243 | RECS80EXT_ADDRESS_OFFSET + RECS80EXT_ADDRESS_LEN, // address_end: end of address\r | |
1244 | RECS80EXT_COMMAND_OFFSET, // command_offset: command offset\r | |
1245 | RECS80EXT_COMMAND_OFFSET + RECS80EXT_COMMAND_LEN, // command_end: end of command\r | |
1246 | RECS80EXT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1247 | RECS80EXT_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1248 | RECS80EXT_LSB, // lsb_first: flag: LSB first\r |
1249 | RECS80EXT_FLAGS // flags: some flags\r | |
4225a882 | 1250 | };\r |
1251 | \r | |
1252 | #endif\r | |
1253 | \r | |
504d9df9 | 1254 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r |
4225a882 | 1255 | \r |
63b94f48 | 1256 | static const PROGMEM IRMP_PARAMETER nubert_param =\r |
4225a882 | 1257 | {\r |
d155e9ab | 1258 | IRMP_NUBERT_PROTOCOL, // protocol: ir protocol\r |
1259 | NUBERT_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1260 | NUBERT_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1261 | NUBERT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1262 | NUBERT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1263 | NUBERT_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1264 | NUBERT_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1265 | NUBERT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1266 | NUBERT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1267 | NUBERT_ADDRESS_OFFSET, // address_offset: address offset\r | |
1268 | NUBERT_ADDRESS_OFFSET + NUBERT_ADDRESS_LEN, // address_end: end of address\r | |
1269 | NUBERT_COMMAND_OFFSET, // command_offset: command offset\r | |
1270 | NUBERT_COMMAND_OFFSET + NUBERT_COMMAND_LEN, // command_end: end of command\r | |
1271 | NUBERT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1272 | NUBERT_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1273 | NUBERT_LSB, // lsb_first: flag: LSB first\r |
1274 | NUBERT_FLAGS // flags: some flags\r | |
4225a882 | 1275 | };\r |
1276 | \r | |
1277 | #endif\r | |
1278 | \r | |
504d9df9 | 1279 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
1280 | \r | |
63b94f48 | 1281 | static const PROGMEM IRMP_PARAMETER bang_olufsen_param =\r |
504d9df9 | 1282 | {\r |
d155e9ab | 1283 | IRMP_BANG_OLUFSEN_PROTOCOL, // protocol: ir protocol\r |
1284 | BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1285 | BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1286 | BANG_OLUFSEN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1287 | BANG_OLUFSEN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1288 | BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1289 | BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1290 | BANG_OLUFSEN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1291 | BANG_OLUFSEN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1292 | BANG_OLUFSEN_ADDRESS_OFFSET, // address_offset: address offset\r | |
1293 | BANG_OLUFSEN_ADDRESS_OFFSET + BANG_OLUFSEN_ADDRESS_LEN, // address_end: end of address\r | |
1294 | BANG_OLUFSEN_COMMAND_OFFSET, // command_offset: command offset\r | |
1295 | BANG_OLUFSEN_COMMAND_OFFSET + BANG_OLUFSEN_COMMAND_LEN, // command_end: end of command\r | |
1296 | BANG_OLUFSEN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1297 | BANG_OLUFSEN_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 1298 | BANG_OLUFSEN_LSB, // lsb_first: flag: LSB first\r |
1299 | BANG_OLUFSEN_FLAGS // flags: some flags\r | |
504d9df9 | 1300 | };\r |
1301 | \r | |
1302 | #endif\r | |
1303 | \r | |
89e8cafb | 1304 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
1305 | \r | |
1306 | static uint8_t first_bit;\r | |
592411d1 | 1307 | \r |
63b94f48 | 1308 | static const PROGMEM IRMP_PARAMETER grundig_param =\r |
592411d1 | 1309 | {\r |
d155e9ab | 1310 | IRMP_GRUNDIG_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 1311 | \r |
89e8cafb | 1312 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r |
1313 | GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
1314 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
1315 | GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1316 | 0, // pulse_0_len_min: here: not used\r |
1317 | 0, // pulse_0_len_max: here: not used\r | |
1318 | 0, // pause_0_len_min: here: not used\r | |
1319 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 1320 | GRUNDIG_ADDRESS_OFFSET, // address_offset: address offset\r |
1321 | GRUNDIG_ADDRESS_OFFSET + GRUNDIG_ADDRESS_LEN, // address_end: end of address\r | |
1322 | GRUNDIG_COMMAND_OFFSET, // command_offset: command offset\r | |
1323 | GRUNDIG_COMMAND_OFFSET + GRUNDIG_COMMAND_LEN + 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)\r | |
1324 | NOKIA_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!\r | |
89e8cafb | 1325 | GRUNDIG_NOKIA_IR60_STOP_BIT, // stop_bit: flag: frame has stop bit\r |
1326 | GRUNDIG_NOKIA_IR60_LSB, // lsb_first: flag: LSB first\r | |
1327 | GRUNDIG_NOKIA_IR60_FLAGS // flags: some flags\r | |
592411d1 | 1328 | };\r |
1329 | \r | |
1330 | #endif\r | |
1331 | \r | |
12948cf3 | 1332 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
a7054daf | 1333 | \r |
63b94f48 | 1334 | static const PROGMEM IRMP_PARAMETER ruwido_param =\r |
a7054daf | 1335 | {\r |
12948cf3 | 1336 | IRMP_RUWIDO_PROTOCOL, // protocol: ir protocol\r |
1337 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r | |
1338 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
1339 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
1340 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1341 | 0, // pulse_0_len_min: here: not used\r |
1342 | 0, // pulse_0_len_max: here: not used\r | |
1343 | 0, // pause_0_len_min: here: not used\r | |
1344 | 0, // pause_0_len_max: here: not used\r | |
12948cf3 | 1345 | RUWIDO_ADDRESS_OFFSET, // address_offset: address offset\r |
1346 | RUWIDO_ADDRESS_OFFSET + RUWIDO_ADDRESS_LEN, // address_end: end of address\r | |
1347 | RUWIDO_COMMAND_OFFSET, // command_offset: command offset\r | |
1348 | RUWIDO_COMMAND_OFFSET + RUWIDO_COMMAND_LEN, // command_end: end of command\r | |
1349 | SIEMENS_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!\r | |
1350 | SIEMENS_OR_RUWIDO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1351 | SIEMENS_OR_RUWIDO_LSB, // lsb_first: flag: LSB first\r | |
1352 | SIEMENS_OR_RUWIDO_FLAGS // flags: some flags\r | |
a7054daf | 1353 | };\r |
1354 | \r | |
1355 | #endif\r | |
1356 | \r | |
48664931 | 1357 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
b5ea7869 | 1358 | \r |
63b94f48 | 1359 | static const PROGMEM IRMP_PARAMETER fdc_param =\r |
b5ea7869 | 1360 | {\r |
48664931 | 1361 | IRMP_FDC_PROTOCOL, // protocol: ir protocol\r |
1362 | FDC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1363 | FDC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1364 | FDC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1365 | FDC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1366 | FDC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1367 | FDC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1368 | FDC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1369 | FDC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1370 | FDC_ADDRESS_OFFSET, // address_offset: address offset\r | |
1371 | FDC_ADDRESS_OFFSET + FDC_ADDRESS_LEN, // address_end: end of address\r | |
1372 | FDC_COMMAND_OFFSET, // command_offset: command offset\r | |
1373 | FDC_COMMAND_OFFSET + FDC_COMMAND_LEN, // command_end: end of command\r | |
1374 | FDC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1375 | FDC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1376 | FDC_LSB, // lsb_first: flag: LSB first\r | |
1377 | FDC_FLAGS // flags: some flags\r | |
b5ea7869 | 1378 | };\r |
1379 | \r | |
1380 | #endif\r | |
1381 | \r | |
9e16d699 | 1382 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
1383 | \r | |
63b94f48 | 1384 | static const PROGMEM IRMP_PARAMETER rccar_param =\r |
9e16d699 | 1385 | {\r |
1386 | IRMP_RCCAR_PROTOCOL, // protocol: ir protocol\r | |
1387 | RCCAR_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1388 | RCCAR_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1389 | RCCAR_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1390 | RCCAR_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1391 | RCCAR_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1392 | RCCAR_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1393 | RCCAR_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1394 | RCCAR_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1395 | RCCAR_ADDRESS_OFFSET, // address_offset: address offset\r | |
1396 | RCCAR_ADDRESS_OFFSET + RCCAR_ADDRESS_LEN, // address_end: end of address\r | |
1397 | RCCAR_COMMAND_OFFSET, // command_offset: command offset\r | |
1398 | RCCAR_COMMAND_OFFSET + RCCAR_COMMAND_LEN, // command_end: end of command\r | |
1399 | RCCAR_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1400 | RCCAR_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1401 | RCCAR_LSB, // lsb_first: flag: LSB first\r | |
1402 | RCCAR_FLAGS // flags: some flags\r | |
1403 | };\r | |
1404 | \r | |
1405 | #endif\r | |
1406 | \r | |
9405f84a | 1407 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
1408 | \r | |
63b94f48 | 1409 | static const PROGMEM IRMP_PARAMETER nikon_param =\r |
9405f84a | 1410 | {\r |
1411 | IRMP_NIKON_PROTOCOL, // protocol: ir protocol\r | |
1412 | NIKON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1413 | NIKON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1414 | NIKON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1415 | NIKON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1416 | NIKON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1417 | NIKON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1418 | NIKON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1419 | NIKON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1420 | NIKON_ADDRESS_OFFSET, // address_offset: address offset\r | |
1421 | NIKON_ADDRESS_OFFSET + NIKON_ADDRESS_LEN, // address_end: end of address\r | |
1422 | NIKON_COMMAND_OFFSET, // command_offset: command offset\r | |
1423 | NIKON_COMMAND_OFFSET + NIKON_COMMAND_LEN, // command_end: end of command\r | |
1424 | NIKON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1425 | NIKON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1426 | NIKON_LSB, // lsb_first: flag: LSB first\r | |
1427 | NIKON_FLAGS // flags: some flags\r | |
1428 | };\r | |
1429 | \r | |
1430 | #endif\r | |
1431 | \r | |
111d6191 | 1432 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
1433 | \r | |
63b94f48 | 1434 | static const PROGMEM IRMP_PARAMETER kathrein_param =\r |
111d6191 | 1435 | {\r |
1436 | IRMP_KATHREIN_PROTOCOL, // protocol: ir protocol\r | |
1437 | KATHREIN_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1438 | KATHREIN_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1439 | KATHREIN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1440 | KATHREIN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1441 | KATHREIN_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1442 | KATHREIN_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1443 | KATHREIN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1444 | KATHREIN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1445 | KATHREIN_ADDRESS_OFFSET, // address_offset: address offset\r | |
1446 | KATHREIN_ADDRESS_OFFSET + KATHREIN_ADDRESS_LEN, // address_end: end of address\r | |
1447 | KATHREIN_COMMAND_OFFSET, // command_offset: command offset\r | |
1448 | KATHREIN_COMMAND_OFFSET + KATHREIN_COMMAND_LEN, // command_end: end of command\r | |
1449 | KATHREIN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1450 | KATHREIN_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1451 | KATHREIN_LSB, // lsb_first: flag: LSB first\r | |
1452 | KATHREIN_FLAGS // flags: some flags\r | |
1453 | };\r | |
1454 | \r | |
1455 | #endif\r | |
1456 | \r | |
deba2a0a | 1457 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
1458 | \r | |
63b94f48 | 1459 | static const PROGMEM IRMP_PARAMETER netbox_param =\r |
deba2a0a | 1460 | {\r |
1461 | IRMP_NETBOX_PROTOCOL, // protocol: ir protocol\r | |
a42d1ee6 | 1462 | NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value\r |
1463 | NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value\r | |
1464 | NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value\r | |
1465 | NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value\r | |
1466 | NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value\r | |
1467 | NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value\r | |
1468 | NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value\r | |
1469 | NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value\r | |
deba2a0a | 1470 | NETBOX_ADDRESS_OFFSET, // address_offset: address offset\r |
1471 | NETBOX_ADDRESS_OFFSET + NETBOX_ADDRESS_LEN, // address_end: end of address\r | |
1472 | NETBOX_COMMAND_OFFSET, // command_offset: command offset\r | |
1473 | NETBOX_COMMAND_OFFSET + NETBOX_COMMAND_LEN, // command_end: end of command\r | |
1474 | NETBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1475 | NETBOX_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1476 | NETBOX_LSB, // lsb_first: flag: LSB first\r | |
1477 | NETBOX_FLAGS // flags: some flags\r | |
1478 | };\r | |
1479 | \r | |
1480 | #endif\r | |
1481 | \r | |
f50e01e7 | 1482 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
1483 | \r | |
63b94f48 | 1484 | static const PROGMEM IRMP_PARAMETER lego_param =\r |
f50e01e7 | 1485 | {\r |
1486 | IRMP_LEGO_PROTOCOL, // protocol: ir protocol\r | |
1487 | LEGO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1488 | LEGO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1489 | LEGO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1490 | LEGO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1491 | LEGO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1492 | LEGO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1493 | LEGO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1494 | LEGO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1495 | LEGO_ADDRESS_OFFSET, // address_offset: address offset\r | |
1496 | LEGO_ADDRESS_OFFSET + LEGO_ADDRESS_LEN, // address_end: end of address\r | |
1497 | LEGO_COMMAND_OFFSET, // command_offset: command offset\r | |
1498 | LEGO_COMMAND_OFFSET + LEGO_COMMAND_LEN, // command_end: end of command\r | |
1499 | LEGO_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1500 | LEGO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1501 | LEGO_LSB, // lsb_first: flag: LSB first\r | |
1502 | LEGO_FLAGS // flags: some flags\r | |
1503 | };\r | |
1504 | \r | |
1505 | #endif\r | |
1506 | \r | |
beda975f | 1507 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
1508 | \r | |
63b94f48 | 1509 | static const PROGMEM IRMP_PARAMETER thomson_param =\r |
beda975f | 1510 | {\r |
1511 | IRMP_THOMSON_PROTOCOL, // protocol: ir protocol\r | |
1512 | THOMSON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1513 | THOMSON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1514 | THOMSON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1515 | THOMSON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1516 | THOMSON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1517 | THOMSON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1518 | THOMSON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1519 | THOMSON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1520 | THOMSON_ADDRESS_OFFSET, // address_offset: address offset\r | |
1521 | THOMSON_ADDRESS_OFFSET + THOMSON_ADDRESS_LEN, // address_end: end of address\r | |
1522 | THOMSON_COMMAND_OFFSET, // command_offset: command offset\r | |
1523 | THOMSON_COMMAND_OFFSET + THOMSON_COMMAND_LEN, // command_end: end of command\r | |
1524 | THOMSON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1525 | THOMSON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1526 | THOMSON_LSB, // lsb_first: flag: LSB first\r | |
1527 | THOMSON_FLAGS // flags: some flags\r | |
1528 | };\r | |
1529 | \r | |
1530 | #endif\r | |
1531 | \r | |
d155e9ab | 1532 | static uint8_t irmp_bit; // current bit position\r |
4225a882 | 1533 | static IRMP_PARAMETER irmp_param;\r |
1534 | \r | |
6f750020 | 1535 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
1536 | static IRMP_PARAMETER irmp_param2;\r | |
1537 | #endif\r | |
1538 | \r | |
4225a882 | 1539 | static volatile uint8_t irmp_ir_detected;\r |
1540 | static volatile uint8_t irmp_protocol;\r | |
1541 | static volatile uint16_t irmp_address;\r | |
1542 | static volatile uint16_t irmp_command;\r | |
d155e9ab | 1543 | static volatile uint16_t irmp_id; // only used for SAMSUNG protocol\r |
4225a882 | 1544 | static volatile uint8_t irmp_flags;\r |
1f54e86c | 1545 | // static volatile uint8_t irmp_busy_flag;\r |
4225a882 | 1546 | \r |
48664931 | 1547 | #ifdef ANALYZE\r |
4225a882 | 1548 | static uint8_t IRMP_PIN;\r |
1549 | #endif\r | |
1550 | \r | |
1551 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1552 | * Initialize IRMP decoder\r | |
1553 | * @details Configures IRMP input pin\r | |
1554 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1555 | */\r | |
48664931 | 1556 | #ifndef ANALYZE\r |
4225a882 | 1557 | void\r |
1558 | irmp_init (void)\r | |
1559 | {\r | |
93ba2e01 | 1560 | #if !defined(PIC_CCS_COMPILER) && !defined(PIC_C18) // only AVR\r |
d155e9ab | 1561 | IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r |
1562 | IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r | |
93ba2e01 | 1563 | #endif\r |
4225a882 | 1564 | \r |
1565 | #if IRMP_LOGGING == 1\r | |
1566 | irmp_uart_init ();\r | |
1567 | #endif\r | |
1568 | }\r | |
1569 | #endif\r | |
1570 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1571 | * Get IRMP data\r | |
1572 | * @details gets decoded IRMP data\r | |
1573 | * @param pointer in order to store IRMP data\r | |
1574 | * @return TRUE: successful, FALSE: failed\r | |
1575 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1576 | */\r | |
1577 | uint8_t\r | |
1578 | irmp_get_data (IRMP_DATA * irmp_data_p)\r | |
1579 | {\r | |
1580 | uint8_t rtc = FALSE;\r | |
1581 | \r | |
1582 | if (irmp_ir_detected)\r | |
1583 | {\r | |
1584 | switch (irmp_protocol)\r | |
1585 | {\r | |
1586 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
1587 | case IRMP_SAMSUNG_PROTOCOL:\r | |
1588 | if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r | |
1589 | {\r | |
1590 | irmp_command &= 0xff;\r | |
1591 | irmp_command |= irmp_id << 8;\r | |
1592 | rtc = TRUE;\r | |
1593 | }\r | |
1594 | break;\r | |
1595 | #endif\r | |
1596 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
1597 | case IRMP_NEC_PROTOCOL:\r | |
1598 | if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r | |
1599 | {\r | |
1600 | irmp_command &= 0xff;\r | |
1601 | rtc = TRUE;\r | |
1602 | }\r | |
770a1a9d | 1603 | else if (irmp_address == 0x87EE)\r |
4225a882 | 1604 | {\r |
48664931 | 1605 | ANALYZE_PRINTF ("Switching to APPLE protocol\n");\r |
4225a882 | 1606 | irmp_protocol = IRMP_APPLE_PROTOCOL;\r |
770a1a9d | 1607 | irmp_address = (irmp_command & 0xFF00) >> 8;\r |
1608 | irmp_command &= 0x00FF;\r | |
4225a882 | 1609 | rtc = TRUE;\r |
1610 | }\r | |
1611 | break;\r | |
48664931 | 1612 | #endif\r |
12948cf3 | 1613 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
9405f84a | 1614 | case IRMP_SIEMENS_PROTOCOL:\r |
12948cf3 | 1615 | case IRMP_RUWIDO_PROTOCOL:\r |
9405f84a | 1616 | if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001))\r |
1617 | {\r | |
1618 | irmp_command >>= 1;\r | |
1619 | rtc = TRUE;\r | |
1620 | }\r | |
1621 | break;\r | |
1622 | #endif\r | |
111d6191 | 1623 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
1624 | case IRMP_KATHREIN_PROTOCOL:\r | |
2cfc146d | 1625 | if (irmp_command != 0x0000)\r |
111d6191 | 1626 | {\r |
1627 | rtc = TRUE;\r | |
1628 | }\r | |
1629 | break;\r | |
1630 | #endif\r | |
03780b34 | 1631 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r |
1632 | case IRMP_RC5_PROTOCOL:\r | |
1633 | irmp_address &= ~0x20; // clear toggle bit\r | |
1634 | rtc = TRUE;\r | |
1635 | break;\r | |
1636 | #endif\r | |
89e8cafb | 1637 | #if IRMP_SUPPORT_IR60_PROTOCOL == 1\r |
1638 | case IRMP_IR60_PROTOCOL:\r | |
1639 | if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame\r | |
1640 | {\r | |
1641 | rtc = TRUE;\r | |
1642 | }\r | |
f60c4644 | 1643 | else\r |
1644 | {\r | |
1645 | ANALYZE_PRINTF("Info IR60: got start instruction frame\n");\r | |
1646 | }\r | |
89e8cafb | 1647 | break;\r |
1648 | #endif\r | |
48664931 | 1649 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
1650 | case IRMP_RCCAR_PROTOCOL:\r | |
1651 | // frame in irmp_data:\r | |
1652 | // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0\r | |
1653 | // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0\r | |
1654 | irmp_address = (irmp_command & 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0\r | |
1655 | irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0\r | |
1656 | ((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0\r | |
1657 | ((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0\r | |
1658 | rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0\r | |
1659 | break;\r | |
4225a882 | 1660 | #endif\r |
beda975f | 1661 | \r |
1662 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key\r | |
deba2a0a | 1663 | case IRMP_NETBOX_PROTOCOL:\r |
1664 | if (irmp_command & 0x1000) // last bit set?\r | |
1665 | {\r | |
1666 | if ((irmp_command & 0x1f) == 0x15) // key pressed: 101 01 (LSB)\r | |
1667 | {\r | |
1668 | irmp_command >>= 5;\r | |
1669 | irmp_command &= 0x7F;\r | |
1670 | rtc = TRUE;\r | |
1671 | }\r | |
1672 | else if ((irmp_command & 0x1f) == 0x10) // key released: 000 01 (LSB)\r | |
1673 | {\r | |
1674 | irmp_command >>= 5;\r | |
1675 | irmp_command |= 0x80;\r | |
1676 | rtc = TRUE;\r | |
1677 | }\r | |
1678 | else\r | |
1679 | {\r | |
1680 | ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");\r | |
1681 | }\r | |
1682 | }\r | |
1683 | else\r | |
1684 | {\r | |
1685 | ANALYZE_PRINTF("error NETBOX: last bit not set\n");\r | |
1686 | }\r | |
1687 | break;\r | |
1688 | #endif\r | |
f50e01e7 | 1689 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
1690 | case IRMP_LEGO_PROTOCOL:\r | |
1691 | {\r | |
1692 | uint8_t crc = 0x0F ^ ((irmp_command & 0xF000) >> 12) ^ ((irmp_command & 0x0F00) >> 8) ^ ((irmp_command & 0x00F0) >> 4);\r | |
1693 | \r | |
1694 | if ((irmp_command & 0x000F) == crc)\r | |
1695 | {\r | |
1696 | irmp_command >>= 4;\r | |
1697 | rtc = TRUE;\r | |
1698 | }\r | |
1699 | else\r | |
1700 | {\r | |
1701 | ANALYZE_PRINTF ("CRC error in LEGO protocol\n");\r | |
1702 | rtc = TRUE;\r | |
1703 | }\r | |
1704 | break;\r | |
1705 | }\r | |
1706 | #endif\r | |
4225a882 | 1707 | default:\r |
1708 | rtc = TRUE;\r | |
1709 | }\r | |
1710 | \r | |
1711 | if (rtc)\r | |
1712 | {\r | |
1713 | irmp_data_p->protocol = irmp_protocol;\r | |
1714 | irmp_data_p->address = irmp_address;\r | |
1715 | irmp_data_p->command = irmp_command;\r | |
1716 | irmp_data_p->flags = irmp_flags;\r | |
1717 | irmp_command = 0;\r | |
1718 | irmp_address = 0;\r | |
1719 | irmp_flags = 0;\r | |
1720 | }\r | |
1721 | \r | |
1722 | irmp_ir_detected = FALSE;\r | |
1723 | }\r | |
1724 | \r | |
1725 | return rtc;\r | |
1726 | }\r | |
1727 | \r | |
1f54e86c | 1728 | // uint8_t\r |
1729 | // irmp_is_busy (void)\r | |
1730 | // {\r | |
1731 | // return irmp_busy_flag;\r | |
1732 | // }\r | |
1733 | \r | |
7644ac04 | 1734 | #if IRMP_USE_CALLBACK == 1\r |
1735 | void\r | |
1736 | irmp_set_callback_ptr (void (*cb)(uint8_t))\r | |
1737 | {\r | |
1738 | irmp_callback_ptr = cb;\r | |
1739 | }\r | |
1740 | #endif // IRMP_USE_CALLBACK == 1\r | |
1741 | \r | |
4225a882 | 1742 | // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()\r |
770a1a9d | 1743 | static uint16_t irmp_tmp_address; // ir address\r |
1744 | static uint16_t irmp_tmp_command; // ir command\r | |
6f750020 | 1745 | \r |
35213800 | 1746 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
770a1a9d | 1747 | static uint16_t irmp_tmp_address2; // ir address\r |
1748 | static uint16_t irmp_tmp_command2; // ir command\r | |
6f750020 | 1749 | #endif\r |
1750 | \r | |
4225a882 | 1751 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
770a1a9d | 1752 | static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)\r |
1753 | #endif\r | |
1754 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
1755 | static uint8_t xor_check[6]; // check kaseikyo "parity" bits\r | |
0f700c8e | 1756 | static uint8_t genre2; // save genre2 bits here, later copied to MSB in flags\r |
4225a882 | 1757 | #endif\r |
1758 | \r | |
4225a882 | 1759 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1760 | * store bit\r | |
1761 | * @details store bit in temp address or temp command\r | |
1762 | * @param value to store: 0 or 1\r | |
1763 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1764 | */\r | |
d823e852 | 1765 | // verhindert, dass irmp_store_bit() inline compiliert wird:\r |
1766 | // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));\r | |
1767 | \r | |
4225a882 | 1768 | static void\r |
1769 | irmp_store_bit (uint8_t value)\r | |
1770 | {\r | |
89e8cafb | 1771 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
1772 | if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)\r | |
1773 | {\r | |
1774 | first_bit = value;\r | |
1775 | }\r | |
1776 | else\r | |
1777 | #endif\r | |
770a1a9d | 1778 | \r |
4225a882 | 1779 | if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)\r |
1780 | {\r | |
1781 | if (irmp_param.lsb_first)\r | |
1782 | {\r | |
1783 | irmp_tmp_address |= (((uint16_t) (value)) << (irmp_bit - irmp_param.address_offset)); // CV wants cast\r | |
1784 | }\r | |
1785 | else\r | |
1786 | {\r | |
1787 | irmp_tmp_address <<= 1;\r | |
1788 | irmp_tmp_address |= value;\r | |
1789 | }\r | |
1790 | }\r | |
1791 | else if (irmp_bit >= irmp_param.command_offset && irmp_bit < irmp_param.command_end)\r | |
1792 | {\r | |
1793 | if (irmp_param.lsb_first)\r | |
1794 | {\r | |
1795 | irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast\r | |
1796 | }\r | |
1797 | else\r | |
1798 | {\r | |
1799 | irmp_tmp_command <<= 1;\r | |
1800 | irmp_tmp_command |= value;\r | |
1801 | }\r | |
1802 | }\r | |
770a1a9d | 1803 | \r |
35213800 | 1804 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
f60c4644 | 1805 | if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)\r |
35213800 | 1806 | {\r |
1807 | irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit - 13)); // CV wants cast\r | |
1808 | }\r | |
f60c4644 | 1809 | else\r |
35213800 | 1810 | #endif\r |
1811 | \r | |
4225a882 | 1812 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
f60c4644 | 1813 | if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)\r |
4225a882 | 1814 | {\r |
1815 | irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first\r | |
1816 | }\r | |
f60c4644 | 1817 | else\r |
4225a882 | 1818 | #endif\r |
770a1a9d | 1819 | \r |
1820 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
f60c4644 | 1821 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r |
770a1a9d | 1822 | {\r |
0f700c8e | 1823 | if (irmp_bit >= 20 && irmp_bit < 24)\r |
770a1a9d | 1824 | {\r |
0f700c8e | 1825 | irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8)); // store 4 system bits (genre 1) in upper nibble with LSB first\r |
770a1a9d | 1826 | }\r |
cea96148 | 1827 | else if (irmp_bit >= 24 && irmp_bit < 28)\r |
770a1a9d | 1828 | {\r |
0f700c8e | 1829 | genre2 |= (((uint8_t) (value)) << (irmp_bit - 20)); // store 4 system bits (genre 2) in upper nibble with LSB first\r |
770a1a9d | 1830 | }\r |
770a1a9d | 1831 | \r |
0f700c8e | 1832 | if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)\r |
1833 | {\r | |
1834 | if (value)\r | |
1835 | {\r | |
1836 | xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);\r | |
1837 | }\r | |
1838 | else\r | |
1839 | {\r | |
1840 | xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));\r | |
1841 | }\r | |
1842 | }\r | |
1843 | }\r | |
770a1a9d | 1844 | #endif\r |
1845 | \r | |
4225a882 | 1846 | irmp_bit++;\r |
1847 | }\r | |
1848 | \r | |
6f750020 | 1849 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1850 | * store bit\r | |
1851 | * @details store bit in temp address or temp command\r | |
1852 | * @param value to store: 0 or 1\r | |
1853 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1854 | */\r | |
1855 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r | |
1856 | static void\r | |
1857 | irmp_store_bit2 (uint8_t value)\r | |
1858 | {\r | |
1859 | uint8_t irmp_bit2;\r | |
1860 | \r | |
1861 | if (irmp_param.protocol)\r | |
1862 | {\r | |
1863 | irmp_bit2 = irmp_bit - 2;\r | |
1864 | }\r | |
1865 | else\r | |
1866 | {\r | |
1867 | irmp_bit2 = irmp_bit - 1;\r | |
1868 | }\r | |
1869 | \r | |
1870 | if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)\r | |
1871 | {\r | |
1872 | irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset)); // CV wants cast\r | |
1873 | }\r | |
1874 | else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)\r | |
1875 | {\r | |
1876 | irmp_tmp_command2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset)); // CV wants cast\r | |
1877 | }\r | |
1878 | }\r | |
1879 | #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r | |
1880 | \r | |
4225a882 | 1881 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1882 | * ISR routine\r | |
1883 | * @details ISR routine, called 10000 times per second\r | |
1884 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1885 | */\r | |
879b06c2 | 1886 | uint8_t\r |
4225a882 | 1887 | irmp_ISR (void)\r |
1888 | {\r | |
48664931 | 1889 | static uint8_t irmp_start_bit_detected; // flag: start bit detected\r |
1890 | static uint8_t wait_for_space; // flag: wait for data bit space\r | |
1891 | static uint8_t wait_for_start_space; // flag: wait for start bit space\r | |
1892 | static uint8_t irmp_pulse_time; // count bit time for pulse\r | |
1893 | static PAUSE_LEN irmp_pause_time; // count bit time for pause\r | |
1894 | static uint16_t last_irmp_address = 0xFFFF; // save last irmp address to recognize key repetition\r | |
1895 | static uint16_t last_irmp_command = 0xFFFF; // save last irmp command to recognize key repetition\r | |
c7a47e89 | 1896 | static uint16_t repetition_len; // SIRCS repeats frame 2-5 times with 45 ms pause\r |
48664931 | 1897 | static uint8_t repetition_frame_number;\r |
4225a882 | 1898 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
48664931 | 1899 | static uint16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition\r |
4225a882 | 1900 | #endif\r |
1901 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
48664931 | 1902 | static uint8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit\r |
4225a882 | 1903 | #endif\r |
77f488bb | 1904 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
48664931 | 1905 | static PAUSE_LEN last_pause; // last pause value\r |
504d9df9 | 1906 | #endif\r |
77f488bb | 1907 | #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
48664931 | 1908 | static uint8_t last_value; // last bit value\r |
4225a882 | 1909 | #endif\r |
48664931 | 1910 | uint8_t irmp_input; // input value\r |
4225a882 | 1911 | \r |
48664931 | 1912 | #ifdef ANALYZE\r |
592411d1 | 1913 | time_counter++;\r |
1914 | #endif\r | |
1915 | \r | |
4225a882 | 1916 | irmp_input = input(IRMP_PIN);\r |
1917 | \r | |
7644ac04 | 1918 | #if IRMP_USE_CALLBACK == 1\r |
1919 | if (irmp_callback_ptr)\r | |
1920 | {\r | |
1921 | static uint8_t last_inverted_input;\r | |
1922 | \r | |
1923 | if (last_inverted_input != !irmp_input)\r | |
1924 | {\r | |
1925 | (*irmp_callback_ptr) (! irmp_input);\r | |
1926 | last_inverted_input = !irmp_input;\r | |
1927 | }\r | |
1928 | }\r | |
1929 | #endif // IRMP_USE_CALLBACK == 1\r | |
1930 | \r | |
d155e9ab | 1931 | irmp_log(irmp_input); // log ir signal, if IRMP_LOGGING defined\r |
4225a882 | 1932 | \r |
1933 | if (! irmp_ir_detected) // ir code already detected?\r | |
1934 | { // no...\r | |
1935 | if (! irmp_start_bit_detected) // start bit detected?\r | |
1936 | { // no...\r | |
d155e9ab | 1937 | if (! irmp_input) // receiving burst?\r |
4225a882 | 1938 | { // yes...\r |
1f54e86c | 1939 | // irmp_busy_flag = TRUE;\r |
48664931 | 1940 | #ifdef ANALYZE\r |
d155e9ab | 1941 | if (! irmp_pulse_time)\r |
1942 | {\r | |
0f700c8e | 1943 | ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r |
d155e9ab | 1944 | }\r |
1945 | #endif\r | |
4225a882 | 1946 | irmp_pulse_time++; // increment counter\r |
1947 | }\r | |
1948 | else\r | |
1949 | { // no...\r | |
1950 | if (irmp_pulse_time) // it's dark....\r | |
1951 | { // set flags for counting the time of darkness...\r | |
1952 | irmp_start_bit_detected = 1;\r | |
1953 | wait_for_start_space = 1;\r | |
1954 | wait_for_space = 0;\r | |
1955 | irmp_tmp_command = 0;\r | |
1956 | irmp_tmp_address = 0;\r | |
0f700c8e | 1957 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r |
1958 | genre2 = 0;\r | |
1959 | #endif\r | |
6f750020 | 1960 | \r |
35213800 | 1961 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
6f750020 | 1962 | irmp_tmp_command2 = 0;\r |
1963 | irmp_tmp_address2 = 0;\r | |
1964 | #endif\r | |
1965 | \r | |
4225a882 | 1966 | irmp_bit = 0xff;\r |
1967 | irmp_pause_time = 1; // 1st pause: set to 1, not to 0!\r | |
1968 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
1969 | rc5_cmd_bit6 = 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!\r | |
1970 | #endif\r | |
1971 | }\r | |
1972 | else\r | |
1973 | {\r | |
c7a47e89 | 1974 | if (repetition_len < 0xFFFF) // avoid overflow of counter\r |
6db2522c | 1975 | {\r |
c7a47e89 | 1976 | repetition_len++;\r |
6db2522c | 1977 | }\r |
4225a882 | 1978 | }\r |
1979 | }\r | |
1980 | }\r | |
1981 | else\r | |
1982 | {\r | |
1983 | if (wait_for_start_space) // we have received start bit...\r | |
1984 | { // ...and are counting the time of darkness\r | |
1985 | if (irmp_input) // still dark?\r | |
1986 | { // yes\r | |
1987 | irmp_pause_time++; // increment counter\r | |
1988 | \r | |
9405f84a | 1989 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
1990 | 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) ||\r | |
1991 | irmp_pause_time > IRMP_TIMEOUT_NIKON_LEN)\r | |
1992 | #else\r | |
504d9df9 | 1993 | if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r |
9405f84a | 1994 | #endif\r |
4225a882 | 1995 | { // yes...\r |
c7a47e89 | 1996 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
1997 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // don't show eror if JVC protocol, irmp_pulse_time has been set below!\r | |
1998 | {\r | |
1999 | ;\r | |
2000 | }\r | |
2001 | else\r | |
2002 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2003 | {\r | |
0f700c8e | 2004 | 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);\r |
c7a47e89 | 2005 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
2006 | }\r | |
1f54e86c | 2007 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2008 | irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit\r |
2009 | irmp_pulse_time = 0;\r | |
2010 | irmp_pause_time = 0;\r | |
2011 | }\r | |
2012 | }\r | |
2013 | else\r | |
2014 | { // receiving first data pulse!\r | |
46dd89b7 | 2015 | IRMP_PARAMETER * irmp_param_p = (IRMP_PARAMETER *) 0;\r |
2016 | \r | |
6f750020 | 2017 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
2018 | irmp_param2.protocol = 0;\r | |
2019 | #endif\r | |
2020 | \r | |
0f700c8e | 2021 | ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 2022 | \r |
2023 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
2024 | if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&\r | |
2025 | irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2026 | { // it's SIRCS\r |
48664931 | 2027 | ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2028 | SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX,\r |
2029 | SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2030 | irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param;\r |
4225a882 | 2031 | }\r |
2032 | else\r | |
2033 | #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
2034 | \r | |
770a1a9d | 2035 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
2036 | if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame\r | |
2037 | irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&\r | |
2038 | irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r | |
2039 | {\r | |
93ba2e01 | 2040 | ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
770a1a9d | 2041 | JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,\r |
2042 | JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
35213800 | 2043 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r |
770a1a9d | 2044 | }\r |
2045 | else\r | |
2046 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2047 | \r | |
4225a882 | 2048 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
2049 | if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
46dd89b7 | 2050 | irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r |
2051 | {\r | |
35213800 | 2052 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
2053 | ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2054 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
2055 | NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r | |
2056 | irmp_param_p = (IRMP_PARAMETER *) &nec42_param;\r | |
2057 | #else\r | |
48664931 | 2058 | ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
46dd89b7 | 2059 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r |
2060 | NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r | |
2061 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
35213800 | 2062 | #endif\r |
2063 | \r | |
46dd89b7 | 2064 | }\r |
2065 | else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
2066 | irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r | |
2067 | { // it's NEC\r | |
93ba2e01 | 2068 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
2069 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // last protocol was JVC, awaiting repeat frame\r | |
2070 | { // some jvc remote controls use nec repetition frame for jvc repetition frame\r | |
2071 | ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2072 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
2073 | NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
2074 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
2075 | }\r | |
2076 | else\r | |
2077 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2078 | {\r | |
2079 | ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2080 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
2081 | NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2082 | \r |
93ba2e01 | 2083 | irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;\r |
2084 | }\r | |
2085 | }\r | |
2086 | else\r | |
2087 | \r | |
2088 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2089 | if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame\r | |
2090 | irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
2091 | irmp_pause_time >= NEC_0_PAUSE_LEN_MIN && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX)\r | |
2092 | { // it's JVC repetition type 3\r | |
2093 | ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2094 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
2095 | NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX);\r | |
2096 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
4225a882 | 2097 | }\r |
2098 | else\r | |
93ba2e01 | 2099 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
2100 | \r | |
4225a882 | 2101 | #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
2102 | \r | |
9405f84a | 2103 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
2104 | if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&\r | |
2105 | irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)\r | |
2106 | {\r | |
2107 | ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2108 | NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,\r | |
2109 | NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);\r | |
2110 | irmp_param_p = (IRMP_PARAMETER *) &nikon_param;\r | |
2111 | }\r | |
2112 | else\r | |
2113 | #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1\r | |
2114 | \r | |
4225a882 | 2115 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
2116 | if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&\r | |
2117 | irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2118 | { // it's SAMSUNG\r |
48664931 | 2119 | ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2120 | SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX,\r |
2121 | SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2122 | irmp_param_p = (IRMP_PARAMETER *) &samsung_param;\r |
4225a882 | 2123 | }\r |
2124 | else\r | |
2125 | #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
2126 | \r | |
2127 | #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
2128 | if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&\r | |
2129 | irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2130 | { // it's MATSUSHITA\r |
48664931 | 2131 | ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2132 | MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX,\r |
2133 | MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2134 | irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;\r |
4225a882 | 2135 | }\r |
2136 | else\r | |
2137 | #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
2138 | \r | |
2139 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
2140 | if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&\r | |
2141 | irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2142 | { // it's KASEIKYO\r |
48664931 | 2143 | ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2144 | KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX,\r |
2145 | KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2146 | irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;\r |
4225a882 | 2147 | }\r |
2148 | else\r | |
2149 | #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
2150 | \r | |
2151 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
2152 | if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&\r | |
2153 | irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2154 | { // it's RECS80\r |
48664931 | 2155 | ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2156 | RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX,\r |
2157 | RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2158 | irmp_param_p = (IRMP_PARAMETER *) &recs80_param;\r |
4225a882 | 2159 | }\r |
2160 | else\r | |
2161 | #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
2162 | \r | |
2163 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
31c1f035 | 2164 | if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||\r |
2165 | (irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&\r | |
2166 | ((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||\r | |
2167 | (irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))\r | |
46dd89b7 | 2168 | { // it's RC5\r |
6f750020 | 2169 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
2170 | if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r | |
2171 | irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r | |
2172 | {\r | |
2173 | ANALYZE_PRINTF ("protocol = RC5 or FDC\n");\r | |
2174 | ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2175 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r | |
2176 | FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r | |
2177 | ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2178 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
2179 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r | |
2180 | memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));\r | |
2181 | }\r | |
2182 | else\r | |
2183 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
12948cf3 | 2184 | \r |
6f750020 | 2185 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
2186 | if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r | |
2187 | irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r | |
2188 | {\r | |
2189 | ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");\r | |
2190 | ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2191 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r | |
2192 | RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r | |
2193 | ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2194 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
2195 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r | |
2196 | memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));\r | |
2197 | }\r | |
2198 | else\r | |
2199 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2200 | {\r | |
1aee56bc | 2201 | ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",\r |
6f750020 | 2202 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r |
31c1f035 | 2203 | 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX,\r |
1aee56bc | 2204 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r |
31c1f035 | 2205 | 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX);\r |
6f750020 | 2206 | }\r |
2207 | \r | |
46dd89b7 | 2208 | irmp_param_p = (IRMP_PARAMETER *) &rc5_param;\r |
504d9df9 | 2209 | last_pause = irmp_pause_time;\r |
4225a882 | 2210 | \r |
31c1f035 | 2211 | if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||\r |
2212 | (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))\r | |
4225a882 | 2213 | {\r |
504d9df9 | 2214 | last_value = 0;\r |
4225a882 | 2215 | rc5_cmd_bit6 = 1<<6;\r |
2216 | }\r | |
2217 | else\r | |
2218 | {\r | |
504d9df9 | 2219 | last_value = 1;\r |
4225a882 | 2220 | }\r |
2221 | }\r | |
2222 | else\r | |
2223 | #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
2224 | \r | |
2225 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
2226 | if ( (irmp_pulse_time >= DENON_PULSE_LEN_MIN && irmp_pulse_time <= DENON_PULSE_LEN_MAX) &&\r | |
2227 | ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||\r | |
2228 | (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))\r | |
2229 | { // it's DENON\r | |
48664931 | 2230 | ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r |
4225a882 | 2231 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r |
2232 | DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,\r | |
2233 | DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2234 | irmp_param_p = (IRMP_PARAMETER *) &denon_param;\r |
4225a882 | 2235 | }\r |
2236 | else\r | |
2237 | #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
2238 | \r | |
beda975f | 2239 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
2240 | if ( (irmp_pulse_time >= THOMSON_PULSE_LEN_MIN && irmp_pulse_time <= THOMSON_PULSE_LEN_MAX) &&\r | |
2241 | ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||\r | |
2242 | (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)))\r | |
2243 | { // it's THOMSON\r | |
2244 | ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r | |
2245 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,\r | |
2246 | THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX,\r | |
2247 | THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX);\r | |
2248 | irmp_param_p = (IRMP_PARAMETER *) &thomson_param;\r | |
2249 | }\r | |
2250 | else\r | |
2251 | #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r | |
2252 | \r | |
4225a882 | 2253 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2254 | if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&\r | |
2255 | irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)\r | |
2256 | { // it's RC6\r | |
48664931 | 2257 | ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2258 | RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX,\r |
2259 | RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2260 | irmp_param_p = (IRMP_PARAMETER *) &rc6_param;\r |
504d9df9 | 2261 | last_pause = 0;\r |
c7a47e89 | 2262 | last_value = 1;\r |
4225a882 | 2263 | }\r |
2264 | else\r | |
2265 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2266 | \r | |
2267 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
2268 | if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&\r | |
2269 | irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2270 | { // it's RECS80EXT\r |
48664931 | 2271 | ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2272 | RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX,\r |
2273 | RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2274 | irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;\r |
4225a882 | 2275 | }\r |
2276 | else\r | |
2277 | #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
2278 | \r | |
2279 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
2280 | if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&\r | |
2281 | irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2282 | { // it's NUBERT\r |
48664931 | 2283 | ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2284 | NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX,\r |
2285 | NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2286 | irmp_param_p = (IRMP_PARAMETER *) &nubert_param;\r |
4225a882 | 2287 | }\r |
2288 | else\r | |
2289 | #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
2290 | \r | |
504d9df9 | 2291 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
2292 | if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&\r | |
2293 | irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2294 | { // it's BANG_OLUFSEN\r |
48664931 | 2295 | ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");\r |
2296 | ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
504d9df9 | 2297 | BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r |
2298 | BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r | |
48664931 | 2299 | ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2300 | BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r |
2301 | BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r | |
48664931 | 2302 | ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2303 | BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r |
2304 | BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r | |
48664931 | 2305 | ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2306 | BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r |
2307 | BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2308 | irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;\r |
504d9df9 | 2309 | last_value = 0;\r |
2310 | }\r | |
2311 | else\r | |
2312 | #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r | |
2313 | \r | |
89e8cafb | 2314 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
2315 | if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&\r | |
2316 | irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)\r | |
592411d1 | 2317 | { // it's GRUNDIG\r |
48664931 | 2318 | ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
89e8cafb | 2319 | GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r |
2320 | GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);\r | |
592411d1 | 2321 | irmp_param_p = (IRMP_PARAMETER *) &grundig_param;\r |
2322 | last_pause = irmp_pause_time;\r | |
2323 | last_value = 1;\r | |
2324 | }\r | |
2325 | else\r | |
89e8cafb | 2326 | #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
592411d1 | 2327 | \r |
12948cf3 | 2328 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2329 | if (((irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||\r | |
31c1f035 | 2330 | (irmp_pulse_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX)) &&\r |
fc80d688 | 2331 | ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) || \r |
31c1f035 | 2332 | (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))\r |
12948cf3 | 2333 | { // it's RUWIDO or SIEMENS\r |
2334 | ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r | |
2335 | SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r | |
31c1f035 | 2336 | 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r |
12948cf3 | 2337 | SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r |
31c1f035 | 2338 | 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX);\r |
12948cf3 | 2339 | irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;\r |
a7054daf | 2340 | last_pause = irmp_pause_time;\r |
2341 | last_value = 1;\r | |
2342 | }\r | |
2343 | else\r | |
12948cf3 | 2344 | #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2345 | \r | |
48664931 | 2346 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
2347 | if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r | |
2348 | irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r | |
eaaf80c3 | 2349 | {\r |
48664931 | 2350 | ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
2351 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r | |
2352 | FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r | |
2353 | irmp_param_p = (IRMP_PARAMETER *) &fdc_param;\r | |
eaaf80c3 | 2354 | }\r |
2355 | else\r | |
48664931 | 2356 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
12948cf3 | 2357 | \r |
9e16d699 | 2358 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
2359 | if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r | |
2360 | irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r | |
2361 | {\r | |
48664931 | 2362 | ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
9e16d699 | 2363 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r |
2364 | RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r | |
2365 | irmp_param_p = (IRMP_PARAMETER *) &rccar_param;\r | |
2366 | }\r | |
2367 | else\r | |
2368 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
89e8cafb | 2369 | \r |
111d6191 | 2370 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
2371 | if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&\r | |
2372 | irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)\r | |
2373 | { // it's KATHREIN\r | |
2374 | ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2375 | KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX,\r | |
2376 | KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX);\r | |
2377 | irmp_param_p = (IRMP_PARAMETER *) &kathrein_param;\r | |
2378 | }\r | |
2379 | else\r | |
2380 | #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r | |
2381 | \r | |
deba2a0a | 2382 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
2383 | if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&\r | |
2384 | irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)\r | |
2385 | { // it's NETBOX\r | |
2386 | ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2387 | NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX,\r | |
2388 | NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX);\r | |
2389 | irmp_param_p = (IRMP_PARAMETER *) &netbox_param;\r | |
2390 | }\r | |
2391 | else\r | |
2392 | #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r | |
2393 | \r | |
f50e01e7 | 2394 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
2395 | if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&\r | |
2396 | irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)\r | |
2397 | {\r | |
2398 | ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2399 | LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX,\r | |
2400 | LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX);\r | |
2401 | irmp_param_p = (IRMP_PARAMETER *) &lego_param;\r | |
2402 | }\r | |
2403 | else\r | |
93ba2e01 | 2404 | #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
f50e01e7 | 2405 | \r |
4225a882 | 2406 | {\r |
48664931 | 2407 | ANALYZE_PRINTF ("protocol = UNKNOWN\n");\r |
1f54e86c | 2408 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2409 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2410 | }\r | |
2411 | \r | |
2412 | if (irmp_start_bit_detected)\r | |
2413 | {\r | |
46dd89b7 | 2414 | memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));\r |
2415 | \r | |
48664931 | 2416 | #ifdef ANALYZE\r |
77f488bb | 2417 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r |
2418 | {\r | |
48664931 | 2419 | ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r |
2420 | ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\r | |
77f488bb | 2421 | }\r |
2422 | else\r | |
2423 | {\r | |
48664931 | 2424 | ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,\r |
31c1f035 | 2425 | 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);\r |
48664931 | 2426 | ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max,\r |
31c1f035 | 2427 | 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r |
77f488bb | 2428 | }\r |
46dd89b7 | 2429 | \r |
6f750020 | 2430 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
2431 | if (irmp_param2.protocol)\r | |
2432 | {\r | |
2433 | ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);\r | |
2434 | ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);\r | |
2435 | ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);\r | |
2436 | ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);\r | |
2437 | }\r | |
2438 | #endif\r | |
2439 | \r | |
d823e852 | 2440 | \r |
504d9df9 | 2441 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
4225a882 | 2442 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r |
2443 | {\r | |
48664931 | 2444 | ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r |
4225a882 | 2445 | }\r |
504d9df9 | 2446 | #endif\r |
77f488bb | 2447 | \r |
2448 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r | |
2449 | {\r | |
93ba2e01 | 2450 | ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r |
2451 | ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r | |
2452 | }\r | |
2453 | else\r | |
2454 | {\r | |
2455 | ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max,\r | |
2456 | 2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max);\r | |
2457 | ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max,\r | |
2458 | 2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max);\r | |
77f488bb | 2459 | }\r |
46dd89b7 | 2460 | \r |
504d9df9 | 2461 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
2462 | if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r | |
2463 | {\r | |
48664931 | 2464 | ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r |
2465 | ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);\r | |
504d9df9 | 2466 | }\r |
2467 | #endif\r | |
2468 | \r | |
48664931 | 2469 | ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset);\r |
2470 | ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset);\r | |
2471 | ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len);\r | |
2472 | ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param.stop_bit);\r | |
2473 | #endif // ANALYZE\r | |
4225a882 | 2474 | }\r |
2475 | \r | |
2476 | irmp_bit = 0;\r | |
2477 | \r | |
77f488bb | 2478 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
12948cf3 | 2479 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r |
2480 | irmp_param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO\r | |
2481 | irmp_param.protocol != IRMP_RC6_PROTOCOL) // Manchester, but not RC6\r | |
4225a882 | 2482 | {\r |
31c1f035 | 2483 | if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)\r |
4225a882 | 2484 | {\r |
0f700c8e | 2485 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
48664931 | 2486 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r |
2487 | ANALYZE_NEWLINE ();\r | |
77f488bb | 2488 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);\r |
592411d1 | 2489 | }\r |
6f750020 | 2490 | else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r |
592411d1 | 2491 | {\r |
0f700c8e | 2492 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
592411d1 | 2493 | \r |
48664931 | 2494 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r |
2495 | ANALYZE_NEWLINE ();\r | |
77f488bb | 2496 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);\r |
a7054daf | 2497 | }\r |
2498 | }\r | |
2499 | else\r | |
77f488bb | 2500 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
a7054daf | 2501 | \r |
deba2a0a | 2502 | #if IRMP_SUPPORT_SERIAL == 1\r |
2503 | if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r | |
2504 | {\r | |
2505 | ; // do nothing\r | |
2506 | }\r | |
2507 | else\r | |
2508 | #endif // IRMP_SUPPORT_SERIAL == 1\r | |
2509 | \r | |
2510 | \r | |
4225a882 | 2511 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
2512 | if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r | |
2513 | {\r | |
0f700c8e | 2514 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 2515 | \r |
2516 | if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)\r | |
2517 | { // pause timings correct for "1"?\r | |
48664931 | 2518 | ANALYZE_PUTCHAR ('1'); // yes, store 1\r |
2519 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2520 | irmp_store_bit (1);\r |
2521 | }\r | |
2522 | else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)\r | |
2523 | { // pause timings correct for "0"?\r | |
48664931 | 2524 | ANALYZE_PUTCHAR ('0'); // yes, store 0\r |
2525 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2526 | irmp_store_bit (0);\r |
2527 | }\r | |
2528 | }\r | |
881dbf79 | 2529 | else\r |
4225a882 | 2530 | #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
beda975f | 2531 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
2532 | if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL)\r | |
2533 | {\r | |
0f700c8e | 2534 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
beda975f | 2535 | \r |
2536 | if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX)\r | |
2537 | { // pause timings correct for "1"?\r | |
2538 | ANALYZE_PUTCHAR ('1'); // yes, store 1\r | |
2539 | ANALYZE_NEWLINE ();\r | |
2540 | irmp_store_bit (1);\r | |
2541 | }\r | |
2542 | else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)\r | |
2543 | { // pause timings correct for "0"?\r | |
2544 | ANALYZE_PUTCHAR ('0'); // yes, store 0\r | |
2545 | ANALYZE_NEWLINE ();\r | |
2546 | irmp_store_bit (0);\r | |
2547 | }\r | |
2548 | }\r | |
2549 | else\r | |
2550 | #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r | |
881dbf79 | 2551 | {\r |
2552 | ; // else do nothing\r | |
2553 | }\r | |
4225a882 | 2554 | \r |
2555 | irmp_pulse_time = 1; // set counter to 1, not 0\r | |
2556 | irmp_pause_time = 0;\r | |
2557 | wait_for_start_space = 0;\r | |
2558 | }\r | |
2559 | }\r | |
2560 | else if (wait_for_space) // the data section....\r | |
2561 | { // counting the time of darkness....\r | |
2562 | uint8_t got_light = FALSE;\r | |
2563 | \r | |
2564 | if (irmp_input) // still dark?\r | |
2565 | { // yes...\r | |
2566 | if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1)\r | |
2567 | {\r | |
a42d1ee6 | 2568 | if (\r |
2569 | #if IRMP_SUPPORT_MANCHESTER == 1\r | |
2570 | (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||\r | |
2571 | #endif\r | |
2572 | #if IRMP_SUPPORT_SERIAL == 1\r | |
deba2a0a | 2573 | (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||\r |
a42d1ee6 | 2574 | #endif\r |
1aee56bc | 2575 | (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max))\r |
4225a882 | 2576 | {\r |
48664931 | 2577 | #ifdef ANALYZE\r |
77f488bb | 2578 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r |
4225a882 | 2579 | {\r |
48664931 | 2580 | ANALYZE_PRINTF ("stop bit detected\n");\r |
4225a882 | 2581 | }\r |
2582 | #endif\r | |
2583 | irmp_param.stop_bit = 0;\r | |
2584 | }\r | |
2585 | else\r | |
2586 | {\r | |
93ba2e01 | 2587 | 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",\r |
2588 | irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r | |
4225a882 | 2589 | \r |
1f54e86c | 2590 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2591 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2592 | irmp_pulse_time = 0;\r | |
2593 | irmp_pause_time = 0;\r | |
2594 | }\r | |
2595 | }\r | |
2596 | else\r | |
2597 | {\r | |
9547ee89 | 2598 | irmp_pause_time++; // increment counter\r |
4225a882 | 2599 | \r |
2600 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
9547ee89 | 2601 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits:\r |
2602 | irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12\r | |
2603 | irmp_bit >= 12 - 1) // pause too long?\r | |
2604 | { // yes, break and close this frame\r | |
2605 | irmp_param.complete_len = irmp_bit + 1; // set new complete length\r | |
2606 | got_light = TRUE; // this is a lie, but helps (generates stop bit)\r | |
2607 | irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8; // new: store number of additional bits in upper byte of address!\r | |
2608 | irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length\r | |
2609 | irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length\r | |
4225a882 | 2610 | }\r |
2611 | else\r | |
2612 | #endif\r | |
deba2a0a | 2613 | #if IRMP_SUPPORT_SERIAL == 1\r |
a42d1ee6 | 2614 | // NETBOX generates no stop bit, here is the timeout condition:\r |
deba2a0a | 2615 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL &&\r |
a42d1ee6 | 2616 | irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit))\r |
deba2a0a | 2617 | {\r |
2618 | got_light = TRUE; // this is a lie, but helps (generates stop bit)\r | |
2619 | }\r | |
2620 | else\r | |
2621 | #endif\r | |
89e8cafb | 2622 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
77f488bb | 2623 | if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)\r |
d155e9ab | 2624 | {\r |
f60c4644 | 2625 | if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6))\r |
89e8cafb | 2626 | {\r |
2627 | ANALYZE_PRINTF ("Switching to IR60 protocol\n");\r | |
2628 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2629 | irmp_param.stop_bit = TRUE; // set flag\r | |
2630 | \r | |
2631 | irmp_param.protocol = IRMP_IR60_PROTOCOL; // change protocol\r | |
2632 | irmp_param.complete_len = IR60_COMPLETE_DATA_LEN; // correct complete len\r | |
2633 | irmp_param.address_offset = IR60_ADDRESS_OFFSET;\r | |
2634 | irmp_param.address_end = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;\r | |
2635 | irmp_param.command_offset = IR60_COMMAND_OFFSET;\r | |
2636 | irmp_param.command_end = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;\r | |
2637 | \r | |
2638 | irmp_tmp_command <<= 1;\r | |
2639 | irmp_tmp_command |= first_bit;\r | |
2640 | }\r | |
31c1f035 | 2641 | else if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)\r |
77f488bb | 2642 | { // special manchester decoder\r |
2643 | irmp_param.complete_len = GRUNDIG_COMPLETE_DATA_LEN; // correct complete len\r | |
2644 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2645 | irmp_param.stop_bit = TRUE; // set flag\r | |
2646 | }\r | |
2647 | else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r | |
d155e9ab | 2648 | {\r |
48664931 | 2649 | ANALYZE_PRINTF ("Switching to NOKIA protocol\n");\r |
77f488bb | 2650 | irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol\r |
2651 | irmp_param.address_offset = NOKIA_ADDRESS_OFFSET;\r | |
2652 | irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;\r | |
2653 | irmp_param.command_offset = NOKIA_COMMAND_OFFSET;\r | |
2654 | irmp_param.command_end = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;\r | |
2655 | \r | |
2656 | if (irmp_tmp_command & 0x300)\r | |
2657 | {\r | |
2658 | irmp_tmp_address = (irmp_tmp_command >> 8);\r | |
2659 | irmp_tmp_command &= 0xFF;\r | |
2660 | }\r | |
d155e9ab | 2661 | }\r |
2662 | }\r | |
2663 | else\r | |
2664 | #endif\r | |
12948cf3 | 2665 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2666 | if (irmp_param.protocol == IRMP_RUWIDO_PROTOCOL && !irmp_param.stop_bit)\r | |
2667 | {\r | |
31c1f035 | 2668 | if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= RUWIDO_COMPLETE_DATA_LEN - 2)\r |
12948cf3 | 2669 | { // special manchester decoder\r |
2670 | irmp_param.complete_len = RUWIDO_COMPLETE_DATA_LEN; // correct complete len\r | |
2671 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2672 | irmp_param.stop_bit = TRUE; // set flag\r | |
2673 | }\r | |
2674 | else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)\r | |
2675 | {\r | |
2676 | ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");\r | |
2677 | irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol\r | |
2678 | irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET;\r | |
2679 | irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;\r | |
2680 | irmp_param.command_offset = SIEMENS_COMMAND_OFFSET;\r | |
2681 | irmp_param.command_end = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;\r | |
2682 | \r | |
2683 | // 76543210\r | |
2684 | // RUWIDO: AAAAAAAAACCCCCCCp\r | |
2685 | // SIEMENS: AAAAAAAAAAACCCCCCCCCCp\r | |
2686 | irmp_tmp_address <<= 2;\r | |
2687 | irmp_tmp_address |= (irmp_tmp_command >> 6);\r | |
2688 | irmp_tmp_command &= 0x003F;\r | |
2689 | irmp_tmp_command <<= 4;\r | |
2690 | irmp_tmp_command |= last_value;\r | |
2691 | }\r | |
2692 | }\r | |
2693 | else\r | |
2694 | #endif\r | |
77f488bb | 2695 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
2696 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r | |
31c1f035 | 2697 | irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r |
77f488bb | 2698 | { // special manchester decoder\r |
a7054daf | 2699 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r |
2700 | irmp_param.stop_bit = TRUE; // set flag\r | |
2701 | }\r | |
2702 | else\r | |
77f488bb | 2703 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
504d9df9 | 2704 | if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r |
4225a882 | 2705 | { // yes...\r |
2706 | if (irmp_bit == irmp_param.complete_len - 1 && irmp_param.stop_bit == 0)\r | |
2707 | {\r | |
2708 | irmp_bit++;\r | |
2709 | }\r | |
770a1a9d | 2710 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
2711 | else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit\r | |
2712 | {\r | |
93ba2e01 | 2713 | ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r |
770a1a9d | 2714 | irmp_param.stop_bit = TRUE; // set flag\r |
2715 | irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol\r | |
2716 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2717 | irmp_tmp_command = (irmp_tmp_address >> 4); // set command: upper 12 bits are command bits\r | |
2718 | irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits\r | |
2719 | irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...\r | |
2720 | }\r | |
2721 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
35213800 | 2722 | \r |
2723 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
2724 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
2725 | else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32) // it was a NEC stop bit\r | |
2726 | {\r | |
2727 | ANALYZE_PRINTF ("Switching to NEC protocol\n");\r | |
2728 | irmp_param.stop_bit = TRUE; // set flag\r | |
2729 | irmp_param.protocol = IRMP_NEC_PROTOCOL; // switch protocol\r | |
2730 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2731 | \r | |
2732 | // 0123456789ABC0123456789ABC0123456701234567\r | |
2733 | // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r | |
2734 | // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc\r | |
0f700c8e | 2735 | irmp_tmp_address |= (irmp_tmp_address2 & 0x0007) << 13; // fm 2012-02-13: 12 -> 13\r |
35213800 | 2736 | irmp_tmp_command = (irmp_tmp_address2 >> 3) | (irmp_tmp_command << 10);\r |
2737 | }\r | |
2738 | #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
2739 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
93ba2e01 | 2740 | else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit\r |
35213800 | 2741 | {\r |
93ba2e01 | 2742 | ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r |
35213800 | 2743 | irmp_param.stop_bit = TRUE; // set flag\r |
2744 | irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol\r | |
2745 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2746 | \r | |
2747 | // 0123456789ABC0123456789ABC0123456701234567\r | |
2748 | // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r | |
2749 | // JVC: AAAACCCCCCCCCCCC\r | |
2750 | irmp_tmp_command = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9); // set command: upper 12 bits are command bits\r | |
2751 | irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits\r | |
2752 | }\r | |
2753 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2754 | #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
4225a882 | 2755 | else\r |
2756 | {\r | |
48664931 | 2757 | ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);\r |
2758 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
4225a882 | 2759 | \r |
1f54e86c | 2760 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2761 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2762 | irmp_pulse_time = 0;\r | |
2763 | irmp_pause_time = 0;\r | |
2764 | }\r | |
2765 | }\r | |
2766 | }\r | |
2767 | }\r | |
2768 | else\r | |
2769 | { // got light now!\r | |
2770 | got_light = TRUE;\r | |
2771 | }\r | |
2772 | \r | |
2773 | if (got_light)\r | |
2774 | {\r | |
0f700c8e | 2775 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 2776 | \r |
77f488bb | 2777 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
d823e852 | 2778 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester\r |
4225a882 | 2779 | {\r |
31c1f035 | 2780 | #if 1\r |
2781 | if (irmp_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)\r | |
2782 | #else // better, but some IR-RCs use asymmetric timings :-/\r | |
2783 | if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max &&\r | |
2784 | irmp_pause_time <= 2 * irmp_param.pause_1_len_max)\r | |
fc80d688 | 2785 | #endif\r |
4225a882 | 2786 | {\r |
c7a47e89 | 2787 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2788 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit\r | |
4225a882 | 2789 | {\r |
c7a47e89 | 2790 | ANALYZE_PUTCHAR ('T');\r |
2791 | if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A\r | |
2792 | {\r | |
2793 | irmp_store_bit (1);\r | |
2794 | last_value = 1;\r | |
2795 | }\r | |
2796 | else // RC6 mode 0\r | |
2797 | {\r | |
2798 | irmp_store_bit (0);\r | |
2799 | last_value = 0;\r | |
2800 | }\r | |
2801 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2802 | }\r |
c7a47e89 | 2803 | else\r |
2804 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2805 | {\r | |
2806 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r | |
2807 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 );\r | |
4225a882 | 2808 | \r |
c7a47e89 | 2809 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2810 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit\r | |
2811 | {\r | |
2812 | ANALYZE_PUTCHAR ('T');\r | |
2813 | irmp_store_bit (1);\r | |
2814 | \r | |
31c1f035 | 2815 | if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)\r |
c7a47e89 | 2816 | {\r |
2817 | last_value = 0;\r | |
2818 | }\r | |
2819 | else\r | |
2820 | {\r | |
2821 | last_value = 1;\r | |
2822 | }\r | |
2823 | ANALYZE_NEWLINE ();\r | |
2824 | }\r | |
2825 | else\r | |
77f488bb | 2826 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
c7a47e89 | 2827 | {\r |
2828 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r | |
2829 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 );\r | |
6f750020 | 2830 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
c7a47e89 | 2831 | if (! irmp_param2.protocol)\r |
6f750020 | 2832 | #endif\r |
c7a47e89 | 2833 | {\r |
2834 | ANALYZE_NEWLINE ();\r | |
2835 | }\r | |
2836 | last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r | |
2837 | }\r | |
6f750020 | 2838 | }\r |
592411d1 | 2839 | }\r |
31c1f035 | 2840 | else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max\r |
2841 | /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)\r | |
592411d1 | 2842 | {\r |
77f488bb | 2843 | uint8_t manchester_value;\r |
592411d1 | 2844 | \r |
31c1f035 | 2845 | if (last_pause > irmp_param.pause_1_len_max && last_pause <= 2 * irmp_param.pause_1_len_max)\r |
592411d1 | 2846 | {\r |
77f488bb | 2847 | manchester_value = last_value ? 0 : 1;\r |
2848 | last_value = manchester_value;\r | |
592411d1 | 2849 | }\r |
2850 | else\r | |
2851 | {\r | |
77f488bb | 2852 | manchester_value = last_value;\r |
592411d1 | 2853 | }\r |
2854 | \r | |
48664931 | 2855 | ANALYZE_PUTCHAR (manchester_value + '0');\r |
c7a47e89 | 2856 | \r |
6f750020 | 2857 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
2858 | if (! irmp_param2.protocol)\r | |
2859 | #endif\r | |
2860 | {\r | |
2861 | ANALYZE_NEWLINE ();\r | |
2862 | }\r | |
c7a47e89 | 2863 | \r |
2864 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2865 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1) // RC6 mode != 0 ???\r | |
2866 | {\r | |
2867 | ANALYZE_PRINTF ("Switching to RC6A protocol\n");\r | |
2868 | irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;\r | |
2869 | irmp_param.address_offset = 5;\r | |
2870 | irmp_param.address_end = irmp_param.address_offset + 15;\r | |
2871 | irmp_param.command_offset = irmp_param.address_end + 1; // skip 1 system bit, changes like a toggle bit\r | |
2872 | irmp_param.command_end = irmp_param.command_offset + 16 - 1;\r | |
9547ee89 | 2873 | irmp_tmp_address = 0;\r |
c7a47e89 | 2874 | }\r |
2875 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2876 | \r | |
77f488bb | 2877 | irmp_store_bit (manchester_value);\r |
a7054daf | 2878 | }\r |
6f750020 | 2879 | else\r |
2880 | {\r | |
2881 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2882 | if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&\r | |
2883 | irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&\r | |
2884 | ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||\r | |
2885 | (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))\r | |
2886 | {\r | |
2887 | ANALYZE_PUTCHAR ('?');\r | |
d823e852 | 2888 | irmp_param.protocol = 0; // switch to FDC, see below\r |
6f750020 | 2889 | }\r |
2890 | else\r | |
2891 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2892 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2893 | if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&\r | |
2894 | irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&\r | |
2895 | ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||\r | |
2896 | (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))\r | |
2897 | {\r | |
2898 | ANALYZE_PUTCHAR ('?');\r | |
d823e852 | 2899 | irmp_param.protocol = 0; // switch to RCCAR, see below\r |
6f750020 | 2900 | }\r |
2901 | else\r | |
2902 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2903 | {\r | |
2904 | ANALYZE_PUTCHAR ('?');\r | |
2905 | ANALYZE_NEWLINE ();\r | |
c7a47e89 | 2906 | ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
6f750020 | 2907 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
1f54e86c | 2908 | // irmp_busy_flag = FALSE;\r |
6f750020 | 2909 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
2910 | irmp_pause_time = 0;\r | |
2911 | }\r | |
2912 | }\r | |
2913 | \r | |
2914 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2915 | if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)\r | |
2916 | {\r | |
2917 | if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)\r | |
2918 | {\r | |
2919 | ANALYZE_PRINTF (" 1 (FDC)\n");\r | |
2920 | irmp_store_bit2 (1);\r | |
2921 | }\r | |
2922 | else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)\r | |
2923 | {\r | |
2924 | ANALYZE_PRINTF (" 0 (FDC)\n");\r | |
2925 | irmp_store_bit2 (0);\r | |
2926 | }\r | |
2927 | \r | |
2928 | if (! irmp_param.protocol)\r | |
2929 | {\r | |
2930 | ANALYZE_PRINTF ("Switching to FDC protocol\n");\r | |
2931 | memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r | |
2932 | irmp_param2.protocol = 0;\r | |
2933 | irmp_tmp_address = irmp_tmp_address2;\r | |
2934 | irmp_tmp_command = irmp_tmp_command2;\r | |
2935 | }\r | |
2936 | }\r | |
2937 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2938 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2939 | if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)\r | |
2940 | {\r | |
2941 | if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)\r | |
2942 | {\r | |
2943 | ANALYZE_PRINTF (" 1 (RCCAR)\n");\r | |
2944 | irmp_store_bit2 (1);\r | |
2945 | }\r | |
2946 | else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)\r | |
2947 | {\r | |
2948 | ANALYZE_PRINTF (" 0 (RCCAR)\n");\r | |
2949 | irmp_store_bit2 (0);\r | |
2950 | }\r | |
2951 | \r | |
2952 | if (! irmp_param.protocol)\r | |
2953 | {\r | |
2954 | ANALYZE_PRINTF ("Switching to RCCAR protocol\n");\r | |
2955 | memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r | |
2956 | irmp_param2.protocol = 0;\r | |
2957 | irmp_tmp_address = irmp_tmp_address2;\r | |
2958 | irmp_tmp_command = irmp_tmp_command2;\r | |
2959 | }\r | |
2960 | }\r | |
2961 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
a7054daf | 2962 | \r |
77f488bb | 2963 | last_pause = irmp_pause_time;\r |
2964 | wait_for_space = 0;\r | |
a7054daf | 2965 | }\r |
2966 | else\r | |
77f488bb | 2967 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
2968 | \r | |
deba2a0a | 2969 | #if IRMP_SUPPORT_SERIAL == 1\r |
2970 | if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r | |
2971 | {\r | |
2972 | while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)\r | |
2973 | {\r | |
2974 | ANALYZE_PUTCHAR ('1');\r | |
2975 | irmp_store_bit (1);\r | |
2976 | \r | |
2977 | if (irmp_pulse_time >= irmp_param.pulse_1_len_min)\r | |
2978 | {\r | |
2979 | irmp_pulse_time -= irmp_param.pulse_1_len_min;\r | |
2980 | }\r | |
2981 | else\r | |
2982 | {\r | |
2983 | irmp_pulse_time = 0;\r | |
2984 | }\r | |
2985 | }\r | |
2986 | \r | |
2987 | while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)\r | |
2988 | {\r | |
2989 | ANALYZE_PUTCHAR ('0');\r | |
2990 | irmp_store_bit (0);\r | |
2991 | \r | |
2992 | if (irmp_pause_time >= irmp_param.pause_1_len_min)\r | |
2993 | {\r | |
2994 | irmp_pause_time -= irmp_param.pause_1_len_min;\r | |
2995 | }\r | |
2996 | else\r | |
2997 | {\r | |
2998 | irmp_pause_time = 0;\r | |
2999 | }\r | |
3000 | }\r | |
3001 | ANALYZE_NEWLINE ();\r | |
3002 | wait_for_space = 0;\r | |
3003 | }\r | |
3004 | else\r | |
3005 | #endif // IRMP_SUPPORT_SERIAL == 1\r | |
a7054daf | 3006 | \r |
4225a882 | 3007 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
3008 | if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit == 16) // Samsung: 16th bit\r | |
3009 | {\r | |
3010 | if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&\r | |
3011 | irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r | |
3012 | {\r | |
48664931 | 3013 | ANALYZE_PRINTF ("SYNC\n");\r |
4225a882 | 3014 | wait_for_space = 0;\r |
3015 | irmp_tmp_id = 0;\r | |
3016 | irmp_bit++;\r | |
3017 | }\r | |
3018 | else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)\r | |
3019 | {\r | |
5b437ff6 | 3020 | irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;\r |
3021 | irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;\r | |
3022 | irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r | |
3023 | irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;\r | |
3024 | \r | |
4225a882 | 3025 | if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)\r |
3026 | {\r | |
48664931 | 3027 | ANALYZE_PUTCHAR ('1');\r |
3028 | ANALYZE_NEWLINE ();\r | |
4225a882 | 3029 | irmp_store_bit (1);\r |
3030 | wait_for_space = 0;\r | |
3031 | }\r | |
3032 | else\r | |
3033 | {\r | |
48664931 | 3034 | ANALYZE_PUTCHAR ('0');\r |
3035 | ANALYZE_NEWLINE ();\r | |
4225a882 | 3036 | irmp_store_bit (0);\r |
3037 | wait_for_space = 0;\r | |
3038 | }\r | |
3039 | \r | |
48664931 | 3040 | ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");\r |
4225a882 | 3041 | }\r |
3042 | else\r | |
3043 | { // timing incorrect!\r | |
48664931 | 3044 | ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
3045 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3046 | // irmp_busy_flag = FALSE;\r |
504d9df9 | 3047 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
4225a882 | 3048 | irmp_pause_time = 0;\r |
3049 | }\r | |
4225a882 | 3050 | }\r |
3051 | else\r | |
3052 | #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL\r | |
3053 | \r | |
fc80d688 | 3054 | #if IRMP_SUPPORT_NEC16_PROTOCOL\r |
35213800 | 3055 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
3056 | if (irmp_param.protocol == IRMP_NEC42_PROTOCOL &&\r | |
3057 | #else // IRMP_SUPPORT_NEC_PROTOCOL instead\r | |
3058 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL &&\r | |
3059 | #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
3060 | irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r | |
fc80d688 | 3061 | {\r |
3062 | ANALYZE_PRINTF ("Switching to NEC16 protocol\n");\r | |
7644ac04 | 3063 | irmp_param.protocol = IRMP_NEC16_PROTOCOL;\r |
35213800 | 3064 | irmp_param.address_offset = NEC16_ADDRESS_OFFSET;\r |
3065 | irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN;\r | |
3066 | irmp_param.command_offset = NEC16_COMMAND_OFFSET;\r | |
3067 | irmp_param.command_end = NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN;\r | |
3068 | irmp_param.complete_len = NEC16_COMPLETE_DATA_LEN;\r | |
fc80d688 | 3069 | wait_for_space = 0;\r |
3070 | }\r | |
3071 | else\r | |
3072 | #endif // IRMP_SUPPORT_NEC16_PROTOCOL\r | |
3073 | \r | |
504d9df9 | 3074 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
3075 | if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r | |
3076 | {\r | |
3077 | if (irmp_pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)\r | |
3078 | {\r | |
46dd89b7 | 3079 | if (irmp_bit == 1) // Bang & Olufsen: 3rd bit\r |
504d9df9 | 3080 | {\r |
3081 | if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)\r | |
3082 | {\r | |
48664931 | 3083 | ANALYZE_PRINTF ("3rd start bit\n");\r |
504d9df9 | 3084 | wait_for_space = 0;\r |
504d9df9 | 3085 | irmp_bit++;\r |
3086 | }\r | |
3087 | else\r | |
d155e9ab | 3088 | { // timing incorrect!\r |
48664931 | 3089 | 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);\r |
3090 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3091 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 3092 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 3093 | irmp_pause_time = 0;\r |
3094 | }\r | |
504d9df9 | 3095 | }\r |
46dd89b7 | 3096 | else if (irmp_bit == 19) // Bang & Olufsen: trailer bit\r |
504d9df9 | 3097 | {\r |
3098 | if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)\r | |
3099 | {\r | |
48664931 | 3100 | ANALYZE_PRINTF ("trailer bit\n");\r |
504d9df9 | 3101 | wait_for_space = 0;\r |
504d9df9 | 3102 | irmp_bit++;\r |
3103 | }\r | |
3104 | else\r | |
46dd89b7 | 3105 | { // timing incorrect!\r |
48664931 | 3106 | 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);\r |
3107 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3108 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 3109 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 3110 | irmp_pause_time = 0;\r |
3111 | }\r | |
504d9df9 | 3112 | }\r |
3113 | else\r | |
3114 | {\r | |
46dd89b7 | 3115 | if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)\r |
3116 | { // pulse & pause timings correct for "1"?\r | |
48664931 | 3117 | ANALYZE_PUTCHAR ('1');\r |
3118 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 3119 | irmp_store_bit (1);\r |
3120 | last_value = 1;\r | |
3121 | wait_for_space = 0;\r | |
3122 | }\r | |
46dd89b7 | 3123 | else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)\r |
3124 | { // pulse & pause timings correct for "0"?\r | |
48664931 | 3125 | ANALYZE_PUTCHAR ('0');\r |
3126 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 3127 | irmp_store_bit (0);\r |
3128 | last_value = 0;\r | |
3129 | wait_for_space = 0;\r | |
3130 | }\r | |
3131 | else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)\r | |
3132 | {\r | |
48664931 | 3133 | ANALYZE_PUTCHAR (last_value + '0');\r |
3134 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 3135 | irmp_store_bit (last_value);\r |
3136 | wait_for_space = 0;\r | |
3137 | }\r | |
3138 | else\r | |
46dd89b7 | 3139 | { // timing incorrect!\r |
48664931 | 3140 | 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);\r |
3141 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3142 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 3143 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 3144 | irmp_pause_time = 0;\r |
3145 | }\r | |
3146 | }\r | |
3147 | }\r | |
3148 | else\r | |
46dd89b7 | 3149 | { // timing incorrect!\r |
48664931 | 3150 | 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);\r |
3151 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3152 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 3153 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 3154 | irmp_pause_time = 0;\r |
3155 | }\r | |
3156 | }\r | |
3157 | else\r | |
3158 | #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL\r | |
3159 | \r | |
4225a882 | 3160 | if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&\r |
3161 | irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r | |
3162 | { // pulse & pause timings correct for "1"?\r | |
48664931 | 3163 | ANALYZE_PUTCHAR ('1');\r |
3164 | ANALYZE_NEWLINE ();\r | |
4225a882 | 3165 | irmp_store_bit (1);\r |
3166 | wait_for_space = 0;\r | |
3167 | }\r | |
3168 | else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&\r | |
3169 | irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)\r | |
3170 | { // pulse & pause timings correct for "0"?\r | |
48664931 | 3171 | ANALYZE_PUTCHAR ('0');\r |
3172 | ANALYZE_NEWLINE ();\r | |
4225a882 | 3173 | irmp_store_bit (0);\r |
3174 | wait_for_space = 0;\r | |
3175 | }\r | |
3176 | else\r | |
111d6191 | 3177 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL\r |
3178 | \r | |
3179 | if (irmp_param.protocol == IRMP_KATHREIN_PROTOCOL &&\r | |
3180 | irmp_pulse_time >= KATHREIN_1_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&\r | |
3181 | (((irmp_bit == 8 || irmp_bit == 6) &&\r | |
3182 | irmp_pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||\r | |
3183 | (irmp_bit == 12 &&\r | |
3184 | irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))\r | |
3185 | \r | |
3186 | {\r | |
3187 | if (irmp_bit == 8)\r | |
3188 | {\r | |
3189 | irmp_bit++;\r | |
3190 | ANALYZE_PUTCHAR ('S');\r | |
3191 | ANALYZE_NEWLINE ();\r | |
111d6191 | 3192 | irmp_tmp_command <<= 1;\r |
3193 | }\r | |
3194 | else\r | |
3195 | {\r | |
3196 | ANALYZE_PUTCHAR ('S');\r | |
3197 | ANALYZE_NEWLINE ();\r | |
3198 | irmp_store_bit (1);\r | |
3199 | }\r | |
3200 | wait_for_space = 0;\r | |
3201 | }\r | |
3202 | else\r | |
3203 | #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL\r | |
4225a882 | 3204 | { // timing incorrect!\r |
48664931 | 3205 | ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
3206 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 3207 | // irmp_busy_flag = FALSE;\r |
4225a882 | 3208 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
3209 | irmp_pause_time = 0;\r | |
3210 | }\r | |
3211 | \r | |
3212 | irmp_pulse_time = 1; // set counter to 1, not 0\r | |
3213 | }\r | |
3214 | }\r | |
3215 | else\r | |
3216 | { // counting the pulse length ...\r | |
d155e9ab | 3217 | if (! irmp_input) // still light?\r |
4225a882 | 3218 | { // yes...\r |
3219 | irmp_pulse_time++; // increment counter\r | |
3220 | }\r | |
3221 | else\r | |
3222 | { // now it's dark!\r | |
3223 | wait_for_space = 1; // let's count the time (see above)\r | |
3224 | irmp_pause_time = 1; // set pause counter to 1, not 0\r | |
3225 | }\r | |
3226 | }\r | |
3227 | \r | |
881dbf79 | 3228 | if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\r |
4225a882 | 3229 | {\r |
c7a47e89 | 3230 | if (last_irmp_command == irmp_tmp_command && repetition_len < AUTO_FRAME_REPETITION_LEN)\r |
592411d1 | 3231 | {\r |
3232 | repetition_frame_number++;\r | |
3233 | }\r | |
3234 | else\r | |
4225a882 | 3235 | {\r |
592411d1 | 3236 | repetition_frame_number = 0;\r |
3237 | }\r | |
3238 | \r | |
3239 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
3240 | // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame\r | |
3241 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))\r | |
3242 | {\r | |
48664931 | 3243 | ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3244 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3245 | repetition_len = 0;\r | |
592411d1 | 3246 | }\r |
3247 | else\r | |
3248 | #endif\r | |
3249 | \r | |
770a1a9d | 3250 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r |
3251 | // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame\r | |
3252 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)\r | |
3253 | {\r | |
3254 | ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r | |
c7a47e89 | 3255 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3256 | repetition_len = 0;\r | |
770a1a9d | 3257 | }\r |
3258 | else\r | |
3259 | #endif\r | |
3260 | \r | |
592411d1 | 3261 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
3262 | // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r | |
3263 | if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))\r | |
3264 | {\r | |
48664931 | 3265 | ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3266 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3267 | repetition_len = 0;\r | |
592411d1 | 3268 | }\r |
3269 | else\r | |
3270 | #endif\r | |
3271 | \r | |
3272 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
d155e9ab | 3273 | // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r |
592411d1 | 3274 | if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))\r |
3275 | {\r | |
48664931 | 3276 | ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3277 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3278 | repetition_len = 0;\r | |
4225a882 | 3279 | }\r |
3280 | else\r | |
592411d1 | 3281 | #endif\r |
3282 | \r | |
4225a882 | 3283 | {\r |
0f700c8e | 3284 | ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit);\r |
4225a882 | 3285 | irmp_ir_detected = TRUE;\r |
3286 | \r | |
3287 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
3288 | if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r | |
3289 | { // check for repetition frame\r | |
3290 | if ((~irmp_tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted\r | |
3291 | {\r | |
3292 | irmp_tmp_command = last_irmp_denon_command; // use command received before!\r | |
3293 | \r | |
3294 | irmp_protocol = irmp_param.protocol; // store protocol\r | |
3295 | irmp_address = irmp_tmp_address; // store address\r | |
3296 | irmp_command = irmp_tmp_command ; // store command\r | |
3297 | }\r | |
3298 | else\r | |
3299 | {\r | |
48664931 | 3300 | ANALYZE_PRINTF ("waiting for inverted command repetition\n");\r |
4225a882 | 3301 | irmp_ir_detected = FALSE;\r |
3302 | last_irmp_denon_command = irmp_tmp_command;\r | |
3303 | }\r | |
3304 | }\r | |
3305 | else\r | |
3306 | #endif // IRMP_SUPPORT_DENON_PROTOCOL\r | |
592411d1 | 3307 | \r |
3308 | #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1\r | |
d155e9ab | 3309 | if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)\r |
3310 | { // Grundig start frame?\r | |
48664931 | 3311 | ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");\r |
592411d1 | 3312 | irmp_ir_detected = FALSE;\r |
592411d1 | 3313 | }\r |
3314 | else\r | |
d155e9ab | 3315 | #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL\r |
3316 | \r | |
3317 | #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r | |
3318 | if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)\r | |
3319 | { // Nokia start frame?\r | |
48664931 | 3320 | ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");\r |
d155e9ab | 3321 | irmp_ir_detected = FALSE;\r |
3322 | }\r | |
3323 | else\r | |
3324 | #endif // IRMP_SUPPORT_NOKIA_PROTOCOL\r | |
4225a882 | 3325 | {\r |
cb8474cc | 3326 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
3327 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame\r | |
3328 | {\r | |
c7a47e89 | 3329 | if (repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r |
6db2522c | 3330 | {\r |
c7a47e89 | 3331 | ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len);\r |
6db2522c | 3332 | irmp_tmp_address = last_irmp_address; // address is last address\r |
3333 | irmp_tmp_command = last_irmp_command; // command is last command\r | |
3334 | irmp_flags |= IRMP_FLAG_REPETITION;\r | |
c7a47e89 | 3335 | repetition_len = 0;\r |
6db2522c | 3336 | }\r |
3337 | else\r | |
3338 | {\r | |
c7a47e89 | 3339 | ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",\r |
3340 | repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r | |
6db2522c | 3341 | irmp_ir_detected = FALSE;\r |
3342 | }\r | |
cb8474cc | 3343 | }\r |
4225a882 | 3344 | #endif // IRMP_SUPPORT_NEC_PROTOCOL\r |
770a1a9d | 3345 | \r |
3346 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
3347 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r | |
3348 | {\r | |
3349 | uint8_t xor;\r | |
3350 | // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\r | |
3351 | // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);\r | |
3352 | \r | |
3353 | xor = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r | |
3354 | \r | |
3355 | if (xor != (xor_check[2] & 0x0F))\r | |
3356 | {\r | |
3357 | ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check[2] & 0x0F);\r | |
3358 | irmp_ir_detected = FALSE;\r | |
3359 | }\r | |
3360 | \r | |
3361 | xor = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r | |
3362 | \r | |
3363 | if (xor != xor_check[5])\r | |
3364 | {\r | |
f60c4644 | 3365 | ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]);\r |
770a1a9d | 3366 | irmp_ir_detected = FALSE;\r |
3367 | }\r | |
0f700c8e | 3368 | \r |
cea96148 | 3369 | irmp_flags |= genre2; // write the genre2 bits into MSB of the flag byte\r |
770a1a9d | 3370 | }\r |
3371 | #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
3372 | \r | |
c7a47e89 | 3373 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
3374 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode = 6?\r | |
3375 | {\r | |
3376 | irmp_protocol = IRMP_RC6A_PROTOCOL;\r | |
3377 | }\r | |
3378 | else\r | |
3379 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
3380 | \r | |
4225a882 | 3381 | irmp_protocol = irmp_param.protocol;\r |
d823e852 | 3382 | \r |
3383 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
3384 | if (irmp_param.protocol == IRMP_FDC_PROTOCOL)\r | |
3385 | {\r | |
3386 | if (irmp_tmp_command & 0x000F) // released key?\r | |
3387 | {\r | |
3388 | irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80; // yes, set bit 7\r | |
3389 | }\r | |
3390 | else\r | |
3391 | {\r | |
3392 | irmp_tmp_command >>= 4; // no, it's a pressed key\r | |
3393 | }\r | |
3394 | irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000\r | |
3395 | irmp_tmp_address &= 0x003F;\r | |
3396 | }\r | |
3397 | #endif\r | |
3398 | \r | |
4225a882 | 3399 | irmp_address = irmp_tmp_address; // store address\r |
3400 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
03780b34 | 3401 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL)\r |
3402 | {\r | |
3403 | last_irmp_address = irmp_tmp_address; // store as last address, too\r | |
3404 | }\r | |
4225a882 | 3405 | #endif\r |
3406 | \r | |
3407 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
6f750020 | 3408 | if (irmp_param.protocol == IRMP_RC5_PROTOCOL)\r |
3409 | {\r | |
3410 | irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r | |
3411 | }\r | |
4225a882 | 3412 | #endif\r |
3413 | irmp_command = irmp_tmp_command; // store command\r | |
3414 | \r | |
3415 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
3416 | irmp_id = irmp_tmp_id;\r | |
3417 | #endif\r | |
3418 | }\r | |
3419 | }\r | |
3420 | \r | |
3421 | if (irmp_ir_detected)\r | |
3422 | {\r | |
03780b34 | 3423 | if (last_irmp_command == irmp_tmp_command &&\r |
3424 | last_irmp_address == irmp_tmp_address &&\r | |
c7a47e89 | 3425 | repetition_len < IRMP_KEY_REPETITION_LEN)\r |
4225a882 | 3426 | {\r |
3427 | irmp_flags |= IRMP_FLAG_REPETITION;\r | |
3428 | }\r | |
3429 | \r | |
3430 | last_irmp_address = irmp_tmp_address; // store as last address, too\r | |
3431 | last_irmp_command = irmp_tmp_command; // store as last command, too\r | |
3432 | \r | |
c7a47e89 | 3433 | repetition_len = 0;\r |
4225a882 | 3434 | }\r |
879b06c2 | 3435 | else\r |
3436 | {\r | |
48664931 | 3437 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
879b06c2 | 3438 | }\r |
4225a882 | 3439 | \r |
1f54e86c | 3440 | // irmp_busy_flag = FALSE;\r |
4225a882 | 3441 | irmp_start_bit_detected = 0; // and wait for next start bit\r |
3442 | irmp_tmp_command = 0;\r | |
3443 | irmp_pulse_time = 0;\r | |
3444 | irmp_pause_time = 0;\r | |
770a1a9d | 3445 | \r |
3446 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
3447 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // the stop bit of JVC frame is also start bit of next frame\r | |
3448 | { // set pulse time here!\r | |
3449 | irmp_pulse_time = ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));\r | |
3450 | }\r | |
3451 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
4225a882 | 3452 | }\r |
3453 | }\r | |
3454 | }\r | |
879b06c2 | 3455 | return (irmp_ir_detected);\r |
4225a882 | 3456 | }\r |
3457 | \r | |
48664931 | 3458 | #ifdef ANALYZE\r |
4225a882 | 3459 | \r |
2eab5ec9 | 3460 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
3461 | * main functions - for Unix/Linux + Windows only!\r | |
3462 | *\r | |
3463 | * AVR: see main.c!\r | |
3464 | *\r | |
3465 | * Compile it under linux with:\r | |
3466 | * cc irmp.c -o irmp\r | |
3467 | *\r | |
3468 | * usage: ./irmp [-v|-s|-a|-l|-p] < file\r | |
3469 | *\r | |
3470 | * options:\r | |
3471 | * -v verbose\r | |
3472 | * -s silent\r | |
3473 | * -a analyze\r | |
3474 | * -l list pulse/pauses\r | |
3475 | * -p print timings\r | |
3476 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
3477 | */\r | |
4225a882 | 3478 | \r |
fef942f6 | 3479 | static void\r |
3480 | print_timings (void)\r | |
3481 | {\r | |
c7a47e89 | 3482 | printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN, sizeof (PAUSE_LEN));\r |
2eab5ec9 | 3483 | printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN);\r |
3484 | puts ("");\r | |
6f750020 | 3485 | printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");\r |
fef942f6 | 3486 | printf ("====================================================================================\n");\r |
6f750020 | 3487 | printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3488 | SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX,\r | |
3489 | SIRCS_0_PULSE_LEN_MIN, SIRCS_0_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX,\r | |
3490 | SIRCS_1_PULSE_LEN_MIN, SIRCS_1_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX);\r | |
3491 | \r | |
3492 | printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3493 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX,\r | |
3494 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r | |
3495 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r | |
3496 | \r | |
3497 | printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3498 | 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,\r | |
3499 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r | |
3500 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r | |
3501 | \r | |
3502 | printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3503 | SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX,\r | |
3504 | SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_0_PAUSE_LEN_MIN, SAMSUNG_0_PAUSE_LEN_MAX,\r | |
3505 | SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_1_PAUSE_LEN_MIN, SAMSUNG_1_PAUSE_LEN_MAX);\r | |
3506 | \r | |
3507 | printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3508 | MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX,\r | |
3509 | MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_0_PAUSE_LEN_MIN, MATSUSHITA_0_PAUSE_LEN_MAX,\r | |
3510 | MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_1_PAUSE_LEN_MIN, MATSUSHITA_1_PAUSE_LEN_MAX);\r | |
3511 | \r | |
3512 | printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3513 | KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX,\r | |
3514 | KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_0_PAUSE_LEN_MIN, KASEIKYO_0_PAUSE_LEN_MAX,\r | |
3515 | KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_1_PAUSE_LEN_MIN, KASEIKYO_1_PAUSE_LEN_MAX);\r | |
3516 | \r | |
3517 | printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3518 | RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX,\r | |
3519 | RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_0_PAUSE_LEN_MIN, RECS80_0_PAUSE_LEN_MAX,\r | |
3520 | RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_1_PAUSE_LEN_MIN, RECS80_1_PAUSE_LEN_MAX);\r | |
3521 | \r | |
3522 | printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3523 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
3524 | RC5_BIT_LEN_MIN, RC5_BIT_LEN_MAX);\r | |
3525 | \r | |
3526 | printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3527 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r | |
3528 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX,\r | |
3529 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX);\r | |
3530 | \r | |
beda975f | 3531 | printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3532 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,\r | |
3533 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX,\r | |
3534 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX);\r | |
3535 | \r | |
c7a47e89 | 3536 | printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
6f750020 | 3537 | RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX, RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX,\r |
c7a47e89 | 3538 | RC6_BIT_PULSE_LEN_MIN, RC6_BIT_PULSE_LEN_MAX, RC6_BIT_PAUSE_LEN_MIN, RC6_BIT_PAUSE_LEN_MAX);\r |
6f750020 | 3539 | \r |
3540 | printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3541 | RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX, RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX,\r | |
3542 | RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_0_PAUSE_LEN_MIN, RECS80EXT_0_PAUSE_LEN_MAX,\r | |
3543 | RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_1_PAUSE_LEN_MIN, RECS80EXT_1_PAUSE_LEN_MAX);\r | |
3544 | \r | |
3545 | printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3546 | NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX,\r | |
3547 | NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX,\r | |
3548 | NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX);\r | |
3549 | \r | |
3550 | printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r | |
3551 | BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r | |
3552 | BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r | |
3553 | \r | |
2eab5ec9 | 3554 | printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",\r |
3555 | BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r | |
3556 | BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r | |
3557 | \r | |
6f750020 | 3558 | printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r |
3559 | BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r | |
3560 | BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r | |
3561 | \r | |
3562 | printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r | |
3563 | BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r | |
3564 | BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r | |
3565 | \r | |
3566 | printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3567 | BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_0_PAUSE_LEN_MIN, BANG_OLUFSEN_0_PAUSE_LEN_MAX,\r | |
3568 | BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_1_PAUSE_LEN_MIN, BANG_OLUFSEN_1_PAUSE_LEN_MAX);\r | |
3569 | \r | |
3570 | printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",\r | |
89e8cafb | 3571 | GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r |
3572 | GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX,\r | |
3573 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX);\r | |
6f750020 | 3574 | \r |
12948cf3 | 3575 | printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3576 | SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r | |
3577 | SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r | |
3578 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX,\r | |
3579 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX,\r | |
31c1f035 | 3580 | 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX,\r |
3581 | 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX);\r | |
6f750020 | 3582 | \r |
3583 | printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3584 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX,\r | |
3585 | FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX,\r | |
3586 | FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_1_PAUSE_LEN_MIN, FDC_1_PAUSE_LEN_MAX);\r | |
3587 | \r | |
3588 | printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3589 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX,\r | |
3590 | RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_0_PAUSE_LEN_MIN, RCCAR_0_PAUSE_LEN_MAX,\r | |
3591 | RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_1_PAUSE_LEN_MIN, RCCAR_1_PAUSE_LEN_MAX);\r | |
9405f84a | 3592 | \r |
3593 | printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3594 | NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX, NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX,\r | |
3595 | NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_0_PAUSE_LEN_MIN, NIKON_0_PAUSE_LEN_MAX,\r | |
3596 | NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_1_PAUSE_LEN_MIN, NIKON_1_PAUSE_LEN_MAX);\r | |
f50e01e7 | 3597 | \r |
3598 | printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3599 | LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX, LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX,\r | |
3600 | LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_0_PAUSE_LEN_MIN, LEGO_0_PAUSE_LEN_MAX,\r | |
3601 | LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_1_PAUSE_LEN_MIN, LEGO_1_PAUSE_LEN_MAX);\r | |
3602 | \r | |
fef942f6 | 3603 | }\r |
3604 | \r | |
77f488bb | 3605 | void\r |
48664931 | 3606 | print_spectrum (char * text, int * buf, int is_pulse)\r |
77f488bb | 3607 | {\r |
3608 | int i;\r | |
3609 | int j;\r | |
48664931 | 3610 | int min;\r |
3611 | int max;\r | |
3612 | int max_value = 0;\r | |
77f488bb | 3613 | int value;\r |
3614 | int sum = 0;\r | |
3615 | int counter = 0;\r | |
3616 | double average = 0;\r | |
48664931 | 3617 | double tolerance;\r |
77f488bb | 3618 | \r |
48664931 | 3619 | puts ("-------------------------------------------------------------------------------");\r |
77f488bb | 3620 | printf ("%s:\n", text);\r |
3621 | \r | |
3622 | for (i = 0; i < 256; i++)\r | |
3623 | {\r | |
48664931 | 3624 | if (buf[i] > max_value)\r |
77f488bb | 3625 | {\r |
48664931 | 3626 | max_value = buf[i];\r |
77f488bb | 3627 | }\r |
3628 | }\r | |
3629 | \r | |
53c11f07 | 3630 | for (i = 1; i < 100; i++)\r |
77f488bb | 3631 | {\r |
3632 | if (buf[i] > 0)\r | |
3633 | {\r | |
3634 | printf ("%3d ", i);\r | |
48664931 | 3635 | value = (buf[i] * 60) / max_value;\r |
77f488bb | 3636 | \r |
3637 | for (j = 0; j < value; j++)\r | |
3638 | {\r | |
3639 | putchar ('o');\r | |
3640 | }\r | |
3641 | printf (" %d\n", buf[i]);\r | |
3642 | \r | |
3643 | sum += i * buf[i];\r | |
3644 | counter += buf[i];\r | |
3645 | }\r | |
3646 | else\r | |
3647 | {\r | |
48664931 | 3648 | max = i - 1;\r |
3649 | \r | |
77f488bb | 3650 | if (counter > 0)\r |
3651 | {\r | |
3652 | average = (float) sum / (float) counter;\r | |
48664931 | 3653 | \r |
3654 | if (is_pulse)\r | |
3655 | {\r | |
3656 | printf ("pulse ");\r | |
3657 | }\r | |
3658 | else\r | |
3659 | {\r | |
3660 | printf ("pause ");\r | |
3661 | }\r | |
3662 | \r | |
3663 | printf ("avg: %4.1f=%6.1f us, ", average, (1000000. * average) / (float) F_INTERRUPTS);\r | |
3664 | printf ("min: %2d=%6.1f us, ", min, (1000000. * min) / (float) F_INTERRUPTS);\r | |
3665 | printf ("max: %2d=%6.1f us, ", max, (1000000. * max) / (float) F_INTERRUPTS);\r | |
3666 | \r | |
3667 | tolerance = (max - average);\r | |
3668 | \r | |
3669 | if (average - min > tolerance)\r | |
3670 | {\r | |
3671 | tolerance = average - min;\r | |
3672 | }\r | |
3673 | \r | |
3674 | tolerance = tolerance * 100 / average;\r | |
3675 | printf ("tol: %4.1f%%\n", tolerance);\r | |
77f488bb | 3676 | }\r |
48664931 | 3677 | \r |
77f488bb | 3678 | counter = 0;\r |
3679 | sum = 0;\r | |
48664931 | 3680 | min = i + 1;\r |
77f488bb | 3681 | }\r |
3682 | }\r | |
3683 | }\r | |
3684 | \r | |
d823e852 | 3685 | #define STATE_LEFT_SHIFT 0x01\r |
3686 | #define STATE_RIGHT_SHIFT 0x02\r | |
3687 | #define STATE_LEFT_CTRL 0x04\r | |
3688 | #define STATE_LEFT_ALT 0x08\r | |
3689 | #define STATE_RIGHT_ALT 0x10\r | |
3690 | \r | |
3691 | #define KEY_ESCAPE 0x1B // keycode = 0x006e\r | |
3692 | #define KEY_MENUE 0x80 // keycode = 0x0070\r | |
3693 | #define KEY_BACK 0x81 // keycode = 0x0071\r | |
3694 | #define KEY_FORWARD 0x82 // keycode = 0x0072\r | |
3695 | #define KEY_ADDRESS 0x83 // keycode = 0x0073\r | |
3696 | #define KEY_WINDOW 0x84 // keycode = 0x0074\r | |
3697 | #define KEY_1ST_PAGE 0x85 // keycode = 0x0075\r | |
3698 | #define KEY_STOP 0x86 // keycode = 0x0076\r | |
3699 | #define KEY_MAIL 0x87 // keycode = 0x0077\r | |
3700 | #define KEY_FAVORITES 0x88 // keycode = 0x0078\r | |
c6ade1d2 | 3701 | #define KEY_NEW_PAGE 0x89 // keycode = 0x0079\r |
3702 | #define KEY_SETUP 0x8A // keycode = 0x007a\r | |
3703 | #define KEY_FONT 0x8B // keycode = 0x007b\r | |
3704 | #define KEY_PRINT 0x8C // keycode = 0x007c\r | |
3705 | #define KEY_ON_OFF 0x8E // keycode = 0x007c\r | |
3706 | \r | |
3707 | #define KEY_INSERT 0x90 // keycode = 0x004b\r | |
3708 | #define KEY_DELETE 0x91 // keycode = 0x004c\r | |
3709 | #define KEY_LEFT 0x92 // keycode = 0x004f\r | |
3710 | #define KEY_HOME 0x93 // keycode = 0x0050\r | |
3711 | #define KEY_END 0x94 // keycode = 0x0051\r | |
3712 | #define KEY_UP 0x95 // keycode = 0x0053\r | |
3713 | #define KEY_DOWN 0x96 // keycode = 0x0054\r | |
3714 | #define KEY_PAGE_UP 0x97 // keycode = 0x0055\r | |
3715 | #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056\r | |
3716 | #define KEY_RIGHT 0x99 // keycode = 0x0059\r | |
3717 | #define KEY_MOUSE_1 0x9E // keycode = 0x0400\r | |
3718 | #define KEY_MOUSE_2 0x9F // keycode = 0x0800\r | |
d823e852 | 3719 | \r |
3720 | static uint8_t\r | |
3721 | get_fdc_key (uint16_t cmd)\r | |
3722 | {\r | |
3723 | static uint8_t key_table[128] =\r | |
3724 | {\r | |
3725 | // 0 1 2 3 4 5 6 7 8 9 A B C D E F\r | |
3726 | Content-type: text/html ]>