1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.129 2012/10/26 08:09:37 fm Exp $
10 * Supported mikrocontrollers:
15 * ATmega8, ATmega16, ATmega32
17 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284
18 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *---------------------------------------------------------------------------------------------------------------------------------------------------
29 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
30 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
32 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
35 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
36 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
38 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
41 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
42 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
43 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
44 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
45 IRMP_SUPPORT_IR60_PROTOCOL
46 # define IRMP_SUPPORT_MANCHESTER 1
48 # define IRMP_SUPPORT_MANCHESTER 0
51 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
52 # define IRMP_SUPPORT_SERIAL 1
54 # define IRMP_SUPPORT_SERIAL 0
57 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
59 #define MIN_TOLERANCE_00 1.0 // -0%
60 #define MAX_TOLERANCE_00 1.0 // +0%
62 #define MIN_TOLERANCE_05 0.95 // -5%
63 #define MAX_TOLERANCE_05 1.05 // +5%
65 #define MIN_TOLERANCE_10 0.9 // -10%
66 #define MAX_TOLERANCE_10 1.1 // +10%
68 #define MIN_TOLERANCE_15 0.85 // -15%
69 #define MAX_TOLERANCE_15 1.15 // +15%
71 #define MIN_TOLERANCE_20 0.8 // -20%
72 #define MAX_TOLERANCE_20 1.2 // +20%
74 #define MIN_TOLERANCE_30 0.7 // -30%
75 #define MAX_TOLERANCE_30 1.3 // +30%
77 #define MIN_TOLERANCE_40 0.6 // -40%
78 #define MAX_TOLERANCE_40 1.4 // +40%
80 #define MIN_TOLERANCE_50 0.5 // -50%
81 #define MAX_TOLERANCE_50 1.5 // +50%
83 #define MIN_TOLERANCE_60 0.4 // -60%
84 #define MAX_TOLERANCE_60 1.6 // +60%
86 #define MIN_TOLERANCE_70 0.3 // -70%
87 #define MAX_TOLERANCE_70 1.7 // +70%
89 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
90 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
91 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
92 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
93 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
94 #else // only 5% + 1 to avoid conflict with RC6:
95 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
97 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
98 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
99 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
100 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
101 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
102 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
104 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
105 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
106 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
107 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
108 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
109 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
110 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
111 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
112 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
113 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
114 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
115 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
116 // autodetect nec repetition frame within 50 msec:
117 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
119 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
121 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
124 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
125 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
126 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
127 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
128 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
129 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
130 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
131 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
132 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
133 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
135 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
136 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
137 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
138 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
139 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
140 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
141 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
142 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
143 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
144 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
146 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
147 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
148 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
149 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
150 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
151 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
152 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
153 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
154 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
155 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
157 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
158 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
159 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
160 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
161 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
162 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
163 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
164 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
165 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
166 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
169 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
170 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
171 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
173 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
174 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
177 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
178 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
180 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
181 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
182 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
183 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
184 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
185 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
186 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
187 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
189 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
190 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
191 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
192 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
196 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
197 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
198 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
200 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
201 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
202 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
203 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
204 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
207 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
208 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
209 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
210 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
211 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
212 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
213 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
214 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
215 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
216 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
218 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
219 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
220 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
223 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
224 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
225 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
226 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
227 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
228 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
229 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
231 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
232 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
233 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
234 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
235 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
236 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
237 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
238 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
239 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
240 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
241 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
242 #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
243 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
244 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
245 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
246 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
247 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
248 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
249 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
250 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
251 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
252 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
253 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
254 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
255 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
256 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
258 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
259 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
260 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
261 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
262 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
263 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
264 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
266 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
267 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
268 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
269 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
270 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
271 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
272 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
273 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
275 #define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
276 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
277 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
278 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
279 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
280 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
281 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
282 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
284 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
286 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
288 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
291 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
292 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
293 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
294 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
295 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
296 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
297 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
298 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
299 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
301 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
302 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
303 #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!
304 #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!
305 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
306 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
307 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
308 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
309 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
310 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
311 // autodetect JVC repetition frame within 50 msec:
312 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
314 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
315 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
316 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
317 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
318 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
319 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
320 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
321 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
322 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
323 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
324 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
325 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
326 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
328 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
329 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
330 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
331 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
332 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
333 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
334 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
335 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
336 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
337 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
338 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
339 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
340 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
341 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
343 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
344 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
345 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
346 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
347 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
348 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
349 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
350 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
352 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
353 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
354 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
355 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
356 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
357 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
358 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
359 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
360 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
361 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
363 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
364 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
365 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
366 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
367 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
368 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
369 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
370 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
371 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
372 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
373 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
375 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
378 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
379 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
380 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
381 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
383 static int time_counter
;
386 # define ANALYZE_PUTCHAR(a)
387 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
388 # define ANALYZE_PRINTF(...)
389 # define ANALYZE_NEWLINE()
392 #if IRMP_USE_CALLBACK == 1
393 static void (*irmp_callback_ptr
) (uint8_t);
394 #endif // IRMP_USE_CALLBACK == 1
396 /*---------------------------------------------------------------------------------------------------------------------------------------------------
398 *---------------------------------------------------------------------------------------------------------------------------------------------------
400 #if IRMP_PROTOCOL_NAMES == 1
402 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
439 /*---------------------------------------------------------------------------------------------------------------------------------------------------
441 *---------------------------------------------------------------------------------------------------------------------------------------------------
443 #if IRMP_LOGGING == 1 // logging via UART
445 #if IRMP_EXT_LOGGING == 1 // use external logging
446 #include "irmpextlog.h"
447 #else // normal UART log (IRMP_EXT_LOGGING == 0)
449 #include <util/setbaud.h>
453 #define UART0_UBRRH UBRR0H
454 #define UART0_UBRRL UBRR0L
455 #define UART0_UCSRA UCSR0A
456 #define UART0_UCSRB UCSR0B
457 #define UART0_UCSRC UCSR0C
458 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
459 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
460 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
462 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
464 #define UART0_URSEL_BIT_VALUE (0)
466 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
467 #define UART0_UDR UDR0
468 #define UART0_U2X U2X0
472 #define UART0_UBRRH UBRRH
473 #define UART0_UBRRL UBRRL
474 #define UART0_UCSRA UCSRA
475 #define UART0_UCSRB UCSRB
476 #define UART0_UCSRC UCSRC
477 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
478 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
479 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
481 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
483 #define UART0_URSEL_BIT_VALUE (0)
485 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
486 #define UART0_UDR UDR
487 #define UART0_U2X U2X
490 #endif //IRMP_EXT_LOGGING
492 /*---------------------------------------------------------------------------------------------------------------------------------------------------
494 * @details Initializes UART
495 *---------------------------------------------------------------------------------------------------------------------------------------------------
498 irmp_uart_init (void)
500 #if (IRMP_EXT_LOGGING == 0) // use UART
501 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
502 UART0_UBRRL
= UBRRL_VALUE
;
505 UART0_UCSRA
|= (1<<UART0_U2X
);
507 UART0_UCSRA
&= ~(1<<UART0_U2X
);
510 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
511 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
512 #else // other log method
514 #endif //IRMP_EXT_LOGGING
517 /*---------------------------------------------------------------------------------------------------------------------------------------------------
519 * @details Sends character
520 * @param ch character to be transmitted
521 *---------------------------------------------------------------------------------------------------------------------------------------------------
524 irmp_uart_putc (unsigned char ch
)
526 #if (IRMP_EXT_LOGGING == 0)
527 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
534 sendextlog(ch
); //Use external log
538 /*---------------------------------------------------------------------------------------------------------------------------------------------------
540 *---------------------------------------------------------------------------------------------------------------------------------------------------
543 #define STARTCYCLES 2 // min count of zeros before start of logging
544 #define ENDBITS 1000 // number of sequenced highbits to detect end
545 #define DATALEN 700 // log buffer size
548 irmp_log (uint8_t val
)
550 static uint8_t buf
[DATALEN
]; // logging buffer
551 static uint16_t buf_idx
; // number of written bits
552 static uint8_t startcycles
; // current number of start-zeros
553 static uint16_t cnt
; // counts sequenced highbits - to detect end
555 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
563 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
565 if (buf_idx
< DATALEN
* 8) // index in range?
569 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
573 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
580 { // if high received then look at log-stop condition
584 { // if stop condition is true, output on uart
587 for (i
= 0; i
< STARTCYCLES
; i
++)
589 irmp_uart_putc ('0'); // the ignored starting zeros
592 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
597 for (j
= 0; j
< 8; j
++)
599 irmp_uart_putc ((d
& 1) + '0');
604 irmp_uart_putc ('\n');
617 #define irmp_log(val)
618 #endif //IRMP_LOGGING
622 uint8_t protocol
; // ir protocol
623 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
624 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
625 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
626 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
627 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
628 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
629 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
630 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
631 uint8_t address_offset
; // address offset
632 uint8_t address_end
; // end of address
633 uint8_t command_offset
; // command offset
634 uint8_t command_end
; // end of command
635 uint8_t complete_len
; // complete length of frame
636 uint8_t stop_bit
; // flag: frame has stop bit
637 uint8_t lsb_first
; // flag: LSB first
638 uint8_t flags
; // some flags
641 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
643 static const PROGMEM IRMP_PARAMETER sircs_param
=
645 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
646 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
647 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
648 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
649 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
650 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
651 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
652 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
653 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
654 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
655 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
656 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
657 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
658 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
659 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
660 SIRCS_LSB
, // lsb_first: flag: LSB first
661 SIRCS_FLAGS
// flags: some flags
666 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
668 static const PROGMEM IRMP_PARAMETER nec_param
=
670 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
671 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
672 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
673 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
674 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
675 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
676 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
677 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
678 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
679 NEC_ADDRESS_OFFSET
, // address_offset: address offset
680 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
681 NEC_COMMAND_OFFSET
, // command_offset: command offset
682 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
683 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
684 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
685 NEC_LSB
, // lsb_first: flag: LSB first
686 NEC_FLAGS
// flags: some flags
689 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
691 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
692 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
693 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
694 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
695 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
696 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
697 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
698 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
699 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
700 0, // address_offset: address offset
701 0, // address_end: end of address
702 0, // command_offset: command offset
703 0, // command_end: end of command
704 0, // complete_len: complete length of frame
705 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
706 NEC_LSB
, // lsb_first: flag: LSB first
707 NEC_FLAGS
// flags: some flags
712 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
714 static const PROGMEM IRMP_PARAMETER nec42_param
=
716 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
717 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
718 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
719 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
720 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
721 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
722 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
723 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
724 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
725 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
726 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
727 NEC42_COMMAND_OFFSET
, // command_offset: command offset
728 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
729 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
730 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
731 NEC_LSB
, // lsb_first: flag: LSB first
732 NEC_FLAGS
// flags: some flags
737 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
739 static const PROGMEM IRMP_PARAMETER samsung_param
=
741 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
742 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
743 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
744 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
745 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
746 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
747 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
748 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
749 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
750 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
751 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
752 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
753 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
754 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
755 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
756 SAMSUNG_LSB
, // lsb_first: flag: LSB first
757 SAMSUNG_FLAGS
// flags: some flags
762 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
764 static const PROGMEM IRMP_PARAMETER matsushita_param
=
766 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
767 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
768 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
769 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
770 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
771 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
772 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
773 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
774 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
775 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
776 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
777 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
778 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
779 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
780 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
781 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
782 MATSUSHITA_FLAGS
// flags: some flags
787 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
789 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
791 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
792 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
793 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
794 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
795 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
796 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
797 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
798 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
799 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
800 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
801 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
802 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
803 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
804 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
805 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
806 KASEIKYO_LSB
, // lsb_first: flag: LSB first
807 KASEIKYO_FLAGS
// flags: some flags
812 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
814 static const PROGMEM IRMP_PARAMETER recs80_param
=
816 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
817 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
818 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
819 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
820 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
821 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
822 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
823 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
824 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
825 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
826 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
827 RECS80_COMMAND_OFFSET
, // command_offset: command offset
828 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
829 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
830 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
831 RECS80_LSB
, // lsb_first: flag: LSB first
832 RECS80_FLAGS
// flags: some flags
837 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
839 static const PROGMEM IRMP_PARAMETER rc5_param
=
841 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
842 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
843 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
844 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
845 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
846 0, // pulse_0_len_min: here: not used
847 0, // pulse_0_len_max: here: not used
848 0, // pause_0_len_min: here: not used
849 0, // pause_0_len_max: here: not used
850 RC5_ADDRESS_OFFSET
, // address_offset: address offset
851 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
852 RC5_COMMAND_OFFSET
, // command_offset: command offset
853 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
854 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
855 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
856 RC5_LSB
, // lsb_first: flag: LSB first
857 RC5_FLAGS
// flags: some flags
862 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
864 static const PROGMEM IRMP_PARAMETER denon_param
=
866 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
867 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
868 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
869 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
870 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
871 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
872 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
873 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
874 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
875 DENON_ADDRESS_OFFSET
, // address_offset: address offset
876 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
877 DENON_COMMAND_OFFSET
, // command_offset: command offset
878 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
879 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
880 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
881 DENON_LSB
, // lsb_first: flag: LSB first
882 DENON_FLAGS
// flags: some flags
887 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
889 static const PROGMEM IRMP_PARAMETER rc6_param
=
891 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
893 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
894 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
895 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
896 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
897 0, // pulse_0_len_min: here: not used
898 0, // pulse_0_len_max: here: not used
899 0, // pause_0_len_min: here: not used
900 0, // pause_0_len_max: here: not used
901 RC6_ADDRESS_OFFSET
, // address_offset: address offset
902 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
903 RC6_COMMAND_OFFSET
, // command_offset: command offset
904 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
905 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
906 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
907 RC6_LSB
, // lsb_first: flag: LSB first
908 RC6_FLAGS
// flags: some flags
913 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
915 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
917 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
918 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
919 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
920 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
921 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
922 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
923 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
924 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
925 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
926 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
927 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
928 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
929 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
930 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
931 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
932 RECS80EXT_LSB
, // lsb_first: flag: LSB first
933 RECS80EXT_FLAGS
// flags: some flags
938 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
940 static const PROGMEM IRMP_PARAMETER nubert_param
=
942 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
943 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
944 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
945 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
946 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
947 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
948 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
949 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
950 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
951 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
952 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
953 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
954 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
955 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
956 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
957 NUBERT_LSB
, // lsb_first: flag: LSB first
958 NUBERT_FLAGS
// flags: some flags
963 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
965 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
967 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
968 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
969 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
970 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
971 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
972 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
973 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
974 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
975 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
976 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
977 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
978 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
979 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
980 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
981 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
982 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
983 BANG_OLUFSEN_FLAGS
// flags: some flags
988 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
990 static uint8_t first_bit
;
992 static const PROGMEM IRMP_PARAMETER grundig_param
=
994 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
996 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
997 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
998 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
999 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1000 0, // pulse_0_len_min: here: not used
1001 0, // pulse_0_len_max: here: not used
1002 0, // pause_0_len_min: here: not used
1003 0, // pause_0_len_max: here: not used
1004 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1005 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1006 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1007 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1008 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1009 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1010 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1011 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1016 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1018 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1020 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1021 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1022 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1023 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1024 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1025 0, // pulse_0_len_min: here: not used
1026 0, // pulse_0_len_max: here: not used
1027 0, // pause_0_len_min: here: not used
1028 0, // pause_0_len_max: here: not used
1029 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1030 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1031 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1032 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1033 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1034 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1035 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1036 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1041 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1043 static const PROGMEM IRMP_PARAMETER fdc_param
=
1045 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1046 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1047 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1048 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1049 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1050 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1051 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1052 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1053 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1054 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1055 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1056 FDC_COMMAND_OFFSET
, // command_offset: command offset
1057 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1058 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1059 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1060 FDC_LSB
, // lsb_first: flag: LSB first
1061 FDC_FLAGS
// flags: some flags
1066 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1068 static const PROGMEM IRMP_PARAMETER rccar_param
=
1070 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1071 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1072 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1073 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1074 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1075 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1076 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1077 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1078 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1079 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1080 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1081 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1082 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1083 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1084 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1085 RCCAR_LSB
, // lsb_first: flag: LSB first
1086 RCCAR_FLAGS
// flags: some flags
1091 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1093 static const PROGMEM IRMP_PARAMETER nikon_param
=
1095 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1096 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1097 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1098 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1099 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1100 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1101 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1102 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1103 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1104 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1105 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1106 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1107 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1108 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1109 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1110 NIKON_LSB
, // lsb_first: flag: LSB first
1111 NIKON_FLAGS
// flags: some flags
1116 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1118 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1120 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1121 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1122 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1123 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1124 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1125 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1126 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1127 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1128 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1129 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1130 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1131 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1132 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1133 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1134 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1135 KATHREIN_LSB
, // lsb_first: flag: LSB first
1136 KATHREIN_FLAGS
// flags: some flags
1141 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1143 static const PROGMEM IRMP_PARAMETER netbox_param
=
1145 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1146 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1147 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1148 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1149 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1150 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1151 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1152 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1153 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1154 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1155 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1156 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1157 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1158 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1159 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1160 NETBOX_LSB
, // lsb_first: flag: LSB first
1161 NETBOX_FLAGS
// flags: some flags
1166 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1168 static const PROGMEM IRMP_PARAMETER lego_param
=
1170 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1171 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1172 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1173 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1174 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1175 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1176 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1177 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1178 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1179 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1180 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1181 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1182 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1183 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1184 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1185 LEGO_LSB
, // lsb_first: flag: LSB first
1186 LEGO_FLAGS
// flags: some flags
1191 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1193 static const PROGMEM IRMP_PARAMETER thomson_param
=
1195 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1196 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1197 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1198 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1199 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1200 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1201 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1202 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1203 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1204 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1205 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1206 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1207 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1208 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1209 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1210 THOMSON_LSB
, // lsb_first: flag: LSB first
1211 THOMSON_FLAGS
// flags: some flags
1216 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1218 static const PROGMEM IRMP_PARAMETER bose_param
=
1220 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1221 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1222 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1223 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1224 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1225 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1226 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1227 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1228 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1229 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1230 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1231 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1232 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1233 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1234 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1235 BOSE_LSB
, // lsb_first: flag: LSB first
1236 BOSE_FLAGS
// flags: some flags
1241 static uint8_t irmp_bit
; // current bit position
1242 static IRMP_PARAMETER irmp_param
;
1244 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1245 static IRMP_PARAMETER irmp_param2
;
1248 static volatile uint8_t irmp_ir_detected
;
1249 static volatile uint8_t irmp_protocol
;
1250 static volatile uint16_t irmp_address
;
1251 static volatile uint16_t irmp_command
;
1252 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1253 static volatile uint8_t irmp_flags
;
1254 // static volatile uint8_t irmp_busy_flag;
1257 #define input(x) (x)
1258 static uint8_t IRMP_PIN
;
1261 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1262 * Initialize IRMP decoder
1263 * @details Configures IRMP input pin
1264 *---------------------------------------------------------------------------------------------------------------------------------------------------
1270 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1271 #elif defined (ARM_STM32) // STM32
1272 GPIO_InitTypeDef GPIO_InitStructure
;
1274 /* GPIOx clock enable */
1275 #if defined (ARM_STM32L1XX)
1276 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1277 #elif defined (ARM_STM32F10X)
1278 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1279 #elif defined (ARM_STM32F4XX)
1280 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1283 /* GPIO Configuration */
1284 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1285 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1286 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1287 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1288 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1289 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1290 #elif defined (ARM_STM32F10X)
1291 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1292 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1294 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1296 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1297 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1300 #if IRMP_LOGGING == 1
1305 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1307 * @details gets decoded IRMP data
1308 * @param pointer in order to store IRMP data
1309 * @return TRUE: successful, FALSE: failed
1310 *---------------------------------------------------------------------------------------------------------------------------------------------------
1313 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1315 uint8_t rtc
= FALSE
;
1317 if (irmp_ir_detected
)
1319 switch (irmp_protocol
)
1321 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1322 case IRMP_SAMSUNG_PROTOCOL
:
1323 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1325 irmp_command
&= 0xff;
1326 irmp_command
|= irmp_id
<< 8;
1331 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1332 case IRMP_NEC_PROTOCOL
:
1333 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1335 irmp_command
&= 0xff;
1338 else if (irmp_address
== 0x87EE)
1340 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1341 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1342 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1343 irmp_command
&= 0x00FF;
1348 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1349 case IRMP_BOSE_PROTOCOL
:
1350 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1352 irmp_command
&= 0xff;
1357 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1358 case IRMP_SIEMENS_PROTOCOL
:
1359 case IRMP_RUWIDO_PROTOCOL
:
1360 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1367 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1368 case IRMP_KATHREIN_PROTOCOL
:
1369 if (irmp_command
!= 0x0000)
1375 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1376 case IRMP_RC5_PROTOCOL
:
1377 irmp_address
&= ~0x20; // clear toggle bit
1381 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1382 case IRMP_IR60_PROTOCOL
:
1383 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1389 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1393 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1394 case IRMP_RCCAR_PROTOCOL
:
1395 // frame in irmp_data:
1396 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1397 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1398 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1399 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1400 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1401 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1402 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1406 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1407 case IRMP_NETBOX_PROTOCOL
:
1408 if (irmp_command
& 0x1000) // last bit set?
1410 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1413 irmp_command
&= 0x7F;
1416 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1419 irmp_command
|= 0x80;
1424 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1429 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1433 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1434 case IRMP_LEGO_PROTOCOL
:
1436 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1438 if ((irmp_command
& 0x000F) == crc
)
1445 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1446 // rtc = TRUE; // don't accept codes with CRC errors
1460 irmp_data_p
->protocol
= irmp_protocol
;
1461 irmp_data_p
->address
= irmp_address
;
1462 irmp_data_p
->command
= irmp_command
;
1463 irmp_data_p
->flags
= irmp_flags
;
1469 irmp_ir_detected
= FALSE
;
1476 // irmp_is_busy (void)
1478 // return irmp_busy_flag;
1481 #if IRMP_USE_CALLBACK == 1
1483 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1485 irmp_callback_ptr
= cb
;
1487 #endif // IRMP_USE_CALLBACK == 1
1489 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1490 static uint16_t irmp_tmp_address
; // ir address
1491 static uint16_t irmp_tmp_command
; // ir command
1493 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1494 static uint16_t irmp_tmp_address2
; // ir address
1495 static uint16_t irmp_tmp_command2
; // ir command
1498 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1499 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1501 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1502 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1503 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1506 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1508 * @details store bit in temp address or temp command
1509 * @param value to store: 0 or 1
1510 *---------------------------------------------------------------------------------------------------------------------------------------------------
1512 // verhindert, dass irmp_store_bit() inline compiliert wird:
1513 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1516 irmp_store_bit (uint8_t value
)
1518 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1519 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1526 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1528 if (irmp_param
.lsb_first
)
1530 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1534 irmp_tmp_address
<<= 1;
1535 irmp_tmp_address
|= value
;
1538 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1540 if (irmp_param
.lsb_first
)
1542 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1546 irmp_tmp_command
<<= 1;
1547 irmp_tmp_command
|= value
;
1551 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1552 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1554 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1559 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1560 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1562 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1567 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1568 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1570 if (irmp_bit
>= 20 && irmp_bit
< 24)
1572 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1574 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1576 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1579 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1583 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1587 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1600 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1602 * @details store bit in temp address or temp command
1603 * @param value to store: 0 or 1
1604 *---------------------------------------------------------------------------------------------------------------------------------------------------
1606 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1608 irmp_store_bit2 (uint8_t value
)
1612 if (irmp_param
.protocol
)
1614 irmp_bit2
= irmp_bit
- 2;
1618 irmp_bit2
= irmp_bit
- 1;
1621 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1623 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1625 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1627 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1630 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1632 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1634 * @details ISR routine, called 10000 times per second
1635 *---------------------------------------------------------------------------------------------------------------------------------------------------
1640 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1641 static uint8_t wait_for_space
; // flag: wait for data bit space
1642 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1643 static uint8_t irmp_pulse_time
; // count bit time for pulse
1644 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1645 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1646 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1647 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1648 static uint8_t repetition_frame_number
;
1649 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1650 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1652 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1653 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1655 #if IRMP_SUPPORT_MANCHESTER == 1
1656 static PAUSE_LEN last_pause
; // last pause value
1658 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1659 static uint8_t last_value
; // last bit value
1661 uint8_t irmp_input
; // input value
1667 irmp_input
= input(IRMP_PIN
);
1669 #if IRMP_USE_CALLBACK == 1
1670 if (irmp_callback_ptr
)
1672 static uint8_t last_inverted_input
;
1674 if (last_inverted_input
!= !irmp_input
)
1676 (*irmp_callback_ptr
) (! irmp_input
);
1677 last_inverted_input
= !irmp_input
;
1680 #endif // IRMP_USE_CALLBACK == 1
1682 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1684 if (! irmp_ir_detected
) // ir code already detected?
1686 if (! irmp_start_bit_detected
) // start bit detected?
1688 if (! irmp_input
) // receiving burst?
1690 // irmp_busy_flag = TRUE;
1692 if (! irmp_pulse_time
)
1694 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1697 irmp_pulse_time
++; // increment counter
1701 if (irmp_pulse_time
) // it's dark....
1702 { // set flags for counting the time of darkness...
1703 irmp_start_bit_detected
= 1;
1704 wait_for_start_space
= 1;
1706 irmp_tmp_command
= 0;
1707 irmp_tmp_address
= 0;
1708 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1712 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1713 irmp_tmp_command2
= 0;
1714 irmp_tmp_address2
= 0;
1718 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1719 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1720 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1725 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1729 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1730 if (repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
1732 ANALYZE_PRINTF ("%8.3fms error 6: did not receive inverted command repetition\n",
1733 (double) (time_counter
* 1000) / F_INTERRUPTS
);
1734 last_irmp_denon_command
= 0;
1736 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1743 if (wait_for_start_space
) // we have received start bit...
1744 { // ...and are counting the time of darkness
1745 if (irmp_input
) // still dark?
1747 irmp_pause_time
++; // increment counter
1749 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1750 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
) ||
1751 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1753 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1756 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1757 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1762 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1764 ANALYZE_PRINTF ("%8.3fms error 1: pause after start bit pulse %d too long: %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1765 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1767 // irmp_busy_flag = FALSE;
1768 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1769 irmp_pulse_time
= 0;
1770 irmp_pause_time
= 0;
1774 { // receiving first data pulse!
1775 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1777 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1778 irmp_param2
.protocol
= 0;
1781 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1783 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1784 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1785 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1787 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1788 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1789 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1790 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1793 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1795 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1796 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1797 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1798 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1800 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1801 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1802 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1803 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1806 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1808 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1809 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1810 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1812 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1813 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1814 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1815 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1816 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1818 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1819 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1820 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1821 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1825 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1826 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1828 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1829 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
1830 { // some jvc remote controls use nec repetition frame for jvc repetition frame
1831 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1832 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1833 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1834 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1837 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1839 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1840 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1841 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1843 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
1848 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1849 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1850 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1851 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
1852 { // it's JVC repetition type 3
1853 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1854 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1855 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
1856 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1859 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1861 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1863 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1864 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1865 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1867 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1868 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1869 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1870 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1873 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1875 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1876 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1877 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1879 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1880 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
1881 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
1882 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
1885 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1887 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1888 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
1889 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
1890 { // it's MATSUSHITA
1891 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1892 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
1893 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
1894 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
1897 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1899 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1900 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
1901 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
1903 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1904 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
1905 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
1906 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
1909 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1911 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1912 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
1913 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
1915 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1916 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
1917 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
1918 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
1921 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
1923 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1924 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
1925 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
1926 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
1927 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
1929 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1930 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
1931 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
1933 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
1934 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1935 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
1936 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
1937 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1938 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1939 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1940 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
1943 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
1945 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1946 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
1947 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
1949 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
1950 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1951 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
1952 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
1953 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1954 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1955 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1956 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
1959 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1961 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
1962 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1963 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
1964 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1965 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
1968 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
1969 last_pause
= irmp_pause_time
;
1971 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
1972 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
1975 rc5_cmd_bit6
= 1<<6;
1983 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
1985 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1986 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
1987 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
1988 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
1990 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
1991 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
1992 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
1993 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
1994 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
1997 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1999 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2000 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2001 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2002 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2004 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2005 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2006 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2007 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2008 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2011 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2013 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2014 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2015 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2017 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2018 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2019 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2020 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2023 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2025 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2026 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2027 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2029 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2030 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2031 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2032 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2037 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2039 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2040 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2041 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2043 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2044 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2045 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2046 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2049 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2051 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2052 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2053 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2055 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2056 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2057 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2058 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2061 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2063 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2064 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2065 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2066 { // it's BANG_OLUFSEN
2067 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2068 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2069 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2070 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2071 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2072 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2073 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2074 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2075 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2076 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2077 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2078 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2079 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2080 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2084 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2086 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2087 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2088 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2090 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2091 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2092 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2093 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2094 last_pause
= irmp_pause_time
;
2098 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2100 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2101 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2102 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2103 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2104 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2105 { // it's RUWIDO or SIEMENS
2106 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2107 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2108 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2109 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2110 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2111 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2112 last_pause
= irmp_pause_time
;
2116 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2118 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2119 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2120 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2122 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2123 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2124 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2125 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2128 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2130 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2131 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2132 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2134 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2135 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2136 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2137 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2140 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2142 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2143 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2144 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2146 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2147 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2148 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2149 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2152 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2154 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2155 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2156 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2158 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2159 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2160 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2161 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2164 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2166 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2167 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2168 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2170 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2171 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2172 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2173 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2176 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2179 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2180 // irmp_busy_flag = FALSE;
2181 irmp_start_bit_detected
= 0; // wait for another start bit...
2184 if (irmp_start_bit_detected
)
2186 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2189 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2191 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2192 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2196 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2197 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2198 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2199 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2202 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2203 if (irmp_param2
.protocol
)
2205 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2206 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2207 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2208 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2213 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2214 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2216 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2220 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2222 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2223 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2227 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2228 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2229 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2230 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2233 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2234 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2236 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2237 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2241 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2242 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2243 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2244 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2250 #if IRMP_SUPPORT_MANCHESTER == 1
2251 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2252 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2253 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2255 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2257 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2258 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2260 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2262 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2264 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2266 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2268 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2272 #endif // IRMP_SUPPORT_MANCHESTER == 1
2274 #if IRMP_SUPPORT_SERIAL == 1
2275 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2280 #endif // IRMP_SUPPORT_SERIAL == 1
2283 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2284 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2286 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2288 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2289 { // pause timings correct for "1"?
2290 ANALYZE_PUTCHAR ('1'); // yes, store 1
2294 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2295 { // pause timings correct for "0"?
2296 ANALYZE_PUTCHAR ('0'); // yes, store 0
2302 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2303 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2304 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2306 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2308 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2309 { // pause timings correct for "1"?
2310 ANALYZE_PUTCHAR ('1'); // yes, store 1
2314 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2315 { // pause timings correct for "0"?
2316 ANALYZE_PUTCHAR ('0'); // yes, store 0
2322 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2324 ; // else do nothing
2327 irmp_pulse_time
= 1; // set counter to 1, not 0
2328 irmp_pause_time
= 0;
2329 wait_for_start_space
= 0;
2332 else if (wait_for_space
) // the data section....
2333 { // counting the time of darkness....
2334 uint8_t got_light
= FALSE
;
2336 if (irmp_input
) // still dark?
2338 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2341 #if IRMP_SUPPORT_MANCHESTER == 1
2342 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2344 #if IRMP_SUPPORT_SERIAL == 1
2345 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2347 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2350 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2352 ANALYZE_PRINTF ("stop bit detected\n");
2355 irmp_param
.stop_bit
= 0;
2359 ANALYZE_PRINTF ("error: stop bit timing wrong, irmp_bit = %d, irmp_pulse_time = %d, pulse_0_len_min = %d, pulse_0_len_max = %d\n",
2360 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2362 // irmp_busy_flag = FALSE;
2363 irmp_start_bit_detected
= 0; // wait for another start bit...
2364 irmp_pulse_time
= 0;
2365 irmp_pause_time
= 0;
2370 irmp_pause_time
++; // increment counter
2372 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2373 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2374 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2375 irmp_bit
>= 12 - 1) // pause too long?
2376 { // yes, break and close this frame
2377 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2378 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2379 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2380 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2381 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2385 #if IRMP_SUPPORT_SERIAL == 1
2386 // NETBOX generates no stop bit, here is the timeout condition:
2387 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2388 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2390 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2394 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2395 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2397 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2399 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2400 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2401 irmp_param
.stop_bit
= TRUE
; // set flag
2403 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2404 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2405 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2406 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2407 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2408 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2410 irmp_tmp_command
<<= 1;
2411 irmp_tmp_command
|= first_bit
;
2413 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2414 { // special manchester decoder
2415 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2416 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2417 irmp_param
.stop_bit
= TRUE
; // set flag
2419 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2421 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2422 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2423 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2424 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2425 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2426 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2428 if (irmp_tmp_command
& 0x300)
2430 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2431 irmp_tmp_command
&= 0xFF;
2437 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2438 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2440 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2441 { // special manchester decoder
2442 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2443 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2444 irmp_param
.stop_bit
= TRUE
; // set flag
2446 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2448 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2449 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2450 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2451 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2452 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2453 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2456 // RUWIDO: AAAAAAAAACCCCCCCp
2457 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2458 irmp_tmp_address
<<= 2;
2459 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2460 irmp_tmp_command
&= 0x003F;
2461 irmp_tmp_command
<<= 4;
2462 irmp_tmp_command
|= last_value
;
2467 #if IRMP_SUPPORT_MANCHESTER == 1
2468 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2469 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2470 { // special manchester decoder
2471 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2472 irmp_param
.stop_bit
= TRUE
; // set flag
2475 #endif // IRMP_SUPPORT_MANCHESTER == 1
2476 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2478 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2482 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2483 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2485 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2486 irmp_param
.stop_bit
= TRUE
; // set flag
2487 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2488 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2489 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2490 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2491 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2493 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2495 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2496 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2497 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2499 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2500 irmp_param
.stop_bit
= TRUE
; // set flag
2501 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2502 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2504 // 0123456789ABC0123456789ABC0123456701234567
2505 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2506 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2507 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2508 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2510 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2511 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2512 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2514 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2515 irmp_param
.stop_bit
= TRUE
; // set flag
2516 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2517 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2519 // 0123456789ABC0123456789ABC0123456701234567
2520 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2521 // JVC: AAAACCCCCCCCCCCC
2522 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2523 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2525 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2526 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2529 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2530 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2532 // irmp_busy_flag = FALSE;
2533 irmp_start_bit_detected
= 0; // wait for another start bit...
2534 irmp_pulse_time
= 0;
2535 irmp_pause_time
= 0;
2547 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2549 #if IRMP_SUPPORT_MANCHESTER == 1
2550 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2553 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2554 #else // better, but some IR-RCs use asymmetric timings :-/
2555 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2556 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2559 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2560 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2562 ANALYZE_PUTCHAR ('T');
2563 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2576 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2578 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2579 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2581 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2582 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2584 ANALYZE_PUTCHAR ('T');
2587 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2598 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2600 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2601 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2602 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2603 if (! irmp_param2
.protocol
)
2608 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2612 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2613 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2615 uint8_t manchester_value
;
2617 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2619 manchester_value
= last_value
? 0 : 1;
2620 last_value
= manchester_value
;
2624 manchester_value
= last_value
;
2627 ANALYZE_PUTCHAR (manchester_value
+ '0');
2629 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2630 if (! irmp_param2
.protocol
)
2636 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2637 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2639 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2640 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2641 irmp_param
.address_offset
= 5;
2642 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2643 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2644 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2645 irmp_tmp_address
= 0;
2647 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2649 irmp_store_bit (manchester_value
);
2653 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2654 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2655 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2656 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2657 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2659 ANALYZE_PUTCHAR ('?');
2660 irmp_param
.protocol
= 0; // switch to FDC, see below
2663 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2664 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2665 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2666 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2667 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2668 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2670 ANALYZE_PUTCHAR ('?');
2671 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2674 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2676 ANALYZE_PUTCHAR ('?');
2678 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2679 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2680 // irmp_busy_flag = FALSE;
2681 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2682 irmp_pause_time
= 0;
2686 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2687 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2689 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2691 ANALYZE_PRINTF (" 1 (FDC)\n");
2692 irmp_store_bit2 (1);
2694 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2696 ANALYZE_PRINTF (" 0 (FDC)\n");
2697 irmp_store_bit2 (0);
2700 if (! irmp_param
.protocol
)
2702 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2703 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2704 irmp_param2
.protocol
= 0;
2705 irmp_tmp_address
= irmp_tmp_address2
;
2706 irmp_tmp_command
= irmp_tmp_command2
;
2709 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2710 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2711 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2713 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2715 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2716 irmp_store_bit2 (1);
2718 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2720 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2721 irmp_store_bit2 (0);
2724 if (! irmp_param
.protocol
)
2726 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2727 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2728 irmp_param2
.protocol
= 0;
2729 irmp_tmp_address
= irmp_tmp_address2
;
2730 irmp_tmp_command
= irmp_tmp_command2
;
2733 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2735 last_pause
= irmp_pause_time
;
2739 #endif // IRMP_SUPPORT_MANCHESTER == 1
2741 #if IRMP_SUPPORT_SERIAL == 1
2742 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2744 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2746 ANALYZE_PUTCHAR ('1');
2749 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2751 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2755 irmp_pulse_time
= 0;
2759 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2761 ANALYZE_PUTCHAR ('0');
2764 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2766 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2770 irmp_pause_time
= 0;
2777 #endif // IRMP_SUPPORT_SERIAL == 1
2779 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2780 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2782 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2783 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2785 ANALYZE_PRINTF ("SYNC\n");
2790 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2792 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2793 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2794 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2795 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2797 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2799 ANALYZE_PUTCHAR ('1');
2806 ANALYZE_PUTCHAR ('0');
2812 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2815 { // timing incorrect!
2816 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2817 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2818 // irmp_busy_flag = FALSE;
2819 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2820 irmp_pause_time
= 0;
2824 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2826 #if IRMP_SUPPORT_NEC16_PROTOCOL
2827 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2828 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
2829 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
2830 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
2831 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2832 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2834 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2835 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
2836 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
2837 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
2838 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
2839 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
2840 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
2844 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2846 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2847 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2849 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2851 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2853 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2855 ANALYZE_PRINTF ("3rd start bit\n");
2860 { // timing incorrect!
2861 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
);
2862 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2863 // irmp_busy_flag = FALSE;
2864 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2865 irmp_pause_time
= 0;
2868 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2870 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2872 ANALYZE_PRINTF ("trailer bit\n");
2877 { // timing incorrect!
2878 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
);
2879 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2880 // irmp_busy_flag = FALSE;
2881 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2882 irmp_pause_time
= 0;
2887 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
2888 { // pulse & pause timings correct for "1"?
2889 ANALYZE_PUTCHAR ('1');
2895 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
2896 { // pulse & pause timings correct for "0"?
2897 ANALYZE_PUTCHAR ('0');
2903 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
2905 ANALYZE_PUTCHAR (last_value
+ '0');
2907 irmp_store_bit (last_value
);
2911 { // timing incorrect!
2912 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
);
2913 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2914 // irmp_busy_flag = FALSE;
2915 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2916 irmp_pause_time
= 0;
2921 { // timing incorrect!
2922 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
);
2923 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2924 // irmp_busy_flag = FALSE;
2925 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2926 irmp_pause_time
= 0;
2930 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
2932 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
2933 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
2934 { // pulse & pause timings correct for "1"?
2935 ANALYZE_PUTCHAR ('1');
2940 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2941 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2942 { // pulse & pause timings correct for "0"?
2943 ANALYZE_PUTCHAR ('0');
2949 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
2951 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
2952 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
2953 (((irmp_bit
== 8 || irmp_bit
== 6) &&
2954 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
2956 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
2962 ANALYZE_PUTCHAR ('S');
2964 irmp_tmp_command
<<= 1;
2968 ANALYZE_PUTCHAR ('S');
2975 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
2976 { // timing incorrect!
2977 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2978 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2979 // irmp_busy_flag = FALSE;
2980 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2981 irmp_pause_time
= 0;
2984 irmp_pulse_time
= 1; // set counter to 1, not 0
2988 { // counting the pulse length ...
2989 if (! irmp_input
) // still light?
2991 irmp_pulse_time
++; // increment counter
2995 wait_for_space
= 1; // let's count the time (see above)
2996 irmp_pause_time
= 1; // set pause counter to 1, not 0
3000 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3002 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3004 repetition_frame_number
++;
3008 repetition_frame_number
= 0;
3011 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3012 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3013 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3015 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3016 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3022 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3023 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3024 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3026 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3027 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3033 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3034 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3035 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3037 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3038 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3044 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3045 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3046 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3048 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3049 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3056 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3057 irmp_ir_detected
= TRUE
;
3059 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3060 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3061 { // check for repetition frame
3062 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3064 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3065 last_irmp_denon_command
= 0;
3067 irmp_protocol
= irmp_param
.protocol
; // store protocol
3068 irmp_address
= irmp_tmp_address
; // store address
3069 irmp_command
= irmp_tmp_command
; // store command
3073 ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3074 irmp_ir_detected
= FALSE
;
3075 last_irmp_denon_command
= irmp_tmp_command
;
3080 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3082 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3083 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3084 { // Grundig start frame?
3085 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3086 irmp_ir_detected
= FALSE
;
3089 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3091 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3092 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3093 { // Nokia start frame?
3094 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3095 irmp_ir_detected
= FALSE
;
3098 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3100 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3101 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3103 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3105 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3106 irmp_tmp_address
= last_irmp_address
; // address is last address
3107 irmp_tmp_command
= last_irmp_command
; // command is last command
3108 irmp_flags
|= IRMP_FLAG_REPETITION
;
3113 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3114 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3115 irmp_ir_detected
= FALSE
;
3118 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3120 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3121 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3124 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3125 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3127 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3129 if (xor_value
!= (xor_check
[2] & 0x0F))
3131 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
3132 irmp_ir_detected
= FALSE
;
3135 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3137 if (xor_value
!= xor_check
[5])
3139 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
3140 irmp_ir_detected
= FALSE
;
3143 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3145 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3147 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3148 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3150 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3153 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3155 irmp_protocol
= irmp_param
.protocol
;
3158 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3159 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3161 if (irmp_tmp_command
& 0x000F) // released key?
3163 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3167 irmp_tmp_command
>>= 4; // no, it's a pressed key
3169 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3170 irmp_tmp_address
&= 0x003F;
3174 irmp_address
= irmp_tmp_address
; // store address
3175 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3176 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3178 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3182 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3183 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3185 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3188 irmp_command
= irmp_tmp_command
; // store command
3190 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3191 irmp_id
= irmp_tmp_id
;
3196 if (irmp_ir_detected
)
3198 if (last_irmp_command
== irmp_tmp_command
&&
3199 last_irmp_address
== irmp_tmp_address
&&
3200 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3202 irmp_flags
|= IRMP_FLAG_REPETITION
;
3205 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3206 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3212 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3215 // irmp_busy_flag = FALSE;
3216 irmp_start_bit_detected
= 0; // and wait for next start bit
3217 irmp_tmp_command
= 0;
3218 irmp_pulse_time
= 0;
3219 irmp_pause_time
= 0;
3221 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3222 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3223 { // set pulse time here!
3224 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3226 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3230 return (irmp_ir_detected
);
3235 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3236 * main functions - for Unix/Linux + Windows only!
3240 * Compile it under linux with:
3243 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3249 * -l list pulse/pauses
3251 *---------------------------------------------------------------------------------------------------------------------------------------------------
3255 print_timings (void)
3257 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3258 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3260 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3261 printf ("====================================================================================\n");
3262 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3263 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3264 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3265 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3267 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3268 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3269 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3270 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3272 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3273 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
,
3274 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3275 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3277 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3278 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3279 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3280 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3282 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3283 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3284 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3285 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3287 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3288 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3289 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3290 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3292 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3293 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3294 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3295 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3297 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3298 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3299 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3301 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3302 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3303 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3304 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3306 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3307 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3308 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3309 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3311 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3312 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3313 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3315 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3316 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3317 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3318 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3320 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3321 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3322 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3323 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3325 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3326 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3327 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3329 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3330 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3331 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3333 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3334 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3335 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3337 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3338 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3339 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3341 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3342 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3343 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3345 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3346 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3347 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3348 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3350 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3351 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3352 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3353 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3354 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3355 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3356 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3358 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3359 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3360 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3361 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3363 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3364 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3365 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3366 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3368 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3369 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3370 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3371 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3373 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3374 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3375 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3376 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3381 print_spectrum (char * text
, int * buf
, int is_pulse
)
3394 puts ("-------------------------------------------------------------------------------");
3395 printf ("%s:\n", text
);
3397 for (i
= 0; i
< 256; i
++)
3399 if (buf
[i
] > max_value
)
3405 for (i
= 1; i
< 100; i
++)
3410 value
= (buf
[i
] * 60) / max_value
;
3412 for (j
= 0; j
< value
; j
++)
3416 printf (" %d\n", buf
[i
]);
3427 average
= (float) sum
/ (float) counter
;
3438 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3439 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3440 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3442 tolerance
= (max
- average
);
3444 if (average
- min
> tolerance
)
3446 tolerance
= average
- min
;
3449 tolerance
= tolerance
* 100 / average
;
3450 printf ("tol: %4.1f%%\n", tolerance
);
3460 #define STATE_LEFT_SHIFT 0x01
3461 #define STATE_RIGHT_SHIFT 0x02
3462 #define STATE_LEFT_CTRL 0x04
3463 #define STATE_LEFT_ALT 0x08
3464 #define STATE_RIGHT_ALT 0x10
3466 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3467 #define KEY_MENUE 0x80 // keycode = 0x0070
3468 #define KEY_BACK 0x81 // keycode = 0x0071
3469 #define KEY_FORWARD 0x82 // keycode = 0x0072
3470 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3471 #define KEY_WINDOW 0x84 // keycode = 0x0074
3472 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3473 #define KEY_STOP 0x86 // keycode = 0x0076
3474 #define KEY_MAIL 0x87 // keycode = 0x0077
3475 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3476 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3477 #define KEY_SETUP 0x8A // keycode = 0x007a
3478 #define KEY_FONT 0x8B // keycode = 0x007b
3479 #define KEY_PRINT 0x8C // keycode = 0x007c
3480 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3482 #define KEY_INSERT 0x90 // keycode = 0x004b
3483 #define KEY_DELETE 0x91 // keycode = 0x004c
3484 #define KEY_LEFT 0x92 // keycode = 0x004f
3485 #define KEY_HOME 0x93 // keycode = 0x0050
3486 #define KEY_END 0x94 // keycode = 0x0051
3487 #define KEY_UP 0x95 // keycode = 0x0053
3488 #define KEY_DOWN 0x96 // keycode = 0x0054
3489 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3490 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3491 #define KEY_RIGHT 0x99 // keycode = 0x0059
3492 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3493 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3496 get_fdc_key (uint16_t cmd
)
3498 static uint8_t key_table
[128] =
3500 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3501 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3502 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3503 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3504 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3506 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3507 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3508 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3509 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3511 static uint8_t state
;
3517 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3518 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3519 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3520 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3521 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3522 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3523 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3524 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3525 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3526 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3528 case 0x006e: key
= KEY_ESCAPE
; break;
3529 case 0x004b: key
= KEY_INSERT
; break;
3530 case 0x004c: key
= KEY_DELETE
; break;
3531 case 0x004f: key
= KEY_LEFT
; break;
3532 case 0x0050: key
= KEY_HOME
; break;
3533 case 0x0051: key
= KEY_END
; break;
3534 case 0x0053: key
= KEY_UP
; break;
3535 case 0x0054: key
= KEY_DOWN
; break;
3536 case 0x0055: key
= KEY_PAGE_UP
; break;
3537 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3538 case 0x0059: key
= KEY_RIGHT
; break;
3539 case 0x0400: key
= KEY_MOUSE_1
; break;
3540 case 0x0800: key
= KEY_MOUSE_2
; break;
3544 if (!(cmd
& 0x80)) // pressed key
3546 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3548 key
= cmd
+ 0x10; // 7x -> 8x
3550 else if (cmd
< 64) // key listed in key_table
3552 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3556 case 0x0003: key
= '²'; break;
3557 case 0x0008: key
= '{'; break;
3558 case 0x0009: key
= '['; break;
3559 case 0x000A: key
= ']'; break;
3560 case 0x000B: key
= '}'; break;
3561 case 0x000C: key
= '\\'; break;
3562 case 0x001C: key
= '~'; break;
3563 case 0x002D: key
= '|'; break;
3564 case 0x0034: key
= 0xB5; break; // Mu
3567 else if (state
& (STATE_LEFT_CTRL
))
3569 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3571 key
= key_table
[cmd
] - 'a' + 1;
3575 key
= key_table
[cmd
];
3580 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3584 key
= key_table
[idx
];
3596 static int analyze
= FALSE
;
3597 static int list
= FALSE
;
3598 static IRMP_DATA irmp_data
;
3603 if (! analyze
&& ! list
)
3607 if (irmp_get_data (&irmp_data
))
3611 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3615 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3618 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3620 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3622 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3623 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3625 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3627 char * p
= (char *) NULL
;
3631 case '\t' : p
= "TAB"; break;
3632 case '\r' : p
= "CR"; break;
3633 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3634 case KEY_MENUE
: p
= "MENUE"; break;
3635 case KEY_BACK
: p
= "BACK"; break;
3636 case KEY_FORWARD
: p
= "FORWARD"; break;
3637 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3638 case KEY_WINDOW
: p
= "WINDOW"; break;
3639 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3640 case KEY_STOP
: p
= "STOP"; break;
3641 case KEY_MAIL
: p
= "MAIL"; break;
3642 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3643 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3644 case KEY_SETUP
: p
= "SETUP"; break;
3645 case KEY_FONT
: p
= "FONT"; break;
3646 case KEY_PRINT
: p
= "PRINT"; break;
3647 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3649 case KEY_INSERT
: p
= "INSERT"; break;
3650 case KEY_DELETE
: p
= "DELETE"; break;
3651 case KEY_LEFT
: p
= "LEFT"; break;
3652 case KEY_HOME
: p
= "HOME"; break;
3653 case KEY_END
: p
= "END"; break;
3654 case KEY_UP
: p
= "UP"; break;
3655 case KEY_DOWN
: p
= "DOWN"; break;
3656 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3657 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3658 case KEY_RIGHT
: p
= "RIGHT"; break;
3659 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3660 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3661 default : p
= "<UNKNWON>"; break;
3664 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3665 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3669 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3670 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3675 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3676 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3683 main (int argc
, char ** argv
)
3691 int start_pulses
[256];
3692 int start_pauses
[256];
3696 int first_pulse
= TRUE
;
3697 int first_pause
= TRUE
;
3701 if (! strcmp (argv
[1], "-v"))
3705 else if (! strcmp (argv
[1], "-l"))
3709 else if (! strcmp (argv
[1], "-a"))
3713 else if (! strcmp (argv
[1], "-s"))
3717 else if (! strcmp (argv
[1], "-p"))
3724 for (i
= 0; i
< 256; i
++)
3726 start_pulses
[i
] = 0;
3727 start_pauses
[i
] = 0;
3734 while ((ch
= getchar ()) != EOF
)
3736 if (ch
== '_' || ch
== '0')
3744 printf ("pause: %d\n", pause
);
3753 start_pauses
[pause
]++;
3755 first_pause
= FALSE
;
3771 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3777 printf ("pulse: %d ", pulse
);
3786 start_pulses
[pulse
]++;
3788 first_pulse
= FALSE
;
3804 else if (ch
== '\n')
3808 if (list
&& pause
> 0)
3810 printf ("pause: %d\n", pause
);
3816 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
3828 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3835 puts ("-------------------------------------------------------------------");
3838 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3840 if (ch
!= '\r') // ignore CR in DOS/Windows files
3857 print_spectrum ("START PULSES", start_pulses
, TRUE
);
3858 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
3859 print_spectrum ("PULSES", pulses
, TRUE
);
3860 print_spectrum ("PAUSES", pauses
, FALSE
);
3861 puts ("-------------------------------------------------------------------------------");