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.135 2012/12/07 13:04:14 fm Exp $
10 * Supported mikrocontrollers:
15 * ATmega8, ATmega16, ATmega32
17 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284
18 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *---------------------------------------------------------------------------------------------------------------------------------------------------
29 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
30 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
32 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
35 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
36 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
38 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
41 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
42 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
43 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
44 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
45 IRMP_SUPPORT_IR60_PROTOCOL
46 # define IRMP_SUPPORT_MANCHESTER 1
48 # define IRMP_SUPPORT_MANCHESTER 0
51 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
52 # define IRMP_SUPPORT_SERIAL 1
54 # define IRMP_SUPPORT_SERIAL 0
57 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
59 #define MIN_TOLERANCE_00 1.0 // -0%
60 #define MAX_TOLERANCE_00 1.0 // +0%
62 #define MIN_TOLERANCE_05 0.95 // -5%
63 #define MAX_TOLERANCE_05 1.05 // +5%
65 #define MIN_TOLERANCE_10 0.9 // -10%
66 #define MAX_TOLERANCE_10 1.1 // +10%
68 #define MIN_TOLERANCE_15 0.85 // -15%
69 #define MAX_TOLERANCE_15 1.15 // +15%
71 #define MIN_TOLERANCE_20 0.8 // -20%
72 #define MAX_TOLERANCE_20 1.2 // +20%
74 #define MIN_TOLERANCE_30 0.7 // -30%
75 #define MAX_TOLERANCE_30 1.3 // +30%
77 #define MIN_TOLERANCE_40 0.6 // -40%
78 #define MAX_TOLERANCE_40 1.4 // +40%
80 #define MIN_TOLERANCE_50 0.5 // -50%
81 #define MAX_TOLERANCE_50 1.5 // +50%
83 #define MIN_TOLERANCE_60 0.4 // -60%
84 #define MAX_TOLERANCE_60 1.6 // +60%
86 #define MIN_TOLERANCE_70 0.3 // -70%
87 #define MAX_TOLERANCE_70 1.7 // +70%
89 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
90 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
91 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
92 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
93 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
94 #else // only 5% + 1 to avoid conflict with RC6:
95 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
97 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
98 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
99 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
100 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
101 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
102 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
104 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
105 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
106 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
107 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
108 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
109 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
110 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
111 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
112 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
113 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
114 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
115 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
116 // autodetect nec repetition frame within 50 msec:
117 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
119 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
121 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
124 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
125 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
126 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
127 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
128 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
129 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
130 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
131 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
132 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
133 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
135 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
136 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
137 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
138 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
139 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
140 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
141 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
142 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
143 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
144 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
146 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
147 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
148 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
149 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
150 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
151 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
152 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
153 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
154 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
155 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
157 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
158 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
159 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
160 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
161 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
162 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
163 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
164 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
165 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
166 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
169 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
170 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
171 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
173 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
174 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
177 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
178 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
180 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
181 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
182 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
183 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
184 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
185 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
186 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
187 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
189 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
190 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
191 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
192 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
196 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
197 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
198 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
200 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
201 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
202 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
203 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
204 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
207 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)
208 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)
209 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
210 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
211 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
212 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
213 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
214 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
215 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
216 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
218 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
219 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
220 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
223 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
224 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
225 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
226 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
227 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
228 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
229 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
231 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
232 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
233 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
234 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
235 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
236 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
237 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
238 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
239 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
240 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
241 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
242 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((PAUSE_LEN)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // value must be below IRMP_TIMEOUT
243 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
244 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
245 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
246 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
247 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
248 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
249 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
250 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
251 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
252 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
253 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
254 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
255 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
256 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
258 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
259 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
260 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
261 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
262 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
263 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
264 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
266 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
267 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
268 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
269 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
270 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
271 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
272 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
273 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
275 #define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
276 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
277 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
278 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
279 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
280 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
281 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
282 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
284 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
286 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
288 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
291 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
292 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
293 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
294 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
295 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
296 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
297 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
298 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
299 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
301 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
302 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
303 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
304 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!
305 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
306 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
307 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
308 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
309 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
310 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
311 // autodetect JVC repetition frame within 50 msec:
312 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
314 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
315 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
316 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
317 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
318 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
319 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
320 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
321 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
322 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
323 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
324 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
325 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
326 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
328 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
329 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
330 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
331 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
332 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
333 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
334 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
335 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
336 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
337 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
338 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
339 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
340 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
341 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
343 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
344 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
345 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
346 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
347 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
348 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
349 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
350 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
352 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
353 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
354 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
355 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
356 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
357 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
358 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
359 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
360 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
361 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
363 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
364 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
365 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
366 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
367 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
368 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
369 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
370 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
371 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
372 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
373 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
375 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
378 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
379 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
380 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
381 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
382 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
384 static int time_counter
;
387 # define ANALYZE_PUTCHAR(a)
388 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
389 # define ANALYZE_PRINTF(...)
390 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
391 # define ANALYZE_NEWLINE()
394 #if IRMP_USE_CALLBACK == 1
395 static void (*irmp_callback_ptr
) (uint8_t);
396 #endif // IRMP_USE_CALLBACK == 1
398 /*---------------------------------------------------------------------------------------------------------------------------------------------------
400 *---------------------------------------------------------------------------------------------------------------------------------------------------
402 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
404 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
441 /*---------------------------------------------------------------------------------------------------------------------------------------------------
443 *---------------------------------------------------------------------------------------------------------------------------------------------------
445 #if IRMP_LOGGING == 1 // logging via UART
447 #if IRMP_EXT_LOGGING == 1 // use external logging
448 #include "irmpextlog.h"
449 #else // normal UART log (IRMP_EXT_LOGGING == 0)
451 #ifndef UNIX_OR_WINDOWS
452 #include <util/setbaud.h>
457 #define UART0_UBRRH UBRR0H
458 #define UART0_UBRRL UBRR0L
459 #define UART0_UCSRA UCSR0A
460 #define UART0_UCSRB UCSR0B
461 #define UART0_UCSRC UCSR0C
462 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
463 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
464 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
466 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
468 #define UART0_URSEL_BIT_VALUE (0)
470 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
471 #define UART0_UDR UDR0
472 #define UART0_U2X U2X0
476 #define UART0_UBRRH UBRRH
477 #define UART0_UBRRL UBRRL
478 #define UART0_UCSRA UCSRA
479 #define UART0_UCSRB UCSRB
480 #define UART0_UCSRC UCSRC
481 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
482 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
483 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
485 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
487 #define UART0_URSEL_BIT_VALUE (0)
489 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
490 #define UART0_UDR UDR
491 #define UART0_U2X U2X
494 #endif //IRMP_EXT_LOGGING
496 /*---------------------------------------------------------------------------------------------------------------------------------------------------
498 * @details Initializes UART
499 *---------------------------------------------------------------------------------------------------------------------------------------------------
502 irmp_uart_init (void)
504 #ifndef UNIX_OR_WINDOWS
505 #if (IRMP_EXT_LOGGING == 0) // use UART
506 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
507 UART0_UBRRL
= UBRRL_VALUE
;
510 UART0_UCSRA
|= (1<<UART0_U2X
);
512 UART0_UCSRA
&= ~(1<<UART0_U2X
);
515 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
516 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
517 #else // other log method
519 #endif //IRMP_EXT_LOGGING
520 #endif // UNIX_OR_WINDOWS
523 /*---------------------------------------------------------------------------------------------------------------------------------------------------
525 * @details Sends character
526 * @param ch character to be transmitted
527 *---------------------------------------------------------------------------------------------------------------------------------------------------
530 irmp_uart_putc (unsigned char ch
)
532 #ifndef UNIX_OR_WINDOWS
533 #if (IRMP_EXT_LOGGING == 0)
534 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
541 sendextlog(ch
); //Use external log
545 #endif // UNIX_OR_WINDOWS
548 /*---------------------------------------------------------------------------------------------------------------------------------------------------
550 *---------------------------------------------------------------------------------------------------------------------------------------------------
553 #define STARTCYCLES 2 // min count of zeros before start of logging
554 #define ENDBITS 1000 // number of sequenced highbits to detect end
555 #define DATALEN 700 // log buffer size
557 #if 0 // old log routine
560 irmp_log (uint8_t val
)
562 static uint8_t buf
[DATALEN
]; // logging buffer
563 static uint16_t buf_idx
; // number of written bits
564 static uint8_t startcycles
; // current number of start-zeros
565 static uint16_t cnt
; // counts sequenced highbits - to detect end
567 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
575 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
577 if (buf_idx
< DATALEN
* 8) // index in range?
581 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
585 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
592 { // if high received then look at log-stop condition
596 { // if stop condition is true, output on uart
599 for (i
= 0; i
< STARTCYCLES
; i
++)
601 irmp_uart_putc ('0'); // the ignored starting zeros
604 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
609 for (j
= 0; j
< 8; j
++)
611 irmp_uart_putc ((d
& 1) + '0');
616 irmp_uart_putc ('\n');
628 #else // new log routine
631 irmp_log (uint8_t val
)
633 static uint8_t buf
[DATALEN
]; // logging buffer
634 static uint16_t buf_idx
; // index
635 static uint8_t startcycles
; // current number of start-zeros
636 static uint16_t cnt
; // counts sequenced highbits - to detect end
637 static uint8_t last_val
= 1;
639 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
647 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
653 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
654 { // if stop condition is true, output on uart
661 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
663 irmp_uart_putc ('0'); // the ignored starting zeros
666 for (i
= 0; i
< buf_idx
; i
++)
675 d
|= ((uint16_t) buf
[i
] << 8);
678 for (j
= 0; j
< d
; j
++)
683 v
= (v
== '1') ? '0' : '1';
686 for (i8
= 0; i8
< 20; i8
++)
688 irmp_uart_putc ('1');
691 irmp_uart_putc ('\n');
697 else if (buf_idx
< DATALEN
- 3)
701 buf
[buf_idx
++] = 0xff;
702 buf
[buf_idx
++] = (cnt
& 0xff);
703 buf
[buf_idx
] = (cnt
>> 8);
721 #define irmp_log(val)
722 #endif //IRMP_LOGGING
726 uint8_t protocol
; // ir protocol
727 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
728 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
729 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
730 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
731 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
732 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
733 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
734 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
735 uint8_t address_offset
; // address offset
736 uint8_t address_end
; // end of address
737 uint8_t command_offset
; // command offset
738 uint8_t command_end
; // end of command
739 uint8_t complete_len
; // complete length of frame
740 uint8_t stop_bit
; // flag: frame has stop bit
741 uint8_t lsb_first
; // flag: LSB first
742 uint8_t flags
; // some flags
745 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
747 static const PROGMEM IRMP_PARAMETER sircs_param
=
749 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
750 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
751 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
752 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
753 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
754 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
755 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
756 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
757 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
758 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
759 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
760 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
761 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
762 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
763 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
764 SIRCS_LSB
, // lsb_first: flag: LSB first
765 SIRCS_FLAGS
// flags: some flags
770 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
772 static const PROGMEM IRMP_PARAMETER nec_param
=
774 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
775 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
776 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
777 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
778 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
779 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
780 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
781 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
782 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
783 NEC_ADDRESS_OFFSET
, // address_offset: address offset
784 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
785 NEC_COMMAND_OFFSET
, // command_offset: command offset
786 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
787 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
788 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
789 NEC_LSB
, // lsb_first: flag: LSB first
790 NEC_FLAGS
// flags: some flags
793 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
795 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
796 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
797 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
798 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
799 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
800 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
801 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
802 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
803 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
804 0, // address_offset: address offset
805 0, // address_end: end of address
806 0, // command_offset: command offset
807 0, // command_end: end of command
808 0, // complete_len: complete length of frame
809 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
810 NEC_LSB
, // lsb_first: flag: LSB first
811 NEC_FLAGS
// flags: some flags
816 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
818 static const PROGMEM IRMP_PARAMETER nec42_param
=
820 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
821 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
822 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
823 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
824 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
825 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
826 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
827 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
828 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
829 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
830 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
831 NEC42_COMMAND_OFFSET
, // command_offset: command offset
832 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
833 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
834 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
835 NEC_LSB
, // lsb_first: flag: LSB first
836 NEC_FLAGS
// flags: some flags
841 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
843 static const PROGMEM IRMP_PARAMETER samsung_param
=
845 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
846 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
847 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
848 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
849 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
850 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
851 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
852 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
853 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
854 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
855 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
856 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
857 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
858 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
859 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
860 SAMSUNG_LSB
, // lsb_first: flag: LSB first
861 SAMSUNG_FLAGS
// flags: some flags
866 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
868 static const PROGMEM IRMP_PARAMETER matsushita_param
=
870 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
871 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
872 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
873 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
874 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
875 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
876 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
877 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
878 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
879 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
880 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
881 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
882 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
883 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
884 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
885 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
886 MATSUSHITA_FLAGS
// flags: some flags
891 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
893 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
895 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
896 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
897 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
898 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
899 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
900 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
901 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
902 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
903 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
904 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
905 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
906 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
907 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
908 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
909 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
910 KASEIKYO_LSB
, // lsb_first: flag: LSB first
911 KASEIKYO_FLAGS
// flags: some flags
916 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
918 static const PROGMEM IRMP_PARAMETER recs80_param
=
920 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
921 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
922 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
923 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
924 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
925 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
926 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
927 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
928 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
929 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
930 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
931 RECS80_COMMAND_OFFSET
, // command_offset: command offset
932 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
933 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
934 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
935 RECS80_LSB
, // lsb_first: flag: LSB first
936 RECS80_FLAGS
// flags: some flags
941 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
943 static const PROGMEM IRMP_PARAMETER rc5_param
=
945 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
946 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
947 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
948 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
949 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
950 0, // pulse_0_len_min: here: not used
951 0, // pulse_0_len_max: here: not used
952 0, // pause_0_len_min: here: not used
953 0, // pause_0_len_max: here: not used
954 RC5_ADDRESS_OFFSET
, // address_offset: address offset
955 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
956 RC5_COMMAND_OFFSET
, // command_offset: command offset
957 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
958 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
959 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
960 RC5_LSB
, // lsb_first: flag: LSB first
961 RC5_FLAGS
// flags: some flags
966 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
968 static const PROGMEM IRMP_PARAMETER denon_param
=
970 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
971 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
972 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
973 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
974 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
975 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
976 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
977 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
978 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
979 DENON_ADDRESS_OFFSET
, // address_offset: address offset
980 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
981 DENON_COMMAND_OFFSET
, // command_offset: command offset
982 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
983 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
984 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
985 DENON_LSB
, // lsb_first: flag: LSB first
986 DENON_FLAGS
// flags: some flags
991 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
993 static const PROGMEM IRMP_PARAMETER rc6_param
=
995 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
997 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
998 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
999 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1000 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1001 0, // pulse_0_len_min: here: not used
1002 0, // pulse_0_len_max: here: not used
1003 0, // pause_0_len_min: here: not used
1004 0, // pause_0_len_max: here: not used
1005 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1006 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1007 RC6_COMMAND_OFFSET
, // command_offset: command offset
1008 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1009 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1010 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1011 RC6_LSB
, // lsb_first: flag: LSB first
1012 RC6_FLAGS
// flags: some flags
1017 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1019 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1021 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1022 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1023 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1024 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1025 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1026 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1027 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1028 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1029 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1030 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1031 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1032 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1033 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1034 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1035 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1036 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1037 RECS80EXT_FLAGS
// flags: some flags
1042 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1044 static const PROGMEM IRMP_PARAMETER nubert_param
=
1046 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1047 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1048 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1049 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1050 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1051 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1052 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1053 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1054 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1055 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1056 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1057 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1058 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1059 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1060 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1061 NUBERT_LSB
, // lsb_first: flag: LSB first
1062 NUBERT_FLAGS
// flags: some flags
1067 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1069 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1071 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1072 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1073 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1074 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1075 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1076 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1077 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1078 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1079 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1080 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1081 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1082 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1083 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1084 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1085 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1086 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1087 BANG_OLUFSEN_FLAGS
// flags: some flags
1092 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1094 static uint8_t first_bit
;
1096 static const PROGMEM IRMP_PARAMETER grundig_param
=
1098 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1100 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1101 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1102 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1103 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1104 0, // pulse_0_len_min: here: not used
1105 0, // pulse_0_len_max: here: not used
1106 0, // pause_0_len_min: here: not used
1107 0, // pause_0_len_max: here: not used
1108 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1109 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1110 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1111 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1112 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1113 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1114 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1115 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1120 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1122 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1124 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1125 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1126 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1127 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1128 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1129 0, // pulse_0_len_min: here: not used
1130 0, // pulse_0_len_max: here: not used
1131 0, // pause_0_len_min: here: not used
1132 0, // pause_0_len_max: here: not used
1133 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1134 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1135 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1136 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1137 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1138 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1139 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1140 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1145 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1147 static const PROGMEM IRMP_PARAMETER fdc_param
=
1149 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1150 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1151 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1152 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1153 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1154 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1155 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1156 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1157 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1158 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1159 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1160 FDC_COMMAND_OFFSET
, // command_offset: command offset
1161 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1162 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1163 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1164 FDC_LSB
, // lsb_first: flag: LSB first
1165 FDC_FLAGS
// flags: some flags
1170 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1172 static const PROGMEM IRMP_PARAMETER rccar_param
=
1174 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1175 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1176 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1177 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1178 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1179 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1180 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1181 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1182 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1183 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1184 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1185 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1186 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1187 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1188 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1189 RCCAR_LSB
, // lsb_first: flag: LSB first
1190 RCCAR_FLAGS
// flags: some flags
1195 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1197 static const PROGMEM IRMP_PARAMETER nikon_param
=
1199 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1200 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1201 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1202 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1203 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1204 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1205 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1206 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1207 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1208 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1209 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1210 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1211 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1212 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1213 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1214 NIKON_LSB
, // lsb_first: flag: LSB first
1215 NIKON_FLAGS
// flags: some flags
1220 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1222 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1224 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1225 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1226 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1227 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1228 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1229 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1230 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1231 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1232 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1233 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1234 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1235 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1236 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1237 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1238 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1239 KATHREIN_LSB
, // lsb_first: flag: LSB first
1240 KATHREIN_FLAGS
// flags: some flags
1245 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1247 static const PROGMEM IRMP_PARAMETER netbox_param
=
1249 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1250 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1251 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1252 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1253 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1254 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1255 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1256 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1257 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1258 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1259 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1260 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1261 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1262 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1263 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1264 NETBOX_LSB
, // lsb_first: flag: LSB first
1265 NETBOX_FLAGS
// flags: some flags
1270 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1272 static const PROGMEM IRMP_PARAMETER lego_param
=
1274 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1275 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1276 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1277 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1278 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1279 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1280 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1281 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1282 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1283 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1284 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1285 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1286 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1287 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1288 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1289 LEGO_LSB
, // lsb_first: flag: LSB first
1290 LEGO_FLAGS
// flags: some flags
1295 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1297 static const PROGMEM IRMP_PARAMETER thomson_param
=
1299 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1300 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1301 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1302 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1303 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1304 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1305 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1306 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1307 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1308 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1309 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1310 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1311 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1312 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1313 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1314 THOMSON_LSB
, // lsb_first: flag: LSB first
1315 THOMSON_FLAGS
// flags: some flags
1320 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1322 static const PROGMEM IRMP_PARAMETER bose_param
=
1324 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1325 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1326 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1327 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1328 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1329 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1330 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1331 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1332 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1333 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1334 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1335 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1336 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1337 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1338 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1339 BOSE_LSB
, // lsb_first: flag: LSB first
1340 BOSE_FLAGS
// flags: some flags
1345 static uint8_t irmp_bit
; // current bit position
1346 static IRMP_PARAMETER irmp_param
;
1348 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1349 static IRMP_PARAMETER irmp_param2
;
1352 static volatile uint8_t irmp_ir_detected
;
1353 static volatile uint8_t irmp_protocol
;
1354 static volatile uint16_t irmp_address
;
1355 static volatile uint16_t irmp_command
;
1356 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1357 static volatile uint8_t irmp_flags
;
1358 // static volatile uint8_t irmp_busy_flag;
1361 #define input(x) (x)
1362 static uint8_t IRMP_PIN
;
1365 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1366 * Initialize IRMP decoder
1367 * @details Configures IRMP input pin
1368 *---------------------------------------------------------------------------------------------------------------------------------------------------
1374 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1375 #elif defined (ARM_STM32) // STM32
1376 GPIO_InitTypeDef GPIO_InitStructure
;
1378 /* GPIOx clock enable */
1379 #if defined (ARM_STM32L1XX)
1380 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1381 #elif defined (ARM_STM32F10X)
1382 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1383 #elif defined (ARM_STM32F4XX)
1384 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1387 /* GPIO Configuration */
1388 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1389 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1390 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1391 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1392 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1393 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1394 #elif defined (ARM_STM32F10X)
1395 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1396 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1398 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1399 #elif defined(STELLARIS_ARM_CORTEX_M4)
1400 // Enable the GPIO port
1401 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1404 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1405 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1407 GPIO_PIN_TYPE_STD_WPU
);
1409 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1410 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1413 #if IRMP_LOGGING == 1
1418 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1420 * @details gets decoded IRMP data
1421 * @param pointer in order to store IRMP data
1422 * @return TRUE: successful, FALSE: failed
1423 *---------------------------------------------------------------------------------------------------------------------------------------------------
1426 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1428 uint8_t rtc
= FALSE
;
1430 if (irmp_ir_detected
)
1432 switch (irmp_protocol
)
1434 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1435 case IRMP_SAMSUNG_PROTOCOL
:
1436 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1438 irmp_command
&= 0xff;
1439 irmp_command
|= irmp_id
<< 8;
1444 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1445 case IRMP_NEC_PROTOCOL
:
1446 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1448 irmp_command
&= 0xff;
1451 else if (irmp_address
== 0x87EE)
1453 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1454 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1455 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1456 irmp_command
&= 0x00FF;
1461 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1462 case IRMP_BOSE_PROTOCOL
:
1463 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1465 irmp_command
&= 0xff;
1470 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1471 case IRMP_SIEMENS_PROTOCOL
:
1472 case IRMP_RUWIDO_PROTOCOL
:
1473 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1480 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1481 case IRMP_KATHREIN_PROTOCOL
:
1482 if (irmp_command
!= 0x0000)
1488 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1489 case IRMP_RC5_PROTOCOL
:
1490 irmp_address
&= ~0x20; // clear toggle bit
1494 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1495 case IRMP_IR60_PROTOCOL
:
1496 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1502 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1506 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1507 case IRMP_RCCAR_PROTOCOL
:
1508 // frame in irmp_data:
1509 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1510 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1511 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1512 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1513 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1514 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1515 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1519 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1520 case IRMP_NETBOX_PROTOCOL
:
1521 if (irmp_command
& 0x1000) // last bit set?
1523 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1526 irmp_command
&= 0x7F;
1529 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1532 irmp_command
|= 0x80;
1537 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1542 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1546 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1547 case IRMP_LEGO_PROTOCOL
:
1549 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1551 if ((irmp_command
& 0x000F) == crc
)
1558 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1559 // rtc = TRUE; // don't accept codes with CRC errors
1573 irmp_data_p
->protocol
= irmp_protocol
;
1574 irmp_data_p
->address
= irmp_address
;
1575 irmp_data_p
->command
= irmp_command
;
1576 irmp_data_p
->flags
= irmp_flags
;
1582 irmp_ir_detected
= FALSE
;
1589 // irmp_is_busy (void)
1591 // return irmp_busy_flag;
1594 #if IRMP_USE_CALLBACK == 1
1596 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1598 irmp_callback_ptr
= cb
;
1600 #endif // IRMP_USE_CALLBACK == 1
1602 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1603 static uint16_t irmp_tmp_address
; // ir address
1604 static uint16_t irmp_tmp_command
; // ir command
1606 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1607 static uint16_t irmp_tmp_address2
; // ir address
1608 static uint16_t irmp_tmp_command2
; // ir command
1611 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1612 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1614 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1615 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1616 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1619 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1621 * @details store bit in temp address or temp command
1622 * @param value to store: 0 or 1
1623 *---------------------------------------------------------------------------------------------------------------------------------------------------
1625 // verhindert, dass irmp_store_bit() inline compiliert wird:
1626 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1629 irmp_store_bit (uint8_t value
)
1631 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1632 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1639 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1641 if (irmp_param
.lsb_first
)
1643 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1647 irmp_tmp_address
<<= 1;
1648 irmp_tmp_address
|= value
;
1651 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1653 if (irmp_param
.lsb_first
)
1655 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1659 irmp_tmp_command
<<= 1;
1660 irmp_tmp_command
|= value
;
1664 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1665 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1667 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1672 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1673 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1675 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1680 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1681 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1683 if (irmp_bit
>= 20 && irmp_bit
< 24)
1685 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1687 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1689 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1692 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1696 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1700 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1713 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1715 * @details store bit in temp address or temp command
1716 * @param value to store: 0 or 1
1717 *---------------------------------------------------------------------------------------------------------------------------------------------------
1719 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1721 irmp_store_bit2 (uint8_t value
)
1725 if (irmp_param
.protocol
)
1727 irmp_bit2
= irmp_bit
- 2;
1731 irmp_bit2
= irmp_bit
- 1;
1734 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1736 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1738 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1740 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1743 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1745 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1747 * @details ISR routine, called 10000 times per second
1748 *---------------------------------------------------------------------------------------------------------------------------------------------------
1753 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1754 static uint8_t wait_for_space
; // flag: wait for data bit space
1755 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1756 static uint8_t irmp_pulse_time
; // count bit time for pulse
1757 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1758 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1759 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1760 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1761 static uint8_t repetition_frame_number
;
1762 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1763 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1764 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
1766 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1767 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1769 #if IRMP_SUPPORT_MANCHESTER == 1
1770 static PAUSE_LEN last_pause
; // last pause value
1772 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1773 static uint8_t last_value
; // last bit value
1775 uint8_t irmp_input
; // input value
1781 irmp_input
= input(IRMP_PIN
);
1783 #if IRMP_USE_CALLBACK == 1
1784 if (irmp_callback_ptr
)
1786 static uint8_t last_inverted_input
;
1788 if (last_inverted_input
!= !irmp_input
)
1790 (*irmp_callback_ptr
) (! irmp_input
);
1791 last_inverted_input
= !irmp_input
;
1794 #endif // IRMP_USE_CALLBACK == 1
1796 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1798 if (! irmp_ir_detected
) // ir code already detected?
1800 if (! irmp_start_bit_detected
) // start bit detected?
1802 if (! irmp_input
) // receiving burst?
1804 // irmp_busy_flag = TRUE;
1806 if (! irmp_pulse_time
)
1808 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1811 irmp_pulse_time
++; // increment counter
1815 if (irmp_pulse_time
) // it's dark....
1816 { // set flags for counting the time of darkness...
1817 irmp_start_bit_detected
= 1;
1818 wait_for_start_space
= 1;
1820 irmp_tmp_command
= 0;
1821 irmp_tmp_address
= 0;
1822 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1826 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1827 irmp_tmp_command2
= 0;
1828 irmp_tmp_address2
= 0;
1832 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1833 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1834 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1839 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
1841 key_repetition_len
++;
1843 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1844 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
1846 denon_repetition_len
++;
1848 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
1850 ANALYZE_PRINTF ("%8.3fms error 6: did not receive inverted command repetition\n",
1851 (double) (time_counter
* 1000) / F_INTERRUPTS
);
1852 last_irmp_denon_command
= 0;
1853 denon_repetition_len
= 0xFFFF;
1856 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1863 if (wait_for_start_space
) // we have received start bit...
1864 { // ...and are counting the time of darkness
1865 if (irmp_input
) // still dark?
1867 irmp_pause_time
++; // increment counter
1869 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1870 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
) ||
1871 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1873 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1876 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1877 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1882 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1884 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
);
1885 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1887 // irmp_busy_flag = FALSE;
1888 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1889 irmp_pulse_time
= 0;
1890 irmp_pause_time
= 0;
1894 { // receiving first data pulse!
1895 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1897 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1898 irmp_param2
.protocol
= 0;
1901 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1903 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1904 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1905 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1907 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1908 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1909 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1910 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1913 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1915 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1916 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1917 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1918 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1920 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1921 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1922 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1923 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1926 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1928 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1929 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1930 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1932 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1933 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1934 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1935 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1936 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1938 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1939 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1940 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1941 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1945 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1946 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1948 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1949 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
1950 { // some jvc remote controls use nec repetition frame for jvc repetition frame
1951 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1952 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1953 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1954 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1957 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1959 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1960 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1961 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1963 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
1968 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1969 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1970 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1971 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
1972 { // it's JVC repetition type 3
1973 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1974 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1975 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
1976 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1979 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1981 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
1983 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1984 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
1985 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
1987 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1988 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
1989 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
1990 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
1993 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
1995 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1996 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
1997 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
1999 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2000 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2001 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2002 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2005 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2007 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2008 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2009 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2010 { // it's MATSUSHITA
2011 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2012 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2013 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2014 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2017 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2019 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2020 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2021 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2023 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2024 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2025 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2026 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2029 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2031 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2032 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2033 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2035 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2036 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2037 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2038 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2041 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2043 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2044 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2045 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2046 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2047 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2049 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2050 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2051 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2053 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2054 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2055 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2056 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2057 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2058 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2059 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2060 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2063 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2065 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2066 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2067 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2069 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2070 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2071 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2072 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2073 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2074 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2075 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2076 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2079 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2081 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2082 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2083 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2084 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2085 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2088 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2089 last_pause
= irmp_pause_time
;
2091 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2092 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2095 rc5_cmd_bit6
= 1<<6;
2103 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2105 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2106 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2107 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2108 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2110 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2111 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2112 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2113 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2114 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2117 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2119 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2120 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2121 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2122 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2124 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2125 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2126 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2127 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2128 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2131 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2133 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2134 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2135 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2137 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2138 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2139 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2140 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2143 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2145 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2146 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2147 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2149 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2150 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2151 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2152 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2157 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2159 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2160 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2161 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2163 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2164 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2165 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2166 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2169 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2171 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2172 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2173 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2175 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2176 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2177 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2178 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2181 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2183 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2184 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2185 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2186 { // it's BANG_OLUFSEN
2187 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2188 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2189 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2190 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2191 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2192 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2193 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2194 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2195 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2196 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2197 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2198 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2199 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2200 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2204 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2206 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2207 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2208 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2210 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2211 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2212 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2213 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2214 last_pause
= irmp_pause_time
;
2218 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2220 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2221 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2222 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2223 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2224 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2225 { // it's RUWIDO or SIEMENS
2226 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2227 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2228 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2229 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2230 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2231 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2232 last_pause
= irmp_pause_time
;
2236 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2238 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2239 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2240 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2242 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2243 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2244 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2245 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2248 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2250 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2251 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2252 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2254 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2255 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2256 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2257 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2260 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2262 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2263 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2264 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2266 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2267 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2268 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2269 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2272 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2274 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2275 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2276 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2278 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2279 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2280 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2281 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2284 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2286 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2287 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2288 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2290 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2291 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2292 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2293 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2296 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2299 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2300 // irmp_busy_flag = FALSE;
2301 irmp_start_bit_detected
= 0; // wait for another start bit...
2304 if (irmp_start_bit_detected
)
2306 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2309 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2311 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2312 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2316 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2317 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2318 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2319 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2322 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2323 if (irmp_param2
.protocol
)
2325 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2326 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2327 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2328 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2333 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2334 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2336 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2340 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2342 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2343 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2347 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2348 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2349 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2350 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2353 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2354 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2356 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2357 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2361 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2362 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2363 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2364 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2370 #if IRMP_SUPPORT_MANCHESTER == 1
2371 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2372 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2373 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2375 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2377 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2378 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2380 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2382 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2384 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2386 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2388 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2392 #endif // IRMP_SUPPORT_MANCHESTER == 1
2394 #if IRMP_SUPPORT_SERIAL == 1
2395 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2400 #endif // IRMP_SUPPORT_SERIAL == 1
2403 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2404 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2406 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2408 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2409 { // pause timings correct for "1"?
2410 ANALYZE_PUTCHAR ('1'); // yes, store 1
2414 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2415 { // pause timings correct for "0"?
2416 ANALYZE_PUTCHAR ('0'); // yes, store 0
2422 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2423 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2424 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2426 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2428 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2429 { // pause timings correct for "1"?
2430 ANALYZE_PUTCHAR ('1'); // yes, store 1
2434 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2435 { // pause timings correct for "0"?
2436 ANALYZE_PUTCHAR ('0'); // yes, store 0
2442 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2444 ; // else do nothing
2447 irmp_pulse_time
= 1; // set counter to 1, not 0
2448 irmp_pause_time
= 0;
2449 wait_for_start_space
= 0;
2452 else if (wait_for_space
) // the data section....
2453 { // counting the time of darkness....
2454 uint8_t got_light
= FALSE
;
2456 if (irmp_input
) // still dark?
2458 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2461 #if IRMP_SUPPORT_MANCHESTER == 1
2462 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2464 #if IRMP_SUPPORT_SERIAL == 1
2465 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2467 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2470 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2472 ANALYZE_PRINTF ("stop bit detected\n");
2475 irmp_param
.stop_bit
= 0;
2479 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",
2480 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2482 // irmp_busy_flag = FALSE;
2483 irmp_start_bit_detected
= 0; // wait for another start bit...
2484 irmp_pulse_time
= 0;
2485 irmp_pause_time
= 0;
2490 irmp_pause_time
++; // increment counter
2492 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2493 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2494 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2495 irmp_bit
>= 12 - 1) // pause too long?
2496 { // yes, break and close this frame
2497 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2498 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2499 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2500 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2501 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2505 #if IRMP_SUPPORT_SERIAL == 1
2506 // NETBOX generates no stop bit, here is the timeout condition:
2507 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2508 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2510 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2514 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2515 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2517 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2519 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2520 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2521 irmp_param
.stop_bit
= TRUE
; // set flag
2523 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2524 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2525 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2526 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2527 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2528 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2530 irmp_tmp_command
<<= 1;
2531 irmp_tmp_command
|= first_bit
;
2533 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2534 { // special manchester decoder
2535 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2536 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2537 irmp_param
.stop_bit
= TRUE
; // set flag
2539 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2541 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2542 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2543 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2544 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2545 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2546 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2548 if (irmp_tmp_command
& 0x300)
2550 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2551 irmp_tmp_command
&= 0xFF;
2557 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2558 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2560 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2561 { // special manchester decoder
2562 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2563 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2564 irmp_param
.stop_bit
= TRUE
; // set flag
2566 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2568 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2569 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2570 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2571 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2572 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2573 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2576 // RUWIDO: AAAAAAAAACCCCCCCp
2577 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2578 irmp_tmp_address
<<= 2;
2579 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2580 irmp_tmp_command
&= 0x003F;
2581 irmp_tmp_command
<<= 4;
2582 irmp_tmp_command
|= last_value
;
2587 #if IRMP_SUPPORT_MANCHESTER == 1
2588 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2589 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2590 { // special manchester decoder
2591 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2592 irmp_param
.stop_bit
= TRUE
; // set flag
2595 #endif // IRMP_SUPPORT_MANCHESTER == 1
2596 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2598 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2602 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2603 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2605 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2606 irmp_param
.stop_bit
= TRUE
; // set flag
2607 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2608 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2609 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2610 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2611 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2613 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2615 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2616 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2617 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2619 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2620 irmp_param
.stop_bit
= TRUE
; // set flag
2621 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2622 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2624 // 0123456789ABC0123456789ABC0123456701234567
2625 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2626 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2627 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2628 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2630 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2631 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2632 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2634 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2635 irmp_param
.stop_bit
= TRUE
; // set flag
2636 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2637 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2639 // 0123456789ABC0123456789ABC0123456701234567
2640 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2641 // JVC: AAAACCCCCCCCCCCC
2642 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2643 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2645 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2646 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2649 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2650 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2652 // irmp_busy_flag = FALSE;
2653 irmp_start_bit_detected
= 0; // wait for another start bit...
2654 irmp_pulse_time
= 0;
2655 irmp_pause_time
= 0;
2667 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2669 #if IRMP_SUPPORT_MANCHESTER == 1
2670 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2673 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2674 #else // better, but some IR-RCs use asymmetric timings :-/
2675 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2676 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2679 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2680 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2682 ANALYZE_PUTCHAR ('T');
2683 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2696 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2698 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2699 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2701 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2702 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2704 ANALYZE_PUTCHAR ('T');
2707 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2718 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2720 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2721 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2722 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2723 if (! irmp_param2
.protocol
)
2728 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2732 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2733 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2735 uint8_t manchester_value
;
2737 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2739 manchester_value
= last_value
? 0 : 1;
2740 last_value
= manchester_value
;
2744 manchester_value
= last_value
;
2747 ANALYZE_PUTCHAR (manchester_value
+ '0');
2749 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2750 if (! irmp_param2
.protocol
)
2756 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2757 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2759 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2760 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2761 irmp_param
.address_offset
= 5;
2762 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2763 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2764 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2765 irmp_tmp_address
= 0;
2767 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2769 irmp_store_bit (manchester_value
);
2773 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2774 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2775 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2776 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2777 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2779 ANALYZE_PUTCHAR ('?');
2780 irmp_param
.protocol
= 0; // switch to FDC, see below
2783 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2784 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2785 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2786 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2787 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2788 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2790 ANALYZE_PUTCHAR ('?');
2791 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2794 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2796 ANALYZE_PUTCHAR ('?');
2798 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2799 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2800 // irmp_busy_flag = FALSE;
2801 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2802 irmp_pause_time
= 0;
2806 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2807 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2809 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2811 ANALYZE_PRINTF (" 1 (FDC)\n");
2812 irmp_store_bit2 (1);
2814 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2816 ANALYZE_PRINTF (" 0 (FDC)\n");
2817 irmp_store_bit2 (0);
2820 if (! irmp_param
.protocol
)
2822 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2823 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2824 irmp_param2
.protocol
= 0;
2825 irmp_tmp_address
= irmp_tmp_address2
;
2826 irmp_tmp_command
= irmp_tmp_command2
;
2829 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2830 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2831 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2833 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2835 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2836 irmp_store_bit2 (1);
2838 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2840 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2841 irmp_store_bit2 (0);
2844 if (! irmp_param
.protocol
)
2846 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2847 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2848 irmp_param2
.protocol
= 0;
2849 irmp_tmp_address
= irmp_tmp_address2
;
2850 irmp_tmp_command
= irmp_tmp_command2
;
2853 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2855 last_pause
= irmp_pause_time
;
2859 #endif // IRMP_SUPPORT_MANCHESTER == 1
2861 #if IRMP_SUPPORT_SERIAL == 1
2862 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2864 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2866 ANALYZE_PUTCHAR ('1');
2869 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2871 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2875 irmp_pulse_time
= 0;
2879 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2881 ANALYZE_PUTCHAR ('0');
2884 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2886 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2890 irmp_pause_time
= 0;
2897 #endif // IRMP_SUPPORT_SERIAL == 1
2899 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2900 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2902 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2903 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2905 ANALYZE_PRINTF ("SYNC\n");
2910 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2912 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2913 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2914 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2915 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2917 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2919 ANALYZE_PUTCHAR ('1');
2926 ANALYZE_PUTCHAR ('0');
2932 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2935 { // timing incorrect!
2936 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2937 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2938 // irmp_busy_flag = FALSE;
2939 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2940 irmp_pause_time
= 0;
2944 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2946 #if IRMP_SUPPORT_NEC16_PROTOCOL
2947 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2948 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
2949 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
2950 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
2951 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2952 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2954 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
2955 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
2956 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
2957 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
2958 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
2959 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
2960 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
2964 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
2966 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2967 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2969 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
2971 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
2973 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
2975 ANALYZE_PRINTF ("3rd start bit\n");
2980 { // timing incorrect!
2981 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
);
2982 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2983 // irmp_busy_flag = FALSE;
2984 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2985 irmp_pause_time
= 0;
2988 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
2990 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
2992 ANALYZE_PRINTF ("trailer bit\n");
2997 { // timing incorrect!
2998 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
);
2999 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3000 // irmp_busy_flag = FALSE;
3001 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3002 irmp_pause_time
= 0;
3007 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3008 { // pulse & pause timings correct for "1"?
3009 ANALYZE_PUTCHAR ('1');
3015 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3016 { // pulse & pause timings correct for "0"?
3017 ANALYZE_PUTCHAR ('0');
3023 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3025 ANALYZE_PUTCHAR (last_value
+ '0');
3027 irmp_store_bit (last_value
);
3031 { // timing incorrect!
3032 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
);
3033 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3034 // irmp_busy_flag = FALSE;
3035 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3036 irmp_pause_time
= 0;
3041 { // timing incorrect!
3042 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
);
3043 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3044 // irmp_busy_flag = FALSE;
3045 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3046 irmp_pause_time
= 0;
3050 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3052 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3053 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3054 { // pulse & pause timings correct for "1"?
3055 ANALYZE_PUTCHAR ('1');
3060 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3061 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3062 { // pulse & pause timings correct for "0"?
3063 ANALYZE_PUTCHAR ('0');
3069 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3071 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3072 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3073 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3074 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3076 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3082 ANALYZE_PUTCHAR ('S');
3084 irmp_tmp_command
<<= 1;
3088 ANALYZE_PUTCHAR ('S');
3095 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3096 { // timing incorrect!
3097 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3098 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3099 // irmp_busy_flag = FALSE;
3100 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3101 irmp_pause_time
= 0;
3104 irmp_pulse_time
= 1; // set counter to 1, not 0
3108 { // counting the pulse length ...
3109 if (! irmp_input
) // still light?
3111 irmp_pulse_time
++; // increment counter
3115 wait_for_space
= 1; // let's count the time (see above)
3116 irmp_pause_time
= 1; // set pause counter to 1, not 0
3120 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3122 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3124 repetition_frame_number
++;
3128 repetition_frame_number
= 0;
3131 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3132 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3133 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3135 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3136 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3137 key_repetition_len
= 0;
3142 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3143 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3144 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3146 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3147 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3148 key_repetition_len
= 0;
3153 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3154 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3155 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3157 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3158 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3159 key_repetition_len
= 0;
3164 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3165 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3166 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3168 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3169 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3170 key_repetition_len
= 0;
3176 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3177 irmp_ir_detected
= TRUE
;
3179 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3180 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3181 { // check for repetition frame
3182 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3184 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3185 last_irmp_denon_command
= 0;
3187 irmp_protocol
= irmp_param
.protocol
; // store protocol
3188 irmp_address
= irmp_tmp_address
; // store address
3189 irmp_command
= irmp_tmp_command
; // store command
3193 if ((irmp_tmp_command
& 0x03) == 0)
3195 ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3196 last_irmp_denon_command
= irmp_tmp_command
;
3197 denon_repetition_len
= 0;
3201 ANALYZE_PRINTF ("%8.3fms got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3202 last_irmp_denon_command
= 0;
3204 irmp_ir_detected
= FALSE
;
3208 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3210 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3211 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3212 { // Grundig start frame?
3213 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3214 irmp_ir_detected
= FALSE
;
3217 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3219 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3220 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3221 { // Nokia start frame?
3222 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3223 irmp_ir_detected
= FALSE
;
3226 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3228 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3229 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3231 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3233 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
3234 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
3235 irmp_tmp_address
= last_irmp_address
; // address is last address
3236 irmp_tmp_command
= last_irmp_command
; // command is last command
3237 irmp_flags
|= IRMP_FLAG_REPETITION
;
3238 key_repetition_len
= 0;
3242 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
3243 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3244 irmp_ir_detected
= FALSE
;
3247 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3249 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3250 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3253 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3254 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3256 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3258 if (xor_value
!= (xor_check
[2] & 0x0F))
3260 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
3261 irmp_ir_detected
= FALSE
;
3264 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3266 if (xor_value
!= xor_check
[5])
3268 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
3269 irmp_ir_detected
= FALSE
;
3272 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3274 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3276 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3277 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3279 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3282 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3284 irmp_protocol
= irmp_param
.protocol
;
3287 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3288 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3290 if (irmp_tmp_command
& 0x000F) // released key?
3292 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3296 irmp_tmp_command
>>= 4; // no, it's a pressed key
3298 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3299 irmp_tmp_address
&= 0x003F;
3303 irmp_address
= irmp_tmp_address
; // store address
3304 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3305 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3307 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3311 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3312 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3314 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3317 irmp_command
= irmp_tmp_command
; // store command
3319 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3320 irmp_id
= irmp_tmp_id
;
3325 if (irmp_ir_detected
)
3327 if (last_irmp_command
== irmp_tmp_command
&&
3328 last_irmp_address
== irmp_tmp_address
&&
3329 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
3331 irmp_flags
|= IRMP_FLAG_REPETITION
;
3334 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3335 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3337 key_repetition_len
= 0;
3341 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3344 // irmp_busy_flag = FALSE;
3345 irmp_start_bit_detected
= 0; // and wait for next start bit
3346 irmp_tmp_command
= 0;
3347 irmp_pulse_time
= 0;
3348 irmp_pause_time
= 0;
3350 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3351 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3352 { // set pulse time here!
3353 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3355 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3360 #if defined(STELLARIS_ARM_CORTEX_M4)
3361 // Clear the timer interrupt
3362 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
3365 return (irmp_ir_detected
);
3370 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3371 * main functions - for Unix/Linux + Windows only!
3375 * Compile it under linux with:
3378 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3384 * -l list pulse/pauses
3386 *---------------------------------------------------------------------------------------------------------------------------------------------------
3390 print_timings (void)
3392 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3393 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3395 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3396 printf ("====================================================================================\n");
3397 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3398 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3399 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3400 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3402 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3403 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3404 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3405 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3407 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3408 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
,
3409 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3410 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3412 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3413 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3414 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3415 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3417 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3418 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3419 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3420 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3422 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3423 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3424 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3425 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3427 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3428 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3429 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3430 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3432 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3433 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3434 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3436 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3437 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3438 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3439 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3441 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3442 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3443 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3444 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3446 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3447 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3448 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3450 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3451 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3452 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3453 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3455 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3456 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3457 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3458 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3460 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3461 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3462 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3464 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3465 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3466 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3468 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3469 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3470 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3472 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3473 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3474 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3476 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3477 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3478 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3480 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3481 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3482 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3483 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3485 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3486 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3487 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3488 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3489 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3490 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3491 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3493 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3494 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3495 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3496 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3498 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3499 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3500 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3501 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3503 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3504 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3505 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3506 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3508 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3509 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3510 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3511 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3516 print_spectrum (char * text
, int * buf
, int is_pulse
)
3529 puts ("-------------------------------------------------------------------------------");
3530 printf ("%s:\n", text
);
3532 for (i
= 0; i
< 256; i
++)
3534 if (buf
[i
] > max_value
)
3540 for (i
= 1; i
< 100; i
++)
3545 value
= (buf
[i
] * 60) / max_value
;
3547 for (j
= 0; j
< value
; j
++)
3551 printf (" %d\n", buf
[i
]);
3562 average
= (float) sum
/ (float) counter
;
3573 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3574 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3575 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3577 tolerance
= (max
- average
);
3579 if (average
- min
> tolerance
)
3581 tolerance
= average
- min
;
3584 tolerance
= tolerance
* 100 / average
;
3585 printf ("tol: %4.1f%%\n", tolerance
);
3595 #define STATE_LEFT_SHIFT 0x01
3596 #define STATE_RIGHT_SHIFT 0x02
3597 #define STATE_LEFT_CTRL 0x04
3598 #define STATE_LEFT_ALT 0x08
3599 #define STATE_RIGHT_ALT 0x10
3601 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3602 #define KEY_MENUE 0x80 // keycode = 0x0070
3603 #define KEY_BACK 0x81 // keycode = 0x0071
3604 #define KEY_FORWARD 0x82 // keycode = 0x0072
3605 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3606 #define KEY_WINDOW 0x84 // keycode = 0x0074
3607 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3608 #define KEY_STOP 0x86 // keycode = 0x0076
3609 #define KEY_MAIL 0x87 // keycode = 0x0077
3610 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3611 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3612 #define KEY_SETUP 0x8A // keycode = 0x007a
3613 #define KEY_FONT 0x8B // keycode = 0x007b
3614 #define KEY_PRINT 0x8C // keycode = 0x007c
3615 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3617 #define KEY_INSERT 0x90 // keycode = 0x004b
3618 #define KEY_DELETE 0x91 // keycode = 0x004c
3619 #define KEY_LEFT 0x92 // keycode = 0x004f
3620 #define KEY_HOME 0x93 // keycode = 0x0050
3621 #define KEY_END 0x94 // keycode = 0x0051
3622 #define KEY_UP 0x95 // keycode = 0x0053
3623 #define KEY_DOWN 0x96 // keycode = 0x0054
3624 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3625 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3626 #define KEY_RIGHT 0x99 // keycode = 0x0059
3627 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3628 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3631 get_fdc_key (uint16_t cmd
)
3633 static uint8_t key_table
[128] =
3635 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3636 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3637 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3638 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3639 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3641 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3642 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3643 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3644 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3646 static uint8_t state
;
3652 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3653 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3654 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3655 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3656 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3657 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3658 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3659 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3660 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3661 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3663 case 0x006e: key
= KEY_ESCAPE
; break;
3664 case 0x004b: key
= KEY_INSERT
; break;
3665 case 0x004c: key
= KEY_DELETE
; break;
3666 case 0x004f: key
= KEY_LEFT
; break;
3667 case 0x0050: key
= KEY_HOME
; break;
3668 case 0x0051: key
= KEY_END
; break;
3669 case 0x0053: key
= KEY_UP
; break;
3670 case 0x0054: key
= KEY_DOWN
; break;
3671 case 0x0055: key
= KEY_PAGE_UP
; break;
3672 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3673 case 0x0059: key
= KEY_RIGHT
; break;
3674 case 0x0400: key
= KEY_MOUSE_1
; break;
3675 case 0x0800: key
= KEY_MOUSE_2
; break;
3679 if (!(cmd
& 0x80)) // pressed key
3681 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3683 key
= cmd
+ 0x10; // 7x -> 8x
3685 else if (cmd
< 64) // key listed in key_table
3687 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3691 case 0x0003: key
= '²'; break;
3692 case 0x0008: key
= '{'; break;
3693 case 0x0009: key
= '['; break;
3694 case 0x000A: key
= ']'; break;
3695 case 0x000B: key
= '}'; break;
3696 case 0x000C: key
= '\\'; break;
3697 case 0x001C: key
= '~'; break;
3698 case 0x002D: key
= '|'; break;
3699 case 0x0034: key
= 0xB5; break; // Mu
3702 else if (state
& (STATE_LEFT_CTRL
))
3704 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3706 key
= key_table
[cmd
] - 'a' + 1;
3710 key
= key_table
[cmd
];
3715 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3719 key
= key_table
[idx
];
3731 static int analyze
= FALSE
;
3732 static int list
= FALSE
;
3733 static IRMP_DATA irmp_data
;
3734 static int expected_protocol
;
3735 static int expected_address
;
3736 static int expected_command
;
3737 static int do_check_expected_values
;
3742 if (! analyze
&& ! list
)
3746 if (irmp_get_data (&irmp_data
))
3750 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3754 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3757 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3759 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3761 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
3762 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3764 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3766 char * p
= (char *) NULL
;
3770 case '\t' : p
= "TAB"; break;
3771 case '\r' : p
= "CR"; break;
3772 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3773 case KEY_MENUE
: p
= "MENUE"; break;
3774 case KEY_BACK
: p
= "BACK"; break;
3775 case KEY_FORWARD
: p
= "FORWARD"; break;
3776 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3777 case KEY_WINDOW
: p
= "WINDOW"; break;
3778 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3779 case KEY_STOP
: p
= "STOP"; break;
3780 case KEY_MAIL
: p
= "MAIL"; break;
3781 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3782 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3783 case KEY_SETUP
: p
= "SETUP"; break;
3784 case KEY_FONT
: p
= "FONT"; break;
3785 case KEY_PRINT
: p
= "PRINT"; break;
3786 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3788 case KEY_INSERT
: p
= "INSERT"; break;
3789 case KEY_DELETE
: p
= "DELETE"; break;
3790 case KEY_LEFT
: p
= "LEFT"; break;
3791 case KEY_HOME
: p
= "HOME"; break;
3792 case KEY_END
: p
= "END"; break;
3793 case KEY_UP
: p
= "UP"; break;
3794 case KEY_DOWN
: p
= "DOWN"; break;
3795 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3796 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3797 case KEY_RIGHT
: p
= "RIGHT"; break;
3798 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3799 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3800 default : p
= "<UNKNWON>"; break;
3803 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
3804 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3808 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
3809 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3814 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
3815 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3818 if (do_check_expected_values
)
3820 if (irmp_data
.protocol
!= expected_protocol
||
3821 irmp_data
.address
!= expected_address
||
3822 irmp_data
.command
!= expected_command
)
3824 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
3825 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
3829 printf (" checked!\n");
3831 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
3842 main (int argc
, char ** argv
)
3850 int start_pulses
[256];
3851 int start_pauses
[256];
3855 int first_pulse
= TRUE
;
3856 int first_pause
= TRUE
;
3860 if (! strcmp (argv
[1], "-v"))
3864 else if (! strcmp (argv
[1], "-l"))
3868 else if (! strcmp (argv
[1], "-a"))
3872 else if (! strcmp (argv
[1], "-s"))
3876 else if (! strcmp (argv
[1], "-p"))
3883 for (i
= 0; i
< 256; i
++)
3885 start_pulses
[i
] = 0;
3886 start_pauses
[i
] = 0;
3893 while ((ch
= getchar ()) != EOF
)
3895 if (ch
== '_' || ch
== '0')
3903 printf ("pause: %d\n", pause
);
3912 start_pauses
[pause
]++;
3914 first_pause
= FALSE
;
3930 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3936 printf ("pulse: %d ", pulse
);
3945 start_pulses
[pulse
]++;
3947 first_pulse
= FALSE
;
3963 else if (ch
== '\n')
3968 if (list
&& pause
> 0)
3970 printf ("pause: %d\n", pause
);
3976 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
3990 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4001 puts ("-------------------------------------------------------------------");
4005 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4007 if (ch
!= '\r') // ignore CR in DOS/Windows files
4009 if (ch
== '[' && idx
== -1)
4017 do_check_expected_values
= FALSE
;
4021 expected_protocol
= atoi (buf
);
4023 if (expected_protocol
> 0)
4032 if (sscanf (p
, "%x", &expected_address
) == 1)
4034 do_check_expected_values
= TRUE
;
4041 if (do_check_expected_values
)
4043 do_check_expected_values
= FALSE
;
4051 if (sscanf (p
, "%x", &expected_command
) == 1)
4053 do_check_expected_values
= TRUE
;
4060 if (do_check_expected_values
)
4062 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4067 else if (idx
< 1024 - 2)
4087 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4088 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4089 print_spectrum ("PULSES", pulses
, TRUE
);
4090 print_spectrum ("PAUSES", pauses
, FALSE
);
4091 puts ("-------------------------------------------------------------------------------");