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.124 2012/06/18 08:49:29 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)
168 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
169 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
171 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
172 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
174 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
175 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
176 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
177 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
178 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
179 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
180 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
181 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
183 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
184 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
185 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
186 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
187 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
188 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
190 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
191 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
192 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
193 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
194 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
195 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
196 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
197 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
198 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
201 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
202 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
203 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
204 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
205 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
206 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
207 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
208 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
209 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
210 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
212 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
213 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
214 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
215 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
216 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
217 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
218 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
219 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
220 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
223 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
225 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
226 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
227 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
228 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
229 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
230 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
231 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
232 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
233 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
234 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
235 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
236 #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
237 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
238 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
239 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
240 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
241 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
242 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
243 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
244 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
245 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
246 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
247 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
248 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
249 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
250 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
252 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
253 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
254 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
255 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
256 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
257 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
258 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
260 #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)
261 #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)
262 #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)
263 #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)
264 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
265 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
266 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
267 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
269 #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
270 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
271 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
272 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
273 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
274 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
275 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
276 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
278 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
280 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
282 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
284 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
285 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
286 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
287 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
288 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
289 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
290 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
291 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
292 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
293 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
295 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
296 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
297 #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!
298 #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!
299 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
300 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
301 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
302 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
303 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
304 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
305 // autodetect JVC repetition frame within 50 msec:
306 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
308 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
309 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
310 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
311 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
312 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
313 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
314 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
315 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
316 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
317 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
318 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
319 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
320 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
322 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
323 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
324 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
325 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
326 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
327 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
328 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
329 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
330 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
331 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
332 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
333 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
334 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
335 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
337 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
338 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
339 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
340 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
341 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
342 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
343 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
344 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
346 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
347 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
348 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
349 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
350 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
351 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
352 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
353 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
354 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
355 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
357 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
360 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
361 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
362 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
363 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
365 static int time_counter
;
368 # define ANALYZE_PUTCHAR(a)
369 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
370 # define ANALYZE_PRINTF(...)
371 # define ANALYZE_NEWLINE()
374 #if IRMP_USE_CALLBACK == 1
375 static void (*irmp_callback_ptr
) (uint8_t);
376 #endif // IRMP_USE_CALLBACK == 1
378 /*---------------------------------------------------------------------------------------------------------------------------------------------------
380 *---------------------------------------------------------------------------------------------------------------------------------------------------
382 #if IRMP_PROTOCOL_NAMES == 1
384 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
420 /*---------------------------------------------------------------------------------------------------------------------------------------------------
422 *---------------------------------------------------------------------------------------------------------------------------------------------------
424 #if IRMP_LOGGING == 1 // logging via UART
426 #if IRMP_EXT_LOGGING == 1 // use external logging
427 #include "irmpextlog.h"
428 #else // normal UART log (IRMP_EXT_LOGGING == 0)
430 #include <util/setbaud.h>
434 #define UART0_UBRRH UBRR0H
435 #define UART0_UBRRL UBRR0L
436 #define UART0_UCSRA UCSR0A
437 #define UART0_UCSRB UCSR0B
438 #define UART0_UCSRC UCSR0C
439 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
440 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
441 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
443 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
445 #define UART0_URSEL_BIT_VALUE (0)
447 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
448 #define UART0_UDR UDR0
449 #define UART0_U2X U2X0
453 #define UART0_UBRRH UBRRH
454 #define UART0_UBRRL UBRRL
455 #define UART0_UCSRA UCSRA
456 #define UART0_UCSRB UCSRB
457 #define UART0_UCSRC UCSRC
458 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
459 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
460 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
462 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
464 #define UART0_URSEL_BIT_VALUE (0)
466 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
467 #define UART0_UDR UDR
468 #define UART0_U2X U2X
471 #endif //IRMP_EXT_LOGGING
473 /*---------------------------------------------------------------------------------------------------------------------------------------------------
475 * @details Initializes UART
476 *---------------------------------------------------------------------------------------------------------------------------------------------------
479 irmp_uart_init (void)
481 #if (IRMP_EXT_LOGGING == 0) // use UART
482 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
483 UART0_UBRRL
= UBRRL_VALUE
;
486 UART0_UCSRA
|= (1<<UART0_U2X
);
488 UART0_UCSRA
&= ~(1<<UART0_U2X
);
491 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
492 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
493 #else // other log method
495 #endif //IRMP_EXT_LOGGING
498 /*---------------------------------------------------------------------------------------------------------------------------------------------------
500 * @details Sends character
501 * @param ch character to be transmitted
502 *---------------------------------------------------------------------------------------------------------------------------------------------------
505 irmp_uart_putc (unsigned char ch
)
507 #if (IRMP_EXT_LOGGING == 0)
508 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
515 sendextlog(ch
); //Use external log
519 /*---------------------------------------------------------------------------------------------------------------------------------------------------
521 *---------------------------------------------------------------------------------------------------------------------------------------------------
524 #define STARTCYCLES 2 // min count of zeros before start of logging
525 #define ENDBITS 1000 // number of sequenced highbits to detect end
526 #define DATALEN 700 // log buffer size
529 irmp_log (uint8_t val
)
531 static uint8_t buf
[DATALEN
]; // logging buffer
532 static uint16_t buf_idx
; // number of written bits
533 static uint8_t startcycles
; // current number of start-zeros
534 static uint16_t cnt
; // counts sequenced highbits - to detect end
536 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
544 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
546 if (buf_idx
< DATALEN
* 8) // index in range?
550 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
554 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
561 { // if high received then look at log-stop condition
565 { // if stop condition is true, output on uart
568 for (i
= 0; i
< STARTCYCLES
; i
++)
570 irmp_uart_putc ('0'); // the ignored starting zeros
573 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
578 for (j
= 0; j
< 8; j
++)
580 irmp_uart_putc ((d
& 1) + '0');
585 irmp_uart_putc ('\n');
598 #define irmp_log(val)
599 #endif //IRMP_LOGGING
603 uint8_t protocol
; // ir protocol
604 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
605 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
606 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
607 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
608 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
609 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
610 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
611 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
612 uint8_t address_offset
; // address offset
613 uint8_t address_end
; // end of address
614 uint8_t command_offset
; // command offset
615 uint8_t command_end
; // end of command
616 uint8_t complete_len
; // complete length of frame
617 uint8_t stop_bit
; // flag: frame has stop bit
618 uint8_t lsb_first
; // flag: LSB first
619 uint8_t flags
; // some flags
622 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
624 static const PROGMEM IRMP_PARAMETER sircs_param
=
626 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
627 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
628 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
629 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
630 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
631 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
632 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
633 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
634 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
635 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
636 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
637 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
638 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
639 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
640 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
641 SIRCS_LSB
, // lsb_first: flag: LSB first
642 SIRCS_FLAGS
// flags: some flags
647 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
649 static const PROGMEM IRMP_PARAMETER nec_param
=
651 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
652 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
653 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
654 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
655 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
656 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
657 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
658 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
659 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
660 NEC_ADDRESS_OFFSET
, // address_offset: address offset
661 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
662 NEC_COMMAND_OFFSET
, // command_offset: command offset
663 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
664 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
665 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
666 NEC_LSB
, // lsb_first: flag: LSB first
667 NEC_FLAGS
// flags: some flags
670 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
672 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
673 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
674 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
675 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
676 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
677 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
678 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
679 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
680 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
681 0, // address_offset: address offset
682 0, // address_end: end of address
683 0, // command_offset: command offset
684 0, // command_end: end of command
685 0, // complete_len: complete length of frame
686 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
687 NEC_LSB
, // lsb_first: flag: LSB first
688 NEC_FLAGS
// flags: some flags
693 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
695 static const PROGMEM IRMP_PARAMETER nec42_param
=
697 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
698 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
699 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
700 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
701 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
702 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
703 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
704 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
705 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
706 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
707 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
708 NEC42_COMMAND_OFFSET
, // command_offset: command offset
709 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
710 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
711 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
712 NEC_LSB
, // lsb_first: flag: LSB first
713 NEC_FLAGS
// flags: some flags
718 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
720 static const PROGMEM IRMP_PARAMETER samsung_param
=
722 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
723 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
724 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
725 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
726 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
727 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
728 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
729 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
730 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
731 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
732 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
733 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
734 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
735 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
736 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
737 SAMSUNG_LSB
, // lsb_first: flag: LSB first
738 SAMSUNG_FLAGS
// flags: some flags
743 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
745 static const PROGMEM IRMP_PARAMETER matsushita_param
=
747 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
748 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
749 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
750 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
751 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
752 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
753 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
754 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
755 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
756 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
757 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
758 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
759 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
760 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
761 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
762 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
763 MATSUSHITA_FLAGS
// flags: some flags
768 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
770 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
772 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
773 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
774 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
775 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
776 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
777 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
778 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
779 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
780 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
781 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
782 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
783 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
784 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
785 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
786 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
787 KASEIKYO_LSB
, // lsb_first: flag: LSB first
788 KASEIKYO_FLAGS
// flags: some flags
793 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
795 static const PROGMEM IRMP_PARAMETER recs80_param
=
797 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
798 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
799 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
800 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
801 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
802 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
803 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
804 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
805 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
806 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
807 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
808 RECS80_COMMAND_OFFSET
, // command_offset: command offset
809 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
810 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
811 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
812 RECS80_LSB
, // lsb_first: flag: LSB first
813 RECS80_FLAGS
// flags: some flags
818 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
820 static const PROGMEM IRMP_PARAMETER rc5_param
=
822 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
823 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
824 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
825 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
826 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
827 0, // pulse_0_len_min: here: not used
828 0, // pulse_0_len_max: here: not used
829 0, // pause_0_len_min: here: not used
830 0, // pause_0_len_max: here: not used
831 RC5_ADDRESS_OFFSET
, // address_offset: address offset
832 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
833 RC5_COMMAND_OFFSET
, // command_offset: command offset
834 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
835 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
836 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
837 RC5_LSB
, // lsb_first: flag: LSB first
838 RC5_FLAGS
// flags: some flags
843 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
845 static const PROGMEM IRMP_PARAMETER denon_param
=
847 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
848 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
849 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
850 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
851 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
852 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
853 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
854 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
855 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
856 DENON_ADDRESS_OFFSET
, // address_offset: address offset
857 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
858 DENON_COMMAND_OFFSET
, // command_offset: command offset
859 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
860 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
861 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
862 DENON_LSB
, // lsb_first: flag: LSB first
863 DENON_FLAGS
// flags: some flags
868 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
870 static const PROGMEM IRMP_PARAMETER rc6_param
=
872 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
874 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
875 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
876 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
877 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
878 0, // pulse_0_len_min: here: not used
879 0, // pulse_0_len_max: here: not used
880 0, // pause_0_len_min: here: not used
881 0, // pause_0_len_max: here: not used
882 RC6_ADDRESS_OFFSET
, // address_offset: address offset
883 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
884 RC6_COMMAND_OFFSET
, // command_offset: command offset
885 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
886 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
887 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
888 RC6_LSB
, // lsb_first: flag: LSB first
889 RC6_FLAGS
// flags: some flags
894 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
896 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
898 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
899 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
900 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
901 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
902 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
903 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
904 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
905 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
906 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
907 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
908 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
909 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
910 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
911 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
912 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
913 RECS80EXT_LSB
, // lsb_first: flag: LSB first
914 RECS80EXT_FLAGS
// flags: some flags
919 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
921 static const PROGMEM IRMP_PARAMETER nubert_param
=
923 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
924 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
925 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
926 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
927 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
928 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
929 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
930 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
931 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
932 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
933 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
934 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
935 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
936 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
937 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
938 NUBERT_LSB
, // lsb_first: flag: LSB first
939 NUBERT_FLAGS
// flags: some flags
944 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
946 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
948 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
949 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
950 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
951 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
952 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
953 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
954 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
955 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
956 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
957 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
958 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
959 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
960 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
961 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
962 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
963 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
964 BANG_OLUFSEN_FLAGS
// flags: some flags
969 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
971 static uint8_t first_bit
;
973 static const PROGMEM IRMP_PARAMETER grundig_param
=
975 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
977 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
978 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
979 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
980 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
981 0, // pulse_0_len_min: here: not used
982 0, // pulse_0_len_max: here: not used
983 0, // pause_0_len_min: here: not used
984 0, // pause_0_len_max: here: not used
985 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
986 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
987 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
988 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
989 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
990 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
991 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
992 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
997 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
999 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1001 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1002 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1003 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1004 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1005 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1006 0, // pulse_0_len_min: here: not used
1007 0, // pulse_0_len_max: here: not used
1008 0, // pause_0_len_min: here: not used
1009 0, // pause_0_len_max: here: not used
1010 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1011 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1012 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1013 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1014 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1015 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1016 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1017 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1022 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1024 static const PROGMEM IRMP_PARAMETER fdc_param
=
1026 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1027 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1028 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1029 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1030 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1031 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1032 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1033 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1034 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1035 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1036 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1037 FDC_COMMAND_OFFSET
, // command_offset: command offset
1038 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1039 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1040 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1041 FDC_LSB
, // lsb_first: flag: LSB first
1042 FDC_FLAGS
// flags: some flags
1047 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1049 static const PROGMEM IRMP_PARAMETER rccar_param
=
1051 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1052 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1053 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1054 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1055 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1056 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1057 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1058 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1059 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1060 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1061 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1062 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1063 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1064 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1065 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1066 RCCAR_LSB
, // lsb_first: flag: LSB first
1067 RCCAR_FLAGS
// flags: some flags
1072 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1074 static const PROGMEM IRMP_PARAMETER nikon_param
=
1076 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1077 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1078 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1079 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1080 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1081 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1082 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1083 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1084 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1085 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1086 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1087 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1088 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1089 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1090 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1091 NIKON_LSB
, // lsb_first: flag: LSB first
1092 NIKON_FLAGS
// flags: some flags
1097 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1099 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1101 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1102 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1103 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1104 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1105 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1106 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1107 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1108 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1109 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1110 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1111 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1112 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1113 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1114 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1115 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1116 KATHREIN_LSB
, // lsb_first: flag: LSB first
1117 KATHREIN_FLAGS
// flags: some flags
1122 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1124 static const PROGMEM IRMP_PARAMETER netbox_param
=
1126 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1127 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1128 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1129 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1130 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1131 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1132 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1133 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1134 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1135 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1136 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1137 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1138 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1139 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1140 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1141 NETBOX_LSB
, // lsb_first: flag: LSB first
1142 NETBOX_FLAGS
// flags: some flags
1147 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1149 static const PROGMEM IRMP_PARAMETER lego_param
=
1151 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1152 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1153 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1154 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1155 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1156 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1157 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1158 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1159 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1160 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1161 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1162 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1163 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1164 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1165 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1166 LEGO_LSB
, // lsb_first: flag: LSB first
1167 LEGO_FLAGS
// flags: some flags
1172 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1174 static const PROGMEM IRMP_PARAMETER thomson_param
=
1176 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1177 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1178 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1179 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1180 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1181 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1182 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1183 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1184 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1185 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1186 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1187 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1188 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1189 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1190 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1191 THOMSON_LSB
, // lsb_first: flag: LSB first
1192 THOMSON_FLAGS
// flags: some flags
1197 static uint8_t irmp_bit
; // current bit position
1198 static IRMP_PARAMETER irmp_param
;
1200 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1201 static IRMP_PARAMETER irmp_param2
;
1204 static volatile uint8_t irmp_ir_detected
;
1205 static volatile uint8_t irmp_protocol
;
1206 static volatile uint16_t irmp_address
;
1207 static volatile uint16_t irmp_command
;
1208 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1209 static volatile uint8_t irmp_flags
;
1210 // static volatile uint8_t irmp_busy_flag;
1213 #define input(x) (x)
1214 static uint8_t IRMP_PIN
;
1217 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1218 * Initialize IRMP decoder
1219 * @details Configures IRMP input pin
1220 *---------------------------------------------------------------------------------------------------------------------------------------------------
1226 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1227 #elif defined (ARM_STM32) // STM32
1228 GPIO_InitTypeDef GPIO_InitStructure
;
1230 /* GPIOx clock enable */
1231 #if defined (ARM_STM32L1XX)
1232 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1233 #elif defined (ARM_STM32F10X)
1234 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1235 #elif defined (ARM_STM32F4XX)
1236 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1239 /* GPIO Configuration */
1240 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1241 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1242 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1243 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1244 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1245 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1246 #elif defined (ARM_STM32F10X)
1247 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1248 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1250 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1252 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1253 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1256 #if IRMP_LOGGING == 1
1261 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1263 * @details gets decoded IRMP data
1264 * @param pointer in order to store IRMP data
1265 * @return TRUE: successful, FALSE: failed
1266 *---------------------------------------------------------------------------------------------------------------------------------------------------
1269 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1271 uint8_t rtc
= FALSE
;
1273 if (irmp_ir_detected
)
1275 switch (irmp_protocol
)
1277 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1278 case IRMP_SAMSUNG_PROTOCOL
:
1279 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1281 irmp_command
&= 0xff;
1282 irmp_command
|= irmp_id
<< 8;
1287 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1288 case IRMP_NEC_PROTOCOL
:
1289 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1291 irmp_command
&= 0xff;
1294 else if (irmp_address
== 0x87EE)
1296 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1297 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1298 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1299 irmp_command
&= 0x00FF;
1304 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1305 case IRMP_SIEMENS_PROTOCOL
:
1306 case IRMP_RUWIDO_PROTOCOL
:
1307 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1314 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1315 case IRMP_KATHREIN_PROTOCOL
:
1316 if (irmp_command
!= 0x0000)
1322 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1323 case IRMP_RC5_PROTOCOL
:
1324 irmp_address
&= ~0x20; // clear toggle bit
1328 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1329 case IRMP_IR60_PROTOCOL
:
1330 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1336 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1340 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1341 case IRMP_RCCAR_PROTOCOL
:
1342 // frame in irmp_data:
1343 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1344 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1345 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1346 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1347 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1348 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1349 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1353 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1354 case IRMP_NETBOX_PROTOCOL
:
1355 if (irmp_command
& 0x1000) // last bit set?
1357 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1360 irmp_command
&= 0x7F;
1363 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1366 irmp_command
|= 0x80;
1371 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1376 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1380 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1381 case IRMP_LEGO_PROTOCOL
:
1383 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1385 if ((irmp_command
& 0x000F) == crc
)
1392 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1407 irmp_data_p
->protocol
= irmp_protocol
;
1408 irmp_data_p
->address
= irmp_address
;
1409 irmp_data_p
->command
= irmp_command
;
1410 irmp_data_p
->flags
= irmp_flags
;
1416 irmp_ir_detected
= FALSE
;
1423 // irmp_is_busy (void)
1425 // return irmp_busy_flag;
1428 #if IRMP_USE_CALLBACK == 1
1430 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1432 irmp_callback_ptr
= cb
;
1434 #endif // IRMP_USE_CALLBACK == 1
1436 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1437 static uint16_t irmp_tmp_address
; // ir address
1438 static uint16_t irmp_tmp_command
; // ir command
1440 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1441 static uint16_t irmp_tmp_address2
; // ir address
1442 static uint16_t irmp_tmp_command2
; // ir command
1445 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1446 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1448 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1449 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1450 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1453 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1455 * @details store bit in temp address or temp command
1456 * @param value to store: 0 or 1
1457 *---------------------------------------------------------------------------------------------------------------------------------------------------
1459 // verhindert, dass irmp_store_bit() inline compiliert wird:
1460 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1463 irmp_store_bit (uint8_t value
)
1465 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1466 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1473 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1475 if (irmp_param
.lsb_first
)
1477 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1481 irmp_tmp_address
<<= 1;
1482 irmp_tmp_address
|= value
;
1485 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1487 if (irmp_param
.lsb_first
)
1489 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1493 irmp_tmp_command
<<= 1;
1494 irmp_tmp_command
|= value
;
1498 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1499 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1501 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1506 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1507 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1509 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1514 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1515 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1517 if (irmp_bit
>= 20 && irmp_bit
< 24)
1519 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1521 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1523 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1526 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1530 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1534 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1547 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1549 * @details store bit in temp address or temp command
1550 * @param value to store: 0 or 1
1551 *---------------------------------------------------------------------------------------------------------------------------------------------------
1553 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1555 irmp_store_bit2 (uint8_t value
)
1559 if (irmp_param
.protocol
)
1561 irmp_bit2
= irmp_bit
- 2;
1565 irmp_bit2
= irmp_bit
- 1;
1568 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1570 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1572 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1574 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1577 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1579 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1581 * @details ISR routine, called 10000 times per second
1582 *---------------------------------------------------------------------------------------------------------------------------------------------------
1587 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1588 static uint8_t wait_for_space
; // flag: wait for data bit space
1589 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1590 static uint8_t irmp_pulse_time
; // count bit time for pulse
1591 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1592 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1593 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1594 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1595 static uint8_t repetition_frame_number
;
1596 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1597 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1599 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1600 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1602 #if IRMP_SUPPORT_MANCHESTER == 1
1603 static PAUSE_LEN last_pause
; // last pause value
1605 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1606 static uint8_t last_value
; // last bit value
1608 uint8_t irmp_input
; // input value
1614 irmp_input
= input(IRMP_PIN
);
1616 #if IRMP_USE_CALLBACK == 1
1617 if (irmp_callback_ptr
)
1619 static uint8_t last_inverted_input
;
1621 if (last_inverted_input
!= !irmp_input
)
1623 (*irmp_callback_ptr
) (! irmp_input
);
1624 last_inverted_input
= !irmp_input
;
1627 #endif // IRMP_USE_CALLBACK == 1
1629 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1631 if (! irmp_ir_detected
) // ir code already detected?
1633 if (! irmp_start_bit_detected
) // start bit detected?
1635 if (! irmp_input
) // receiving burst?
1637 // irmp_busy_flag = TRUE;
1639 if (! irmp_pulse_time
)
1641 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1644 irmp_pulse_time
++; // increment counter
1648 if (irmp_pulse_time
) // it's dark....
1649 { // set flags for counting the time of darkness...
1650 irmp_start_bit_detected
= 1;
1651 wait_for_start_space
= 1;
1653 irmp_tmp_command
= 0;
1654 irmp_tmp_address
= 0;
1655 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1659 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1660 irmp_tmp_command2
= 0;
1661 irmp_tmp_address2
= 0;
1665 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1666 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1667 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1672 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1676 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1677 if (repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
1679 ANALYZE_PRINTF ("%8.3fms error 6: did not receive inverted command repetition\n",
1680 (double) (time_counter
* 1000) / F_INTERRUPTS
);
1681 last_irmp_denon_command
= 0;
1683 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1690 if (wait_for_start_space
) // we have received start bit...
1691 { // ...and are counting the time of darkness
1692 if (irmp_input
) // still dark?
1694 irmp_pause_time
++; // increment counter
1696 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1697 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
) ||
1698 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1700 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1703 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1704 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1709 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1711 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
);
1712 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1714 // irmp_busy_flag = FALSE;
1715 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1716 irmp_pulse_time
= 0;
1717 irmp_pause_time
= 0;
1721 { // receiving first data pulse!
1722 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1724 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1725 irmp_param2
.protocol
= 0;
1728 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1730 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1731 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1732 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1734 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1735 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1736 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1737 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1740 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1742 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1743 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1744 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1745 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1747 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1748 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1749 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1750 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1753 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1755 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1756 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1757 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1759 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1760 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1761 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1762 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1763 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1765 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1766 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1767 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1768 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1772 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1773 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1775 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1776 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
1777 { // some jvc remote controls use nec repetition frame for jvc repetition frame
1778 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1779 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1780 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1781 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1784 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1786 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1787 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1788 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1790 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
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
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1798 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
1799 { // it's JVC repetition type 3
1800 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1801 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1802 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
1803 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1806 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1808 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1810 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1811 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1812 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1814 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1815 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1816 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1817 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1820 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1822 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1823 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1824 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1826 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1827 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
1828 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
1829 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
1832 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1834 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1835 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
1836 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
1837 { // it's MATSUSHITA
1838 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1839 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
1840 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
1841 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
1844 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1846 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1847 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
1848 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
1850 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1851 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
1852 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
1853 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
1856 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1858 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1859 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
1860 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
1862 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1863 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
1864 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
1865 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
1868 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
1870 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1871 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
1872 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
1873 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
1874 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
1876 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1877 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
1878 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
1880 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
1881 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1882 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
1883 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
1884 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1885 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1886 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1887 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
1890 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
1892 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1893 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
1894 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
1896 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
1897 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1898 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
1899 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
1900 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1901 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1902 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1903 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
1906 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1908 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
1909 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1910 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
1911 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1912 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
1915 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
1916 last_pause
= irmp_pause_time
;
1918 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
1919 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
1922 rc5_cmd_bit6
= 1<<6;
1930 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
1932 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1933 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
1934 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
1935 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
1937 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
1938 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
1939 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
1940 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
1941 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
1944 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1946 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1947 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
1948 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
1949 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
1951 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
1952 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
1953 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
1954 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
1955 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
1958 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1960 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1961 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
1962 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
1964 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1965 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
1966 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
1967 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
1972 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
1974 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1975 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
1976 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
1978 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1979 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
1980 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
1981 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
1984 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1986 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1987 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
1988 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
1990 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1991 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
1992 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
1993 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
1996 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1998 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1999 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2000 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2001 { // it's BANG_OLUFSEN
2002 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2003 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2004 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2005 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2006 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2007 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2008 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2009 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2010 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2011 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2012 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2013 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2014 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2015 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2019 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2021 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2022 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2023 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2025 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2026 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2027 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2028 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2029 last_pause
= irmp_pause_time
;
2033 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2035 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2036 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2037 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2038 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2039 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2040 { // it's RUWIDO or SIEMENS
2041 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2042 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2043 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2044 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2045 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2046 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2047 last_pause
= irmp_pause_time
;
2051 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2053 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2054 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2055 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2057 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2058 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2059 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2060 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2063 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2065 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2066 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2067 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2069 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2070 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2071 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2072 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2075 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2077 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2078 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2079 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2081 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2082 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2083 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2084 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2087 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2089 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2090 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2091 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2093 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2094 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2095 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2096 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2099 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2101 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2102 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2103 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2105 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2106 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2107 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2108 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2111 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2114 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2115 // irmp_busy_flag = FALSE;
2116 irmp_start_bit_detected
= 0; // wait for another start bit...
2119 if (irmp_start_bit_detected
)
2121 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2124 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2126 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2127 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2131 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2132 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2133 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2134 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2137 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2138 if (irmp_param2
.protocol
)
2140 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2141 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2142 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2143 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2148 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2149 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2151 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2155 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2157 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2158 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2162 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2163 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2164 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2165 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2168 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2169 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2171 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2172 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2176 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2177 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2178 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2179 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2185 #if IRMP_SUPPORT_MANCHESTER == 1
2186 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2187 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2188 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2190 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2192 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2193 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2195 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2197 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2199 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2201 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2203 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2207 #endif // IRMP_SUPPORT_MANCHESTER == 1
2209 #if IRMP_SUPPORT_SERIAL == 1
2210 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2215 #endif // IRMP_SUPPORT_SERIAL == 1
2218 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2219 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2221 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2223 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2224 { // pause timings correct for "1"?
2225 ANALYZE_PUTCHAR ('1'); // yes, store 1
2229 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2230 { // pause timings correct for "0"?
2231 ANALYZE_PUTCHAR ('0'); // yes, store 0
2237 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2238 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2239 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2241 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2243 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2244 { // pause timings correct for "1"?
2245 ANALYZE_PUTCHAR ('1'); // yes, store 1
2249 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2250 { // pause timings correct for "0"?
2251 ANALYZE_PUTCHAR ('0'); // yes, store 0
2257 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2259 ; // else do nothing
2262 irmp_pulse_time
= 1; // set counter to 1, not 0
2263 irmp_pause_time
= 0;
2264 wait_for_start_space
= 0;
2267 else if (wait_for_space
) // the data section....
2268 { // counting the time of darkness....
2269 uint8_t got_light
= FALSE
;
2271 if (irmp_input
) // still dark?
2273 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2276 #if IRMP_SUPPORT_MANCHESTER == 1
2277 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2279 #if IRMP_SUPPORT_SERIAL == 1
2280 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2282 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2285 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2287 ANALYZE_PRINTF ("stop bit detected\n");
2290 irmp_param
.stop_bit
= 0;
2294 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",
2295 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2297 // irmp_busy_flag = FALSE;
2298 irmp_start_bit_detected
= 0; // wait for another start bit...
2299 irmp_pulse_time
= 0;
2300 irmp_pause_time
= 0;
2305 irmp_pause_time
++; // increment counter
2307 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2308 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2309 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2310 irmp_bit
>= 12 - 1) // pause too long?
2311 { // yes, break and close this frame
2312 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2313 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2314 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2315 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2316 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2320 #if IRMP_SUPPORT_SERIAL == 1
2321 // NETBOX generates no stop bit, here is the timeout condition:
2322 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2323 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2325 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2329 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2330 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2332 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2334 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2335 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2336 irmp_param
.stop_bit
= TRUE
; // set flag
2338 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2339 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2340 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2341 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2342 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2343 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2345 irmp_tmp_command
<<= 1;
2346 irmp_tmp_command
|= first_bit
;
2348 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2349 { // special manchester decoder
2350 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2351 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2352 irmp_param
.stop_bit
= TRUE
; // set flag
2354 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2356 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2357 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2358 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2359 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2360 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2361 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2363 if (irmp_tmp_command
& 0x300)
2365 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2366 irmp_tmp_command
&= 0xFF;
2372 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2373 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2375 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2376 { // special manchester decoder
2377 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2378 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2379 irmp_param
.stop_bit
= TRUE
; // set flag
2381 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2383 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2384 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2385 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2386 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2387 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2388 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2391 // RUWIDO: AAAAAAAAACCCCCCCp
2392 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2393 irmp_tmp_address
<<= 2;
2394 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2395 irmp_tmp_command
&= 0x003F;
2396 irmp_tmp_command
<<= 4;
2397 irmp_tmp_command
|= last_value
;
2402 #if IRMP_SUPPORT_MANCHESTER == 1
2403 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2404 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2405 { // special manchester decoder
2406 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2407 irmp_param
.stop_bit
= TRUE
; // set flag
2410 #endif // IRMP_SUPPORT_MANCHESTER == 1
2411 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2413 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2417 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2418 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2420 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2421 irmp_param
.stop_bit
= TRUE
; // set flag
2422 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2423 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2424 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2425 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2426 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2428 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2430 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2431 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2432 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2434 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2435 irmp_param
.stop_bit
= TRUE
; // set flag
2436 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2437 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2439 // 0123456789ABC0123456789ABC0123456701234567
2440 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2441 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2442 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2443 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2445 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2446 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2447 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2449 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2450 irmp_param
.stop_bit
= TRUE
; // set flag
2451 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2452 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2454 // 0123456789ABC0123456789ABC0123456701234567
2455 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2456 // JVC: AAAACCCCCCCCCCCC
2457 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2458 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2460 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2461 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2464 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2465 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2467 // irmp_busy_flag = FALSE;
2468 irmp_start_bit_detected
= 0; // wait for another start bit...
2469 irmp_pulse_time
= 0;
2470 irmp_pause_time
= 0;
2482 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2484 #if IRMP_SUPPORT_MANCHESTER == 1
2485 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2488 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2489 #else // better, but some IR-RCs use asymmetric timings :-/
2490 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2491 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2494 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2495 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2497 ANALYZE_PUTCHAR ('T');
2498 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2511 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2513 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2514 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2516 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2517 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2519 ANALYZE_PUTCHAR ('T');
2522 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2533 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2535 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2536 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2537 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2538 if (! irmp_param2
.protocol
)
2543 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2547 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2548 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2550 uint8_t manchester_value
;
2552 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2554 manchester_value
= last_value
? 0 : 1;
2555 last_value
= manchester_value
;
2559 manchester_value
= last_value
;
2562 ANALYZE_PUTCHAR (manchester_value
+ '0');
2564 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2565 if (! irmp_param2
.protocol
)
2571 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2572 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2574 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2575 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2576 irmp_param
.address_offset
= 5;
2577 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2578 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2579 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2580 irmp_tmp_address
= 0;
2582 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2584 irmp_store_bit (manchester_value
);
2588 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2589 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2590 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2591 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2592 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2594 ANALYZE_PUTCHAR ('?');
2595 irmp_param
.protocol
= 0; // switch to FDC, see below
2598 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2599 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2600 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2601 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2602 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2603 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2605 ANALYZE_PUTCHAR ('?');
2606 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2609 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2611 ANALYZE_PUTCHAR ('?');
2613 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2614 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2615 // irmp_busy_flag = FALSE;
2616 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2617 irmp_pause_time
= 0;
2621 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2622 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2624 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2626 ANALYZE_PRINTF (" 1 (FDC)\n");
2627 irmp_store_bit2 (1);
2629 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2631 ANALYZE_PRINTF (" 0 (FDC)\n");
2632 irmp_store_bit2 (0);
2635 if (! irmp_param
.protocol
)
2637 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2638 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2639 irmp_param2
.protocol
= 0;
2640 irmp_tmp_address
= irmp_tmp_address2
;
2641 irmp_tmp_command
= irmp_tmp_command2
;
2644 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2645 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2646 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2648 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2650 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2651 irmp_store_bit2 (1);
2653 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2655 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2656 irmp_store_bit2 (0);
2659 if (! irmp_param
.protocol
)
2661 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2662 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2663 irmp_param2
.protocol
= 0;
2664 irmp_tmp_address
= irmp_tmp_address2
;
2665 irmp_tmp_command
= irmp_tmp_command2
;
2668 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2670 last_pause
= irmp_pause_time
;
2674 #endif // IRMP_SUPPORT_MANCHESTER == 1
2676 #if IRMP_SUPPORT_SERIAL == 1
2677 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2679 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2681 ANALYZE_PUTCHAR ('1');
2684 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2686 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2690 irmp_pulse_time
= 0;
2694 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2696 ANALYZE_PUTCHAR ('0');
2699 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2701 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2705 irmp_pause_time
= 0;
2712 #endif // IRMP_SUPPORT_SERIAL == 1
2714 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2715 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2717 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2718 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2720 ANALYZE_PRINTF ("SYNC\n");
2725 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2727 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2728 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2729 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2730 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2732 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2734 ANALYZE_PUTCHAR ('1');
2741 ANALYZE_PUTCHAR ('0');
2747 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2750 { // timing incorrect!
2751 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2752 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2753 // irmp_busy_flag = FALSE;
2754 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2755 irmp_pause_time
= 0;
2759 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2761 #if IRMP_SUPPORT_NEC16_PROTOCOL
2762 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2763 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
2764 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
2765 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
2766 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2767 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2769 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2770 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
2771 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
2772 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
2773 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
2774 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
2775 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
2779 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2781 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2782 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2784 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2786 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2788 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2790 ANALYZE_PRINTF ("3rd start bit\n");
2795 { // timing incorrect!
2796 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
);
2797 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2798 // irmp_busy_flag = FALSE;
2799 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2800 irmp_pause_time
= 0;
2803 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2805 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2807 ANALYZE_PRINTF ("trailer bit\n");
2812 { // timing incorrect!
2813 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
);
2814 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2815 // irmp_busy_flag = FALSE;
2816 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2817 irmp_pause_time
= 0;
2822 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
2823 { // pulse & pause timings correct for "1"?
2824 ANALYZE_PUTCHAR ('1');
2830 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
2831 { // pulse & pause timings correct for "0"?
2832 ANALYZE_PUTCHAR ('0');
2838 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
2840 ANALYZE_PUTCHAR (last_value
+ '0');
2842 irmp_store_bit (last_value
);
2846 { // timing incorrect!
2847 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
);
2848 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2849 // irmp_busy_flag = FALSE;
2850 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2851 irmp_pause_time
= 0;
2856 { // timing incorrect!
2857 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
);
2858 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2859 // irmp_busy_flag = FALSE;
2860 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2861 irmp_pause_time
= 0;
2865 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
2867 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
2868 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
2869 { // pulse & pause timings correct for "1"?
2870 ANALYZE_PUTCHAR ('1');
2875 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2876 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2877 { // pulse & pause timings correct for "0"?
2878 ANALYZE_PUTCHAR ('0');
2884 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
2886 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
2887 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
2888 (((irmp_bit
== 8 || irmp_bit
== 6) &&
2889 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
2891 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
2897 ANALYZE_PUTCHAR ('S');
2899 irmp_tmp_command
<<= 1;
2903 ANALYZE_PUTCHAR ('S');
2910 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
2911 { // timing incorrect!
2912 ANALYZE_PRINTF ("error 3: 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;
2919 irmp_pulse_time
= 1; // set counter to 1, not 0
2923 { // counting the pulse length ...
2924 if (! irmp_input
) // still light?
2926 irmp_pulse_time
++; // increment counter
2930 wait_for_space
= 1; // let's count the time (see above)
2931 irmp_pause_time
= 1; // set pause counter to 1, not 0
2935 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
2937 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
2939 repetition_frame_number
++;
2943 repetition_frame_number
= 0;
2946 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2947 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
2948 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
2950 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2951 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2957 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2958 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
2959 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
2961 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2962 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2968 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2969 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2970 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
2972 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2973 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2979 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2980 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2981 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
2983 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2984 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2991 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
2992 irmp_ir_detected
= TRUE
;
2994 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2995 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2996 { // check for repetition frame
2997 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
2999 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3000 last_irmp_denon_command
= 0;
3002 irmp_protocol
= irmp_param
.protocol
; // store protocol
3003 irmp_address
= irmp_tmp_address
; // store address
3004 irmp_command
= irmp_tmp_command
; // store command
3008 ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3009 irmp_ir_detected
= FALSE
;
3010 last_irmp_denon_command
= irmp_tmp_command
;
3015 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3017 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3018 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3019 { // Grundig start frame?
3020 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3021 irmp_ir_detected
= FALSE
;
3024 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3026 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3027 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3028 { // Nokia start frame?
3029 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3030 irmp_ir_detected
= FALSE
;
3033 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3035 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3036 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3038 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3040 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3041 irmp_tmp_address
= last_irmp_address
; // address is last address
3042 irmp_tmp_command
= last_irmp_command
; // command is last command
3043 irmp_flags
|= IRMP_FLAG_REPETITION
;
3048 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3049 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3050 irmp_ir_detected
= FALSE
;
3053 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3055 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3056 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3059 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3060 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3062 xor = (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3064 if (xor != (xor_check
[2] & 0x0F))
3066 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check
[2] & 0x0F);
3067 irmp_ir_detected
= FALSE
;
3070 xor = xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3072 if (xor != xor_check
[5])
3074 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check
[5]);
3075 irmp_ir_detected
= FALSE
;
3078 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3080 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3082 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3083 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3085 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3088 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3090 irmp_protocol
= irmp_param
.protocol
;
3093 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3094 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3096 if (irmp_tmp_command
& 0x000F) // released key?
3098 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3102 irmp_tmp_command
>>= 4; // no, it's a pressed key
3104 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3105 irmp_tmp_address
&= 0x003F;
3109 irmp_address
= irmp_tmp_address
; // store address
3110 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3111 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3113 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3117 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3118 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3120 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3123 irmp_command
= irmp_tmp_command
; // store command
3125 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3126 irmp_id
= irmp_tmp_id
;
3131 if (irmp_ir_detected
)
3133 if (last_irmp_command
== irmp_tmp_command
&&
3134 last_irmp_address
== irmp_tmp_address
&&
3135 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3137 irmp_flags
|= IRMP_FLAG_REPETITION
;
3140 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3141 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3147 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3150 // irmp_busy_flag = FALSE;
3151 irmp_start_bit_detected
= 0; // and wait for next start bit
3152 irmp_tmp_command
= 0;
3153 irmp_pulse_time
= 0;
3154 irmp_pause_time
= 0;
3156 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3157 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3158 { // set pulse time here!
3159 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3161 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3165 return (irmp_ir_detected
);
3170 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3171 * main functions - for Unix/Linux + Windows only!
3175 * Compile it under linux with:
3178 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3184 * -l list pulse/pauses
3186 *---------------------------------------------------------------------------------------------------------------------------------------------------
3190 print_timings (void)
3192 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3193 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3195 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3196 printf ("====================================================================================\n");
3197 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3198 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3199 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3200 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3202 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3203 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3204 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3205 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3207 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3208 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
,
3209 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3210 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3212 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3213 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3214 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3215 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3217 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3218 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3219 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3220 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3222 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3223 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3224 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3225 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3227 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3228 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3229 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3230 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3232 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3233 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3234 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3236 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3237 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3238 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3239 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3241 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3242 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3243 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3244 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3246 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3247 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3248 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3250 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3251 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3252 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3253 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3255 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3256 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3257 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3258 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3260 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3261 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3262 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3264 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3265 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3266 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3268 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3269 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3270 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3272 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3273 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3274 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3276 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3277 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3278 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3280 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3281 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3282 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3283 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3285 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3286 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3287 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3288 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3289 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3290 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3291 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3293 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3294 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3295 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3296 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3298 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3299 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3300 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3301 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3303 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3304 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3305 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3306 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3308 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3309 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3310 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3311 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3316 print_spectrum (char * text
, int * buf
, int is_pulse
)
3329 puts ("-------------------------------------------------------------------------------");
3330 printf ("%s:\n", text
);
3332 for (i
= 0; i
< 256; i
++)
3334 if (buf
[i
] > max_value
)
3340 for (i
= 1; i
< 100; i
++)
3345 value
= (buf
[i
] * 60) / max_value
;
3347 for (j
= 0; j
< value
; j
++)
3351 printf (" %d\n", buf
[i
]);
3362 average
= (float) sum
/ (float) counter
;
3373 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3374 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3375 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3377 tolerance
= (max
- average
);
3379 if (average
- min
> tolerance
)
3381 tolerance
= average
- min
;
3384 tolerance
= tolerance
* 100 / average
;
3385 printf ("tol: %4.1f%%\n", tolerance
);
3395 #define STATE_LEFT_SHIFT 0x01
3396 #define STATE_RIGHT_SHIFT 0x02
3397 #define STATE_LEFT_CTRL 0x04
3398 #define STATE_LEFT_ALT 0x08
3399 #define STATE_RIGHT_ALT 0x10
3401 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3402 #define KEY_MENUE 0x80 // keycode = 0x0070
3403 #define KEY_BACK 0x81 // keycode = 0x0071
3404 #define KEY_FORWARD 0x82 // keycode = 0x0072
3405 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3406 #define KEY_WINDOW 0x84 // keycode = 0x0074
3407 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3408 #define KEY_STOP 0x86 // keycode = 0x0076
3409 #define KEY_MAIL 0x87 // keycode = 0x0077
3410 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3411 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3412 #define KEY_SETUP 0x8A // keycode = 0x007a
3413 #define KEY_FONT 0x8B // keycode = 0x007b
3414 #define KEY_PRINT 0x8C // keycode = 0x007c
3415 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3417 #define KEY_INSERT 0x90 // keycode = 0x004b
3418 #define KEY_DELETE 0x91 // keycode = 0x004c
3419 #define KEY_LEFT 0x92 // keycode = 0x004f
3420 #define KEY_HOME 0x93 // keycode = 0x0050
3421 #define KEY_END 0x94 // keycode = 0x0051
3422 #define KEY_UP 0x95 // keycode = 0x0053
3423 #define KEY_DOWN 0x96 // keycode = 0x0054
3424 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3425 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3426 #define KEY_RIGHT 0x99 // keycode = 0x0059
3427 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3428 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3431 get_fdc_key (uint16_t cmd
)
3433 static uint8_t key_table
[128] =
3435 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3436 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3437 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3438 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3439 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3441 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3442 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3443 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3444 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3446 static uint8_t state
;
3452 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3453 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3454 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3455 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3456 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3457 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3458 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3459 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3460 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3461 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3463 case 0x006e: key
= KEY_ESCAPE
; break;
3464 case 0x004b: key
= KEY_INSERT
; break;
3465 case 0x004c: key
= KEY_DELETE
; break;
3466 case 0x004f: key
= KEY_LEFT
; break;
3467 case 0x0050: key
= KEY_HOME
; break;
3468 case 0x0051: key
= KEY_END
; break;
3469 case 0x0053: key
= KEY_UP
; break;
3470 case 0x0054: key
= KEY_DOWN
; break;
3471 case 0x0055: key
= KEY_PAGE_UP
; break;
3472 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3473 case 0x0059: key
= KEY_RIGHT
; break;
3474 case 0x0400: key
= KEY_MOUSE_1
; break;
3475 case 0x0800: key
= KEY_MOUSE_2
; break;
3479 if (!(cmd
& 0x80)) // pressed key
3481 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3483 key
= cmd
+ 0x10; // 7x -> 8x
3485 else if (cmd
< 64) // key listed in key_table
3487 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3491 case 0x0003: key
= '²'; break;
3492 case 0x0008: key
= '{'; break;
3493 case 0x0009: key
= '['; break;
3494 case 0x000A: key
= ']'; break;
3495 case 0x000B: key
= '}'; break;
3496 case 0x000C: key
= '\\'; break;
3497 case 0x001C: key
= '~'; break;
3498 case 0x002D: key
= '|'; break;
3499 case 0x0034: key
= 0xB5; break; // Mu
3502 else if (state
& (STATE_LEFT_CTRL
))
3504 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3506 key
= key_table
[cmd
] - 'a' + 1;
3510 key
= key_table
[cmd
];
3515 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3519 key
= key_table
[idx
];
3531 static int analyze
= FALSE
;
3532 static int list
= FALSE
;
3533 static IRMP_DATA irmp_data
;
3538 if (! analyze
&& ! list
)
3542 if (irmp_get_data (&irmp_data
))
3546 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3550 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3553 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3555 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3557 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3558 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3560 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3562 char * p
= (char *) NULL
;
3566 case '\t' : p
= "TAB"; break;
3567 case '\r' : p
= "CR"; break;
3568 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3569 case KEY_MENUE
: p
= "MENUE"; break;
3570 case KEY_BACK
: p
= "BACK"; break;
3571 case KEY_FORWARD
: p
= "FORWARD"; break;
3572 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3573 case KEY_WINDOW
: p
= "WINDOW"; break;
3574 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3575 case KEY_STOP
: p
= "STOP"; break;
3576 case KEY_MAIL
: p
= "MAIL"; break;
3577 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3578 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3579 case KEY_SETUP
: p
= "SETUP"; break;
3580 case KEY_FONT
: p
= "FONT"; break;
3581 case KEY_PRINT
: p
= "PRINT"; break;
3582 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3584 case KEY_INSERT
: p
= "INSERT"; break;
3585 case KEY_DELETE
: p
= "DELETE"; break;
3586 case KEY_LEFT
: p
= "LEFT"; break;
3587 case KEY_HOME
: p
= "HOME"; break;
3588 case KEY_END
: p
= "END"; break;
3589 case KEY_UP
: p
= "UP"; break;
3590 case KEY_DOWN
: p
= "DOWN"; break;
3591 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3592 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3593 case KEY_RIGHT
: p
= "RIGHT"; break;
3594 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3595 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3596 default : p
= "<UNKNWON>"; break;
3599 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3600 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3604 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3605 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3610 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3611 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3618 main (int argc
, char ** argv
)
3626 int start_pulses
[256];
3627 int start_pauses
[256];
3631 int first_pulse
= TRUE
;
3632 int first_pause
= TRUE
;
3636 if (! strcmp (argv
[1], "-v"))
3640 else if (! strcmp (argv
[1], "-l"))
3644 else if (! strcmp (argv
[1], "-a"))
3648 else if (! strcmp (argv
[1], "-s"))
3652 else if (! strcmp (argv
[1], "-p"))
3659 for (i
= 0; i
< 256; i
++)
3661 start_pulses
[i
] = 0;
3662 start_pauses
[i
] = 0;
3669 while ((ch
= getchar ()) != EOF
)
3671 if (ch
== '_' || ch
== '0')
3679 printf ("pause: %d\n", pause
);
3688 start_pauses
[pause
]++;
3690 first_pause
= FALSE
;
3706 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3712 printf ("pulse: %d ", pulse
);
3721 start_pulses
[pulse
]++;
3723 first_pulse
= FALSE
;
3739 else if (ch
== '\n')
3743 if (list
&& pause
> 0)
3745 printf ("pause: %d\n", pause
);
3751 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
3763 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3770 puts ("-------------------------------------------------------------------");
3773 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3775 if (ch
!= '\r') // ignore CR in DOS/Windows files
3792 print_spectrum ("START PULSES", start_pulses
, TRUE
);
3793 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
3794 print_spectrum ("PULSES", pulses
, TRUE
);
3795 print_spectrum ("PAUSES", pauses
, FALSE
);
3796 puts ("-------------------------------------------------------------------------------");