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.122 2012/05/24 06:55:11 fm Exp $
10 * Supported mikrocontrollers:
14 * ATmega8, ATmega16, ATmega32
16 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284
17 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *---------------------------------------------------------------------------------------------------------------------------------------------------
28 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
29 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
31 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
34 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
35 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
37 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
40 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
41 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
42 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
43 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
44 IRMP_SUPPORT_IR60_PROTOCOL
45 # define IRMP_SUPPORT_MANCHESTER 1
47 # define IRMP_SUPPORT_MANCHESTER 0
50 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
51 # define IRMP_SUPPORT_SERIAL 1
53 # define IRMP_SUPPORT_SERIAL 0
56 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
58 #define MIN_TOLERANCE_00 1.0 // -0%
59 #define MAX_TOLERANCE_00 1.0 // +0%
61 #define MIN_TOLERANCE_05 0.95 // -5%
62 #define MAX_TOLERANCE_05 1.05 // +5%
64 #define MIN_TOLERANCE_10 0.9 // -10%
65 #define MAX_TOLERANCE_10 1.1 // +10%
67 #define MIN_TOLERANCE_15 0.85 // -15%
68 #define MAX_TOLERANCE_15 1.15 // +15%
70 #define MIN_TOLERANCE_20 0.8 // -20%
71 #define MAX_TOLERANCE_20 1.2 // +20%
73 #define MIN_TOLERANCE_30 0.7 // -30%
74 #define MAX_TOLERANCE_30 1.3 // +30%
76 #define MIN_TOLERANCE_40 0.6 // -40%
77 #define MAX_TOLERANCE_40 1.4 // +40%
79 #define MIN_TOLERANCE_50 0.5 // -50%
80 #define MAX_TOLERANCE_50 1.5 // +50%
82 #define MIN_TOLERANCE_60 0.4 // -60%
83 #define MAX_TOLERANCE_60 1.6 // +60%
85 #define MIN_TOLERANCE_70 0.3 // -70%
86 #define MAX_TOLERANCE_70 1.7 // +70%
88 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
89 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
90 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
91 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
92 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
93 #else // only 5% + 1 to avoid conflict with RC6:
94 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
96 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
97 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
98 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
99 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
100 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
101 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
103 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
104 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
105 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
106 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
107 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
108 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
109 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
110 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
111 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
112 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
113 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
114 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
115 // autodetect nec repetition frame within 50 msec:
116 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
118 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
120 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
123 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
124 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
125 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
126 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
127 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
128 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
129 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
130 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
131 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
132 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
134 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
135 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
136 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
137 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
138 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
139 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
140 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
141 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
142 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
143 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
145 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
146 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
147 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
148 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
149 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
150 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
151 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
152 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
153 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
154 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
156 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
157 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
158 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
159 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
160 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
161 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
162 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
163 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
164 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
165 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
167 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
168 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
170 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
171 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
173 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
174 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
175 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
176 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
177 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
178 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
179 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
180 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
182 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
183 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
184 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
185 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
186 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
187 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
189 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
190 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
191 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
192 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
195 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
196 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
197 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
198 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
200 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
201 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
202 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
203 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
204 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
206 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
207 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
208 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
209 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
211 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
212 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
213 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
214 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
215 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
216 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
217 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
218 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
219 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
220 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
221 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
222 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
224 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
225 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
226 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
227 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
228 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
229 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
230 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
231 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
232 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
233 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
234 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
235 #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
236 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
237 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
238 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
239 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
240 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
241 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
242 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
243 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
244 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
245 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
246 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
247 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
248 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
249 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
251 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
252 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
253 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
254 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
255 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
256 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
257 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
259 #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)
260 #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)
261 #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)
262 #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)
263 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
264 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
265 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
266 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
268 #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
269 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
270 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
271 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
272 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
273 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
274 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
275 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
277 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
279 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
281 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
283 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
284 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
285 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
286 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
287 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
288 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
289 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
290 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
291 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
292 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
294 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
295 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
296 #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!
297 #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!
298 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
299 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
300 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
301 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
302 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
303 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
304 // autodetect JVC repetition frame within 50 msec:
305 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
307 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
308 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
309 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
310 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
311 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
312 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
313 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
314 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
315 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
316 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
317 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
318 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
319 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
321 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
322 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
323 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
324 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
325 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
326 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
327 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
328 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
329 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
330 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
331 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
332 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
333 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
334 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
336 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
337 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
338 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
339 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
340 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
341 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
342 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
343 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
345 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
346 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
347 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
348 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
349 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
350 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
351 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
352 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
353 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
354 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
356 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
359 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
360 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
361 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
362 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
364 static int time_counter
;
367 # define ANALYZE_PUTCHAR(a)
368 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
369 # define ANALYZE_PRINTF(...)
370 # define ANALYZE_NEWLINE()
373 #if IRMP_USE_CALLBACK == 1
374 static void (*irmp_callback_ptr
) (uint8_t);
375 #endif // IRMP_USE_CALLBACK == 1
377 /*---------------------------------------------------------------------------------------------------------------------------------------------------
379 *---------------------------------------------------------------------------------------------------------------------------------------------------
381 #if IRMP_PROTOCOL_NAMES == 1
383 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
419 /*---------------------------------------------------------------------------------------------------------------------------------------------------
421 *---------------------------------------------------------------------------------------------------------------------------------------------------
423 #if IRMP_LOGGING == 1 // logging via UART
425 #if IRMP_EXT_LOGGING == 1 // use external logging
426 #include "irmpextlog.h"
427 #else // normal UART log (IRMP_EXT_LOGGING == 0)
429 #include <util/setbaud.h>
433 #define UART0_UBRRH UBRR0H
434 #define UART0_UBRRL UBRR0L
435 #define UART0_UCSRA UCSR0A
436 #define UART0_UCSRB UCSR0B
437 #define UART0_UCSRC UCSR0C
438 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
439 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
440 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
442 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
444 #define UART0_URSEL_BIT_VALUE (0)
446 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
447 #define UART0_UDR UDR0
448 #define UART0_U2X U2X0
452 #define UART0_UBRRH UBRRH
453 #define UART0_UBRRL UBRRL
454 #define UART0_UCSRA UCSRA
455 #define UART0_UCSRB UCSRB
456 #define UART0_UCSRC UCSRC
457 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
458 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
459 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
461 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
463 #define UART0_URSEL_BIT_VALUE (0)
465 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
466 #define UART0_UDR UDR
467 #define UART0_U2X U2X
470 #endif //IRMP_EXT_LOGGING
472 /*---------------------------------------------------------------------------------------------------------------------------------------------------
474 * @details Initializes UART
475 *---------------------------------------------------------------------------------------------------------------------------------------------------
478 irmp_uart_init (void)
480 #if (IRMP_EXT_LOGGING == 0) // use UART
481 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
482 UART0_UBRRL
= UBRRL_VALUE
;
485 UART0_UCSRA
|= (1<<UART0_U2X
);
487 UART0_UCSRA
&= ~(1<<UART0_U2X
);
490 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
491 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
492 #else // other log method
494 #endif //IRMP_EXT_LOGGING
497 /*---------------------------------------------------------------------------------------------------------------------------------------------------
499 * @details Sends character
500 * @param ch character to be transmitted
501 *---------------------------------------------------------------------------------------------------------------------------------------------------
504 irmp_uart_putc (unsigned char ch
)
506 #if (IRMP_EXT_LOGGING == 0)
507 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
514 sendextlog(ch
); //Use external log
518 /*---------------------------------------------------------------------------------------------------------------------------------------------------
520 *---------------------------------------------------------------------------------------------------------------------------------------------------
523 #define STARTCYCLES 2 // min count of zeros before start of logging
524 #define ENDBITS 1000 // number of sequenced highbits to detect end
525 #define DATALEN 700 // log buffer size
528 irmp_log (uint8_t val
)
530 static uint8_t buf
[DATALEN
]; // logging buffer
531 static uint16_t buf_idx
; // number of written bits
532 static uint8_t startcycles
; // current number of start-zeros
533 static uint16_t cnt
; // counts sequenced highbits - to detect end
535 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
543 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
545 if (buf_idx
< DATALEN
* 8) // index in range?
549 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
553 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
560 { // if high received then look at log-stop condition
564 { // if stop condition is true, output on uart
567 for (i
= 0; i
< STARTCYCLES
; i
++)
569 irmp_uart_putc ('0'); // the ignored starting zeros
572 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
577 for (j
= 0; j
< 8; j
++)
579 irmp_uart_putc ((d
& 1) + '0');
584 irmp_uart_putc ('\n');
597 #define irmp_log(val)
598 #endif //IRMP_LOGGING
602 uint8_t protocol
; // ir protocol
603 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
604 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
605 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
606 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
607 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
608 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
609 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
610 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
611 uint8_t address_offset
; // address offset
612 uint8_t address_end
; // end of address
613 uint8_t command_offset
; // command offset
614 uint8_t command_end
; // end of command
615 uint8_t complete_len
; // complete length of frame
616 uint8_t stop_bit
; // flag: frame has stop bit
617 uint8_t lsb_first
; // flag: LSB first
618 uint8_t flags
; // some flags
621 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
623 static const PROGMEM IRMP_PARAMETER sircs_param
=
625 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
626 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
627 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
628 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
629 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
630 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
631 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
632 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
633 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
634 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
635 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
636 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
637 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
638 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
639 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
640 SIRCS_LSB
, // lsb_first: flag: LSB first
641 SIRCS_FLAGS
// flags: some flags
646 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
648 static const PROGMEM IRMP_PARAMETER nec_param
=
650 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
651 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
652 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
653 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
654 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
655 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
656 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
657 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
658 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
659 NEC_ADDRESS_OFFSET
, // address_offset: address offset
660 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
661 NEC_COMMAND_OFFSET
, // command_offset: command offset
662 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
663 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
664 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
665 NEC_LSB
, // lsb_first: flag: LSB first
666 NEC_FLAGS
// flags: some flags
669 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
671 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
672 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
673 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
674 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
675 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
676 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
677 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
678 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
679 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
680 0, // address_offset: address offset
681 0, // address_end: end of address
682 0, // command_offset: command offset
683 0, // command_end: end of command
684 0, // complete_len: complete length of frame
685 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
686 NEC_LSB
, // lsb_first: flag: LSB first
687 NEC_FLAGS
// flags: some flags
692 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
694 static const PROGMEM IRMP_PARAMETER nec42_param
=
696 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
697 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
698 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
699 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
700 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
701 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
702 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
703 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
704 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
705 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
706 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
707 NEC42_COMMAND_OFFSET
, // command_offset: command offset
708 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
709 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
710 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
711 NEC_LSB
, // lsb_first: flag: LSB first
712 NEC_FLAGS
// flags: some flags
717 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
719 static const PROGMEM IRMP_PARAMETER samsung_param
=
721 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
722 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
723 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
724 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
725 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
726 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
727 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
728 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
729 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
730 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
731 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
732 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
733 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
734 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
735 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
736 SAMSUNG_LSB
, // lsb_first: flag: LSB first
737 SAMSUNG_FLAGS
// flags: some flags
742 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
744 static const PROGMEM IRMP_PARAMETER matsushita_param
=
746 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
747 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
748 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
749 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
750 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
751 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
752 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
753 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
754 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
755 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
756 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
757 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
758 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
759 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
760 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
761 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
762 MATSUSHITA_FLAGS
// flags: some flags
767 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
769 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
771 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
772 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
773 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
774 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
775 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
776 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
777 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
778 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
779 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
780 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
781 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
782 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
783 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
784 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
785 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
786 KASEIKYO_LSB
, // lsb_first: flag: LSB first
787 KASEIKYO_FLAGS
// flags: some flags
792 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
794 static const PROGMEM IRMP_PARAMETER recs80_param
=
796 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
797 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
798 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
799 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
800 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
801 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
802 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
803 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
804 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
805 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
806 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
807 RECS80_COMMAND_OFFSET
, // command_offset: command offset
808 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
809 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
810 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
811 RECS80_LSB
, // lsb_first: flag: LSB first
812 RECS80_FLAGS
// flags: some flags
817 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
819 static const PROGMEM IRMP_PARAMETER rc5_param
=
821 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
822 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
823 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
824 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
825 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
826 0, // pulse_0_len_min: here: not used
827 0, // pulse_0_len_max: here: not used
828 0, // pause_0_len_min: here: not used
829 0, // pause_0_len_max: here: not used
830 RC5_ADDRESS_OFFSET
, // address_offset: address offset
831 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
832 RC5_COMMAND_OFFSET
, // command_offset: command offset
833 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
834 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
835 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
836 RC5_LSB
, // lsb_first: flag: LSB first
837 RC5_FLAGS
// flags: some flags
842 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
844 static const PROGMEM IRMP_PARAMETER denon_param
=
846 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
847 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
848 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
849 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
850 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
851 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
852 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
853 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
854 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
855 DENON_ADDRESS_OFFSET
, // address_offset: address offset
856 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
857 DENON_COMMAND_OFFSET
, // command_offset: command offset
858 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
859 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
860 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
861 DENON_LSB
, // lsb_first: flag: LSB first
862 DENON_FLAGS
// flags: some flags
867 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
869 static const PROGMEM IRMP_PARAMETER rc6_param
=
871 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
873 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
874 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
875 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
876 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
877 0, // pulse_0_len_min: here: not used
878 0, // pulse_0_len_max: here: not used
879 0, // pause_0_len_min: here: not used
880 0, // pause_0_len_max: here: not used
881 RC6_ADDRESS_OFFSET
, // address_offset: address offset
882 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
883 RC6_COMMAND_OFFSET
, // command_offset: command offset
884 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
885 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
886 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
887 RC6_LSB
, // lsb_first: flag: LSB first
888 RC6_FLAGS
// flags: some flags
893 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
895 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
897 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
898 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
899 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
900 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
901 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
902 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
903 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
904 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
905 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
906 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
907 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
908 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
909 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
910 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
911 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
912 RECS80EXT_LSB
, // lsb_first: flag: LSB first
913 RECS80EXT_FLAGS
// flags: some flags
918 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
920 static const PROGMEM IRMP_PARAMETER nubert_param
=
922 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
923 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
924 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
925 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
926 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
927 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
928 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
929 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
930 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
931 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
932 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
933 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
934 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
935 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
936 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
937 NUBERT_LSB
, // lsb_first: flag: LSB first
938 NUBERT_FLAGS
// flags: some flags
943 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
945 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
947 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
948 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
949 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
950 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
951 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
952 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
953 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
954 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
955 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
956 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
957 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
958 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
959 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
960 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
961 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
962 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
963 BANG_OLUFSEN_FLAGS
// flags: some flags
968 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
970 static uint8_t first_bit
;
972 static const PROGMEM IRMP_PARAMETER grundig_param
=
974 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
976 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
977 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
978 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
979 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
980 0, // pulse_0_len_min: here: not used
981 0, // pulse_0_len_max: here: not used
982 0, // pause_0_len_min: here: not used
983 0, // pause_0_len_max: here: not used
984 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
985 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
986 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
987 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
988 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
989 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
990 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
991 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
996 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
998 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1000 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1001 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1002 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1003 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1004 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1005 0, // pulse_0_len_min: here: not used
1006 0, // pulse_0_len_max: here: not used
1007 0, // pause_0_len_min: here: not used
1008 0, // pause_0_len_max: here: not used
1009 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1010 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1011 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1012 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1013 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1014 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1015 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1016 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1021 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1023 static const PROGMEM IRMP_PARAMETER fdc_param
=
1025 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1026 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1027 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1028 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1029 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1030 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1031 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1032 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1033 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1034 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1035 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1036 FDC_COMMAND_OFFSET
, // command_offset: command offset
1037 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1038 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1039 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1040 FDC_LSB
, // lsb_first: flag: LSB first
1041 FDC_FLAGS
// flags: some flags
1046 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1048 static const PROGMEM IRMP_PARAMETER rccar_param
=
1050 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1051 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1052 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1053 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1054 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1055 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1056 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1057 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1058 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1059 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1060 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1061 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1062 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1063 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1064 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1065 RCCAR_LSB
, // lsb_first: flag: LSB first
1066 RCCAR_FLAGS
// flags: some flags
1071 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1073 static const PROGMEM IRMP_PARAMETER nikon_param
=
1075 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1076 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1077 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1078 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1079 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1080 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1081 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1082 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1083 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1084 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1085 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1086 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1087 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1088 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1089 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1090 NIKON_LSB
, // lsb_first: flag: LSB first
1091 NIKON_FLAGS
// flags: some flags
1096 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1098 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1100 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1101 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1102 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1103 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1104 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1105 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1106 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1107 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1108 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1109 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1110 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1111 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1112 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1113 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1114 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1115 KATHREIN_LSB
, // lsb_first: flag: LSB first
1116 KATHREIN_FLAGS
// flags: some flags
1121 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1123 static const PROGMEM IRMP_PARAMETER netbox_param
=
1125 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1126 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1127 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1128 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1129 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1130 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1131 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1132 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1133 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1134 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1135 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1136 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1137 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1138 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1139 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1140 NETBOX_LSB
, // lsb_first: flag: LSB first
1141 NETBOX_FLAGS
// flags: some flags
1146 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1148 static const PROGMEM IRMP_PARAMETER lego_param
=
1150 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1151 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1152 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1153 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1154 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1155 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1156 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1157 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1158 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1159 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1160 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1161 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1162 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1163 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1164 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1165 LEGO_LSB
, // lsb_first: flag: LSB first
1166 LEGO_FLAGS
// flags: some flags
1171 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1173 static const PROGMEM IRMP_PARAMETER thomson_param
=
1175 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1176 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1177 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1178 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1179 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1180 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1181 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1182 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1183 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1184 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1185 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1186 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1187 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1188 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1189 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1190 THOMSON_LSB
, // lsb_first: flag: LSB first
1191 THOMSON_FLAGS
// flags: some flags
1196 static uint8_t irmp_bit
; // current bit position
1197 static IRMP_PARAMETER irmp_param
;
1199 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1200 static IRMP_PARAMETER irmp_param2
;
1203 static volatile uint8_t irmp_ir_detected
;
1204 static volatile uint8_t irmp_protocol
;
1205 static volatile uint16_t irmp_address
;
1206 static volatile uint16_t irmp_command
;
1207 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1208 static volatile uint8_t irmp_flags
;
1209 // static volatile uint8_t irmp_busy_flag;
1212 #define input(x) (x)
1213 static uint8_t IRMP_PIN
;
1216 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1217 * Initialize IRMP decoder
1218 * @details Configures IRMP input pin
1219 *---------------------------------------------------------------------------------------------------------------------------------------------------
1225 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1226 #elif defined (ARM_STM32) // STM32
1227 GPIO_InitTypeDef GPIO_InitStructure
;
1229 /* GPIOx clock enable */
1230 #if defined (ARM_STM32L1XX)
1231 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1232 #elif defined (ARM_STM32F10X)
1233 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1234 #elif defined (ARM_STM32F4XX)
1235 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1238 /* GPIO Configuration */
1239 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1240 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1241 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1242 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1243 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1244 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1245 #elif defined (ARM_STM32F10X)
1246 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1247 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1249 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1251 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1252 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1255 #if IRMP_LOGGING == 1
1260 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1262 * @details gets decoded IRMP data
1263 * @param pointer in order to store IRMP data
1264 * @return TRUE: successful, FALSE: failed
1265 *---------------------------------------------------------------------------------------------------------------------------------------------------
1268 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1270 uint8_t rtc
= FALSE
;
1272 if (irmp_ir_detected
)
1274 switch (irmp_protocol
)
1276 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1277 case IRMP_SAMSUNG_PROTOCOL
:
1278 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1280 irmp_command
&= 0xff;
1281 irmp_command
|= irmp_id
<< 8;
1286 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1287 case IRMP_NEC_PROTOCOL
:
1288 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1290 irmp_command
&= 0xff;
1293 else if (irmp_address
== 0x87EE)
1295 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1296 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1297 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1298 irmp_command
&= 0x00FF;
1303 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1304 case IRMP_SIEMENS_PROTOCOL
:
1305 case IRMP_RUWIDO_PROTOCOL
:
1306 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1313 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1314 case IRMP_KATHREIN_PROTOCOL
:
1315 if (irmp_command
!= 0x0000)
1321 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1322 case IRMP_RC5_PROTOCOL
:
1323 irmp_address
&= ~0x20; // clear toggle bit
1327 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1328 case IRMP_IR60_PROTOCOL
:
1329 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1335 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1339 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1340 case IRMP_RCCAR_PROTOCOL
:
1341 // frame in irmp_data:
1342 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1343 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1344 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1345 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1346 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1347 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1348 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1352 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1353 case IRMP_NETBOX_PROTOCOL
:
1354 if (irmp_command
& 0x1000) // last bit set?
1356 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1359 irmp_command
&= 0x7F;
1362 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1365 irmp_command
|= 0x80;
1370 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1375 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1379 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1380 case IRMP_LEGO_PROTOCOL
:
1382 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1384 if ((irmp_command
& 0x000F) == crc
)
1391 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1406 irmp_data_p
->protocol
= irmp_protocol
;
1407 irmp_data_p
->address
= irmp_address
;
1408 irmp_data_p
->command
= irmp_command
;
1409 irmp_data_p
->flags
= irmp_flags
;
1415 irmp_ir_detected
= FALSE
;
1422 // irmp_is_busy (void)
1424 // return irmp_busy_flag;
1427 #if IRMP_USE_CALLBACK == 1
1429 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1431 irmp_callback_ptr
= cb
;
1433 #endif // IRMP_USE_CALLBACK == 1
1435 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1436 static uint16_t irmp_tmp_address
; // ir address
1437 static uint16_t irmp_tmp_command
; // ir command
1439 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1440 static uint16_t irmp_tmp_address2
; // ir address
1441 static uint16_t irmp_tmp_command2
; // ir command
1444 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1445 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1447 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1448 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1449 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1452 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1454 * @details store bit in temp address or temp command
1455 * @param value to store: 0 or 1
1456 *---------------------------------------------------------------------------------------------------------------------------------------------------
1458 // verhindert, dass irmp_store_bit() inline compiliert wird:
1459 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1462 irmp_store_bit (uint8_t value
)
1464 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1465 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1472 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1474 if (irmp_param
.lsb_first
)
1476 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1480 irmp_tmp_address
<<= 1;
1481 irmp_tmp_address
|= value
;
1484 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1486 if (irmp_param
.lsb_first
)
1488 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1492 irmp_tmp_command
<<= 1;
1493 irmp_tmp_command
|= value
;
1497 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1498 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1500 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1505 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1506 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1508 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1513 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1514 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1516 if (irmp_bit
>= 20 && irmp_bit
< 24)
1518 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1520 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1522 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1525 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1529 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1533 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1542 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1544 * @details store bit in temp address or temp command
1545 * @param value to store: 0 or 1
1546 *---------------------------------------------------------------------------------------------------------------------------------------------------
1548 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1550 irmp_store_bit2 (uint8_t value
)
1554 if (irmp_param
.protocol
)
1556 irmp_bit2
= irmp_bit
- 2;
1560 irmp_bit2
= irmp_bit
- 1;
1563 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1565 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1567 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1569 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1572 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1574 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1576 * @details ISR routine, called 10000 times per second
1577 *---------------------------------------------------------------------------------------------------------------------------------------------------
1582 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1583 static uint8_t wait_for_space
; // flag: wait for data bit space
1584 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1585 static uint8_t irmp_pulse_time
; // count bit time for pulse
1586 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1587 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1588 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1589 static uint16_t repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1590 static uint8_t repetition_frame_number
;
1591 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1592 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1594 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1595 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1597 #if IRMP_SUPPORT_MANCHESTER == 1
1598 static PAUSE_LEN last_pause
; // last pause value
1600 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1601 static uint8_t last_value
; // last bit value
1603 uint8_t irmp_input
; // input value
1609 irmp_input
= input(IRMP_PIN
);
1611 #if IRMP_USE_CALLBACK == 1
1612 if (irmp_callback_ptr
)
1614 static uint8_t last_inverted_input
;
1616 if (last_inverted_input
!= !irmp_input
)
1618 (*irmp_callback_ptr
) (! irmp_input
);
1619 last_inverted_input
= !irmp_input
;
1622 #endif // IRMP_USE_CALLBACK == 1
1624 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1626 if (! irmp_ir_detected
) // ir code already detected?
1628 if (! irmp_start_bit_detected
) // start bit detected?
1630 if (! irmp_input
) // receiving burst?
1632 // irmp_busy_flag = TRUE;
1634 if (! irmp_pulse_time
)
1636 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1639 irmp_pulse_time
++; // increment counter
1643 if (irmp_pulse_time
) // it's dark....
1644 { // set flags for counting the time of darkness...
1645 irmp_start_bit_detected
= 1;
1646 wait_for_start_space
= 1;
1648 irmp_tmp_command
= 0;
1649 irmp_tmp_address
= 0;
1650 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1654 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1655 irmp_tmp_command2
= 0;
1656 irmp_tmp_address2
= 0;
1660 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1661 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1662 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1667 if (repetition_len
< 0xFFFF) // avoid overflow of counter
1671 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1672 if (repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
1674 ANALYZE_PRINTF ("%8.3fms error 6: did not receive inverted command repetition\n",
1675 (double) (time_counter
* 1000) / F_INTERRUPTS
);
1676 last_irmp_denon_command
= 0;
1678 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1685 if (wait_for_start_space
) // we have received start bit...
1686 { // ...and are counting the time of darkness
1687 if (irmp_input
) // still dark?
1689 irmp_pause_time
++; // increment counter
1691 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1692 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
) ||
1693 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1695 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1698 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1699 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1704 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1706 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
);
1707 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1709 // irmp_busy_flag = FALSE;
1710 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1711 irmp_pulse_time
= 0;
1712 irmp_pause_time
= 0;
1716 { // receiving first data pulse!
1717 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1719 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1720 irmp_param2
.protocol
= 0;
1723 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1725 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1726 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1727 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1729 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1730 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1731 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1732 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1735 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1737 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1738 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1739 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1740 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1742 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1743 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1744 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1745 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1748 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1750 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1751 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1752 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1754 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1755 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1756 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1757 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1758 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1760 ANALYZE_PRINTF ("protocol = NEC, 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
*) &nec_param
;
1767 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1768 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1770 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1771 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
1772 { // some jvc remote controls use nec repetition frame for jvc repetition frame
1773 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1774 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1775 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1776 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1779 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1781 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1782 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1783 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1785 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
1790 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1791 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1792 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1793 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
1794 { // it's JVC repetition type 3
1795 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1796 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1797 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
1798 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1801 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1803 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1805 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1806 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1807 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1809 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1810 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1811 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1812 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1815 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1817 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1818 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1819 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1821 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1822 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
1823 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
1824 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
1827 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1829 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1830 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
1831 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
1832 { // it's MATSUSHITA
1833 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1834 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
1835 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
1836 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
1839 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1841 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1842 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
1843 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
1845 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1846 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
1847 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
1848 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
1851 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1853 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1854 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
1855 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
1857 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1858 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
1859 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
1860 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
1863 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
1865 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1866 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
1867 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
1868 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
1869 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
1871 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1872 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
1873 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
1875 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
1876 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1877 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
1878 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
1879 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1880 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1881 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1882 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
1885 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
1887 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1888 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
1889 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
1891 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
1892 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1893 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
1894 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
1895 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1896 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1897 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
1898 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
1901 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1903 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
1904 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1905 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
1906 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
1907 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
1910 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
1911 last_pause
= irmp_pause_time
;
1913 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
1914 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
1917 rc5_cmd_bit6
= 1<<6;
1925 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
1927 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1928 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
1929 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
1930 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
1932 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
1933 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
1934 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
1935 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
1936 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
1939 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1941 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1942 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
1943 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
1944 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
1946 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
1947 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
1948 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
1949 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
1950 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
1953 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1955 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1956 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
1957 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
1959 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1960 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
1961 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
1962 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
1967 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
1969 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1970 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
1971 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
1973 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1974 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
1975 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
1976 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
1979 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1981 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1982 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
1983 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
1985 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1986 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
1987 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
1988 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
1991 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1993 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1994 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
1995 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
1996 { // it's BANG_OLUFSEN
1997 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
1998 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1999 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2000 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2001 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2002 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2003 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2004 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2005 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2006 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2007 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2008 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2009 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2010 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2014 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2016 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2017 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2018 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2020 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2021 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2022 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2023 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2024 last_pause
= irmp_pause_time
;
2028 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2030 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2031 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2032 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2033 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2034 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2035 { // it's RUWIDO or SIEMENS
2036 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2037 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2038 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2039 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2040 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2041 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2042 last_pause
= irmp_pause_time
;
2046 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2048 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2049 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2050 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2052 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2053 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2054 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2055 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2058 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2060 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2061 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2062 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2064 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2065 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2066 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2067 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2070 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2072 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2073 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2074 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2076 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2077 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2078 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2079 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2082 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2084 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2085 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2086 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2088 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2089 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2090 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2091 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2094 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2096 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2097 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2098 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2100 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2101 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2102 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2103 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2106 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2109 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2110 // irmp_busy_flag = FALSE;
2111 irmp_start_bit_detected
= 0; // wait for another start bit...
2114 if (irmp_start_bit_detected
)
2116 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2119 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2121 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2122 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2126 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2127 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2128 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2129 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2132 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2133 if (irmp_param2
.protocol
)
2135 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2136 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2137 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2138 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2143 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2144 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2146 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2150 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2152 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2153 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2157 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2158 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2159 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2160 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2163 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2164 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2166 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2167 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2171 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2172 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2173 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2174 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2180 #if IRMP_SUPPORT_MANCHESTER == 1
2181 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2182 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2183 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2185 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2187 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2188 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2190 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2192 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2194 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2196 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2198 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2202 #endif // IRMP_SUPPORT_MANCHESTER == 1
2204 #if IRMP_SUPPORT_SERIAL == 1
2205 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2210 #endif // IRMP_SUPPORT_SERIAL == 1
2213 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2214 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2216 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2218 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2219 { // pause timings correct for "1"?
2220 ANALYZE_PUTCHAR ('1'); // yes, store 1
2224 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2225 { // pause timings correct for "0"?
2226 ANALYZE_PUTCHAR ('0'); // yes, store 0
2232 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2233 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2234 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2236 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2238 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2239 { // pause timings correct for "1"?
2240 ANALYZE_PUTCHAR ('1'); // yes, store 1
2244 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2245 { // pause timings correct for "0"?
2246 ANALYZE_PUTCHAR ('0'); // yes, store 0
2252 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2254 ; // else do nothing
2257 irmp_pulse_time
= 1; // set counter to 1, not 0
2258 irmp_pause_time
= 0;
2259 wait_for_start_space
= 0;
2262 else if (wait_for_space
) // the data section....
2263 { // counting the time of darkness....
2264 uint8_t got_light
= FALSE
;
2266 if (irmp_input
) // still dark?
2268 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2271 #if IRMP_SUPPORT_MANCHESTER == 1
2272 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2274 #if IRMP_SUPPORT_SERIAL == 1
2275 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2277 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2280 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2282 ANALYZE_PRINTF ("stop bit detected\n");
2285 irmp_param
.stop_bit
= 0;
2289 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",
2290 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2292 // irmp_busy_flag = FALSE;
2293 irmp_start_bit_detected
= 0; // wait for another start bit...
2294 irmp_pulse_time
= 0;
2295 irmp_pause_time
= 0;
2300 irmp_pause_time
++; // increment counter
2302 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2303 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2304 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2305 irmp_bit
>= 12 - 1) // pause too long?
2306 { // yes, break and close this frame
2307 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2308 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2309 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2310 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2311 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2315 #if IRMP_SUPPORT_SERIAL == 1
2316 // NETBOX generates no stop bit, here is the timeout condition:
2317 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2318 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2320 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2324 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2325 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2327 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2329 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2330 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2331 irmp_param
.stop_bit
= TRUE
; // set flag
2333 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2334 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2335 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2336 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2337 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2338 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2340 irmp_tmp_command
<<= 1;
2341 irmp_tmp_command
|= first_bit
;
2343 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2344 { // special manchester decoder
2345 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2346 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2347 irmp_param
.stop_bit
= TRUE
; // set flag
2349 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2351 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2352 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2353 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2354 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2355 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2356 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2358 if (irmp_tmp_command
& 0x300)
2360 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2361 irmp_tmp_command
&= 0xFF;
2367 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2368 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2370 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2371 { // special manchester decoder
2372 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2373 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2374 irmp_param
.stop_bit
= TRUE
; // set flag
2376 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2378 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2379 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2380 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2381 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2382 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2383 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2386 // RUWIDO: AAAAAAAAACCCCCCCp
2387 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2388 irmp_tmp_address
<<= 2;
2389 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2390 irmp_tmp_command
&= 0x003F;
2391 irmp_tmp_command
<<= 4;
2392 irmp_tmp_command
|= last_value
;
2397 #if IRMP_SUPPORT_MANCHESTER == 1
2398 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2399 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2400 { // special manchester decoder
2401 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2402 irmp_param
.stop_bit
= TRUE
; // set flag
2405 #endif // IRMP_SUPPORT_MANCHESTER == 1
2406 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2408 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2412 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2413 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2415 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2416 irmp_param
.stop_bit
= TRUE
; // set flag
2417 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2418 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2419 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2420 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2421 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2423 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2425 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2426 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2427 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2429 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2430 irmp_param
.stop_bit
= TRUE
; // set flag
2431 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2432 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2434 // 0123456789ABC0123456789ABC0123456701234567
2435 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2436 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2437 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2438 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2440 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2441 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2442 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2444 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2445 irmp_param
.stop_bit
= TRUE
; // set flag
2446 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2447 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2449 // 0123456789ABC0123456789ABC0123456701234567
2450 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2451 // JVC: AAAACCCCCCCCCCCC
2452 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2453 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2455 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2456 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2459 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2460 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2462 // irmp_busy_flag = FALSE;
2463 irmp_start_bit_detected
= 0; // wait for another start bit...
2464 irmp_pulse_time
= 0;
2465 irmp_pause_time
= 0;
2477 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2479 #if IRMP_SUPPORT_MANCHESTER == 1
2480 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2483 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2484 #else // better, but some IR-RCs use asymmetric timings :-/
2485 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2486 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2489 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2490 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2492 ANALYZE_PUTCHAR ('T');
2493 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2506 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2508 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2509 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2511 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2512 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2514 ANALYZE_PUTCHAR ('T');
2517 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2528 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2530 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2531 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2532 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2533 if (! irmp_param2
.protocol
)
2538 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2542 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2543 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2545 uint8_t manchester_value
;
2547 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2549 manchester_value
= last_value
? 0 : 1;
2550 last_value
= manchester_value
;
2554 manchester_value
= last_value
;
2557 ANALYZE_PUTCHAR (manchester_value
+ '0');
2559 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2560 if (! irmp_param2
.protocol
)
2566 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2567 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2569 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2570 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2571 irmp_param
.address_offset
= 5;
2572 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2573 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2574 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2575 irmp_tmp_address
= 0;
2577 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2579 irmp_store_bit (manchester_value
);
2583 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2584 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2585 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2586 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2587 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2589 ANALYZE_PUTCHAR ('?');
2590 irmp_param
.protocol
= 0; // switch to FDC, see below
2593 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2594 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2595 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2596 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2597 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2598 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2600 ANALYZE_PUTCHAR ('?');
2601 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2604 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2606 ANALYZE_PUTCHAR ('?');
2608 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2609 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2610 // irmp_busy_flag = FALSE;
2611 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2612 irmp_pause_time
= 0;
2616 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2617 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2619 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2621 ANALYZE_PRINTF (" 1 (FDC)\n");
2622 irmp_store_bit2 (1);
2624 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2626 ANALYZE_PRINTF (" 0 (FDC)\n");
2627 irmp_store_bit2 (0);
2630 if (! irmp_param
.protocol
)
2632 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2633 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2634 irmp_param2
.protocol
= 0;
2635 irmp_tmp_address
= irmp_tmp_address2
;
2636 irmp_tmp_command
= irmp_tmp_command2
;
2639 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2640 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2641 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2643 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2645 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2646 irmp_store_bit2 (1);
2648 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2650 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2651 irmp_store_bit2 (0);
2654 if (! irmp_param
.protocol
)
2656 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2657 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2658 irmp_param2
.protocol
= 0;
2659 irmp_tmp_address
= irmp_tmp_address2
;
2660 irmp_tmp_command
= irmp_tmp_command2
;
2663 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2665 last_pause
= irmp_pause_time
;
2669 #endif // IRMP_SUPPORT_MANCHESTER == 1
2671 #if IRMP_SUPPORT_SERIAL == 1
2672 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2674 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2676 ANALYZE_PUTCHAR ('1');
2679 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2681 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2685 irmp_pulse_time
= 0;
2689 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2691 ANALYZE_PUTCHAR ('0');
2694 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2696 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2700 irmp_pause_time
= 0;
2707 #endif // IRMP_SUPPORT_SERIAL == 1
2709 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2710 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2712 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2713 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2715 ANALYZE_PRINTF ("SYNC\n");
2720 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2722 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2723 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2724 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2725 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2727 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2729 ANALYZE_PUTCHAR ('1');
2736 ANALYZE_PUTCHAR ('0');
2742 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2745 { // timing incorrect!
2746 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2747 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2748 // irmp_busy_flag = FALSE;
2749 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2750 irmp_pause_time
= 0;
2754 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2756 #if IRMP_SUPPORT_NEC16_PROTOCOL
2757 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2758 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
2759 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
2760 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
2761 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2762 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2764 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2765 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
2766 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
2767 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
2768 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
2769 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
2770 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
2774 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2776 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2777 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2779 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2781 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2783 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2785 ANALYZE_PRINTF ("3rd start bit\n");
2790 { // timing incorrect!
2791 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
);
2792 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2793 // irmp_busy_flag = FALSE;
2794 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2795 irmp_pause_time
= 0;
2798 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2800 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2802 ANALYZE_PRINTF ("trailer bit\n");
2807 { // timing incorrect!
2808 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
);
2809 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2810 // irmp_busy_flag = FALSE;
2811 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2812 irmp_pause_time
= 0;
2817 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
2818 { // pulse & pause timings correct for "1"?
2819 ANALYZE_PUTCHAR ('1');
2825 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
2826 { // pulse & pause timings correct for "0"?
2827 ANALYZE_PUTCHAR ('0');
2833 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
2835 ANALYZE_PUTCHAR (last_value
+ '0');
2837 irmp_store_bit (last_value
);
2841 { // timing incorrect!
2842 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
);
2843 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2844 // irmp_busy_flag = FALSE;
2845 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2846 irmp_pause_time
= 0;
2851 { // timing incorrect!
2852 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
);
2853 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2854 // irmp_busy_flag = FALSE;
2855 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2856 irmp_pause_time
= 0;
2860 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
2862 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
2863 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
2864 { // pulse & pause timings correct for "1"?
2865 ANALYZE_PUTCHAR ('1');
2870 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
2871 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
2872 { // pulse & pause timings correct for "0"?
2873 ANALYZE_PUTCHAR ('0');
2879 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
2881 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
2882 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
2883 (((irmp_bit
== 8 || irmp_bit
== 6) &&
2884 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
2886 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
2892 ANALYZE_PUTCHAR ('S');
2894 irmp_tmp_command
<<= 1;
2898 ANALYZE_PUTCHAR ('S');
2905 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
2906 { // timing incorrect!
2907 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2908 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2909 // irmp_busy_flag = FALSE;
2910 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2911 irmp_pause_time
= 0;
2914 irmp_pulse_time
= 1; // set counter to 1, not 0
2918 { // counting the pulse length ...
2919 if (! irmp_input
) // still light?
2921 irmp_pulse_time
++; // increment counter
2925 wait_for_space
= 1; // let's count the time (see above)
2926 irmp_pause_time
= 1; // set pause counter to 1, not 0
2930 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
2932 if (last_irmp_command
== irmp_tmp_command
&& repetition_len
< AUTO_FRAME_REPETITION_LEN
)
2934 repetition_frame_number
++;
2938 repetition_frame_number
= 0;
2941 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2942 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
2943 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
2945 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2946 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2952 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2953 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
2954 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
2956 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2957 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2963 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2964 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2965 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
2967 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2968 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2974 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2975 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
2976 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
2978 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
2979 repetition_frame_number
+ 1, repetition_len
, AUTO_FRAME_REPETITION_LEN
);
2986 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
2987 irmp_ir_detected
= TRUE
;
2989 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2990 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2991 { // check for repetition frame
2992 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
2994 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
2995 last_irmp_denon_command
= 0;
2997 irmp_protocol
= irmp_param
.protocol
; // store protocol
2998 irmp_address
= irmp_tmp_address
; // store address
2999 irmp_command
= irmp_tmp_command
; // store command
3003 ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3004 irmp_ir_detected
= FALSE
;
3005 last_irmp_denon_command
= irmp_tmp_command
;
3010 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3012 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3013 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3014 { // Grundig start frame?
3015 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3016 irmp_ir_detected
= FALSE
;
3019 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3021 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3022 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3023 { // Nokia start frame?
3024 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3025 irmp_ir_detected
= FALSE
;
3028 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3030 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3031 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3033 if (repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3035 ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len
);
3036 irmp_tmp_address
= last_irmp_address
; // address is last address
3037 irmp_tmp_command
= last_irmp_command
; // command is last command
3038 irmp_flags
|= IRMP_FLAG_REPETITION
;
3043 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",
3044 repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3045 irmp_ir_detected
= FALSE
;
3048 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3050 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3051 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3054 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3055 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3057 xor = (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3059 if (xor != (xor_check
[2] & 0x0F))
3061 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check
[2] & 0x0F);
3062 irmp_ir_detected
= FALSE
;
3065 xor = xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3067 if (xor != xor_check
[5])
3069 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check
[5]);
3070 irmp_ir_detected
= FALSE
;
3073 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3075 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3077 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3078 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3080 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3083 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3085 irmp_protocol
= irmp_param
.protocol
;
3087 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3088 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3090 if (irmp_tmp_command
& 0x000F) // released key?
3092 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3096 irmp_tmp_command
>>= 4; // no, it's a pressed key
3098 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3099 irmp_tmp_address
&= 0x003F;
3103 irmp_address
= irmp_tmp_address
; // store address
3104 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3105 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3107 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3111 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3112 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3114 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3117 irmp_command
= irmp_tmp_command
; // store command
3119 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3120 irmp_id
= irmp_tmp_id
;
3125 if (irmp_ir_detected
)
3127 if (last_irmp_command
== irmp_tmp_command
&&
3128 last_irmp_address
== irmp_tmp_address
&&
3129 repetition_len
< IRMP_KEY_REPETITION_LEN
)
3131 irmp_flags
|= IRMP_FLAG_REPETITION
;
3134 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3135 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3141 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3144 // irmp_busy_flag = FALSE;
3145 irmp_start_bit_detected
= 0; // and wait for next start bit
3146 irmp_tmp_command
= 0;
3147 irmp_pulse_time
= 0;
3148 irmp_pause_time
= 0;
3150 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3151 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3152 { // set pulse time here!
3153 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3155 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3159 return (irmp_ir_detected
);
3164 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3165 * main functions - for Unix/Linux + Windows only!
3169 * Compile it under linux with:
3172 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3178 * -l list pulse/pauses
3180 *---------------------------------------------------------------------------------------------------------------------------------------------------
3184 print_timings (void)
3186 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3187 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3189 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3190 printf ("====================================================================================\n");
3191 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3192 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3193 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3194 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3196 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3197 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3198 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3199 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3201 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3202 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
,
3203 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3204 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3206 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3207 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3208 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3209 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3211 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3212 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3213 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3214 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3216 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3217 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3218 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3219 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3221 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3222 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3223 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3224 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3226 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3227 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3228 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3230 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3231 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3232 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3233 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3235 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3236 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3237 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3238 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3240 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3241 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3242 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3244 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3245 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3246 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3247 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3249 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3250 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3251 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3252 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3254 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3255 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3256 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3258 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3259 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3260 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3262 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3263 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3264 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3266 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3267 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3268 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3270 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3271 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3272 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3274 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3275 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3276 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3277 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3279 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3280 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3281 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3282 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3283 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3284 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3285 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3287 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3288 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3289 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3290 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3292 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3293 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3294 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3295 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3297 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3298 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3299 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3300 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3302 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3303 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3304 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3305 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3310 print_spectrum (char * text
, int * buf
, int is_pulse
)
3323 puts ("-------------------------------------------------------------------------------");
3324 printf ("%s:\n", text
);
3326 for (i
= 0; i
< 256; i
++)
3328 if (buf
[i
] > max_value
)
3334 for (i
= 1; i
< 100; i
++)
3339 value
= (buf
[i
] * 60) / max_value
;
3341 for (j
= 0; j
< value
; j
++)
3345 printf (" %d\n", buf
[i
]);
3356 average
= (float) sum
/ (float) counter
;
3367 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3368 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3369 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3371 tolerance
= (max
- average
);
3373 if (average
- min
> tolerance
)
3375 tolerance
= average
- min
;
3378 tolerance
= tolerance
* 100 / average
;
3379 printf ("tol: %4.1f%%\n", tolerance
);
3389 #define STATE_LEFT_SHIFT 0x01
3390 #define STATE_RIGHT_SHIFT 0x02
3391 #define STATE_LEFT_CTRL 0x04
3392 #define STATE_LEFT_ALT 0x08
3393 #define STATE_RIGHT_ALT 0x10
3395 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3396 #define KEY_MENUE 0x80 // keycode = 0x0070
3397 #define KEY_BACK 0x81 // keycode = 0x0071
3398 #define KEY_FORWARD 0x82 // keycode = 0x0072
3399 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3400 #define KEY_WINDOW 0x84 // keycode = 0x0074
3401 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3402 #define KEY_STOP 0x86 // keycode = 0x0076
3403 #define KEY_MAIL 0x87 // keycode = 0x0077
3404 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3405 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3406 #define KEY_SETUP 0x8A // keycode = 0x007a
3407 #define KEY_FONT 0x8B // keycode = 0x007b
3408 #define KEY_PRINT 0x8C // keycode = 0x007c
3409 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3411 #define KEY_INSERT 0x90 // keycode = 0x004b
3412 #define KEY_DELETE 0x91 // keycode = 0x004c
3413 #define KEY_LEFT 0x92 // keycode = 0x004f
3414 #define KEY_HOME 0x93 // keycode = 0x0050
3415 #define KEY_END 0x94 // keycode = 0x0051
3416 #define KEY_UP 0x95 // keycode = 0x0053
3417 #define KEY_DOWN 0x96 // keycode = 0x0054
3418 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3419 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3420 #define KEY_RIGHT 0x99 // keycode = 0x0059
3421 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3422 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3425 get_fdc_key (uint16_t cmd
)
3427 static uint8_t key_table
[128] =
3429 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3430 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3431 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3432 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3433 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3435 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3436 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3437 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3438 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3440 static uint8_t state
;
3446 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3447 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3448 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3449 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3450 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3451 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3452 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3453 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3454 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3455 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3457 case 0x006e: key
= KEY_ESCAPE
; break;
3458 case 0x004b: key
= KEY_INSERT
; break;
3459 case 0x004c: key
= KEY_DELETE
; break;
3460 case 0x004f: key
= KEY_LEFT
; break;
3461 case 0x0050: key
= KEY_HOME
; break;
3462 case 0x0051: key
= KEY_END
; break;
3463 case 0x0053: key
= KEY_UP
; break;
3464 case 0x0054: key
= KEY_DOWN
; break;
3465 case 0x0055: key
= KEY_PAGE_UP
; break;
3466 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3467 case 0x0059: key
= KEY_RIGHT
; break;
3468 case 0x0400: key
= KEY_MOUSE_1
; break;
3469 case 0x0800: key
= KEY_MOUSE_2
; break;
3473 if (!(cmd
& 0x80)) // pressed key
3475 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3477 key
= cmd
+ 0x10; // 7x -> 8x
3479 else if (cmd
< 64) // key listed in key_table
3481 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3485 case 0x0003: key
= '²'; break;
3486 case 0x0008: key
= '{'; break;
3487 case 0x0009: key
= '['; break;
3488 case 0x000A: key
= ']'; break;
3489 case 0x000B: key
= '}'; break;
3490 case 0x000C: key
= '\\'; break;
3491 case 0x001C: key
= '~'; break;
3492 case 0x002D: key
= '|'; break;
3493 case 0x0034: key
= 0xB5; break; // Mu
3496 else if (state
& (STATE_LEFT_CTRL
))
3498 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3500 key
= key_table
[cmd
] - 'a' + 1;
3504 key
= key_table
[cmd
];
3509 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3513 key
= key_table
[idx
];
3525 static int analyze
= FALSE
;
3526 static int list
= FALSE
;
3527 static IRMP_DATA irmp_data
;
3532 if (! analyze
&& ! list
)
3536 if (irmp_get_data (&irmp_data
))
3540 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3544 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3547 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3549 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3551 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",
3552 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3554 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3556 char * p
= (char *) NULL
;
3560 case '\t' : p
= "TAB"; break;
3561 case '\r' : p
= "CR"; break;
3562 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3563 case KEY_MENUE
: p
= "MENUE"; break;
3564 case KEY_BACK
: p
= "BACK"; break;
3565 case KEY_FORWARD
: p
= "FORWARD"; break;
3566 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3567 case KEY_WINDOW
: p
= "WINDOW"; break;
3568 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3569 case KEY_STOP
: p
= "STOP"; break;
3570 case KEY_MAIL
: p
= "MAIL"; break;
3571 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3572 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3573 case KEY_SETUP
: p
= "SETUP"; break;
3574 case KEY_FONT
: p
= "FONT"; break;
3575 case KEY_PRINT
: p
= "PRINT"; break;
3576 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3578 case KEY_INSERT
: p
= "INSERT"; break;
3579 case KEY_DELETE
: p
= "DELETE"; break;
3580 case KEY_LEFT
: p
= "LEFT"; break;
3581 case KEY_HOME
: p
= "HOME"; break;
3582 case KEY_END
: p
= "END"; break;
3583 case KEY_UP
: p
= "UP"; break;
3584 case KEY_DOWN
: p
= "DOWN"; break;
3585 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3586 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3587 case KEY_RIGHT
: p
= "RIGHT"; break;
3588 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3589 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3590 default : p
= "<UNKNWON>"; break;
3593 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",
3594 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3598 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",
3599 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3604 printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",
3605 irmp_data
.protocol
, irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3612 main (int argc
, char ** argv
)
3620 int start_pulses
[256];
3621 int start_pauses
[256];
3625 int first_pulse
= TRUE
;
3626 int first_pause
= TRUE
;
3630 if (! strcmp (argv
[1], "-v"))
3634 else if (! strcmp (argv
[1], "-l"))
3638 else if (! strcmp (argv
[1], "-a"))
3642 else if (! strcmp (argv
[1], "-s"))
3646 else if (! strcmp (argv
[1], "-p"))
3653 for (i
= 0; i
< 256; i
++)
3655 start_pulses
[i
] = 0;
3656 start_pauses
[i
] = 0;
3663 while ((ch
= getchar ()) != EOF
)
3665 if (ch
== '_' || ch
== '0')
3673 printf ("pause: %d\n", pause
);
3682 start_pauses
[pause
]++;
3684 first_pause
= FALSE
;
3700 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3706 printf ("pulse: %d ", pulse
);
3715 start_pulses
[pulse
]++;
3717 first_pulse
= FALSE
;
3733 else if (ch
== '\n')
3737 if (list
&& pause
> 0)
3739 printf ("pause: %d\n", pause
);
3745 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
3757 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3764 puts ("-------------------------------------------------------------------");
3767 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
3769 if (ch
!= '\r') // ignore CR in DOS/Windows files
3786 print_spectrum ("START PULSES", start_pulses
, TRUE
);
3787 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
3788 print_spectrum ("PULSES", pulses
, TRUE
);
3789 print_spectrum ("PAUSES", pauses
, FALSE
);
3790 puts ("-------------------------------------------------------------------------------");