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