1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.139 2013/03/12 12:49:59 fm Exp $
10 * Supported mikrocontrollers:
15 * ATmega8, ATmega16, ATmega32
17 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284, ATmega1284P
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 == 1 || \
46 IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
47 # define IRMP_SUPPORT_MANCHESTER 1
49 # define IRMP_SUPPORT_MANCHESTER 0
52 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
53 # define IRMP_SUPPORT_SERIAL 1
55 # define IRMP_SUPPORT_SERIAL 0
58 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
60 #define MIN_TOLERANCE_00 1.0 // -0%
61 #define MAX_TOLERANCE_00 1.0 // +0%
63 #define MIN_TOLERANCE_05 0.95 // -5%
64 #define MAX_TOLERANCE_05 1.05 // +5%
66 #define MIN_TOLERANCE_10 0.9 // -10%
67 #define MAX_TOLERANCE_10 1.1 // +10%
69 #define MIN_TOLERANCE_15 0.85 // -15%
70 #define MAX_TOLERANCE_15 1.15 // +15%
72 #define MIN_TOLERANCE_20 0.8 // -20%
73 #define MAX_TOLERANCE_20 1.2 // +20%
75 #define MIN_TOLERANCE_30 0.7 // -30%
76 #define MAX_TOLERANCE_30 1.3 // +30%
78 #define MIN_TOLERANCE_40 0.6 // -40%
79 #define MAX_TOLERANCE_40 1.4 // +40%
81 #define MIN_TOLERANCE_50 0.5 // -50%
82 #define MAX_TOLERANCE_50 1.5 // +50%
84 #define MIN_TOLERANCE_60 0.4 // -60%
85 #define MAX_TOLERANCE_60 1.6 // +60%
87 #define MIN_TOLERANCE_70 0.3 // -70%
88 #define MAX_TOLERANCE_70 1.7 // +70%
90 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
91 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
92 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
93 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
94 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
95 #else // only 5% + 1 to avoid conflict with RC6:
96 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
98 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
99 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
100 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
101 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
102 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
103 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
105 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
106 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
107 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
108 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
109 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
110 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
111 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
112 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
113 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
114 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
115 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
116 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
117 // autodetect nec repetition frame within 50 msec:
118 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
120 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
122 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
125 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
126 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
127 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
128 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
129 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
130 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
131 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
132 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
133 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
134 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
136 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
137 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
138 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
139 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
140 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
141 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
142 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
143 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
144 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
145 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
147 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
148 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
149 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
150 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
151 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
152 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
153 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
154 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
155 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
156 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
158 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
159 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
160 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
161 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
162 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
163 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
164 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
165 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
166 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
167 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
170 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
171 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
172 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
174 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
175 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
178 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
179 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
181 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
182 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
183 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
184 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
185 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
186 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
187 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
188 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
190 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
191 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
192 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
193 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
194 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
195 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
197 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
198 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
199 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
200 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
201 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
202 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
203 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
204 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
205 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
206 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
208 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
209 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
210 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
211 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
212 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
213 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
214 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
215 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
216 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
217 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
219 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
220 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
221 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
222 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
223 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
224 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
225 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
226 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
227 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
228 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
229 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
230 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
232 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
233 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
234 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
235 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
236 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
237 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
238 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
239 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
240 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
241 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
242 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
243 #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
244 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
245 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
246 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
247 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
248 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
249 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
250 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
251 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
252 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
253 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
254 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
255 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
256 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
257 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
259 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
260 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
261 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
262 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
263 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
264 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
265 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
267 #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)
268 #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)
269 #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)
270 #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)
271 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
272 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
273 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
274 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
276 #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
277 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
278 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
279 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
280 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
281 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
282 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
283 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
285 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
287 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
289 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
291 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
292 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
293 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
294 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
295 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
296 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
297 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
298 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
299 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
300 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
302 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
303 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
304 #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!
305 #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!
306 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
307 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
308 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
309 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
310 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
311 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
312 // autodetect JVC repetition frame within 50 msec:
313 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
315 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
316 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
317 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
318 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
319 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
320 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
321 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
322 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
323 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
324 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
325 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
326 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
327 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
329 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
330 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
331 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
332 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
333 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
334 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
335 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
336 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
337 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
338 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
339 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
340 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
341 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
342 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
344 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
345 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
346 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
347 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
348 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
349 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
350 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
351 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
353 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
354 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
355 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
356 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
357 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
358 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
359 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
360 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
361 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
362 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
364 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
365 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
366 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
367 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
368 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
369 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
370 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
371 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
372 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
373 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
374 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
376 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
377 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
378 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
379 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
380 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
381 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
382 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
383 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
385 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
388 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
389 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
390 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
391 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
392 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
394 static int time_counter
;
397 # define ANALYZE_PUTCHAR(a)
398 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
399 # define ANALYZE_PRINTF(...)
400 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
401 # define ANALYZE_NEWLINE()
404 #if IRMP_USE_CALLBACK == 1
405 static void (*irmp_callback_ptr
) (uint8_t);
406 #endif // IRMP_USE_CALLBACK == 1
408 /*---------------------------------------------------------------------------------------------------------------------------------------------------
410 *---------------------------------------------------------------------------------------------------------------------------------------------------
412 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
414 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
452 /*---------------------------------------------------------------------------------------------------------------------------------------------------
454 *---------------------------------------------------------------------------------------------------------------------------------------------------
456 #if IRMP_LOGGING == 1 // logging via UART
458 #if IRMP_EXT_LOGGING == 1 // use external logging
459 #include "irmpextlog.h"
460 #else // normal UART log (IRMP_EXT_LOGGING == 0)
462 #ifndef UNIX_OR_WINDOWS
463 #include <util/setbaud.h>
468 #define UART0_UBRRH UBRR0H
469 #define UART0_UBRRL UBRR0L
470 #define UART0_UCSRA UCSR0A
471 #define UART0_UCSRB UCSR0B
472 #define UART0_UCSRC UCSR0C
473 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
474 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
475 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
477 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
479 #define UART0_URSEL_BIT_VALUE (0)
481 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
482 #define UART0_UDR UDR0
483 #define UART0_U2X U2X0
487 #define UART0_UBRRH UBRRH
488 #define UART0_UBRRL UBRRL
489 #define UART0_UCSRA UCSRA
490 #define UART0_UCSRB UCSRB
491 #define UART0_UCSRC UCSRC
492 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
493 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
494 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
496 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
498 #define UART0_URSEL_BIT_VALUE (0)
500 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
501 #define UART0_UDR UDR
502 #define UART0_U2X U2X
505 #endif //IRMP_EXT_LOGGING
507 /*---------------------------------------------------------------------------------------------------------------------------------------------------
509 * @details Initializes UART
510 *---------------------------------------------------------------------------------------------------------------------------------------------------
513 irmp_uart_init (void)
515 #ifndef UNIX_OR_WINDOWS
516 #if (IRMP_EXT_LOGGING == 0) // use UART
517 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
518 UART0_UBRRL
= UBRRL_VALUE
;
521 UART0_UCSRA
|= (1<<UART0_U2X
);
523 UART0_UCSRA
&= ~(1<<UART0_U2X
);
526 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
527 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
528 #else // other log method
530 #endif //IRMP_EXT_LOGGING
531 #endif // UNIX_OR_WINDOWS
534 /*---------------------------------------------------------------------------------------------------------------------------------------------------
536 * @details Sends character
537 * @param ch character to be transmitted
538 *---------------------------------------------------------------------------------------------------------------------------------------------------
541 irmp_uart_putc (unsigned char ch
)
543 #ifndef UNIX_OR_WINDOWS
544 #if (IRMP_EXT_LOGGING == 0)
545 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
552 sendextlog(ch
); //Use external log
556 #endif // UNIX_OR_WINDOWS
559 /*---------------------------------------------------------------------------------------------------------------------------------------------------
561 *---------------------------------------------------------------------------------------------------------------------------------------------------
564 #define STARTCYCLES 2 // min count of zeros before start of logging
565 #define ENDBITS 1000 // number of sequenced highbits to detect end
566 #define DATALEN 700 // log buffer size
568 #if 0 // old log routine
571 irmp_log (uint8_t val
)
573 static uint8_t buf
[DATALEN
]; // logging buffer
574 static uint16_t buf_idx
; // number of written bits
575 static uint8_t startcycles
; // current number of start-zeros
576 static uint16_t cnt
; // counts sequenced highbits - to detect end
578 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
586 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
588 if (buf_idx
< DATALEN
* 8) // index in range?
592 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
596 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
603 { // if high received then look at log-stop condition
607 { // if stop condition is true, output on uart
610 for (i
= 0; i
< STARTCYCLES
; i
++)
612 irmp_uart_putc ('0'); // the ignored starting zeros
615 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
620 for (j
= 0; j
< 8; j
++)
622 irmp_uart_putc ((d
& 1) + '0');
627 irmp_uart_putc ('\n');
639 #else // new log routine
642 irmp_log (uint8_t val
)
644 static uint8_t buf
[DATALEN
]; // logging buffer
645 static uint16_t buf_idx
; // index
646 static uint8_t startcycles
; // current number of start-zeros
647 static uint16_t cnt
; // counts sequenced highbits - to detect end
648 static uint8_t last_val
= 1;
650 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
658 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
664 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
665 { // if stop condition is true, output on uart
672 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
674 irmp_uart_putc ('0'); // the ignored starting zeros
677 for (i
= 0; i
< buf_idx
; i
++)
686 d
|= ((uint16_t) buf
[i
] << 8);
689 for (j
= 0; j
< d
; j
++)
694 v
= (v
== '1') ? '0' : '1';
697 for (i8
= 0; i8
< 20; i8
++)
699 irmp_uart_putc ('1');
702 irmp_uart_putc ('\n');
708 else if (buf_idx
< DATALEN
- 3)
712 buf
[buf_idx
++] = 0xff;
713 buf
[buf_idx
++] = (cnt
& 0xff);
714 buf
[buf_idx
] = (cnt
>> 8);
732 #define irmp_log(val)
733 #endif //IRMP_LOGGING
737 uint8_t protocol
; // ir protocol
738 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
739 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
740 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
741 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
742 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
743 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
744 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
745 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
746 uint8_t address_offset
; // address offset
747 uint8_t address_end
; // end of address
748 uint8_t command_offset
; // command offset
749 uint8_t command_end
; // end of command
750 uint8_t complete_len
; // complete length of frame
751 uint8_t stop_bit
; // flag: frame has stop bit
752 uint8_t lsb_first
; // flag: LSB first
753 uint8_t flags
; // some flags
756 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
758 static const PROGMEM IRMP_PARAMETER sircs_param
=
760 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
761 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
762 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
763 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
764 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
765 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
766 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
767 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
768 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
769 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
770 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
771 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
772 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
773 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
774 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
775 SIRCS_LSB
, // lsb_first: flag: LSB first
776 SIRCS_FLAGS
// flags: some flags
781 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
783 static const PROGMEM IRMP_PARAMETER nec_param
=
785 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
786 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
787 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
788 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
789 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
790 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
791 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
792 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
793 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
794 NEC_ADDRESS_OFFSET
, // address_offset: address offset
795 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
796 NEC_COMMAND_OFFSET
, // command_offset: command offset
797 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
798 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
799 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
800 NEC_LSB
, // lsb_first: flag: LSB first
801 NEC_FLAGS
// flags: some flags
804 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
806 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
807 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
808 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
809 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
810 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
811 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
812 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
813 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
814 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
815 0, // address_offset: address offset
816 0, // address_end: end of address
817 0, // command_offset: command offset
818 0, // command_end: end of command
819 0, // complete_len: complete length of frame
820 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
821 NEC_LSB
, // lsb_first: flag: LSB first
822 NEC_FLAGS
// flags: some flags
827 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
829 static const PROGMEM IRMP_PARAMETER nec42_param
=
831 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
832 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
833 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
834 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
835 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
836 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
837 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
838 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
839 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
840 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
841 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
842 NEC42_COMMAND_OFFSET
, // command_offset: command offset
843 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
844 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
845 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
846 NEC_LSB
, // lsb_first: flag: LSB first
847 NEC_FLAGS
// flags: some flags
852 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
854 static const PROGMEM IRMP_PARAMETER samsung_param
=
856 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
857 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
858 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
859 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
860 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
861 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
862 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
863 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
864 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
865 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
866 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
867 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
868 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
869 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
870 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
871 SAMSUNG_LSB
, // lsb_first: flag: LSB first
872 SAMSUNG_FLAGS
// flags: some flags
877 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
879 static const PROGMEM IRMP_PARAMETER matsushita_param
=
881 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
882 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
883 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
884 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
885 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
886 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
887 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
888 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
889 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
890 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
891 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
892 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
893 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
894 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
895 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
896 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
897 MATSUSHITA_FLAGS
// flags: some flags
902 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
904 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
906 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
907 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
908 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
909 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
910 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
911 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
912 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
913 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
914 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
915 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
916 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
917 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
918 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
919 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
920 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
921 KASEIKYO_LSB
, // lsb_first: flag: LSB first
922 KASEIKYO_FLAGS
// flags: some flags
927 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
929 static const PROGMEM IRMP_PARAMETER recs80_param
=
931 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
932 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
933 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
934 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
935 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
936 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
937 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
938 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
939 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
940 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
941 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
942 RECS80_COMMAND_OFFSET
, // command_offset: command offset
943 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
944 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
945 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
946 RECS80_LSB
, // lsb_first: flag: LSB first
947 RECS80_FLAGS
// flags: some flags
952 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
954 static const PROGMEM IRMP_PARAMETER rc5_param
=
956 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
957 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
958 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
959 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
960 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
961 0, // pulse_0_len_min: here: not used
962 0, // pulse_0_len_max: here: not used
963 0, // pause_0_len_min: here: not used
964 0, // pause_0_len_max: here: not used
965 RC5_ADDRESS_OFFSET
, // address_offset: address offset
966 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
967 RC5_COMMAND_OFFSET
, // command_offset: command offset
968 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
969 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
970 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
971 RC5_LSB
, // lsb_first: flag: LSB first
972 RC5_FLAGS
// flags: some flags
977 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
979 static const PROGMEM IRMP_PARAMETER denon_param
=
981 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
982 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
983 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
984 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
985 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
986 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
987 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
988 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
989 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
990 DENON_ADDRESS_OFFSET
, // address_offset: address offset
991 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
992 DENON_COMMAND_OFFSET
, // command_offset: command offset
993 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
994 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
995 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
996 DENON_LSB
, // lsb_first: flag: LSB first
997 DENON_FLAGS
// flags: some flags
1002 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1004 static const PROGMEM IRMP_PARAMETER rc6_param
=
1006 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1008 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1009 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1010 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1011 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1012 0, // pulse_0_len_min: here: not used
1013 0, // pulse_0_len_max: here: not used
1014 0, // pause_0_len_min: here: not used
1015 0, // pause_0_len_max: here: not used
1016 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1017 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1018 RC6_COMMAND_OFFSET
, // command_offset: command offset
1019 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1020 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1021 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1022 RC6_LSB
, // lsb_first: flag: LSB first
1023 RC6_FLAGS
// flags: some flags
1028 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1030 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1032 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1033 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1034 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1035 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1036 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1037 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1038 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1039 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1040 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1041 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1042 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1043 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1044 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1045 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1046 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1047 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1048 RECS80EXT_FLAGS
// flags: some flags
1053 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1055 static const PROGMEM IRMP_PARAMETER nubert_param
=
1057 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1058 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1059 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1060 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1061 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1062 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1063 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1064 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1065 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1066 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1067 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1068 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1069 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1070 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1071 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1072 NUBERT_LSB
, // lsb_first: flag: LSB first
1073 NUBERT_FLAGS
// flags: some flags
1078 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1080 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1082 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1083 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1084 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1085 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1086 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1087 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1088 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1089 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1090 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1091 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1092 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1093 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1094 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1095 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1096 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1097 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1098 BANG_OLUFSEN_FLAGS
// flags: some flags
1103 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1105 static uint8_t first_bit
;
1107 static const PROGMEM IRMP_PARAMETER grundig_param
=
1109 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1111 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1112 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1113 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1114 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1115 0, // pulse_0_len_min: here: not used
1116 0, // pulse_0_len_max: here: not used
1117 0, // pause_0_len_min: here: not used
1118 0, // pause_0_len_max: here: not used
1119 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1120 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1121 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1122 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1123 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1124 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1125 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1126 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1131 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1133 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1135 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1136 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1137 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1138 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1139 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1140 0, // pulse_0_len_min: here: not used
1141 0, // pulse_0_len_max: here: not used
1142 0, // pause_0_len_min: here: not used
1143 0, // pause_0_len_max: here: not used
1144 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1145 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1146 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1147 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1148 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1149 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1150 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1151 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1156 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1158 static const PROGMEM IRMP_PARAMETER fdc_param
=
1160 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1161 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1162 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1163 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1164 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1165 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1166 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1167 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1168 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1169 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1170 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1171 FDC_COMMAND_OFFSET
, // command_offset: command offset
1172 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1173 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1174 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1175 FDC_LSB
, // lsb_first: flag: LSB first
1176 FDC_FLAGS
// flags: some flags
1181 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1183 static const PROGMEM IRMP_PARAMETER rccar_param
=
1185 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1186 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1187 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1188 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1189 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1190 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1191 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1192 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1193 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1194 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1195 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1196 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1197 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1198 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1199 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1200 RCCAR_LSB
, // lsb_first: flag: LSB first
1201 RCCAR_FLAGS
// flags: some flags
1206 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1208 static const PROGMEM IRMP_PARAMETER nikon_param
=
1210 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1211 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1212 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1213 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1214 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1215 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1216 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1217 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1218 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1219 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1220 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1221 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1222 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1223 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1224 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1225 NIKON_LSB
, // lsb_first: flag: LSB first
1226 NIKON_FLAGS
// flags: some flags
1231 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1233 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1235 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1236 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1237 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1238 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1239 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1240 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1241 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1242 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1243 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1244 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1245 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1246 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1247 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1248 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1249 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1250 KATHREIN_LSB
, // lsb_first: flag: LSB first
1251 KATHREIN_FLAGS
// flags: some flags
1256 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1258 static const PROGMEM IRMP_PARAMETER netbox_param
=
1260 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1261 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1262 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1263 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1264 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1265 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1266 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1267 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1268 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1269 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1270 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1271 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1272 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1273 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1274 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1275 NETBOX_LSB
, // lsb_first: flag: LSB first
1276 NETBOX_FLAGS
// flags: some flags
1281 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1283 static const PROGMEM IRMP_PARAMETER lego_param
=
1285 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1286 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1287 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1288 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1289 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1290 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1291 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1292 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1293 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1294 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1295 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1296 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1297 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1298 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1299 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1300 LEGO_LSB
, // lsb_first: flag: LSB first
1301 LEGO_FLAGS
// flags: some flags
1306 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1308 static const PROGMEM IRMP_PARAMETER thomson_param
=
1310 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1311 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1312 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1313 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1314 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1315 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1316 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1317 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1318 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1319 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1320 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1321 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1322 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1323 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1324 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1325 THOMSON_LSB
, // lsb_first: flag: LSB first
1326 THOMSON_FLAGS
// flags: some flags
1331 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1333 static const PROGMEM IRMP_PARAMETER bose_param
=
1335 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1336 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1337 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1338 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1339 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1340 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1341 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1342 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1343 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1344 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1345 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1346 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1347 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1348 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1349 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1350 BOSE_LSB
, // lsb_first: flag: LSB first
1351 BOSE_FLAGS
// flags: some flags
1356 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1358 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1360 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1362 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1363 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1364 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1365 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1366 0, // pulse_0_len_min: here: not used
1367 0, // pulse_0_len_max: here: not used
1368 0, // pause_0_len_min: here: not used
1369 0, // pause_0_len_max: here: not used
1370 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1371 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1372 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1373 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1374 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1375 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1376 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1377 A1TVBOX_FLAGS
// flags: some flags
1382 static uint8_t irmp_bit
; // current bit position
1383 static IRMP_PARAMETER irmp_param
;
1385 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1386 static IRMP_PARAMETER irmp_param2
;
1389 static volatile uint8_t irmp_ir_detected
;
1390 static volatile uint8_t irmp_protocol
;
1391 static volatile uint16_t irmp_address
;
1392 static volatile uint16_t irmp_command
;
1393 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1394 static volatile uint8_t irmp_flags
;
1395 // static volatile uint8_t irmp_busy_flag;
1398 #define input(x) (x)
1399 static uint8_t IRMP_PIN
;
1402 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1403 * Initialize IRMP decoder
1404 * @details Configures IRMP input pin
1405 *---------------------------------------------------------------------------------------------------------------------------------------------------
1411 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1412 #elif defined (ARM_STM32) // STM32
1413 GPIO_InitTypeDef GPIO_InitStructure
;
1415 /* GPIOx clock enable */
1416 #if defined (ARM_STM32L1XX)
1417 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1418 #elif defined (ARM_STM32F10X)
1419 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1420 #elif defined (ARM_STM32F4XX)
1421 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1424 /* GPIO Configuration */
1425 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1426 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1427 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1428 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1429 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1430 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1431 #elif defined (ARM_STM32F10X)
1432 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1433 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1435 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1436 #elif defined(STELLARIS_ARM_CORTEX_M4)
1437 // Enable the GPIO port
1438 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1441 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1442 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1444 GPIO_PIN_TYPE_STD_WPU
);
1446 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1447 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1450 #if IRMP_LOGGING == 1
1455 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1457 * @details gets decoded IRMP data
1458 * @param pointer in order to store IRMP data
1459 * @return TRUE: successful, FALSE: failed
1460 *---------------------------------------------------------------------------------------------------------------------------------------------------
1463 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1465 uint8_t rtc
= FALSE
;
1467 if (irmp_ir_detected
)
1469 switch (irmp_protocol
)
1471 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1472 case IRMP_SAMSUNG_PROTOCOL
:
1473 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1475 irmp_command
&= 0xff;
1476 irmp_command
|= irmp_id
<< 8;
1481 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1482 case IRMP_NEC_PROTOCOL
:
1483 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1485 irmp_command
&= 0xff;
1488 else if (irmp_address
== 0x87EE)
1490 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1491 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1492 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1493 irmp_command
&= 0x00FF;
1498 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1499 case IRMP_BOSE_PROTOCOL
:
1500 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1502 irmp_command
&= 0xff;
1507 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1508 case IRMP_SIEMENS_PROTOCOL
:
1509 case IRMP_RUWIDO_PROTOCOL
:
1510 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1517 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1518 case IRMP_KATHREIN_PROTOCOL
:
1519 if (irmp_command
!= 0x0000)
1525 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1526 case IRMP_RC5_PROTOCOL
:
1527 irmp_address
&= ~0x20; // clear toggle bit
1531 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1532 case IRMP_IR60_PROTOCOL
:
1533 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1539 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1543 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1544 case IRMP_RCCAR_PROTOCOL
:
1545 // frame in irmp_data:
1546 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1547 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1548 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1549 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1550 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1551 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1552 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1556 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1557 case IRMP_NETBOX_PROTOCOL
:
1558 if (irmp_command
& 0x1000) // last bit set?
1560 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1563 irmp_command
&= 0x7F;
1566 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1569 irmp_command
|= 0x80;
1574 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1579 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1583 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1584 case IRMP_LEGO_PROTOCOL
:
1586 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1588 if ((irmp_command
& 0x000F) == crc
)
1595 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1596 // rtc = TRUE; // don't accept codes with CRC errors
1610 irmp_data_p
->protocol
= irmp_protocol
;
1611 irmp_data_p
->address
= irmp_address
;
1612 irmp_data_p
->command
= irmp_command
;
1613 irmp_data_p
->flags
= irmp_flags
;
1619 irmp_ir_detected
= FALSE
;
1626 // irmp_is_busy (void)
1628 // return irmp_busy_flag;
1631 #if IRMP_USE_CALLBACK == 1
1633 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1635 irmp_callback_ptr
= cb
;
1637 #endif // IRMP_USE_CALLBACK == 1
1639 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1640 static uint16_t irmp_tmp_address
; // ir address
1641 static uint16_t irmp_tmp_command
; // ir command
1643 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1644 static uint16_t irmp_tmp_address2
; // ir address
1645 static uint16_t irmp_tmp_command2
; // ir command
1648 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1649 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1651 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1652 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1653 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1656 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1658 * @details store bit in temp address or temp command
1659 * @param value to store: 0 or 1
1660 *---------------------------------------------------------------------------------------------------------------------------------------------------
1662 // verhindert, dass irmp_store_bit() inline compiliert wird:
1663 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1666 irmp_store_bit (uint8_t value
)
1668 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1669 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1676 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1678 if (irmp_param
.lsb_first
)
1680 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1684 irmp_tmp_address
<<= 1;
1685 irmp_tmp_address
|= value
;
1688 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1690 if (irmp_param
.lsb_first
)
1692 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1696 irmp_tmp_command
<<= 1;
1697 irmp_tmp_command
|= value
;
1701 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1702 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1704 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1709 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1710 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1712 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1717 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1718 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1720 if (irmp_bit
>= 20 && irmp_bit
< 24)
1722 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1724 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1726 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1729 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1733 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1737 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1750 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1752 * @details store bit in temp address or temp command
1753 * @param value to store: 0 or 1
1754 *---------------------------------------------------------------------------------------------------------------------------------------------------
1756 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1758 irmp_store_bit2 (uint8_t value
)
1762 if (irmp_param
.protocol
)
1764 irmp_bit2
= irmp_bit
- 2;
1768 irmp_bit2
= irmp_bit
- 1;
1771 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1773 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1775 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1777 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1780 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1782 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1784 * @details ISR routine, called 10000 times per second
1785 *---------------------------------------------------------------------------------------------------------------------------------------------------
1790 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1791 static uint8_t wait_for_space
; // flag: wait for data bit space
1792 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1793 static uint8_t irmp_pulse_time
; // count bit time for pulse
1794 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1795 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1796 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1797 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1798 static uint8_t repetition_frame_number
;
1799 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1800 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1801 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
1803 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1804 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1806 #if IRMP_SUPPORT_MANCHESTER == 1
1807 static PAUSE_LEN last_pause
; // last pause value
1809 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1810 static uint8_t last_value
; // last bit value
1812 uint8_t irmp_input
; // input value
1818 irmp_input
= input(IRMP_PIN
);
1820 #if IRMP_USE_CALLBACK == 1
1821 if (irmp_callback_ptr
)
1823 static uint8_t last_inverted_input
;
1825 if (last_inverted_input
!= !irmp_input
)
1827 (*irmp_callback_ptr
) (! irmp_input
);
1828 last_inverted_input
= !irmp_input
;
1831 #endif // IRMP_USE_CALLBACK == 1
1833 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1835 if (! irmp_ir_detected
) // ir code already detected?
1837 if (! irmp_start_bit_detected
) // start bit detected?
1839 if (! irmp_input
) // receiving burst?
1841 // irmp_busy_flag = TRUE;
1843 if (! irmp_pulse_time
)
1845 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
1848 irmp_pulse_time
++; // increment counter
1852 if (irmp_pulse_time
) // it's dark....
1853 { // set flags for counting the time of darkness...
1854 irmp_start_bit_detected
= 1;
1855 wait_for_start_space
= 1;
1857 irmp_tmp_command
= 0;
1858 irmp_tmp_address
= 0;
1859 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1863 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1864 irmp_tmp_command2
= 0;
1865 irmp_tmp_address2
= 0;
1869 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
1870 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1871 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
1876 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
1878 key_repetition_len
++;
1880 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1881 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
1883 denon_repetition_len
++;
1885 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
1887 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
1888 (double) (time_counter
* 1000) / F_INTERRUPTS
);
1889 last_irmp_denon_command
= 0;
1890 denon_repetition_len
= 0xFFFF;
1893 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
1900 if (wait_for_start_space
) // we have received start bit...
1901 { // ...and are counting the time of darkness
1902 if (irmp_input
) // still dark?
1904 irmp_pause_time
++; // increment counter
1906 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1907 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
) ||
1908 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
1910 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
1913 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1914 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
1919 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1921 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
);
1922 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
1924 // irmp_busy_flag = FALSE;
1925 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
1926 irmp_pulse_time
= 0;
1927 irmp_pause_time
= 0;
1931 { // receiving first data pulse!
1932 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
1934 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1935 irmp_param2
.protocol
= 0;
1938 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
1940 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1941 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
1942 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
1944 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1945 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
1946 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
1947 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
1950 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1952 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1953 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
1954 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
1955 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1957 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1958 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
1959 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1960 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1963 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1965 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1966 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1967 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
1969 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1970 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1971 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1972 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1973 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
1975 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1976 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1977 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
1978 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1982 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
1983 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
1985 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
1986 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
1987 { // some jvc remote controls use nec repetition frame for jvc repetition frame
1988 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1989 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1990 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
1991 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
1994 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
1996 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
1997 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
1998 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2000 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2005 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2006 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2007 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2008 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2009 { // it's JVC repetition type 3
2010 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2011 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2012 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2013 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2016 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2018 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2020 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2021 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2022 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2024 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2025 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2026 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2027 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2030 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2032 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2033 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2034 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2036 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2037 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2038 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2039 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2042 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2044 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2045 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2046 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2047 { // it's MATSUSHITA
2048 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2049 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2050 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2051 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2054 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2056 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2057 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2058 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2060 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2061 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2062 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2063 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2066 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2068 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2069 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2070 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2072 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2073 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2074 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2075 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2078 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2080 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2081 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2082 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2083 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2084 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2086 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2087 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2088 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2090 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2091 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2092 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2093 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2094 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2095 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2096 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2097 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2100 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2102 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2103 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2104 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2106 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2107 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2108 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2109 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2110 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2111 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2112 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2113 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2116 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2118 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2119 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2120 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2121 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2122 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2125 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2126 last_pause
= irmp_pause_time
;
2128 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2129 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2132 rc5_cmd_bit6
= 1<<6;
2140 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2142 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2143 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2144 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2145 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2147 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2148 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2149 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2150 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2151 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2154 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2156 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2157 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2158 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2159 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2161 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2162 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2163 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2164 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2165 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2168 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2170 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2171 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2172 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2174 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2175 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2176 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2177 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2180 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2182 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2183 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2184 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2186 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2187 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2188 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2189 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2194 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2196 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2197 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2198 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2200 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2201 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2202 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2203 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2206 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2208 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2209 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2210 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2212 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2213 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2214 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2215 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2218 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2220 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2221 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2222 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2223 { // it's BANG_OLUFSEN
2224 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2225 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2226 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2227 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2228 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2229 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2230 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2231 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2232 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2233 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2234 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2235 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2236 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2237 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2241 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2243 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2244 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2245 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2247 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2248 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2249 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2250 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2251 last_pause
= irmp_pause_time
;
2255 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2257 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2258 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2259 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2260 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2261 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2262 { // it's RUWIDO or SIEMENS
2263 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2264 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2265 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2266 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2267 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2268 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2269 last_pause
= irmp_pause_time
;
2273 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2275 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2276 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2277 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2279 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2280 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2281 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2282 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2285 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2287 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2288 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2289 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2291 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2292 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2293 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2294 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2297 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2299 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2300 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2301 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2303 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2304 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2305 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2306 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2309 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2311 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2312 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2313 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2315 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2316 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2317 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2318 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2321 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2323 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2324 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2325 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2327 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2328 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2329 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2330 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2333 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2335 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2336 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
2337 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
2339 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2340 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
2341 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
2342 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
2347 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2350 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2351 // irmp_busy_flag = FALSE;
2352 irmp_start_bit_detected
= 0; // wait for another start bit...
2355 if (irmp_start_bit_detected
)
2357 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2360 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2362 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2363 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2367 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2368 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2369 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2370 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2373 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2374 if (irmp_param2
.protocol
)
2376 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2377 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2378 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2379 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2384 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2385 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2387 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2391 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2393 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2394 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2398 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2399 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2400 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2401 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2404 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2405 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2407 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2408 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2412 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2413 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2414 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2415 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2421 #if IRMP_SUPPORT_MANCHESTER == 1
2422 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2423 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2424 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2426 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2428 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2429 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2431 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2433 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2435 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2437 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2439 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2443 #endif // IRMP_SUPPORT_MANCHESTER == 1
2445 #if IRMP_SUPPORT_SERIAL == 1
2446 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2451 #endif // IRMP_SUPPORT_SERIAL == 1
2454 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2455 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2457 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2459 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2460 { // pause timings correct for "1"?
2461 ANALYZE_PUTCHAR ('1'); // yes, store 1
2465 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2466 { // pause timings correct for "0"?
2467 ANALYZE_PUTCHAR ('0'); // yes, store 0
2473 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2474 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2475 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2477 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2479 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2480 { // pause timings correct for "1"?
2481 ANALYZE_PUTCHAR ('1'); // yes, store 1
2485 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2486 { // pause timings correct for "0"?
2487 ANALYZE_PUTCHAR ('0'); // yes, store 0
2493 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2495 ; // else do nothing
2498 irmp_pulse_time
= 1; // set counter to 1, not 0
2499 irmp_pause_time
= 0;
2500 wait_for_start_space
= 0;
2503 else if (wait_for_space
) // the data section....
2504 { // counting the time of darkness....
2505 uint8_t got_light
= FALSE
;
2507 if (irmp_input
) // still dark?
2509 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2512 #if IRMP_SUPPORT_MANCHESTER == 1
2513 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2515 #if IRMP_SUPPORT_SERIAL == 1
2516 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2518 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2521 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2523 ANALYZE_PRINTF ("stop bit detected\n");
2526 irmp_param
.stop_bit
= 0;
2530 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",
2531 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2533 // irmp_busy_flag = FALSE;
2534 irmp_start_bit_detected
= 0; // wait for another start bit...
2535 irmp_pulse_time
= 0;
2536 irmp_pause_time
= 0;
2541 irmp_pause_time
++; // increment counter
2543 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2544 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2545 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2546 irmp_bit
>= 12 - 1) // pause too long?
2547 { // yes, break and close this frame
2548 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2549 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2550 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2551 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2552 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2556 #if IRMP_SUPPORT_SERIAL == 1
2557 // NETBOX generates no stop bit, here is the timeout condition:
2558 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2559 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2561 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2565 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2566 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2568 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2570 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2571 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2572 irmp_param
.stop_bit
= TRUE
; // set flag
2574 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2575 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2576 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2577 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2578 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2579 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2581 irmp_tmp_command
<<= 1;
2582 irmp_tmp_command
|= first_bit
;
2584 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2585 { // special manchester decoder
2586 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2587 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2588 irmp_param
.stop_bit
= TRUE
; // set flag
2590 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2592 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2593 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2594 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2595 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2596 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2597 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2599 if (irmp_tmp_command
& 0x300)
2601 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2602 irmp_tmp_command
&= 0xFF;
2608 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2609 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2611 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2612 { // special manchester decoder
2613 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2614 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2615 irmp_param
.stop_bit
= TRUE
; // set flag
2617 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2619 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2620 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2621 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2622 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2623 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2624 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2627 // RUWIDO: AAAAAAAAACCCCCCCp
2628 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2629 irmp_tmp_address
<<= 2;
2630 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2631 irmp_tmp_command
&= 0x003F;
2632 irmp_tmp_command
<<= 4;
2633 irmp_tmp_command
|= last_value
;
2638 #if IRMP_SUPPORT_MANCHESTER == 1
2639 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2640 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2641 { // special manchester decoder
2642 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2643 irmp_param
.stop_bit
= TRUE
; // set flag
2646 #endif // IRMP_SUPPORT_MANCHESTER == 1
2647 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2649 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2653 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2654 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2656 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2657 irmp_param
.stop_bit
= TRUE
; // set flag
2658 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2659 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2660 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2661 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2662 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2664 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2666 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2667 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2668 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2670 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2671 irmp_param
.stop_bit
= TRUE
; // set flag
2672 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2673 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2675 // 0123456789ABC0123456789ABC0123456701234567
2676 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2677 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2678 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2679 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2681 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2682 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2683 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2685 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2686 irmp_param
.stop_bit
= TRUE
; // set flag
2687 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2688 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2690 // 0123456789ABC0123456789ABC0123456701234567
2691 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2692 // JVC: AAAACCCCCCCCCCCC
2693 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2694 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2696 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2697 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2700 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2701 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2703 // irmp_busy_flag = FALSE;
2704 irmp_start_bit_detected
= 0; // wait for another start bit...
2705 irmp_pulse_time
= 0;
2706 irmp_pause_time
= 0;
2718 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2720 #if IRMP_SUPPORT_MANCHESTER == 1
2721 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2724 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2725 #else // better, but some IR-RCs use asymmetric timings :-/
2726 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2727 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2730 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2731 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2733 ANALYZE_PUTCHAR ('T');
2734 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2747 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2749 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2750 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2752 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2753 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2755 ANALYZE_PUTCHAR ('T');
2758 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2769 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2771 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2772 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2773 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2774 if (! irmp_param2
.protocol
)
2779 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
2783 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
2784 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
2786 uint8_t manchester_value
;
2788 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
2790 manchester_value
= last_value
? 0 : 1;
2791 last_value
= manchester_value
;
2795 manchester_value
= last_value
;
2798 ANALYZE_PUTCHAR (manchester_value
+ '0');
2800 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2801 if (! irmp_param2
.protocol
)
2807 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2808 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
2810 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
2811 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
2812 irmp_param
.address_offset
= 5;
2813 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
2814 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
2815 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
2816 irmp_tmp_address
= 0;
2818 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2820 irmp_store_bit (manchester_value
);
2824 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2825 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
2826 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
2827 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
2828 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
2830 ANALYZE_PUTCHAR ('?');
2831 irmp_param
.protocol
= 0; // switch to FDC, see below
2834 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2835 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2836 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
2837 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
2838 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
2839 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
2841 ANALYZE_PUTCHAR ('?');
2842 irmp_param
.protocol
= 0; // switch to RCCAR, see below
2845 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2847 ANALYZE_PUTCHAR ('?');
2849 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2850 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2851 // irmp_busy_flag = FALSE;
2852 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2853 irmp_pause_time
= 0;
2857 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
2858 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
2860 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
2862 ANALYZE_PRINTF (" 1 (FDC)\n");
2863 irmp_store_bit2 (1);
2865 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
2867 ANALYZE_PRINTF (" 0 (FDC)\n");
2868 irmp_store_bit2 (0);
2871 if (! irmp_param
.protocol
)
2873 ANALYZE_PRINTF ("Switching to FDC protocol\n");
2874 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2875 irmp_param2
.protocol
= 0;
2876 irmp_tmp_address
= irmp_tmp_address2
;
2877 irmp_tmp_command
= irmp_tmp_command2
;
2880 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2881 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2882 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
2884 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
2886 ANALYZE_PRINTF (" 1 (RCCAR)\n");
2887 irmp_store_bit2 (1);
2889 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
2891 ANALYZE_PRINTF (" 0 (RCCAR)\n");
2892 irmp_store_bit2 (0);
2895 if (! irmp_param
.protocol
)
2897 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
2898 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
2899 irmp_param2
.protocol
= 0;
2900 irmp_tmp_address
= irmp_tmp_address2
;
2901 irmp_tmp_command
= irmp_tmp_command2
;
2904 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2906 last_pause
= irmp_pause_time
;
2910 #endif // IRMP_SUPPORT_MANCHESTER == 1
2912 #if IRMP_SUPPORT_SERIAL == 1
2913 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2915 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
2917 ANALYZE_PUTCHAR ('1');
2920 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
2922 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
2926 irmp_pulse_time
= 0;
2930 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
2932 ANALYZE_PUTCHAR ('0');
2935 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
2937 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
2941 irmp_pause_time
= 0;
2948 #endif // IRMP_SUPPORT_SERIAL == 1
2950 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2951 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
2953 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
2954 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2956 ANALYZE_PRINTF ("SYNC\n");
2961 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
2963 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
2964 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
2965 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
2966 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
2968 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
2970 ANALYZE_PUTCHAR ('1');
2977 ANALYZE_PUTCHAR ('0');
2983 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
2986 { // timing incorrect!
2987 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2988 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2989 // irmp_busy_flag = FALSE;
2990 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
2991 irmp_pause_time
= 0;
2995 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
2997 #if IRMP_SUPPORT_NEC16_PROTOCOL
2998 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2999 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3000 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3001 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3002 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3003 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3005 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3006 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3007 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3008 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3009 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3010 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3011 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3015 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3017 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3018 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3020 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3022 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3024 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3026 ANALYZE_PRINTF ("3rd start bit\n");
3031 { // timing incorrect!
3032 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
);
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;
3039 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3041 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3043 ANALYZE_PRINTF ("trailer bit\n");
3048 { // timing incorrect!
3049 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
);
3050 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3051 // irmp_busy_flag = FALSE;
3052 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3053 irmp_pause_time
= 0;
3058 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3059 { // pulse & pause timings correct for "1"?
3060 ANALYZE_PUTCHAR ('1');
3066 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3067 { // pulse & pause timings correct for "0"?
3068 ANALYZE_PUTCHAR ('0');
3074 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3076 ANALYZE_PUTCHAR (last_value
+ '0');
3078 irmp_store_bit (last_value
);
3082 { // timing incorrect!
3083 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
);
3084 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3085 // irmp_busy_flag = FALSE;
3086 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3087 irmp_pause_time
= 0;
3092 { // timing incorrect!
3093 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
);
3094 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3095 // irmp_busy_flag = FALSE;
3096 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3097 irmp_pause_time
= 0;
3101 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3103 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3104 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3105 { // pulse & pause timings correct for "1"?
3106 ANALYZE_PUTCHAR ('1');
3111 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3112 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3113 { // pulse & pause timings correct for "0"?
3114 ANALYZE_PUTCHAR ('0');
3120 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3122 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3123 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3124 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3125 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3127 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3133 ANALYZE_PUTCHAR ('S');
3135 irmp_tmp_command
<<= 1;
3139 ANALYZE_PUTCHAR ('S');
3146 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3147 { // timing incorrect!
3148 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3149 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3150 // irmp_busy_flag = FALSE;
3151 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3152 irmp_pause_time
= 0;
3155 irmp_pulse_time
= 1; // set counter to 1, not 0
3159 { // counting the pulse length ...
3160 if (! irmp_input
) // still light?
3162 irmp_pulse_time
++; // increment counter
3166 wait_for_space
= 1; // let's count the time (see above)
3167 irmp_pause_time
= 1; // set pause counter to 1, not 0
3171 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3173 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3175 repetition_frame_number
++;
3179 repetition_frame_number
= 0;
3182 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3183 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3184 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3186 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3187 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3188 key_repetition_len
= 0;
3193 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3194 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3195 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3197 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3198 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3199 key_repetition_len
= 0;
3204 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3205 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3206 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3208 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3209 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3210 key_repetition_len
= 0;
3215 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3216 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3217 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3219 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3220 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3221 key_repetition_len
= 0;
3227 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3228 irmp_ir_detected
= TRUE
;
3230 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3231 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3232 { // check for repetition frame
3233 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3235 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3236 last_irmp_denon_command
= 0;
3238 irmp_protocol
= irmp_param
.protocol
; // store protocol
3239 irmp_address
= irmp_tmp_address
; // store address
3240 irmp_command
= irmp_tmp_command
; // store command
3244 if ((irmp_tmp_command
& 0x01) == 0x00)
3246 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3247 last_irmp_denon_command
= irmp_tmp_command
;
3248 denon_repetition_len
= 0;
3249 irmp_ir_detected
= FALSE
;
3253 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3254 last_irmp_denon_command
= 0;
3255 irmp_ir_detected
= FALSE
;
3260 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3262 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3263 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3264 { // Grundig start frame?
3265 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3266 irmp_ir_detected
= FALSE
;
3269 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3271 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3272 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3273 { // Nokia start frame?
3274 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3275 irmp_ir_detected
= FALSE
;
3278 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3280 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3281 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3283 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3285 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
3286 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
3287 irmp_tmp_address
= last_irmp_address
; // address is last address
3288 irmp_tmp_command
= last_irmp_command
; // command is last command
3289 irmp_flags
|= IRMP_FLAG_REPETITION
;
3290 key_repetition_len
= 0;
3294 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
3295 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3296 irmp_ir_detected
= FALSE
;
3299 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3301 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3302 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3305 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3306 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3308 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3310 if (xor_value
!= (xor_check
[2] & 0x0F))
3312 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
3313 irmp_ir_detected
= FALSE
;
3316 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3318 if (xor_value
!= xor_check
[5])
3320 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
3321 irmp_ir_detected
= FALSE
;
3324 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3326 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3328 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3329 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3331 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3334 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3336 irmp_protocol
= irmp_param
.protocol
;
3339 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3340 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3342 if (irmp_tmp_command
& 0x000F) // released key?
3344 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3348 irmp_tmp_command
>>= 4; // no, it's a pressed key
3350 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3351 irmp_tmp_address
&= 0x003F;
3355 irmp_address
= irmp_tmp_address
; // store address
3356 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3357 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3359 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3363 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3364 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3366 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3369 irmp_command
= irmp_tmp_command
; // store command
3371 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3372 irmp_id
= irmp_tmp_id
;
3377 if (irmp_ir_detected
)
3379 if (last_irmp_command
== irmp_tmp_command
&&
3380 last_irmp_address
== irmp_tmp_address
&&
3381 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
3383 irmp_flags
|= IRMP_FLAG_REPETITION
;
3386 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3387 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3389 key_repetition_len
= 0;
3393 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3396 // irmp_busy_flag = FALSE;
3397 irmp_start_bit_detected
= 0; // and wait for next start bit
3398 irmp_tmp_command
= 0;
3399 irmp_pulse_time
= 0;
3400 irmp_pause_time
= 0;
3402 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3403 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3404 { // set pulse time here!
3405 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3407 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3412 #if defined(STELLARIS_ARM_CORTEX_M4)
3413 // Clear the timer interrupt
3414 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
3417 return (irmp_ir_detected
);
3422 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3423 * main functions - for Unix/Linux + Windows only!
3427 * Compile it under linux with:
3430 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3436 * -l list pulse/pauses
3438 *---------------------------------------------------------------------------------------------------------------------------------------------------
3442 print_timings (void)
3444 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3445 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3447 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3448 printf ("====================================================================================\n");
3449 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3450 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3451 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3452 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3454 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3455 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3456 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3457 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3459 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3460 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
,
3461 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3462 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3464 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3465 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3466 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3467 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3469 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3470 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3471 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3472 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3474 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3475 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3476 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3477 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3479 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3480 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3481 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3482 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3484 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3485 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3486 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3488 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3489 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3490 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3491 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3493 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3494 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3495 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3496 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3498 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3499 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3500 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3502 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3503 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3504 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3505 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3507 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3508 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3509 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3510 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3512 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3513 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3514 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3516 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3517 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3518 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3520 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3521 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3522 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3524 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3525 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3526 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3528 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3529 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3530 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3532 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3533 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3534 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3535 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3537 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3538 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3539 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3540 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3541 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3542 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3543 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3545 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3546 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3547 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3548 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3550 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3551 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3552 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3553 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3555 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3556 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3557 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3558 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3560 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3561 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3562 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3563 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3568 print_spectrum (char * text
, int * buf
, int is_pulse
)
3581 puts ("-------------------------------------------------------------------------------");
3582 printf ("%s:\n", text
);
3584 for (i
= 0; i
< 256; i
++)
3586 if (buf
[i
] > max_value
)
3592 for (i
= 1; i
< 100; i
++)
3597 value
= (buf
[i
] * 60) / max_value
;
3599 for (j
= 0; j
< value
; j
++)
3603 printf (" %d\n", buf
[i
]);
3614 average
= (float) sum
/ (float) counter
;
3625 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3626 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3627 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3629 tolerance
= (max
- average
);
3631 if (average
- min
> tolerance
)
3633 tolerance
= average
- min
;
3636 tolerance
= tolerance
* 100 / average
;
3637 printf ("tol: %4.1f%%\n", tolerance
);
3647 #define STATE_LEFT_SHIFT 0x01
3648 #define STATE_RIGHT_SHIFT 0x02
3649 #define STATE_LEFT_CTRL 0x04
3650 #define STATE_LEFT_ALT 0x08
3651 #define STATE_RIGHT_ALT 0x10
3653 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3654 #define KEY_MENUE 0x80 // keycode = 0x0070
3655 #define KEY_BACK 0x81 // keycode = 0x0071
3656 #define KEY_FORWARD 0x82 // keycode = 0x0072
3657 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3658 #define KEY_WINDOW 0x84 // keycode = 0x0074
3659 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3660 #define KEY_STOP 0x86 // keycode = 0x0076
3661 #define KEY_MAIL 0x87 // keycode = 0x0077
3662 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3663 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3664 #define KEY_SETUP 0x8A // keycode = 0x007a
3665 #define KEY_FONT 0x8B // keycode = 0x007b
3666 #define KEY_PRINT 0x8C // keycode = 0x007c
3667 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3669 #define KEY_INSERT 0x90 // keycode = 0x004b
3670 #define KEY_DELETE 0x91 // keycode = 0x004c
3671 #define KEY_LEFT 0x92 // keycode = 0x004f
3672 #define KEY_HOME 0x93 // keycode = 0x0050
3673 #define KEY_END 0x94 // keycode = 0x0051
3674 #define KEY_UP 0x95 // keycode = 0x0053
3675 #define KEY_DOWN 0x96 // keycode = 0x0054
3676 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3677 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3678 #define KEY_RIGHT 0x99 // keycode = 0x0059
3679 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3680 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3683 get_fdc_key (uint16_t cmd
)
3685 static uint8_t key_table
[128] =
3687 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3688 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3689 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3690 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3691 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3693 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3694 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3695 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3696 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3698 static uint8_t state
;
3704 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3705 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3706 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3707 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3708 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3709 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3710 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3711 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3712 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3713 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3715 case 0x006e: key
= KEY_ESCAPE
; break;
3716 case 0x004b: key
= KEY_INSERT
; break;
3717 case 0x004c: key
= KEY_DELETE
; break;
3718 case 0x004f: key
= KEY_LEFT
; break;
3719 case 0x0050: key
= KEY_HOME
; break;
3720 case 0x0051: key
= KEY_END
; break;
3721 case 0x0053: key
= KEY_UP
; break;
3722 case 0x0054: key
= KEY_DOWN
; break;
3723 case 0x0055: key
= KEY_PAGE_UP
; break;
3724 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3725 case 0x0059: key
= KEY_RIGHT
; break;
3726 case 0x0400: key
= KEY_MOUSE_1
; break;
3727 case 0x0800: key
= KEY_MOUSE_2
; break;
3731 if (!(cmd
& 0x80)) // pressed key
3733 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3735 key
= cmd
+ 0x10; // 7x -> 8x
3737 else if (cmd
< 64) // key listed in key_table
3739 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3743 case 0x0003: key
= '²'; break;
3744 case 0x0008: key
= '{'; break;
3745 case 0x0009: key
= '['; break;
3746 case 0x000A: key
= ']'; break;
3747 case 0x000B: key
= '}'; break;
3748 case 0x000C: key
= '\\'; break;
3749 case 0x001C: key
= '~'; break;
3750 case 0x002D: key
= '|'; break;
3751 case 0x0034: key
= 0xB5; break; // Mu
3754 else if (state
& (STATE_LEFT_CTRL
))
3756 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
3758 key
= key_table
[cmd
] - 'a' + 1;
3762 key
= key_table
[cmd
];
3767 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
3771 key
= key_table
[idx
];
3783 static int analyze
= FALSE
;
3784 static int list
= FALSE
;
3785 static IRMP_DATA irmp_data
;
3786 static int expected_protocol
;
3787 static int expected_address
;
3788 static int expected_command
;
3789 static int do_check_expected_values
;
3794 if (! analyze
&& ! list
)
3798 if (irmp_get_data (&irmp_data
))
3802 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
3806 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3809 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
3811 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
3813 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
3814 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
3816 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
3818 char * p
= (char *) NULL
;
3822 case '\t' : p
= "TAB"; break;
3823 case '\r' : p
= "CR"; break;
3824 case KEY_ESCAPE
: p
= "ESCAPE"; break;
3825 case KEY_MENUE
: p
= "MENUE"; break;
3826 case KEY_BACK
: p
= "BACK"; break;
3827 case KEY_FORWARD
: p
= "FORWARD"; break;
3828 case KEY_ADDRESS
: p
= "ADDRESS"; break;
3829 case KEY_WINDOW
: p
= "WINDOW"; break;
3830 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
3831 case KEY_STOP
: p
= "STOP"; break;
3832 case KEY_MAIL
: p
= "MAIL"; break;
3833 case KEY_FAVORITES
: p
= "FAVORITES"; break;
3834 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
3835 case KEY_SETUP
: p
= "SETUP"; break;
3836 case KEY_FONT
: p
= "FONT"; break;
3837 case KEY_PRINT
: p
= "PRINT"; break;
3838 case KEY_ON_OFF
: p
= "ON_OFF"; break;
3840 case KEY_INSERT
: p
= "INSERT"; break;
3841 case KEY_DELETE
: p
= "DELETE"; break;
3842 case KEY_LEFT
: p
= "LEFT"; break;
3843 case KEY_HOME
: p
= "HOME"; break;
3844 case KEY_END
: p
= "END"; break;
3845 case KEY_UP
: p
= "UP"; break;
3846 case KEY_DOWN
: p
= "DOWN"; break;
3847 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
3848 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
3849 case KEY_RIGHT
: p
= "RIGHT"; break;
3850 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
3851 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
3852 default : p
= "<UNKNWON>"; break;
3855 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
3856 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
3860 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
3861 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
3866 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
3867 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
3870 if (do_check_expected_values
)
3872 if (irmp_data
.protocol
!= expected_protocol
||
3873 irmp_data
.address
!= expected_address
||
3874 irmp_data
.command
!= expected_command
)
3876 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
3877 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
3881 printf (" checked!\n");
3883 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
3894 main (int argc
, char ** argv
)
3902 int start_pulses
[256];
3903 int start_pauses
[256];
3907 int first_pulse
= TRUE
;
3908 int first_pause
= TRUE
;
3912 if (! strcmp (argv
[1], "-v"))
3916 else if (! strcmp (argv
[1], "-l"))
3920 else if (! strcmp (argv
[1], "-a"))
3924 else if (! strcmp (argv
[1], "-s"))
3928 else if (! strcmp (argv
[1], "-p"))
3935 for (i
= 0; i
< 256; i
++)
3937 start_pulses
[i
] = 0;
3938 start_pauses
[i
] = 0;
3945 while ((ch
= getchar ()) != EOF
)
3947 if (ch
== '_' || ch
== '0')
3955 printf ("pause: %d\n", pause
);
3964 start_pauses
[pause
]++;
3966 first_pause
= FALSE
;
3982 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
3988 printf ("pulse: %d ", pulse
);
3997 start_pulses
[pulse
]++;
3999 first_pulse
= FALSE
;
4015 else if (ch
== '\n')
4020 if (list
&& pause
> 0)
4022 printf ("pause: %d\n", pause
);
4028 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
4042 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4053 puts ("-------------------------------------------------------------------");
4057 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4059 if (ch
!= '\r') // ignore CR in DOS/Windows files
4061 if (ch
== '[' && idx
== -1)
4069 do_check_expected_values
= FALSE
;
4073 expected_protocol
= atoi (buf
);
4075 if (expected_protocol
> 0)
4084 if (sscanf (p
, "%x", &expected_address
) == 1)
4086 do_check_expected_values
= TRUE
;
4093 if (do_check_expected_values
)
4095 do_check_expected_values
= FALSE
;
4103 if (sscanf (p
, "%x", &expected_command
) == 1)
4105 do_check_expected_values
= TRUE
;
4112 if (do_check_expected_values
)
4114 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4119 else if (idx
< 1024 - 2)
4139 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4140 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4141 print_spectrum ("PULSES", pulses
, TRUE
);
4142 print_spectrum ("PAUSES", pauses
, FALSE
);
4143 puts ("-------------------------------------------------------------------------------");