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.149 2014/06/05 21:00:06 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 IRMP_SUPPORT_ORTEK_PROTOCOL == 1
48 # define IRMP_SUPPORT_MANCHESTER 1
50 # define IRMP_SUPPORT_MANCHESTER 0
53 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
54 # define IRMP_SUPPORT_SERIAL 1
56 # define IRMP_SUPPORT_SERIAL 0
59 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
61 #define MIN_TOLERANCE_00 1.0 // -0%
62 #define MAX_TOLERANCE_00 1.0 // +0%
64 #define MIN_TOLERANCE_05 0.95 // -5%
65 #define MAX_TOLERANCE_05 1.05 // +5%
67 #define MIN_TOLERANCE_10 0.9 // -10%
68 #define MAX_TOLERANCE_10 1.1 // +10%
70 #define MIN_TOLERANCE_15 0.85 // -15%
71 #define MAX_TOLERANCE_15 1.15 // +15%
73 #define MIN_TOLERANCE_20 0.8 // -20%
74 #define MAX_TOLERANCE_20 1.2 // +20%
76 #define MIN_TOLERANCE_30 0.7 // -30%
77 #define MAX_TOLERANCE_30 1.3 // +30%
79 #define MIN_TOLERANCE_40 0.6 // -40%
80 #define MAX_TOLERANCE_40 1.4 // +40%
82 #define MIN_TOLERANCE_50 0.5 // -50%
83 #define MAX_TOLERANCE_50 1.5 // +50%
85 #define MIN_TOLERANCE_60 0.4 // -60%
86 #define MAX_TOLERANCE_60 1.6 // +60%
88 #define MIN_TOLERANCE_70 0.3 // -70%
89 #define MAX_TOLERANCE_70 1.7 // +70%
91 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
92 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
93 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
94 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
95 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
96 #else // only 5% + 1 to avoid conflict with RC6:
97 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
99 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
100 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
101 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
102 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
103 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
104 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
106 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
107 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
108 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
109 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
110 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
111 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
112 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
113 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
114 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
115 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
116 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
117 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
118 // autodetect nec repetition frame within 50 msec:
119 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
121 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
123 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
126 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
127 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
128 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
129 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
130 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
131 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
132 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
133 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
134 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
135 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
137 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
138 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
139 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
140 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
141 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
142 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
143 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
144 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
145 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
146 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
148 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
149 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
150 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
151 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
152 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
153 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
154 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
155 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
156 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
157 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
159 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
160 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
161 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
162 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
163 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
164 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
165 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
166 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
167 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
168 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
171 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
172 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
173 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
175 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
176 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
179 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
180 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
182 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
183 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
184 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
185 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
186 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
187 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
188 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
189 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
191 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
192 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
195 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
196 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
198 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
200 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
201 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
202 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
203 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
204 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
206 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
207 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
209 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
210 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
211 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
212 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
213 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
214 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
215 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
216 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
217 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
218 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
220 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
223 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
224 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
225 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
226 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
227 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
228 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
229 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
230 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
231 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
233 #define SPEAKER_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
234 #define SPEAKER_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
235 #define SPEAKER_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
236 #define SPEAKER_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
237 #define SPEAKER_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
238 #define SPEAKER_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
239 #define SPEAKER_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
240 #define SPEAKER_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
241 #define SPEAKER_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
242 #define SPEAKER_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
243 #define SPEAKER_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
244 #define SPEAKER_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
246 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
247 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
248 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
249 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
250 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
251 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
252 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
253 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
254 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
255 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
256 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
257 #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
258 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
259 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
260 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
261 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
262 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
263 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
264 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
265 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
266 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
267 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
268 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
269 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
270 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
271 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
273 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
274 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
275 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
276 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
277 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
278 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
279 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
281 #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)
282 #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)
283 #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)
284 #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)
285 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
286 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
287 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
288 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #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
291 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
292 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
293 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
294 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
295 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
296 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
297 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
299 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
301 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
303 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
305 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
306 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
307 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
308 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
309 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
310 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
311 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
312 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
313 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
314 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
316 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
317 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
318 #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!
319 #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!
320 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
321 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
322 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
323 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
324 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
325 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
326 // autodetect JVC repetition frame within 50 msec:
327 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
329 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
330 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
331 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
332 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
333 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
334 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
335 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
336 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
337 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
338 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
339 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
340 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
341 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
343 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
344 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
345 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
346 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
347 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
348 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
349 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
350 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
351 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
352 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
353 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
354 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
355 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
356 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
358 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
359 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
360 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
361 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
362 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
363 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
364 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
365 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
367 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
368 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
369 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
370 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
371 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
372 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
373 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
374 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
375 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
376 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
378 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
379 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
380 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
381 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
382 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
383 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
384 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
385 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
386 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
387 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
388 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
390 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
391 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
392 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
393 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
394 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
395 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
396 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
397 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
399 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
400 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
401 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
402 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
403 #define ORTEK_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
404 #define ORTEK_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
405 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
406 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
408 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
409 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
410 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
411 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
412 #define TELEFUNKEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
413 #define TELEFUNKEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
414 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
415 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
416 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
417 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
418 // autodetect TELEFUNKEN repetition frame within 50 msec:
419 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
421 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
422 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
423 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
424 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
425 #define ROOMBA_1_PAUSE_LEN_EXACT ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))
426 #define ROOMBA_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
427 #define ROOMBA_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
428 #define ROOMBA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
429 #define ROOMBA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
430 #define ROOMBA_0_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
431 #define ROOMBA_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
432 #define ROOMBA_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
433 #define ROOMBA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
434 #define ROOMBA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
436 #define RCMM32_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
437 #define RCMM32_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
438 #define RCMM32_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
439 #define RCMM32_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
440 #define RCMM32_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
441 #define RCMM32_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
442 #define RCMM32_BIT_00_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
443 #define RCMM32_BIT_00_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
444 #define RCMM32_BIT_01_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
445 #define RCMM32_BIT_01_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
446 #define RCMM32_BIT_10_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
447 #define RCMM32_BIT_10_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
448 #define RCMM32_BIT_11_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
449 #define RCMM32_BIT_11_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
451 #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
452 #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
453 #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
454 #define RADIO1_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
455 #define RADIO1_1_PAUSE_LEN_EXACT ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))
456 #define RADIO1_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
457 #define RADIO1_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
458 #define RADIO1_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
459 #define RADIO1_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
460 #define RADIO1_0_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))
461 #define RADIO1_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
462 #define RADIO1_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
463 #define RADIO1_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
464 #define RADIO1_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
466 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
469 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
470 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
471 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
472 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
473 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
475 static int time_counter
;
478 # define ANALYZE_PUTCHAR(a)
479 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
480 # define ANALYZE_PRINTF(...)
481 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
482 # define ANALYZE_NEWLINE()
485 #if IRMP_USE_CALLBACK == 1
486 static void (*irmp_callback_ptr
) (uint8_t);
487 #endif // IRMP_USE_CALLBACK == 1
489 #define PARITY_CHECK_OK 1
490 #define PARITY_CHECK_FAILED 0
492 /*---------------------------------------------------------------------------------------------------------------------------------------------------
494 *---------------------------------------------------------------------------------------------------------------------------------------------------
496 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
498 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
546 /*---------------------------------------------------------------------------------------------------------------------------------------------------
548 *---------------------------------------------------------------------------------------------------------------------------------------------------
550 #if IRMP_LOGGING == 1 // logging via UART
552 #if IRMP_EXT_LOGGING == 1 // use external logging
553 #include "irmpextlog.h"
554 #else // normal UART log (IRMP_EXT_LOGGING == 0)
556 #ifndef UNIX_OR_WINDOWS
557 #include <util/setbaud.h>
562 #define UART0_UBRRH UBRR0H
563 #define UART0_UBRRL UBRR0L
564 #define UART0_UCSRA UCSR0A
565 #define UART0_UCSRB UCSR0B
566 #define UART0_UCSRC UCSR0C
567 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
568 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
569 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
571 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
573 #define UART0_URSEL_BIT_VALUE (0)
575 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
576 #define UART0_UDR UDR0
577 #define UART0_U2X U2X0
581 #define UART0_UBRRH UBRRH
582 #define UART0_UBRRL UBRRL
583 #define UART0_UCSRA UCSRA
584 #define UART0_UCSRB UCSRB
585 #define UART0_UCSRC UCSRC
586 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
587 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
588 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
590 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
592 #define UART0_URSEL_BIT_VALUE (0)
594 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
595 #define UART0_UDR UDR
596 #define UART0_U2X U2X
599 #endif //IRMP_EXT_LOGGING
601 /*---------------------------------------------------------------------------------------------------------------------------------------------------
603 * @details Initializes UART
604 *---------------------------------------------------------------------------------------------------------------------------------------------------
607 irmp_uart_init (void)
609 #ifndef UNIX_OR_WINDOWS
610 #if (IRMP_EXT_LOGGING == 0) // use UART
611 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
612 UART0_UBRRL
= UBRRL_VALUE
;
615 UART0_UCSRA
|= (1<<UART0_U2X
);
617 UART0_UCSRA
&= ~(1<<UART0_U2X
);
620 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
621 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
622 #else // other log method
624 #endif //IRMP_EXT_LOGGING
625 #endif // UNIX_OR_WINDOWS
628 /*---------------------------------------------------------------------------------------------------------------------------------------------------
630 * @details Sends character
631 * @param ch character to be transmitted
632 *---------------------------------------------------------------------------------------------------------------------------------------------------
635 irmp_uart_putc (unsigned char ch
)
637 #ifndef UNIX_OR_WINDOWS
638 #if (IRMP_EXT_LOGGING == 0)
639 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
646 sendextlog(ch
); //Use external log
650 #endif // UNIX_OR_WINDOWS
653 /*---------------------------------------------------------------------------------------------------------------------------------------------------
655 *---------------------------------------------------------------------------------------------------------------------------------------------------
658 #define STARTCYCLES 2 // min count of zeros before start of logging
659 #define ENDBITS 1000 // number of sequenced highbits to detect end
660 #define DATALEN 700 // log buffer size
662 #if 0 // old log routine
665 irmp_log (uint8_t val
)
667 static uint8_t buf
[DATALEN
]; // logging buffer
668 static uint16_t buf_idx
; // number of written bits
669 static uint8_t startcycles
; // current number of start-zeros
670 static uint16_t cnt
; // counts sequenced highbits - to detect end
672 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
680 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
682 if (buf_idx
< DATALEN
* 8) // index in range?
686 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
690 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
697 { // if high received then look at log-stop condition
701 { // if stop condition is true, output on uart
704 for (i
= 0; i
< STARTCYCLES
; i
++)
706 irmp_uart_putc ('0'); // the ignored starting zeros
709 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
714 for (j
= 0; j
< 8; j
++)
716 irmp_uart_putc ((d
& 1) + '0');
721 irmp_uart_putc ('\n');
733 #else // new log routine
736 irmp_log (uint8_t val
)
738 static uint8_t buf
[DATALEN
]; // logging buffer
739 static uint16_t buf_idx
; // index
740 static uint8_t startcycles
; // current number of start-zeros
741 static uint16_t cnt
; // counts sequenced highbits - to detect end
742 static uint8_t last_val
= 1;
744 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
752 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
758 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
759 { // if stop condition is true, output on uart
766 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
768 irmp_uart_putc ('0'); // the ignored starting zeros
771 for (i
= 0; i
< buf_idx
; i
++)
780 d
|= ((uint16_t) buf
[i
] << 8);
783 for (j
= 0; j
< d
; j
++)
788 v
= (v
== '1') ? '0' : '1';
791 for (i8
= 0; i8
< 20; i8
++)
793 irmp_uart_putc ('1');
796 irmp_uart_putc ('\n');
802 else if (buf_idx
< DATALEN
- 3)
806 buf
[buf_idx
++] = 0xff;
807 buf
[buf_idx
++] = (cnt
& 0xff);
808 buf
[buf_idx
] = (cnt
>> 8);
826 #define irmp_log(val)
827 #endif //IRMP_LOGGING
831 uint8_t protocol
; // ir protocol
832 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
833 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
834 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
835 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
836 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
837 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
838 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
839 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
840 uint8_t address_offset
; // address offset
841 uint8_t address_end
; // end of address
842 uint8_t command_offset
; // command offset
843 uint8_t command_end
; // end of command
844 uint8_t complete_len
; // complete length of frame
845 uint8_t stop_bit
; // flag: frame has stop bit
846 uint8_t lsb_first
; // flag: LSB first
847 uint8_t flags
; // some flags
850 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
852 static const PROGMEM IRMP_PARAMETER sircs_param
=
854 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
855 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
856 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
857 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
858 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
859 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
860 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
861 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
862 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
863 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
864 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
865 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
866 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
867 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
868 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
869 SIRCS_LSB
, // lsb_first: flag: LSB first
870 SIRCS_FLAGS
// flags: some flags
875 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
877 static const PROGMEM IRMP_PARAMETER nec_param
=
879 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
880 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
881 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
882 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
883 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
884 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
885 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
886 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
887 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
888 NEC_ADDRESS_OFFSET
, // address_offset: address offset
889 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
890 NEC_COMMAND_OFFSET
, // command_offset: command offset
891 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
892 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
893 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
894 NEC_LSB
, // lsb_first: flag: LSB first
895 NEC_FLAGS
// flags: some flags
898 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
900 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
901 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
902 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
903 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
904 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
905 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
906 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
907 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
908 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
909 0, // address_offset: address offset
910 0, // address_end: end of address
911 0, // command_offset: command offset
912 0, // command_end: end of command
913 0, // complete_len: complete length of frame
914 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
915 NEC_LSB
, // lsb_first: flag: LSB first
916 NEC_FLAGS
// flags: some flags
921 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
923 static const PROGMEM IRMP_PARAMETER nec42_param
=
925 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
926 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
927 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
928 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
929 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
930 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
931 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
932 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
933 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
934 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
935 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
936 NEC42_COMMAND_OFFSET
, // command_offset: command offset
937 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
938 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
939 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
940 NEC_LSB
, // lsb_first: flag: LSB first
941 NEC_FLAGS
// flags: some flags
946 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
948 static const PROGMEM IRMP_PARAMETER lgair_param
=
950 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
951 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
952 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
953 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
954 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
955 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
956 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
957 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
958 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
959 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
960 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
961 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
962 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
963 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
964 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
965 NEC_LSB
, // lsb_first: flag: LSB first
966 NEC_FLAGS
// flags: some flags
971 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
973 static const PROGMEM IRMP_PARAMETER samsung_param
=
975 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
976 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
977 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
978 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
979 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
980 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
981 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
982 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
983 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
984 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
985 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
986 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
987 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
988 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
989 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
990 SAMSUNG_LSB
, // lsb_first: flag: LSB first
991 SAMSUNG_FLAGS
// flags: some flags
996 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
998 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1000 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1001 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1002 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1003 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1004 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1005 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1006 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1007 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1008 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1009 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1010 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1011 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1012 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1013 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1014 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1015 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1016 TELEFUNKEN_FLAGS
// flags: some flags
1021 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1023 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1025 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1026 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1027 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1028 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1029 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1030 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1031 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1032 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1033 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1034 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1035 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1036 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1037 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1038 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1039 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1040 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1041 MATSUSHITA_FLAGS
// flags: some flags
1046 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1048 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1050 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1051 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1052 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1053 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1054 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1055 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1056 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1057 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1058 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1059 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1060 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1061 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1062 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1063 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1064 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1065 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1066 KASEIKYO_FLAGS
// flags: some flags
1071 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1073 static const PROGMEM IRMP_PARAMETER recs80_param
=
1075 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1076 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1077 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1078 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1079 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1080 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1081 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1082 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1083 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1084 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1085 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1086 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1087 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1088 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1089 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1090 RECS80_LSB
, // lsb_first: flag: LSB first
1091 RECS80_FLAGS
// flags: some flags
1096 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1098 static const PROGMEM IRMP_PARAMETER rc5_param
=
1100 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1101 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1102 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1103 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1104 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1105 0, // pulse_0_len_min: here: not used
1106 0, // pulse_0_len_max: here: not used
1107 0, // pause_0_len_min: here: not used
1108 0, // pause_0_len_max: here: not used
1109 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1110 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1111 RC5_COMMAND_OFFSET
, // command_offset: command offset
1112 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1113 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1114 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1115 RC5_LSB
, // lsb_first: flag: LSB first
1116 RC5_FLAGS
// flags: some flags
1121 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1123 static const PROGMEM IRMP_PARAMETER denon_param
=
1125 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1126 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1127 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1128 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1129 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1130 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1131 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1132 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1133 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1134 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1135 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1136 DENON_COMMAND_OFFSET
, // command_offset: command offset
1137 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1138 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1139 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1140 DENON_LSB
, // lsb_first: flag: LSB first
1141 DENON_FLAGS
// flags: some flags
1146 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1148 static const PROGMEM IRMP_PARAMETER rc6_param
=
1150 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1152 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1153 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1154 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1155 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1156 0, // pulse_0_len_min: here: not used
1157 0, // pulse_0_len_max: here: not used
1158 0, // pause_0_len_min: here: not used
1159 0, // pause_0_len_max: here: not used
1160 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1161 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1162 RC6_COMMAND_OFFSET
, // command_offset: command offset
1163 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1164 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1165 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1166 RC6_LSB
, // lsb_first: flag: LSB first
1167 RC6_FLAGS
// flags: some flags
1172 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1174 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1176 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1177 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1178 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1179 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1180 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1181 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1182 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1183 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1184 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1185 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1186 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1187 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1188 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1189 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1190 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1191 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1192 RECS80EXT_FLAGS
// flags: some flags
1197 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1199 static const PROGMEM IRMP_PARAMETER nubert_param
=
1201 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1202 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1203 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1204 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1205 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1206 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1207 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1208 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1209 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1210 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1211 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1212 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1213 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1214 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1215 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1216 NUBERT_LSB
, // lsb_first: flag: LSB first
1217 NUBERT_FLAGS
// flags: some flags
1222 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1224 static const PROGMEM IRMP_PARAMETER speaker_param
=
1226 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1227 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1228 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1229 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1230 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1231 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1232 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1233 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1234 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1235 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1236 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1237 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1238 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1239 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1240 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1241 SPEAKER_LSB
, // lsb_first: flag: LSB first
1242 SPEAKER_FLAGS
// flags: some flags
1247 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1249 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1251 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1252 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1253 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1254 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1255 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1256 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1257 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1258 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1259 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1260 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1261 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1262 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1263 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1264 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1265 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1266 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1267 BANG_OLUFSEN_FLAGS
// flags: some flags
1272 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1274 static uint8_t first_bit
;
1276 static const PROGMEM IRMP_PARAMETER grundig_param
=
1278 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1280 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1281 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1282 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1283 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1284 0, // pulse_0_len_min: here: not used
1285 0, // pulse_0_len_max: here: not used
1286 0, // pause_0_len_min: here: not used
1287 0, // pause_0_len_max: here: not used
1288 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1289 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1290 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1291 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1292 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1293 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1294 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1295 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1300 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1302 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1304 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1305 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1306 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1307 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1308 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1309 0, // pulse_0_len_min: here: not used
1310 0, // pulse_0_len_max: here: not used
1311 0, // pause_0_len_min: here: not used
1312 0, // pause_0_len_max: here: not used
1313 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1314 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1315 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1316 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1317 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1318 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1319 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1320 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1325 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1327 static const PROGMEM IRMP_PARAMETER fdc_param
=
1329 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1330 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1331 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1332 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1333 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1334 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1335 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1336 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1337 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1338 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1339 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1340 FDC_COMMAND_OFFSET
, // command_offset: command offset
1341 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1342 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1343 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1344 FDC_LSB
, // lsb_first: flag: LSB first
1345 FDC_FLAGS
// flags: some flags
1350 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1352 static const PROGMEM IRMP_PARAMETER rccar_param
=
1354 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1355 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1356 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1357 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1358 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1359 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1360 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1361 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1362 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1363 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1364 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1365 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1366 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1367 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1368 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1369 RCCAR_LSB
, // lsb_first: flag: LSB first
1370 RCCAR_FLAGS
// flags: some flags
1375 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1377 static const PROGMEM IRMP_PARAMETER nikon_param
=
1379 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1380 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1381 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1382 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1383 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1384 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1385 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1386 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1387 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1388 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1389 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1390 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1391 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1392 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1393 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1394 NIKON_LSB
, // lsb_first: flag: LSB first
1395 NIKON_FLAGS
// flags: some flags
1400 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1402 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1404 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1405 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1406 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1407 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1408 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1409 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1410 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1411 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1412 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1413 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1414 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1415 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1416 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1417 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1418 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1419 KATHREIN_LSB
, // lsb_first: flag: LSB first
1420 KATHREIN_FLAGS
// flags: some flags
1425 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1427 static const PROGMEM IRMP_PARAMETER netbox_param
=
1429 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1430 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1431 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1432 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1433 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1434 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1435 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1436 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1437 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1438 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1439 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1440 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1441 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1442 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1443 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1444 NETBOX_LSB
, // lsb_first: flag: LSB first
1445 NETBOX_FLAGS
// flags: some flags
1450 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1452 static const PROGMEM IRMP_PARAMETER lego_param
=
1454 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1455 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1456 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1457 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1458 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1459 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1460 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1461 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1462 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1463 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1464 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1465 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1466 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1467 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1468 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1469 LEGO_LSB
, // lsb_first: flag: LSB first
1470 LEGO_FLAGS
// flags: some flags
1475 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1477 static const PROGMEM IRMP_PARAMETER thomson_param
=
1479 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1480 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1481 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1482 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1483 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1484 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1485 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1486 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1487 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1488 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1489 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1490 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1491 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1492 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1493 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1494 THOMSON_LSB
, // lsb_first: flag: LSB first
1495 THOMSON_FLAGS
// flags: some flags
1500 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1502 static const PROGMEM IRMP_PARAMETER bose_param
=
1504 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1505 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1506 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1507 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1508 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1509 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1510 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1511 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1512 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1513 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1514 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1515 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1516 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1517 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1518 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1519 BOSE_LSB
, // lsb_first: flag: LSB first
1520 BOSE_FLAGS
// flags: some flags
1525 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1527 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1529 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1531 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1532 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1533 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1534 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1535 0, // pulse_0_len_min: here: not used
1536 0, // pulse_0_len_max: here: not used
1537 0, // pause_0_len_min: here: not used
1538 0, // pause_0_len_max: here: not used
1539 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1540 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1541 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1542 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1543 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1544 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1545 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1546 A1TVBOX_FLAGS
// flags: some flags
1551 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1553 static const PROGMEM IRMP_PARAMETER ortek_param
=
1555 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1557 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1558 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1559 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1560 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1561 0, // pulse_0_len_min: here: not used
1562 0, // pulse_0_len_max: here: not used
1563 0, // pause_0_len_min: here: not used
1564 0, // pause_0_len_max: here: not used
1565 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1566 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1567 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1568 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1569 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1570 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1571 ORTEK_LSB
, // lsb_first: flag: LSB first
1572 ORTEK_FLAGS
// flags: some flags
1577 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1579 static const PROGMEM IRMP_PARAMETER roomba_param
=
1581 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1582 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1583 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1584 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1585 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1586 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1587 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1588 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1589 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1590 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1591 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1592 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1593 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1594 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1595 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1596 ROOMBA_LSB
, // lsb_first: flag: LSB first
1597 ROOMBA_FLAGS
// flags: some flags
1602 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1604 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1606 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1608 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1609 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1610 0, // pause_1_len_min: here: minimum length of short pause
1611 0, // pause_1_len_max: here: maximum length of short pause
1612 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1613 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1614 0, // pause_0_len_min: here: not used
1615 0, // pause_0_len_max: here: not used
1616 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1617 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1618 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1619 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1620 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1621 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1622 RCMM32_LSB
, // lsb_first: flag: LSB first
1623 RCMM32_FLAGS
// flags: some flags
1628 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1630 static const PROGMEM IRMP_PARAMETER radio1_param
=
1632 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1634 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1635 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1636 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1637 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1638 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1639 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1640 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1641 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1642 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1643 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1644 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1645 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1646 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1647 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1648 RADIO1_LSB
, // lsb_first: flag: LSB first
1649 RADIO1_FLAGS
// flags: some flags
1654 static uint8_t irmp_bit
; // current bit position
1655 static IRMP_PARAMETER irmp_param
;
1657 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1658 static IRMP_PARAMETER irmp_param2
;
1661 static volatile uint8_t irmp_ir_detected
;
1662 static volatile uint8_t irmp_protocol
;
1663 static volatile uint16_t irmp_address
;
1664 static volatile uint16_t irmp_command
;
1665 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1666 static volatile uint8_t irmp_flags
;
1667 // static volatile uint8_t irmp_busy_flag;
1670 #define input(x) (x)
1671 static uint8_t IRMP_PIN
;
1672 static uint8_t radio
;
1675 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1676 * Initialize IRMP decoder
1677 * @details Configures IRMP input pin
1678 *---------------------------------------------------------------------------------------------------------------------------------------------------
1684 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1685 #elif defined (ARM_STM32) // STM32
1686 GPIO_InitTypeDef GPIO_InitStructure
;
1688 /* GPIOx clock enable */
1689 #if defined (ARM_STM32L1XX)
1690 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1691 #elif defined (ARM_STM32F10X)
1692 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1693 #elif defined (ARM_STM32F4XX)
1694 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1697 /* GPIO Configuration */
1698 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1699 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1700 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1701 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1702 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1703 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1704 #elif defined (ARM_STM32F10X)
1705 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1706 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1708 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1709 #elif defined(STELLARIS_ARM_CORTEX_M4)
1710 // Enable the GPIO port
1711 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1714 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1715 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1717 GPIO_PIN_TYPE_STD_WPU
);
1719 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1720 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1723 #if IRMP_LOGGING == 1
1728 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1730 * @details gets decoded IRMP data
1731 * @param pointer in order to store IRMP data
1732 * @return TRUE: successful, FALSE: failed
1733 *---------------------------------------------------------------------------------------------------------------------------------------------------
1736 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1738 uint8_t rtc
= FALSE
;
1740 if (irmp_ir_detected
)
1742 switch (irmp_protocol
)
1744 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1745 case IRMP_SAMSUNG_PROTOCOL
:
1746 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1748 irmp_command
&= 0xff;
1749 irmp_command
|= irmp_id
<< 8;
1754 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1755 case IRMP_NEC_PROTOCOL
:
1756 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1758 irmp_command
&= 0xff;
1761 else if (irmp_address
== 0x87EE)
1763 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1764 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1765 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1766 irmp_command
&= 0x00FF;
1771 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1772 case IRMP_BOSE_PROTOCOL
:
1773 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1775 irmp_command
&= 0xff;
1780 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1781 case IRMP_SIEMENS_PROTOCOL
:
1782 case IRMP_RUWIDO_PROTOCOL
:
1783 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1790 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1791 case IRMP_KATHREIN_PROTOCOL
:
1792 if (irmp_command
!= 0x0000)
1798 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1799 case IRMP_RC5_PROTOCOL
:
1800 irmp_address
&= ~0x20; // clear toggle bit
1804 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1805 case IRMP_IR60_PROTOCOL
:
1806 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1812 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1816 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1817 case IRMP_RCCAR_PROTOCOL
:
1818 // frame in irmp_data:
1819 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1820 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1821 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1822 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1823 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1824 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1825 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1829 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1830 case IRMP_NETBOX_PROTOCOL
:
1831 if (irmp_command
& 0x1000) // last bit set?
1833 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1836 irmp_command
&= 0x7F;
1839 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1842 irmp_command
|= 0x80;
1847 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1852 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1856 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1857 case IRMP_LEGO_PROTOCOL
:
1859 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1861 if ((irmp_command
& 0x000F) == crc
)
1868 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1869 // rtc = TRUE; // don't accept codes with CRC errors
1884 irmp_data_p
->protocol
= irmp_protocol
;
1885 irmp_data_p
->address
= irmp_address
;
1886 irmp_data_p
->command
= irmp_command
;
1887 irmp_data_p
->flags
= irmp_flags
;
1893 irmp_ir_detected
= FALSE
;
1900 // irmp_is_busy (void)
1902 // return irmp_busy_flag;
1905 #if IRMP_USE_CALLBACK == 1
1907 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1909 irmp_callback_ptr
= cb
;
1911 #endif // IRMP_USE_CALLBACK == 1
1913 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1914 static uint16_t irmp_tmp_address
; // ir address
1915 static uint16_t irmp_tmp_command
; // ir command
1917 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1918 static uint16_t irmp_tmp_address2
; // ir address
1919 static uint16_t irmp_tmp_command2
; // ir command
1922 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1923 static uint16_t irmp_lgair_address
; // ir address
1924 static uint16_t irmp_lgair_command
; // ir command
1927 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1928 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1930 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1931 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1932 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1935 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1936 static uint8_t parity
; // number of '1' of the first 14 bits, check if even.
1939 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1941 * @details store bit in temp address or temp command
1942 * @param value to store: 0 or 1
1943 *---------------------------------------------------------------------------------------------------------------------------------------------------
1945 // verhindert, dass irmp_store_bit() inline compiliert wird:
1946 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1949 irmp_store_bit (uint8_t value
)
1951 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1952 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
1961 else if (irmp_bit
== 14)
1963 if (value
) // value == 1: even parity
1967 parity
= PARITY_CHECK_FAILED
;
1971 parity
= PARITY_CHECK_OK
;
1976 if (parity
& 0x01) // value == 0: odd parity
1978 parity
= PARITY_CHECK_OK
;
1982 parity
= PARITY_CHECK_FAILED
;
1989 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1990 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1997 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1999 if (irmp_param
.lsb_first
)
2001 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2005 irmp_tmp_address
<<= 1;
2006 irmp_tmp_address
|= value
;
2009 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2011 if (irmp_param
.lsb_first
)
2013 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2017 irmp_tmp_command
<<= 1;
2018 irmp_tmp_command
|= value
;
2022 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2023 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2027 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2028 irmp_lgair_address
|= value
;
2030 else if (irmp_bit
< 24)
2032 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2033 irmp_lgair_command
|= value
;
2039 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2040 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2042 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2047 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2048 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2050 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2055 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2056 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2058 if (irmp_bit
>= 20 && irmp_bit
< 24)
2060 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2062 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2064 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2067 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2071 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2075 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2088 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2090 * @details store bit in temp address or temp command
2091 * @param value to store: 0 or 1
2092 *---------------------------------------------------------------------------------------------------------------------------------------------------
2094 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2096 irmp_store_bit2 (uint8_t value
)
2100 if (irmp_param
.protocol
)
2102 irmp_bit2
= irmp_bit
- 2;
2106 irmp_bit2
= irmp_bit
- 1;
2109 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2111 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2113 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2115 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2118 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2120 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2122 * @details ISR routine, called 10000 times per second
2123 *---------------------------------------------------------------------------------------------------------------------------------------------------
2128 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
2129 static uint8_t wait_for_space
; // flag: wait for data bit space
2130 static uint8_t wait_for_start_space
; // flag: wait for start bit space
2131 static uint8_t irmp_pulse_time
; // count bit time for pulse
2132 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2133 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2134 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2135 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2136 static uint8_t repetition_frame_number
;
2137 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2138 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2139 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2141 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2142 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2144 #if IRMP_SUPPORT_MANCHESTER == 1
2145 static PAUSE_LEN last_pause
; // last pause value
2147 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2148 static uint8_t last_value
; // last bit value
2150 uint8_t irmp_input
; // input value
2156 irmp_input
= input(IRMP_PIN
);
2158 #if IRMP_USE_CALLBACK == 1
2159 if (irmp_callback_ptr
)
2161 static uint8_t last_inverted_input
;
2163 if (last_inverted_input
!= !irmp_input
)
2165 (*irmp_callback_ptr
) (! irmp_input
);
2166 last_inverted_input
= !irmp_input
;
2169 #endif // IRMP_USE_CALLBACK == 1
2171 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2173 if (! irmp_ir_detected
) // ir code already detected?
2175 if (! irmp_start_bit_detected
) // start bit detected?
2177 if (! irmp_input
) // receiving burst?
2179 // irmp_busy_flag = TRUE;
2181 if (! irmp_pulse_time
)
2183 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2186 irmp_pulse_time
++; // increment counter
2190 if (irmp_pulse_time
) // it's dark....
2191 { // set flags for counting the time of darkness...
2192 irmp_start_bit_detected
= 1;
2193 wait_for_start_space
= 1;
2195 irmp_tmp_command
= 0;
2196 irmp_tmp_address
= 0;
2197 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2201 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2202 irmp_tmp_command2
= 0;
2203 irmp_tmp_address2
= 0;
2205 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2206 irmp_lgair_command
= 0;
2207 irmp_lgair_address
= 0;
2210 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2211 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2212 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2217 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2219 key_repetition_len
++;
2221 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2222 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2224 denon_repetition_len
++;
2226 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2228 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2229 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2230 last_irmp_denon_command
= 0;
2231 denon_repetition_len
= 0xFFFF;
2234 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2241 if (wait_for_start_space
) // we have received start bit...
2242 { // ...and are counting the time of darkness
2243 if (irmp_input
) // still dark?
2245 irmp_pause_time
++; // increment counter
2247 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2248 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
) ||
2249 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2251 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2254 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2255 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2260 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2262 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
);
2263 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2265 // irmp_busy_flag = FALSE;
2266 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2267 irmp_pulse_time
= 0;
2268 irmp_pause_time
= 0;
2272 { // receiving first data pulse!
2273 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
2275 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2276 irmp_param2
.protocol
= 0;
2279 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2281 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2282 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2283 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2285 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2286 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2287 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2288 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
2291 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2293 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2294 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2295 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2296 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2298 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2299 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2300 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2301 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2304 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2306 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2307 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2308 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2310 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2311 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2312 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2313 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2314 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2316 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2317 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2318 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2319 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2322 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2323 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2325 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2326 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2327 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2328 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2329 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2330 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2331 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2334 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2336 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2337 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2338 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2340 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2345 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2346 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2347 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2348 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2349 { // it's JVC repetition type 3
2350 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2351 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2352 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2353 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2356 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2358 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2360 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2361 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2362 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2364 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2365 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2366 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2367 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2370 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2372 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2373 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2374 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2376 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2377 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2378 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2379 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2382 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2384 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2385 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2386 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2388 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2389 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2390 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2391 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2394 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2396 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2397 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2398 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2400 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2401 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2402 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2403 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2406 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2408 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2409 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2410 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2411 { // it's MATSUSHITA
2412 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2413 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2414 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2415 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2418 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2420 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2421 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2422 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2424 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2425 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2426 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2427 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2430 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2432 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2433 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2434 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2436 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2437 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2438 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2439 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2442 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2444 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2445 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2446 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2448 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2449 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2450 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2451 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2454 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2456 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2457 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2458 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2459 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2460 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2462 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2463 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2464 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2466 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2467 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2468 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2469 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2470 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2471 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2472 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2473 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2476 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2478 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2479 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2480 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2482 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2483 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2484 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2485 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2486 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2487 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2488 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2489 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2492 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2494 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2495 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2496 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2497 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2498 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2501 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2502 last_pause
= irmp_pause_time
;
2504 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2505 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2508 rc5_cmd_bit6
= 1<<6;
2516 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2518 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2519 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2520 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2521 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2523 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2524 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2525 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2526 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2527 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2530 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2532 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2533 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2534 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2535 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2537 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2538 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2539 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2540 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2541 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2544 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2546 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2547 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2548 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2550 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2551 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2552 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2553 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2556 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2558 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2559 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2560 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2562 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2563 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2564 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2565 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2570 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2572 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2573 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2574 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2576 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2577 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2578 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2579 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2582 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2584 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2585 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2586 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2588 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2589 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2590 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2591 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2594 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2596 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2597 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
2598 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
2600 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2601 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
2602 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
2603 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
2606 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2608 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2609 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2610 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2611 { // it's BANG_OLUFSEN
2612 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2613 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2614 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2615 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2616 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2617 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2618 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2619 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2620 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2621 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2622 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2623 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2624 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2625 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2629 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2631 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2632 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2633 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2635 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2636 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2637 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2638 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2639 last_pause
= irmp_pause_time
;
2643 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2645 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2646 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2647 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2648 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2649 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2650 { // it's RUWIDO or SIEMENS
2651 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2652 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2653 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2654 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2655 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2656 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2657 last_pause
= irmp_pause_time
;
2661 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2663 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2664 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2665 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2667 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2668 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2669 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2670 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2673 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2675 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2676 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2677 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2679 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2680 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2681 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2682 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2685 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2687 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2688 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2689 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2691 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2692 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2693 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2694 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2697 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2699 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2700 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2701 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2703 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2704 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2705 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2706 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2709 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2711 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2712 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2713 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2715 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2716 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2717 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2718 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2721 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2723 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2724 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
2725 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
2727 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2728 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
2729 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
2730 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
2735 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2737 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2738 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
2739 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
2740 { // it's ORTEK (Hama)
2741 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2742 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
2743 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
2744 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
2750 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2752 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
2753 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
2754 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
2756 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2757 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
2758 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
2759 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
2762 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
2764 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2765 // irmp_busy_flag = FALSE;
2766 irmp_start_bit_detected
= 0; // wait for another start bit...
2769 if (irmp_start_bit_detected
)
2771 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2774 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2776 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2777 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2781 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2782 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2783 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2784 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2787 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2788 if (irmp_param2
.protocol
)
2790 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2791 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2792 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2793 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2798 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2799 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2801 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2805 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2807 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2808 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2812 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2813 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2814 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2815 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2818 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2819 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2821 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2822 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2826 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2827 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2828 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2829 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2835 #if IRMP_SUPPORT_MANCHESTER == 1
2836 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2837 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2838 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2840 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2842 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2843 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2845 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2847 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2849 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2851 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2853 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2857 #endif // IRMP_SUPPORT_MANCHESTER == 1
2859 #if IRMP_SUPPORT_SERIAL == 1
2860 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2865 #endif // IRMP_SUPPORT_SERIAL == 1
2868 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2869 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2871 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2873 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2874 { // pause timings correct for "1"?
2875 ANALYZE_PUTCHAR ('1'); // yes, store 1
2879 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2880 { // pause timings correct for "0"?
2881 ANALYZE_PUTCHAR ('0'); // yes, store 0
2887 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2888 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2889 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2891 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2893 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2894 { // pause timings correct for "1"?
2895 ANALYZE_PUTCHAR ('1'); // yes, store 1
2899 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2900 { // pause timings correct for "0"?
2901 ANALYZE_PUTCHAR ('0'); // yes, store 0
2907 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2909 ; // else do nothing
2912 irmp_pulse_time
= 1; // set counter to 1, not 0
2913 irmp_pause_time
= 0;
2914 wait_for_start_space
= 0;
2917 else if (wait_for_space
) // the data section....
2918 { // counting the time of darkness....
2919 uint8_t got_light
= FALSE
;
2921 if (irmp_input
) // still dark?
2923 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2926 #if IRMP_SUPPORT_MANCHESTER == 1
2927 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2929 #if IRMP_SUPPORT_SERIAL == 1
2930 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2932 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2935 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2937 ANALYZE_PRINTF ("stop bit detected\n");
2940 irmp_param
.stop_bit
= 0;
2944 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",
2945 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2947 // irmp_busy_flag = FALSE;
2948 irmp_start_bit_detected
= 0; // wait for another start bit...
2949 irmp_pulse_time
= 0;
2950 irmp_pause_time
= 0;
2955 irmp_pause_time
++; // increment counter
2957 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2958 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2959 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2960 irmp_bit
>= 12 - 1) // pause too long?
2961 { // yes, break and close this frame
2962 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2963 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2964 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2965 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2966 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2970 #if IRMP_SUPPORT_SERIAL == 1
2971 // NETBOX generates no stop bit, here is the timeout condition:
2972 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2973 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2975 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2979 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2980 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2982 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2984 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2985 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2986 irmp_param
.stop_bit
= TRUE
; // set flag
2988 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2989 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2990 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2991 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2992 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2993 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2995 irmp_tmp_command
<<= 1;
2996 irmp_tmp_command
|= first_bit
;
2998 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2999 { // special manchester decoder
3000 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3001 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3002 irmp_param
.stop_bit
= TRUE
; // set flag
3004 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3006 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
3007 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3008 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3009 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3010 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3011 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3013 if (irmp_tmp_command
& 0x300)
3015 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3016 irmp_tmp_command
&= 0xFF;
3022 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3023 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3025 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3026 { // special manchester decoder
3027 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3028 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3029 irmp_param
.stop_bit
= TRUE
; // set flag
3031 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3033 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3034 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3035 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3036 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3037 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3038 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3041 // RUWIDO: AAAAAAAAACCCCCCCp
3042 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3043 irmp_tmp_address
<<= 2;
3044 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3045 irmp_tmp_command
&= 0x003F;
3046 // irmp_tmp_command <<= 4;
3047 irmp_tmp_command
|= last_value
;
3052 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3053 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3054 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3055 { // break and close this frame
3056 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3058 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3060 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3062 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3065 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3069 #if IRMP_SUPPORT_MANCHESTER == 1
3070 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3071 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3072 { // special manchester decoder
3073 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3074 irmp_param
.stop_bit
= TRUE
; // set flag
3077 #endif // IRMP_SUPPORT_MANCHESTER == 1
3078 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3080 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3084 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3085 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3087 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3088 irmp_param
.stop_bit
= TRUE
; // set flag
3089 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3090 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3091 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3092 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3093 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3095 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3096 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3097 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3099 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3100 irmp_param
.stop_bit
= TRUE
; // set flag
3101 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3102 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3103 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3104 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3105 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3107 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3109 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3110 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3111 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3113 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3114 irmp_param
.stop_bit
= TRUE
; // set flag
3115 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3116 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3118 // 0123456789ABC0123456789ABC0123456701234567
3119 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3120 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3121 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3122 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3124 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3125 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3126 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3128 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3129 irmp_param
.stop_bit
= TRUE
; // set flag
3130 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3131 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3132 irmp_tmp_address
= irmp_lgair_address
;
3133 irmp_tmp_command
= irmp_lgair_command
;
3135 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3136 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3137 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3139 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3140 irmp_param
.stop_bit
= TRUE
; // set flag
3141 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3142 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3144 // 0123456789ABC0123456789ABC0123456701234567
3145 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3146 // JVC: AAAACCCCCCCCCCCC
3147 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3148 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3150 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3151 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3152 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3153 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3157 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3158 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3160 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3161 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3163 else // if ((irmp_bit == 24)
3165 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3166 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3168 irmp_param
.stop_bit
= TRUE
; // set flag
3169 irmp_param
.complete_len
= irmp_bit
; // patch length
3171 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3174 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3175 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3177 // irmp_busy_flag = FALSE;
3178 irmp_start_bit_detected
= 0; // wait for another start bit...
3179 irmp_pulse_time
= 0;
3180 irmp_pause_time
= 0;
3192 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3194 #if IRMP_SUPPORT_MANCHESTER == 1
3195 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3198 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3199 #else // better, but some IR-RCs use asymmetric timings :-/
3200 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3201 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3204 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3205 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3207 ANALYZE_PUTCHAR ('T');
3208 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3221 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3223 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3224 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3226 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3227 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3229 ANALYZE_PUTCHAR ('T');
3232 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3243 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3245 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3246 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3247 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3248 if (! irmp_param2
.protocol
)
3253 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3257 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3258 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3260 uint8_t manchester_value
;
3262 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3264 manchester_value
= last_value
? 0 : 1;
3265 last_value
= manchester_value
;
3269 manchester_value
= last_value
;
3272 ANALYZE_PUTCHAR (manchester_value
+ '0');
3274 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3275 if (! irmp_param2
.protocol
)
3281 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3282 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3284 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3285 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3286 irmp_param
.address_offset
= 5;
3287 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3288 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3289 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3290 irmp_tmp_address
= 0;
3292 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3294 irmp_store_bit (manchester_value
);
3298 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3299 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3300 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3301 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3302 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3304 ANALYZE_PUTCHAR ('?');
3305 irmp_param
.protocol
= 0; // switch to FDC, see below
3308 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3309 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3310 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3311 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3312 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3313 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3315 ANALYZE_PUTCHAR ('?');
3316 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3319 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3321 ANALYZE_PUTCHAR ('?');
3323 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3324 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3325 // irmp_busy_flag = FALSE;
3326 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3327 irmp_pause_time
= 0;
3331 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3332 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3334 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3336 ANALYZE_PRINTF (" 1 (FDC)\n");
3337 irmp_store_bit2 (1);
3339 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3341 ANALYZE_PRINTF (" 0 (FDC)\n");
3342 irmp_store_bit2 (0);
3345 if (! irmp_param
.protocol
)
3347 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3348 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3349 irmp_param2
.protocol
= 0;
3350 irmp_tmp_address
= irmp_tmp_address2
;
3351 irmp_tmp_command
= irmp_tmp_command2
;
3354 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3355 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3356 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3358 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3360 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3361 irmp_store_bit2 (1);
3363 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3365 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3366 irmp_store_bit2 (0);
3369 if (! irmp_param
.protocol
)
3371 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3372 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3373 irmp_param2
.protocol
= 0;
3374 irmp_tmp_address
= irmp_tmp_address2
;
3375 irmp_tmp_command
= irmp_tmp_command2
;
3378 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3380 last_pause
= irmp_pause_time
;
3384 #endif // IRMP_SUPPORT_MANCHESTER == 1
3386 #if IRMP_SUPPORT_SERIAL == 1
3387 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3389 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3391 ANALYZE_PUTCHAR ('1');
3394 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3396 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3400 irmp_pulse_time
= 0;
3404 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3406 ANALYZE_PUTCHAR ('0');
3409 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3411 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3415 irmp_pause_time
= 0;
3422 #endif // IRMP_SUPPORT_SERIAL == 1
3424 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3425 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3427 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3428 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3430 ANALYZE_PRINTF ("SYNC\n");
3435 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3437 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3438 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3439 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3440 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3442 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3444 ANALYZE_PUTCHAR ('1');
3451 ANALYZE_PUTCHAR ('0');
3457 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3460 { // timing incorrect!
3461 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3462 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3463 // irmp_busy_flag = FALSE;
3464 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3465 irmp_pause_time
= 0;
3469 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3471 #if IRMP_SUPPORT_NEC16_PROTOCOL
3472 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3473 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3474 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3475 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3476 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3477 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3479 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3480 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3481 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3482 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3483 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3484 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3485 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3489 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3491 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3492 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3494 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3496 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3498 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3500 ANALYZE_PRINTF ("3rd start bit\n");
3505 { // timing incorrect!
3506 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
);
3507 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3508 // irmp_busy_flag = FALSE;
3509 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3510 irmp_pause_time
= 0;
3513 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3515 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3517 ANALYZE_PRINTF ("trailer bit\n");
3522 { // timing incorrect!
3523 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
);
3524 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3525 // irmp_busy_flag = FALSE;
3526 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3527 irmp_pause_time
= 0;
3532 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3533 { // pulse & pause timings correct for "1"?
3534 ANALYZE_PUTCHAR ('1');
3540 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3541 { // pulse & pause timings correct for "0"?
3542 ANALYZE_PUTCHAR ('0');
3548 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3550 ANALYZE_PUTCHAR (last_value
+ '0');
3552 irmp_store_bit (last_value
);
3556 { // timing incorrect!
3557 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
);
3558 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3559 // irmp_busy_flag = FALSE;
3560 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3561 irmp_pause_time
= 0;
3566 { // timing incorrect!
3567 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
);
3568 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3569 // irmp_busy_flag = FALSE;
3570 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3571 irmp_pause_time
= 0;
3575 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3577 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3578 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
3580 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
3582 ANALYZE_PUTCHAR ('0');
3583 ANALYZE_PUTCHAR ('0');
3587 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
3589 ANALYZE_PUTCHAR ('0');
3590 ANALYZE_PUTCHAR ('1');
3594 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
3596 ANALYZE_PUTCHAR ('1');
3597 ANALYZE_PUTCHAR ('0');
3601 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
3603 ANALYZE_PUTCHAR ('1');
3604 ANALYZE_PUTCHAR ('1');
3608 ANALYZE_PRINTF ("\n");
3614 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3615 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3616 { // pulse & pause timings correct for "1"?
3617 ANALYZE_PUTCHAR ('1');
3622 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3623 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3624 { // pulse & pause timings correct for "0"?
3625 ANALYZE_PUTCHAR ('0');
3631 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3633 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3634 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3635 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3636 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3638 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3644 ANALYZE_PUTCHAR ('S');
3646 irmp_tmp_command
<<= 1;
3650 ANALYZE_PUTCHAR ('S');
3657 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3658 { // timing incorrect!
3659 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3660 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3661 // irmp_busy_flag = FALSE;
3662 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3663 irmp_pause_time
= 0;
3666 irmp_pulse_time
= 1; // set counter to 1, not 0
3670 { // counting the pulse length ...
3671 if (! irmp_input
) // still light?
3673 irmp_pulse_time
++; // increment counter
3677 wait_for_space
= 1; // let's count the time (see above)
3678 irmp_pause_time
= 1; // set pause counter to 1, not 0
3682 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3684 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3686 repetition_frame_number
++;
3690 repetition_frame_number
= 0;
3693 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3694 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3695 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3697 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3698 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3699 key_repetition_len
= 0;
3704 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3705 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3706 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
3708 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3709 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3710 key_repetition_len
= 0;
3715 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3716 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3717 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3719 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3720 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3721 key_repetition_len
= 0;
3726 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3727 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3728 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3730 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3731 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3732 key_repetition_len
= 0;
3737 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3738 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3739 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3741 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3742 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3743 key_repetition_len
= 0;
3748 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
3749 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3750 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
3752 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3753 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3754 key_repetition_len
= 0;
3760 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3761 irmp_ir_detected
= TRUE
;
3763 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3764 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3765 { // check for repetition frame
3766 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3768 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3769 last_irmp_denon_command
= 0;
3771 irmp_protocol
= irmp_param
.protocol
; // store protocol
3772 irmp_address
= irmp_tmp_address
; // store address
3773 irmp_command
= irmp_tmp_command
; // store command
3777 if ((irmp_tmp_command
& 0x01) == 0x00)
3779 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3780 last_irmp_denon_command
= irmp_tmp_command
;
3781 denon_repetition_len
= 0;
3782 irmp_ir_detected
= FALSE
;
3786 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3787 last_irmp_denon_command
= 0;
3788 irmp_ir_detected
= FALSE
;
3793 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3795 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3796 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3797 { // Grundig start frame?
3798 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3799 irmp_ir_detected
= FALSE
;
3802 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3804 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3805 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3806 { // Nokia start frame?
3807 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3808 irmp_ir_detected
= FALSE
;
3811 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3813 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3814 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3816 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3818 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
3819 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
3820 irmp_tmp_address
= last_irmp_address
; // address is last address
3821 irmp_tmp_command
= last_irmp_command
; // command is last command
3822 irmp_flags
|= IRMP_FLAG_REPETITION
;
3823 key_repetition_len
= 0;
3827 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
3828 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3829 irmp_ir_detected
= FALSE
;
3832 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3834 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3835 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3838 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3839 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3841 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3843 if (xor_value
!= (xor_check
[2] & 0x0F))
3845 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
3846 irmp_ir_detected
= FALSE
;
3849 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3851 if (xor_value
!= xor_check
[5])
3853 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
3854 irmp_ir_detected
= FALSE
;
3857 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3859 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3861 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3862 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
3864 if (parity
== PARITY_CHECK_FAILED
)
3866 ANALYZE_PRINTF ("error 6: parity check failed\n");
3867 irmp_ir_detected
= FALSE
;
3870 if ((irmp_tmp_address
& 0x03) == 0x02)
3872 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
3873 irmp_ir_detected
= FALSE
;
3875 irmp_tmp_address
>>= 2;
3877 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3879 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3880 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3882 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3885 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3887 irmp_protocol
= irmp_param
.protocol
;
3890 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3891 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3893 if (irmp_tmp_command
& 0x000F) // released key?
3895 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3899 irmp_tmp_command
>>= 4; // no, it's a pressed key
3901 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3902 irmp_tmp_address
&= 0x003F;
3906 irmp_address
= irmp_tmp_address
; // store address
3907 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3908 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3910 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3914 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3915 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3917 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3920 irmp_command
= irmp_tmp_command
; // store command
3922 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3923 irmp_id
= irmp_tmp_id
;
3928 if (irmp_ir_detected
)
3930 if (last_irmp_command
== irmp_tmp_command
&&
3931 last_irmp_address
== irmp_tmp_address
&&
3932 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
3934 irmp_flags
|= IRMP_FLAG_REPETITION
;
3937 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3938 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3940 key_repetition_len
= 0;
3944 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3947 // irmp_busy_flag = FALSE;
3948 irmp_start_bit_detected
= 0; // and wait for next start bit
3949 irmp_tmp_command
= 0;
3950 irmp_pulse_time
= 0;
3951 irmp_pause_time
= 0;
3953 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3954 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3955 { // set pulse time here!
3956 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3958 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3963 #if defined(STELLARIS_ARM_CORTEX_M4)
3964 // Clear the timer interrupt
3965 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
3968 return (irmp_ir_detected
);
3973 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3974 * main functions - for Unix/Linux + Windows only!
3978 * Compile it under linux with:
3981 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3987 * -l list pulse/pauses
3989 *---------------------------------------------------------------------------------------------------------------------------------------------------
3993 print_timings (void)
3995 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3996 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3998 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3999 printf ("====================================================================================\n");
4000 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4001 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4002 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4003 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4005 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4006 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4007 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4008 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4010 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4011 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
,
4012 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4013 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4015 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4016 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4017 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4018 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4020 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4021 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4022 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4023 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4025 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4026 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4027 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4028 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4030 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4031 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4032 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4033 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4035 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4036 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4037 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4039 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4040 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4041 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4042 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4044 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4045 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4046 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4047 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4049 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4050 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4051 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4053 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4054 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4055 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4056 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4058 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4059 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4060 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4061 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4063 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4064 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4065 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4066 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4068 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4069 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4070 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4072 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4073 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4074 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4076 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4077 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4078 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4080 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4081 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4082 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4084 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4085 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4086 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4088 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4089 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4090 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4091 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4093 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4094 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4095 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4096 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4097 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4098 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4099 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4101 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4102 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4103 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4104 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4106 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4107 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4108 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4109 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4111 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4112 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4113 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4114 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4116 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4117 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4118 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4119 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4122 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4123 printf ("================================================================================================\n");
4124 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4125 (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4126 (uint8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4127 (uint8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4128 (uint8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4129 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4130 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4131 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4132 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4133 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4137 print_spectrum (char * text
, int * buf
, int is_pulse
)
4150 puts ("-------------------------------------------------------------------------------");
4151 printf ("%s:\n", text
);
4153 for (i
= 0; i
< 256; i
++)
4155 if (buf
[i
] > max_value
)
4161 for (i
= 1; i
< 200; i
++)
4166 value
= (buf
[i
] * 60) / max_value
;
4168 for (j
= 0; j
< value
; j
++)
4172 printf (" %d\n", buf
[i
]);
4183 average
= (float) sum
/ (float) counter
;
4194 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
4195 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
4196 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
4198 tolerance
= (max
- average
);
4200 if (average
- min
> tolerance
)
4202 tolerance
= average
- min
;
4205 tolerance
= tolerance
* 100 / average
;
4206 printf ("tol: %4.1f%%\n", tolerance
);
4216 #define STATE_LEFT_SHIFT 0x01
4217 #define STATE_RIGHT_SHIFT 0x02
4218 #define STATE_LEFT_CTRL 0x04
4219 #define STATE_LEFT_ALT 0x08
4220 #define STATE_RIGHT_ALT 0x10
4222 #define KEY_ESCAPE 0x1B // keycode = 0x006e
4223 #define KEY_MENUE 0x80 // keycode = 0x0070
4224 #define KEY_BACK 0x81 // keycode = 0x0071
4225 #define KEY_FORWARD 0x82 // keycode = 0x0072
4226 #define KEY_ADDRESS 0x83 // keycode = 0x0073
4227 #define KEY_WINDOW 0x84 // keycode = 0x0074
4228 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
4229 #define KEY_STOP 0x86 // keycode = 0x0076
4230 #define KEY_MAIL 0x87 // keycode = 0x0077
4231 #define KEY_FAVORITES 0x88 // keycode = 0x0078
4232 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
4233 #define KEY_SETUP 0x8A // keycode = 0x007a
4234 #define KEY_FONT 0x8B // keycode = 0x007b
4235 #define KEY_PRINT 0x8C // keycode = 0x007c
4236 #define KEY_ON_OFF 0x8E // keycode = 0x007c
4238 #define KEY_INSERT 0x90 // keycode = 0x004b
4239 #define KEY_DELETE 0x91 // keycode = 0x004c
4240 #define KEY_LEFT 0x92 // keycode = 0x004f
4241 #define KEY_HOME 0x93 // keycode = 0x0050
4242 #define KEY_END 0x94 // keycode = 0x0051
4243 #define KEY_UP 0x95 // keycode = 0x0053
4244 #define KEY_DOWN 0x96 // keycode = 0x0054
4245 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
4246 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
4247 #define KEY_RIGHT 0x99 // keycode = 0x0059
4248 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
4249 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
4252 get_fdc_key (uint16_t cmd
)
4254 static uint8_t key_table
[128] =
4256 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
4257 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
4258 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
4259 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
4260 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
4262 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
4263 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
4264 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
4265 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
4267 static uint8_t state
;
4273 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
4274 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
4275 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
4276 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
4277 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
4278 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
4279 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
4280 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
4281 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
4282 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
4284 case 0x006e: key
= KEY_ESCAPE
; break;
4285 case 0x004b: key
= KEY_INSERT
; break;
4286 case 0x004c: key
= KEY_DELETE
; break;
4287 case 0x004f: key
= KEY_LEFT
; break;
4288 case 0x0050: key
= KEY_HOME
; break;
4289 case 0x0051: key
= KEY_END
; break;
4290 case 0x0053: key
= KEY_UP
; break;
4291 case 0x0054: key
= KEY_DOWN
; break;
4292 case 0x0055: key
= KEY_PAGE_UP
; break;
4293 case 0x0056: key
= KEY_PAGE_DOWN
; break;
4294 case 0x0059: key
= KEY_RIGHT
; break;
4295 case 0x0400: key
= KEY_MOUSE_1
; break;
4296 case 0x0800: key
= KEY_MOUSE_2
; break;
4300 if (!(cmd
& 0x80)) // pressed key
4302 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
4304 key
= cmd
+ 0x10; // 7x -> 8x
4306 else if (cmd
< 64) // key listed in key_table
4308 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
4312 case 0x0003: key
= '²'; break;
4313 case 0x0008: key
= '{'; break;
4314 case 0x0009: key
= '['; break;
4315 case 0x000A: key
= ']'; break;
4316 case 0x000B: key
= '}'; break;
4317 case 0x000C: key
= '\\'; break;
4318 case 0x001C: key
= '~'; break;
4319 case 0x002D: key
= '|'; break;
4320 case 0x0034: key
= 0xB5; break; // Mu
4323 else if (state
& (STATE_LEFT_CTRL
))
4325 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4327 key
= key_table
[cmd
] - 'a' + 1;
4331 key
= key_table
[cmd
];
4336 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4340 key
= key_table
[idx
];
4352 static int analyze
= FALSE
;
4353 static int list
= FALSE
;
4354 static IRMP_DATA irmp_data
;
4355 static int expected_protocol
;
4356 static int expected_address
;
4357 static int expected_command
;
4358 static int do_check_expected_values
;
4363 if (! analyze
&& ! list
)
4367 if (irmp_get_data (&irmp_data
))
4371 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4375 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4378 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4380 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4382 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4383 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4385 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4387 char * p
= (char *) NULL
;
4391 case '\t' : p
= "TAB"; break;
4392 case '\r' : p
= "CR"; break;
4393 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4394 case KEY_MENUE
: p
= "MENUE"; break;
4395 case KEY_BACK
: p
= "BACK"; break;
4396 case KEY_FORWARD
: p
= "FORWARD"; break;
4397 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4398 case KEY_WINDOW
: p
= "WINDOW"; break;
4399 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4400 case KEY_STOP
: p
= "STOP"; break;
4401 case KEY_MAIL
: p
= "MAIL"; break;
4402 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4403 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4404 case KEY_SETUP
: p
= "SETUP"; break;
4405 case KEY_FONT
: p
= "FONT"; break;
4406 case KEY_PRINT
: p
= "PRINT"; break;
4407 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4409 case KEY_INSERT
: p
= "INSERT"; break;
4410 case KEY_DELETE
: p
= "DELETE"; break;
4411 case KEY_LEFT
: p
= "LEFT"; break;
4412 case KEY_HOME
: p
= "HOME"; break;
4413 case KEY_END
: p
= "END"; break;
4414 case KEY_UP
: p
= "UP"; break;
4415 case KEY_DOWN
: p
= "DOWN"; break;
4416 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
4417 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
4418 case KEY_RIGHT
: p
= "RIGHT"; break;
4419 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
4420 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
4421 default : p
= "<UNKNWON>"; break;
4424 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
4425 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
4429 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
4430 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
4435 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
4436 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
4439 if (do_check_expected_values
)
4441 if (irmp_data
.protocol
!= expected_protocol
||
4442 irmp_data
.address
!= expected_address
||
4443 irmp_data
.command
!= expected_command
)
4445 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
4446 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
4450 printf (" checked!\n");
4452 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
4463 main (int argc
, char ** argv
)
4471 int start_pulses
[256];
4472 int start_pauses
[256];
4476 int first_pulse
= TRUE
;
4477 int first_pause
= TRUE
;
4481 if (! strcmp (argv
[1], "-v"))
4485 else if (! strcmp (argv
[1], "-l"))
4489 else if (! strcmp (argv
[1], "-a"))
4493 else if (! strcmp (argv
[1], "-s"))
4497 else if (! strcmp (argv
[1], "-p"))
4502 else if (! strcmp (argv
[1], "-r"))
4508 for (i
= 0; i
< 256; i
++)
4510 start_pulses
[i
] = 0;
4511 start_pauses
[i
] = 0;
4518 while ((ch
= getchar ()) != EOF
)
4520 if (ch
== '_' || ch
== '0')
4528 printf ("pause: %d\n", pause
);
4537 start_pauses
[pause
]++;
4539 first_pause
= FALSE
;
4555 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
4561 printf ("pulse: %d ", pulse
);
4570 start_pulses
[pulse
]++;
4572 first_pulse
= FALSE
;
4588 else if (ch
== '\n')
4593 if (list
&& pause
> 0)
4595 printf ("pause: %d\n", pause
);
4601 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
4615 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4626 puts ("-------------------------------------------------------------------");
4630 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4632 if (ch
!= '\r') // ignore CR in DOS/Windows files
4634 if (ch
== '[' && idx
== -1)
4642 do_check_expected_values
= FALSE
;
4646 expected_protocol
= atoi (buf
);
4648 if (expected_protocol
> 0)
4657 if (sscanf (p
, "%x", &expected_address
) == 1)
4659 do_check_expected_values
= TRUE
;
4666 if (do_check_expected_values
)
4668 do_check_expected_values
= FALSE
;
4676 if (sscanf (p
, "%x", &expected_command
) == 1)
4678 do_check_expected_values
= TRUE
;
4685 if (do_check_expected_values
)
4687 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4692 else if (idx
< 1024 - 2)
4712 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4713 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4714 print_spectrum ("PULSES", pulses
, TRUE
);
4715 print_spectrum ("PAUSES", pauses
, FALSE
);
4716 puts ("-------------------------------------------------------------------------------");