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