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.151 2014/07/01 08:27:22 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 /******************************* not every PIC compiler knows variadic macros :-(
480 # define ANALYZE_PUTCHAR(a)
481 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
483 # define ANALYZE_PRINTF(__VA_ARGS)
484 # define ANALYZE_ONLY_NORMAL_PRINTF(__VA_ARGS)
486 # define ANALYZE_PRINTF(...)
487 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
489 # define ANALYZE_NEWLINE()
490 *********************************/
493 #if IRMP_USE_CALLBACK == 1
494 static void (*irmp_callback_ptr
) (uint8_t);
495 #endif // IRMP_USE_CALLBACK == 1
497 #define PARITY_CHECK_OK 1
498 #define PARITY_CHECK_FAILED 0
500 /*---------------------------------------------------------------------------------------------------------------------------------------------------
502 *---------------------------------------------------------------------------------------------------------------------------------------------------
504 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
506 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
554 /*---------------------------------------------------------------------------------------------------------------------------------------------------
556 *---------------------------------------------------------------------------------------------------------------------------------------------------
558 #if IRMP_LOGGING == 1 // logging via UART
560 #if IRMP_EXT_LOGGING == 1 // use external logging
561 #include "irmpextlog.h"
562 #else // normal UART log (IRMP_EXT_LOGGING == 0)
564 #ifndef UNIX_OR_WINDOWS
565 #include <util/setbaud.h>
570 #define UART0_UBRRH UBRR0H
571 #define UART0_UBRRL UBRR0L
572 #define UART0_UCSRA UCSR0A
573 #define UART0_UCSRB UCSR0B
574 #define UART0_UCSRC UCSR0C
575 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
576 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
577 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
579 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
581 #define UART0_URSEL_BIT_VALUE (0)
583 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
584 #define UART0_UDR UDR0
585 #define UART0_U2X U2X0
589 #define UART0_UBRRH UBRRH
590 #define UART0_UBRRL UBRRL
591 #define UART0_UCSRA UCSRA
592 #define UART0_UCSRB UCSRB
593 #define UART0_UCSRC UCSRC
594 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
595 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
596 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
598 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
600 #define UART0_URSEL_BIT_VALUE (0)
602 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
603 #define UART0_UDR UDR
604 #define UART0_U2X U2X
607 #endif //IRMP_EXT_LOGGING
609 /*---------------------------------------------------------------------------------------------------------------------------------------------------
611 * @details Initializes UART
612 *---------------------------------------------------------------------------------------------------------------------------------------------------
615 irmp_uart_init (void)
617 #ifndef UNIX_OR_WINDOWS
618 #if (IRMP_EXT_LOGGING == 0) // use UART
619 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
620 UART0_UBRRL
= UBRRL_VALUE
;
623 UART0_UCSRA
|= (1<<UART0_U2X
);
625 UART0_UCSRA
&= ~(1<<UART0_U2X
);
628 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
629 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
630 #else // other log method
632 #endif //IRMP_EXT_LOGGING
633 #endif // UNIX_OR_WINDOWS
636 /*---------------------------------------------------------------------------------------------------------------------------------------------------
638 * @details Sends character
639 * @param ch character to be transmitted
640 *---------------------------------------------------------------------------------------------------------------------------------------------------
643 irmp_uart_putc (unsigned char ch
)
645 #ifndef UNIX_OR_WINDOWS
646 #if (IRMP_EXT_LOGGING == 0)
647 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
654 sendextlog(ch
); //Use external log
658 #endif // UNIX_OR_WINDOWS
661 /*---------------------------------------------------------------------------------------------------------------------------------------------------
663 *---------------------------------------------------------------------------------------------------------------------------------------------------
666 #define STARTCYCLES 2 // min count of zeros before start of logging
667 #define ENDBITS 1000 // number of sequenced highbits to detect end
668 #define DATALEN 700 // log buffer size
670 #if 0 // old log routine
673 irmp_log (uint8_t val
)
675 static uint8_t buf
[DATALEN
]; // logging buffer
676 static uint16_t buf_idx
; // number of written bits
677 static uint8_t startcycles
; // current number of start-zeros
678 static uint16_t cnt
; // counts sequenced highbits - to detect end
680 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
688 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
690 if (buf_idx
< DATALEN
* 8) // index in range?
694 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
698 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
705 { // if high received then look at log-stop condition
709 { // if stop condition is true, output on uart
712 for (i
= 0; i
< STARTCYCLES
; i
++)
714 irmp_uart_putc ('0'); // the ignored starting zeros
717 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
722 for (j
= 0; j
< 8; j
++)
724 irmp_uart_putc ((d
& 1) + '0');
729 irmp_uart_putc ('\n');
741 #else // new log routine
744 irmp_log (uint8_t val
)
746 static uint8_t buf
[DATALEN
]; // logging buffer
747 static uint16_t buf_idx
; // index
748 static uint8_t startcycles
; // current number of start-zeros
749 static uint16_t cnt
; // counts sequenced highbits - to detect end
750 static uint8_t last_val
= 1;
752 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
760 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
766 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
767 { // if stop condition is true, output on uart
774 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
776 irmp_uart_putc ('0'); // the ignored starting zeros
779 for (i
= 0; i
< buf_idx
; i
++)
788 d
|= ((uint16_t) buf
[i
] << 8);
791 for (j
= 0; j
< d
; j
++)
796 v
= (v
== '1') ? '0' : '1';
799 for (i8
= 0; i8
< 20; i8
++)
801 irmp_uart_putc ('1');
804 irmp_uart_putc ('\n');
810 else if (buf_idx
< DATALEN
- 3)
814 buf
[buf_idx
++] = 0xff;
815 buf
[buf_idx
++] = (cnt
& 0xff);
816 buf
[buf_idx
] = (cnt
>> 8);
834 #define irmp_log(val)
835 #endif //IRMP_LOGGING
839 uint8_t protocol
; // ir protocol
840 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
841 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
842 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
843 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
844 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
845 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
846 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
847 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
848 uint8_t address_offset
; // address offset
849 uint8_t address_end
; // end of address
850 uint8_t command_offset
; // command offset
851 uint8_t command_end
; // end of command
852 uint8_t complete_len
; // complete length of frame
853 uint8_t stop_bit
; // flag: frame has stop bit
854 uint8_t lsb_first
; // flag: LSB first
855 uint8_t flags
; // some flags
858 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
860 static const PROGMEM IRMP_PARAMETER sircs_param
=
862 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
863 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
864 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
865 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
866 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
867 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
868 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
869 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
870 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
871 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
872 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
873 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
874 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
875 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
876 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
877 SIRCS_LSB
, // lsb_first: flag: LSB first
878 SIRCS_FLAGS
// flags: some flags
883 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
885 static const PROGMEM IRMP_PARAMETER nec_param
=
887 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
888 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
889 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
890 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
891 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
892 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
893 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
894 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
895 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
896 NEC_ADDRESS_OFFSET
, // address_offset: address offset
897 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
898 NEC_COMMAND_OFFSET
, // command_offset: command offset
899 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
900 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
901 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
902 NEC_LSB
, // lsb_first: flag: LSB first
903 NEC_FLAGS
// flags: some flags
906 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
908 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
909 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
910 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
911 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
912 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
913 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
914 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
915 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
916 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
917 0, // address_offset: address offset
918 0, // address_end: end of address
919 0, // command_offset: command offset
920 0, // command_end: end of command
921 0, // complete_len: complete length of frame
922 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
923 NEC_LSB
, // lsb_first: flag: LSB first
924 NEC_FLAGS
// flags: some flags
929 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
931 static const PROGMEM IRMP_PARAMETER nec42_param
=
933 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
934 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
935 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
936 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
937 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
938 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
939 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
940 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
941 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
942 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
943 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
944 NEC42_COMMAND_OFFSET
, // command_offset: command offset
945 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
946 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
947 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
948 NEC_LSB
, // lsb_first: flag: LSB first
949 NEC_FLAGS
// flags: some flags
954 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
956 static const PROGMEM IRMP_PARAMETER lgair_param
=
958 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
959 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
960 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
961 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
962 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
963 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
964 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
965 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
966 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
967 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
968 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
969 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
970 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
971 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
972 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
973 NEC_LSB
, // lsb_first: flag: LSB first
974 NEC_FLAGS
// flags: some flags
979 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
981 static const PROGMEM IRMP_PARAMETER samsung_param
=
983 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
984 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
985 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
986 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
987 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
988 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
989 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
990 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
991 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
992 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
993 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
994 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
995 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
996 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
997 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
998 SAMSUNG_LSB
, // lsb_first: flag: LSB first
999 SAMSUNG_FLAGS
// flags: some flags
1004 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
1006 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1008 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1009 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1010 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1011 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1012 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1013 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1014 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1015 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1016 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1017 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1018 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1019 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1020 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1021 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1022 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1023 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1024 TELEFUNKEN_FLAGS
// flags: some flags
1029 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1031 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1033 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1034 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1035 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1036 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1037 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1038 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1039 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1040 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1041 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1042 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1043 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1044 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1045 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1046 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1047 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1048 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1049 MATSUSHITA_FLAGS
// flags: some flags
1054 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1056 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1058 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1059 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1060 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1061 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1062 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1063 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1064 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1065 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1066 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1067 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1068 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1069 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1070 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1071 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1072 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1073 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1074 KASEIKYO_FLAGS
// flags: some flags
1079 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1081 static const PROGMEM IRMP_PARAMETER recs80_param
=
1083 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1084 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1085 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1086 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1087 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1088 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1089 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1090 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1091 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1092 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1093 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1094 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1095 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1096 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1097 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1098 RECS80_LSB
, // lsb_first: flag: LSB first
1099 RECS80_FLAGS
// flags: some flags
1104 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1106 static const PROGMEM IRMP_PARAMETER rc5_param
=
1108 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1109 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1110 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1111 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1112 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1113 0, // pulse_0_len_min: here: not used
1114 0, // pulse_0_len_max: here: not used
1115 0, // pause_0_len_min: here: not used
1116 0, // pause_0_len_max: here: not used
1117 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1118 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1119 RC5_COMMAND_OFFSET
, // command_offset: command offset
1120 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1121 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1122 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1123 RC5_LSB
, // lsb_first: flag: LSB first
1124 RC5_FLAGS
// flags: some flags
1129 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1131 static const PROGMEM IRMP_PARAMETER denon_param
=
1133 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1134 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1135 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1136 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1137 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1138 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1139 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1140 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1141 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1142 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1143 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1144 DENON_COMMAND_OFFSET
, // command_offset: command offset
1145 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1146 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1147 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1148 DENON_LSB
, // lsb_first: flag: LSB first
1149 DENON_FLAGS
// flags: some flags
1154 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1156 static const PROGMEM IRMP_PARAMETER rc6_param
=
1158 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1160 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1161 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1162 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1163 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1164 0, // pulse_0_len_min: here: not used
1165 0, // pulse_0_len_max: here: not used
1166 0, // pause_0_len_min: here: not used
1167 0, // pause_0_len_max: here: not used
1168 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1169 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1170 RC6_COMMAND_OFFSET
, // command_offset: command offset
1171 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1172 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1173 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1174 RC6_LSB
, // lsb_first: flag: LSB first
1175 RC6_FLAGS
// flags: some flags
1180 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1182 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1184 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1185 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1186 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1187 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1188 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1189 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1190 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1191 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1192 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1193 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1194 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1195 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1196 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1197 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1198 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1199 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1200 RECS80EXT_FLAGS
// flags: some flags
1205 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1207 static const PROGMEM IRMP_PARAMETER nubert_param
=
1209 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1210 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1211 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1212 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1213 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1214 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1215 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1216 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1217 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1218 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1219 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1220 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1221 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1222 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1223 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1224 NUBERT_LSB
, // lsb_first: flag: LSB first
1225 NUBERT_FLAGS
// flags: some flags
1230 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1232 static const PROGMEM IRMP_PARAMETER speaker_param
=
1234 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1235 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1236 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1237 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1238 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1239 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1240 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1241 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1242 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1243 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1244 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1245 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1246 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1247 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1248 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1249 SPEAKER_LSB
, // lsb_first: flag: LSB first
1250 SPEAKER_FLAGS
// flags: some flags
1255 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1257 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1259 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1260 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1261 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1262 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1263 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1264 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1265 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1266 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1267 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1268 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1269 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1270 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1271 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1272 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1273 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1274 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1275 BANG_OLUFSEN_FLAGS
// flags: some flags
1280 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1282 static uint8_t first_bit
;
1284 static const PROGMEM IRMP_PARAMETER grundig_param
=
1286 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1288 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1289 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1290 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1291 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1292 0, // pulse_0_len_min: here: not used
1293 0, // pulse_0_len_max: here: not used
1294 0, // pause_0_len_min: here: not used
1295 0, // pause_0_len_max: here: not used
1296 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1297 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1298 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1299 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1300 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1301 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1302 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1303 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1308 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1310 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1312 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1313 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1314 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1315 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1316 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1317 0, // pulse_0_len_min: here: not used
1318 0, // pulse_0_len_max: here: not used
1319 0, // pause_0_len_min: here: not used
1320 0, // pause_0_len_max: here: not used
1321 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1322 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1323 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1324 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1325 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1326 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1327 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1328 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1333 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1335 static const PROGMEM IRMP_PARAMETER fdc_param
=
1337 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1338 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1339 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1340 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1341 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1342 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1343 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1344 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1345 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1346 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1347 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1348 FDC_COMMAND_OFFSET
, // command_offset: command offset
1349 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1350 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1351 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1352 FDC_LSB
, // lsb_first: flag: LSB first
1353 FDC_FLAGS
// flags: some flags
1358 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1360 static const PROGMEM IRMP_PARAMETER rccar_param
=
1362 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1363 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1364 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1365 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1366 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1367 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1368 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1369 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1370 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1371 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1372 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1373 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1374 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1375 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1376 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1377 RCCAR_LSB
, // lsb_first: flag: LSB first
1378 RCCAR_FLAGS
// flags: some flags
1383 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1385 static const PROGMEM IRMP_PARAMETER nikon_param
=
1387 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1388 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1389 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1390 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1391 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1392 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1393 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1394 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1395 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1396 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1397 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1398 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1399 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1400 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1401 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1402 NIKON_LSB
, // lsb_first: flag: LSB first
1403 NIKON_FLAGS
// flags: some flags
1408 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1410 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1412 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1413 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1414 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1415 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1416 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1417 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1418 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1419 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1420 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1421 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1422 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1423 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1424 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1425 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1426 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1427 KATHREIN_LSB
, // lsb_first: flag: LSB first
1428 KATHREIN_FLAGS
// flags: some flags
1433 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1435 static const PROGMEM IRMP_PARAMETER netbox_param
=
1437 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1438 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1439 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1440 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1441 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1442 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1443 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1444 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1445 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1446 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1447 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1448 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1449 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1450 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1451 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1452 NETBOX_LSB
, // lsb_first: flag: LSB first
1453 NETBOX_FLAGS
// flags: some flags
1458 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1460 static const PROGMEM IRMP_PARAMETER lego_param
=
1462 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1463 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1464 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1465 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1466 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1467 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1468 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1469 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1470 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1471 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1472 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1473 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1474 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1475 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1476 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1477 LEGO_LSB
, // lsb_first: flag: LSB first
1478 LEGO_FLAGS
// flags: some flags
1483 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1485 static const PROGMEM IRMP_PARAMETER thomson_param
=
1487 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1488 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1489 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1490 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1491 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1492 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1493 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1494 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1495 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1496 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1497 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1498 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1499 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1500 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1501 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1502 THOMSON_LSB
, // lsb_first: flag: LSB first
1503 THOMSON_FLAGS
// flags: some flags
1508 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1510 static const PROGMEM IRMP_PARAMETER bose_param
=
1512 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1513 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1514 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1515 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1516 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1517 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1518 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1519 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1520 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1521 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1522 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1523 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1524 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1525 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1526 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1527 BOSE_LSB
, // lsb_first: flag: LSB first
1528 BOSE_FLAGS
// flags: some flags
1533 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1535 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1537 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1539 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1540 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1541 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1542 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1543 0, // pulse_0_len_min: here: not used
1544 0, // pulse_0_len_max: here: not used
1545 0, // pause_0_len_min: here: not used
1546 0, // pause_0_len_max: here: not used
1547 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1548 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1549 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1550 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1551 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1552 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1553 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1554 A1TVBOX_FLAGS
// flags: some flags
1559 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1561 static const PROGMEM IRMP_PARAMETER ortek_param
=
1563 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1565 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1566 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1567 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1568 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1569 0, // pulse_0_len_min: here: not used
1570 0, // pulse_0_len_max: here: not used
1571 0, // pause_0_len_min: here: not used
1572 0, // pause_0_len_max: here: not used
1573 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1574 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1575 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1576 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1577 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1578 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1579 ORTEK_LSB
, // lsb_first: flag: LSB first
1580 ORTEK_FLAGS
// flags: some flags
1585 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1587 static const PROGMEM IRMP_PARAMETER roomba_param
=
1589 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1590 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1591 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1592 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1593 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1594 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1595 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1596 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1597 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1598 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1599 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1600 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1601 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1602 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1603 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1604 ROOMBA_LSB
, // lsb_first: flag: LSB first
1605 ROOMBA_FLAGS
// flags: some flags
1610 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1612 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1614 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1616 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1617 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1618 0, // pause_1_len_min: here: minimum length of short pause
1619 0, // pause_1_len_max: here: maximum length of short pause
1620 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1621 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1622 0, // pause_0_len_min: here: not used
1623 0, // pause_0_len_max: here: not used
1624 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1625 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1626 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1627 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1628 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1629 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1630 RCMM32_LSB
, // lsb_first: flag: LSB first
1631 RCMM32_FLAGS
// flags: some flags
1636 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1638 static const PROGMEM IRMP_PARAMETER radio1_param
=
1640 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1642 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1643 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1644 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1645 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1646 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1647 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1648 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1649 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1650 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1651 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1652 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1653 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1654 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1655 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1656 RADIO1_LSB
, // lsb_first: flag: LSB first
1657 RADIO1_FLAGS
// flags: some flags
1662 static uint8_t irmp_bit
; // current bit position
1663 static IRMP_PARAMETER irmp_param
;
1665 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1666 static IRMP_PARAMETER irmp_param2
;
1669 static volatile uint8_t irmp_ir_detected
;
1670 static volatile uint8_t irmp_protocol
;
1671 static volatile uint16_t irmp_address
;
1672 static volatile uint16_t irmp_command
;
1673 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1674 static volatile uint8_t irmp_flags
;
1675 // static volatile uint8_t irmp_busy_flag;
1678 #define input(x) (x)
1679 static uint8_t IRMP_PIN
;
1680 static uint8_t radio
;
1683 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1684 * Initialize IRMP decoder
1685 * @details Configures IRMP input pin
1686 *---------------------------------------------------------------------------------------------------------------------------------------------------
1692 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1693 #elif defined (ARM_STM32) // STM32
1694 GPIO_InitTypeDef GPIO_InitStructure
;
1696 /* GPIOx clock enable */
1697 #if defined (ARM_STM32L1XX)
1698 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1699 #elif defined (ARM_STM32F10X)
1700 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1701 #elif defined (ARM_STM32F4XX)
1702 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1705 /* GPIO Configuration */
1706 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1707 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1708 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1709 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1710 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1711 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1712 #elif defined (ARM_STM32F10X)
1713 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1714 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1716 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1717 #elif defined(STELLARIS_ARM_CORTEX_M4)
1718 // Enable the GPIO port
1719 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1722 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1723 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1725 GPIO_PIN_TYPE_STD_WPU
);
1727 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1728 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1731 #if IRMP_LOGGING == 1
1736 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1738 * @details gets decoded IRMP data
1739 * @param pointer in order to store IRMP data
1740 * @return TRUE: successful, FALSE: failed
1741 *---------------------------------------------------------------------------------------------------------------------------------------------------
1744 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1746 uint8_t rtc
= FALSE
;
1748 if (irmp_ir_detected
)
1750 switch (irmp_protocol
)
1752 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1753 case IRMP_SAMSUNG_PROTOCOL
:
1754 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1756 irmp_command
&= 0xff;
1757 irmp_command
|= irmp_id
<< 8;
1762 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1763 case IRMP_NEC_PROTOCOL
:
1764 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1766 irmp_command
&= 0xff;
1769 else if (irmp_address
== 0x87EE)
1772 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1774 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1775 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1776 irmp_command
&= 0x00FF;
1781 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1782 case IRMP_BOSE_PROTOCOL
:
1783 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1785 irmp_command
&= 0xff;
1790 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1791 case IRMP_SIEMENS_PROTOCOL
:
1792 case IRMP_RUWIDO_PROTOCOL
:
1793 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1800 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1801 case IRMP_KATHREIN_PROTOCOL
:
1802 if (irmp_command
!= 0x0000)
1808 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1809 case IRMP_RC5_PROTOCOL
:
1810 irmp_address
&= ~0x20; // clear toggle bit
1814 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1815 case IRMP_IR60_PROTOCOL
:
1816 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1823 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1828 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1829 case IRMP_RCCAR_PROTOCOL
:
1830 // frame in irmp_data:
1831 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1832 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1833 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1834 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1835 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1836 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1837 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1841 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1842 case IRMP_NETBOX_PROTOCOL
:
1843 if (irmp_command
& 0x1000) // last bit set?
1845 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1848 irmp_command
&= 0x7F;
1851 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1854 irmp_command
|= 0x80;
1860 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1867 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1872 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1873 case IRMP_LEGO_PROTOCOL
:
1875 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1877 if ((irmp_command
& 0x000F) == crc
)
1885 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1887 // rtc = TRUE; // don't accept codes with CRC errors
1902 irmp_data_p
->protocol
= irmp_protocol
;
1903 irmp_data_p
->address
= irmp_address
;
1904 irmp_data_p
->command
= irmp_command
;
1905 irmp_data_p
->flags
= irmp_flags
;
1911 irmp_ir_detected
= FALSE
;
1918 // irmp_is_busy (void)
1920 // return irmp_busy_flag;
1923 #if IRMP_USE_CALLBACK == 1
1925 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1927 irmp_callback_ptr
= cb
;
1929 #endif // IRMP_USE_CALLBACK == 1
1931 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1932 static uint16_t irmp_tmp_address
; // ir address
1933 static uint16_t irmp_tmp_command
; // ir command
1935 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1936 static uint16_t irmp_tmp_address2
; // ir address
1937 static uint16_t irmp_tmp_command2
; // ir command
1940 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1941 static uint16_t irmp_lgair_address
; // ir address
1942 static uint16_t irmp_lgair_command
; // ir command
1945 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1946 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1948 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1949 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1950 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1953 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1954 static uint8_t parity
; // number of '1' of the first 14 bits, check if even.
1957 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1959 * @details store bit in temp address or temp command
1960 * @param value to store: 0 or 1
1961 *---------------------------------------------------------------------------------------------------------------------------------------------------
1963 // verhindert, dass irmp_store_bit() inline compiliert wird:
1964 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1967 irmp_store_bit (uint8_t value
)
1969 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1970 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
1979 else if (irmp_bit
== 14)
1981 if (value
) // value == 1: even parity
1985 parity
= PARITY_CHECK_FAILED
;
1989 parity
= PARITY_CHECK_OK
;
1994 if (parity
& 0x01) // value == 0: odd parity
1996 parity
= PARITY_CHECK_OK
;
2000 parity
= PARITY_CHECK_FAILED
;
2007 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2008 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
2015 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
2017 if (irmp_param
.lsb_first
)
2019 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2023 irmp_tmp_address
<<= 1;
2024 irmp_tmp_address
|= value
;
2027 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2029 if (irmp_param
.lsb_first
)
2031 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2035 irmp_tmp_command
<<= 1;
2036 irmp_tmp_command
|= value
;
2040 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2041 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2045 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2046 irmp_lgair_address
|= value
;
2048 else if (irmp_bit
< 24)
2050 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2051 irmp_lgair_command
|= value
;
2057 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2058 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2060 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2065 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2066 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2068 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2073 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2074 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2076 if (irmp_bit
>= 20 && irmp_bit
< 24)
2078 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2080 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2082 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2085 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2089 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2093 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2106 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2108 * @details store bit in temp address or temp command
2109 * @param value to store: 0 or 1
2110 *---------------------------------------------------------------------------------------------------------------------------------------------------
2112 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2114 irmp_store_bit2 (uint8_t value
)
2118 if (irmp_param
.protocol
)
2120 irmp_bit2
= irmp_bit
- 2;
2124 irmp_bit2
= irmp_bit
- 1;
2127 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2129 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2131 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2133 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2136 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2138 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2140 * @details ISR routine, called 10000 times per second
2141 *---------------------------------------------------------------------------------------------------------------------------------------------------
2146 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
2147 static uint8_t wait_for_space
; // flag: wait for data bit space
2148 static uint8_t wait_for_start_space
; // flag: wait for start bit space
2149 static uint8_t irmp_pulse_time
; // count bit time for pulse
2150 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2151 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2152 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2153 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2154 static uint8_t repetition_frame_number
;
2155 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2156 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2157 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2159 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2160 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2162 #if IRMP_SUPPORT_MANCHESTER == 1
2163 static PAUSE_LEN last_pause
; // last pause value
2165 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2166 static uint8_t last_value
; // last bit value
2168 uint8_t irmp_input
; // input value
2174 irmp_input
= input(IRMP_PIN
);
2176 #if IRMP_USE_CALLBACK == 1
2177 if (irmp_callback_ptr
)
2179 static uint8_t last_inverted_input
;
2181 if (last_inverted_input
!= !irmp_input
)
2183 (*irmp_callback_ptr
) (! irmp_input
);
2184 last_inverted_input
= !irmp_input
;
2187 #endif // IRMP_USE_CALLBACK == 1
2189 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2191 if (! irmp_ir_detected
) // ir code already detected?
2193 if (! irmp_start_bit_detected
) // start bit detected?
2195 if (! irmp_input
) // receiving burst?
2197 // irmp_busy_flag = TRUE;
2199 if (! irmp_pulse_time
)
2202 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2206 irmp_pulse_time
++; // increment counter
2210 if (irmp_pulse_time
) // it's dark....
2211 { // set flags for counting the time of darkness...
2212 irmp_start_bit_detected
= 1;
2213 wait_for_start_space
= 1;
2215 irmp_tmp_command
= 0;
2216 irmp_tmp_address
= 0;
2217 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2221 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2222 irmp_tmp_command2
= 0;
2223 irmp_tmp_address2
= 0;
2225 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2226 irmp_lgair_command
= 0;
2227 irmp_lgair_address
= 0;
2230 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2231 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2232 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2237 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2239 key_repetition_len
++;
2241 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2242 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2244 denon_repetition_len
++;
2246 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2249 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2251 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2252 last_irmp_denon_command
= 0;
2253 denon_repetition_len
= 0xFFFF;
2256 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2263 if (wait_for_start_space
) // we have received start bit...
2264 { // ...and are counting the time of darkness
2265 if (irmp_input
) // still dark?
2267 irmp_pause_time
++; // increment counter
2269 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2270 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
) ||
2271 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2273 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2276 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2277 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2282 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2285 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
);
2286 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2289 // irmp_busy_flag = FALSE;
2290 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2291 irmp_pulse_time
= 0;
2292 irmp_pause_time
= 0;
2296 { // receiving first data pulse!
2297 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
2299 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2300 irmp_param2
.protocol
= 0;
2304 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2307 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2308 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2309 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2312 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2313 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2314 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2316 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
2319 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2321 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2322 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2323 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2324 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2327 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2328 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2329 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2331 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2334 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2336 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2337 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2338 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2340 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2342 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2343 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2344 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2346 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2349 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2350 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2351 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2353 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2356 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2357 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2359 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2360 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2361 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2363 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2364 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2365 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2367 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2370 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2373 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2374 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2375 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2378 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2383 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2384 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2385 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2386 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2387 { // it's JVC repetition type 3
2389 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2390 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2391 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2393 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2396 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2398 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2400 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2401 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2402 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2405 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2406 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2407 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2409 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2412 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2414 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2415 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2416 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2419 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2420 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2421 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2423 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2426 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2428 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2429 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2430 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2433 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2434 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2435 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2437 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2440 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2442 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2443 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2444 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2447 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2448 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2449 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2451 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2454 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2456 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2457 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2458 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2459 { // it's MATSUSHITA
2461 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2462 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2463 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2465 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2468 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2470 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2471 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2472 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2475 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2476 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2477 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2479 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2482 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2484 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2485 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2486 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2489 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2490 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2491 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2493 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2496 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2498 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2499 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2500 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2503 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2504 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2505 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2507 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2510 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2512 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2513 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2514 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2515 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2516 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2518 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2519 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2520 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2523 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2524 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2525 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2526 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2527 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2528 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2529 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2531 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2534 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2536 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2537 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2538 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2541 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2542 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2543 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2544 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2545 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2546 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2547 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2549 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2552 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2555 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2556 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2557 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2558 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2559 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2563 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2564 last_pause
= irmp_pause_time
;
2566 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2567 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2570 rc5_cmd_bit6
= 1<<6;
2578 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2580 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2581 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2582 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2583 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2586 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2587 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2588 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2589 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2591 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2594 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2596 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2597 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2598 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2599 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2602 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2603 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2604 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2605 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2607 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2610 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2612 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2613 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2614 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2617 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2618 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2619 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2621 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2624 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2626 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2627 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2628 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2631 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2632 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2633 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2635 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2640 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2642 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2643 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2644 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2647 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2648 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2649 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2651 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2654 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2656 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2657 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2658 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2661 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2662 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2663 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2665 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2668 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2670 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2671 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
2672 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
2675 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2676 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
2677 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
2679 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
2682 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2684 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2685 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2686 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2687 { // it's BANG_OLUFSEN
2689 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2690 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2691 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2692 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2693 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2694 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2695 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2696 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2697 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2698 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2699 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2700 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2701 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2703 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2707 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2709 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2710 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2711 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2714 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2715 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2716 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2718 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2719 last_pause
= irmp_pause_time
;
2723 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2725 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2726 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2727 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2728 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2729 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2730 { // it's RUWIDO or SIEMENS
2732 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2733 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2734 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2735 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2736 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2738 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2739 last_pause
= irmp_pause_time
;
2743 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2745 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2746 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2747 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2750 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2751 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2752 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2754 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2757 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2759 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2760 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2761 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2764 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2765 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2766 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2768 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2771 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2773 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2774 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2775 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2778 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2779 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2780 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2782 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2785 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2787 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2788 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2789 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2792 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2793 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2794 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2796 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2799 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2801 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2802 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2803 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2806 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2807 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2808 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2810 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2813 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2815 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2816 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
2817 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
2820 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2821 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
2822 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
2824 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
2829 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2831 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2832 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
2833 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
2834 { // it's ORTEK (Hama)
2836 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2837 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
2838 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
2840 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
2846 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2848 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
2849 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
2850 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
2853 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2854 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
2855 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
2857 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
2860 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
2863 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2865 // irmp_busy_flag = FALSE;
2866 irmp_start_bit_detected
= 0; // wait for another start bit...
2869 if (irmp_start_bit_detected
)
2871 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2873 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2876 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2877 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2883 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2884 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2885 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2886 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2890 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2891 if (irmp_param2
.protocol
)
2894 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2895 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2896 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2897 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2903 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2904 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2907 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2912 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2915 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2916 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2922 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2923 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2924 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2925 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2929 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2930 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2933 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2934 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2940 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2941 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2942 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2943 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2949 #if IRMP_SUPPORT_MANCHESTER == 1
2950 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2951 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2952 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2954 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2957 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2958 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2961 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2963 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2966 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2967 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2970 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2974 #endif // IRMP_SUPPORT_MANCHESTER == 1
2976 #if IRMP_SUPPORT_SERIAL == 1
2977 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2982 #endif // IRMP_SUPPORT_SERIAL == 1
2985 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2986 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2989 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2992 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2993 { // pause timings correct for "1"?
2995 ANALYZE_PUTCHAR ('1'); // yes, store 1
3000 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
3001 { // pause timings correct for "0"?
3003 ANALYZE_PUTCHAR ('0'); // yes, store 0
3010 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3011 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3012 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
3015 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3018 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
3019 { // pause timings correct for "1"?
3021 ANALYZE_PUTCHAR ('1'); // yes, store 1
3026 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
3027 { // pause timings correct for "0"?
3029 ANALYZE_PUTCHAR ('0'); // yes, store 0
3036 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3038 ; // else do nothing
3041 irmp_pulse_time
= 1; // set counter to 1, not 0
3042 irmp_pause_time
= 0;
3043 wait_for_start_space
= 0;
3046 else if (wait_for_space
) // the data section....
3047 { // counting the time of darkness....
3048 uint8_t got_light
= FALSE
;
3050 if (irmp_input
) // still dark?
3052 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
3055 #if IRMP_SUPPORT_MANCHESTER == 1
3056 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
3058 #if IRMP_SUPPORT_SERIAL == 1
3059 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
3061 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
3064 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3067 ANALYZE_PRINTF ("stop bit detected\n");
3071 irmp_param
.stop_bit
= 0;
3076 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",
3078 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3080 // irmp_busy_flag = FALSE;
3081 irmp_start_bit_detected
= 0; // wait for another start bit...
3082 irmp_pulse_time
= 0;
3083 irmp_pause_time
= 0;
3088 irmp_pause_time
++; // increment counter
3090 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3091 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
3092 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
3093 irmp_bit
>= 12 - 1) // pause too long?
3094 { // yes, break and close this frame
3095 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
3096 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3097 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
3098 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
3099 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
3103 #if IRMP_SUPPORT_SERIAL == 1
3104 // NETBOX generates no stop bit, here is the timeout condition:
3105 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
3106 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
3108 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3112 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3113 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
3115 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
3118 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
3120 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3121 irmp_param
.stop_bit
= TRUE
; // set flag
3123 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
3124 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
3125 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
3126 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
3127 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
3128 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
3130 irmp_tmp_command
<<= 1;
3131 irmp_tmp_command
|= first_bit
;
3133 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
3134 { // special manchester decoder
3135 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3136 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3137 irmp_param
.stop_bit
= TRUE
; // set flag
3139 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3142 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
3144 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3145 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3146 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3147 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3148 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3150 if (irmp_tmp_command
& 0x300)
3152 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3153 irmp_tmp_command
&= 0xFF;
3159 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3160 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3162 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3163 { // special manchester decoder
3164 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3165 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3166 irmp_param
.stop_bit
= TRUE
; // set flag
3168 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3171 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3173 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3174 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3175 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3176 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3177 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3180 // RUWIDO: AAAAAAAAACCCCCCCp
3181 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3182 irmp_tmp_address
<<= 2;
3183 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3184 irmp_tmp_command
&= 0x003F;
3185 // irmp_tmp_command <<= 4;
3186 irmp_tmp_command
|= last_value
;
3191 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3192 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3193 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3194 { // break and close this frame
3195 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3197 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3199 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3201 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3204 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3208 #if IRMP_SUPPORT_MANCHESTER == 1
3209 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3210 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3211 { // special manchester decoder
3212 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3213 irmp_param
.stop_bit
= TRUE
; // set flag
3216 #endif // IRMP_SUPPORT_MANCHESTER == 1
3217 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3219 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3223 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3224 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3227 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3229 irmp_param
.stop_bit
= TRUE
; // set flag
3230 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3231 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3232 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3233 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3234 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3236 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3237 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3238 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3241 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3243 irmp_param
.stop_bit
= TRUE
; // set flag
3244 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3245 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3246 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3247 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3248 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3250 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3252 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3253 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3254 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3257 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3259 irmp_param
.stop_bit
= TRUE
; // set flag
3260 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3261 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3263 // 0123456789ABC0123456789ABC0123456701234567
3264 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3265 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3266 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3267 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3269 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3270 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3271 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3274 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3276 irmp_param
.stop_bit
= TRUE
; // set flag
3277 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3278 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3279 irmp_tmp_address
= irmp_lgair_address
;
3280 irmp_tmp_command
= irmp_lgair_command
;
3282 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3283 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3284 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3287 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3289 irmp_param
.stop_bit
= TRUE
; // set flag
3290 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3291 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3293 // 0123456789ABC0123456789ABC0123456701234567
3294 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3295 // JVC: AAAACCCCCCCCCCCC
3296 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3297 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3299 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3300 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3301 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3302 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3306 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3307 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3310 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3312 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3314 else // if ((irmp_bit == 24)
3317 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3319 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3321 irmp_param
.stop_bit
= TRUE
; // set flag
3322 irmp_param
.complete_len
= irmp_bit
; // patch length
3324 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3328 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3329 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3332 // irmp_busy_flag = FALSE;
3333 irmp_start_bit_detected
= 0; // wait for another start bit...
3334 irmp_pulse_time
= 0;
3335 irmp_pause_time
= 0;
3348 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3351 #if IRMP_SUPPORT_MANCHESTER == 1
3352 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3355 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3356 #else // better, but some IR-RCs use asymmetric timings :-/
3357 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3358 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3361 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3362 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3365 ANALYZE_PUTCHAR ('T');
3367 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3382 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3385 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3387 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3389 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3390 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3393 ANALYZE_PUTCHAR ('T');
3397 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3410 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3413 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3415 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3416 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3417 if (! irmp_param2
.protocol
)
3424 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3428 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3429 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3431 uint8_t manchester_value
;
3433 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3435 manchester_value
= last_value
? 0 : 1;
3436 last_value
= manchester_value
;
3440 manchester_value
= last_value
;
3444 ANALYZE_PUTCHAR (manchester_value
+ '0');
3447 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3448 if (! irmp_param2
.protocol
)
3456 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3457 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3460 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3462 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3463 irmp_param
.address_offset
= 5;
3464 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3465 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3466 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3467 irmp_tmp_address
= 0;
3469 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3471 irmp_store_bit (manchester_value
);
3475 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3476 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3477 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3478 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3479 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3482 ANALYZE_PUTCHAR ('?');
3484 irmp_param
.protocol
= 0; // switch to FDC, see below
3487 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3488 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3489 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3490 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3491 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3492 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3495 ANALYZE_PUTCHAR ('?');
3497 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3500 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3503 ANALYZE_PUTCHAR ('?');
3505 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3506 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;
3514 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3515 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3517 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3520 ANALYZE_PRINTF (" 1 (FDC)\n");
3522 irmp_store_bit2 (1);
3524 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3527 ANALYZE_PRINTF (" 0 (FDC)\n");
3529 irmp_store_bit2 (0);
3532 if (! irmp_param
.protocol
)
3535 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3537 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3538 irmp_param2
.protocol
= 0;
3539 irmp_tmp_address
= irmp_tmp_address2
;
3540 irmp_tmp_command
= irmp_tmp_command2
;
3543 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3544 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3545 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3547 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3550 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3552 irmp_store_bit2 (1);
3554 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3557 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3559 irmp_store_bit2 (0);
3562 if (! irmp_param
.protocol
)
3565 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3567 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3568 irmp_param2
.protocol
= 0;
3569 irmp_tmp_address
= irmp_tmp_address2
;
3570 irmp_tmp_command
= irmp_tmp_command2
;
3573 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3575 last_pause
= irmp_pause_time
;
3579 #endif // IRMP_SUPPORT_MANCHESTER == 1
3581 #if IRMP_SUPPORT_SERIAL == 1
3582 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3584 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3587 ANALYZE_PUTCHAR ('1');
3591 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3593 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3597 irmp_pulse_time
= 0;
3601 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3604 ANALYZE_PUTCHAR ('0');
3608 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3610 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3614 irmp_pause_time
= 0;
3623 #endif // IRMP_SUPPORT_SERIAL == 1
3625 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3626 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3628 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3629 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3632 ANALYZE_PRINTF ("SYNC\n");
3638 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3640 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3641 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3642 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3643 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3645 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3648 ANALYZE_PUTCHAR ('1');
3657 ANALYZE_PUTCHAR ('0');
3665 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3669 { // timing incorrect!
3671 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3672 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3674 // irmp_busy_flag = FALSE;
3675 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3676 irmp_pause_time
= 0;
3680 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3682 #if IRMP_SUPPORT_NEC16_PROTOCOL
3683 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3684 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3685 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3686 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3687 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3688 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3691 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3693 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3694 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3695 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3696 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3697 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3698 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3702 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3704 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3705 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3707 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3709 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3711 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3714 ANALYZE_PRINTF ("3rd start bit\n");
3720 { // timing incorrect!
3722 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
);
3723 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3725 // irmp_busy_flag = FALSE;
3726 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3727 irmp_pause_time
= 0;
3730 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3732 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3735 ANALYZE_PRINTF ("trailer bit\n");
3741 { // timing incorrect!
3743 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
);
3744 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3746 // irmp_busy_flag = FALSE;
3747 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3748 irmp_pause_time
= 0;
3753 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3754 { // pulse & pause timings correct for "1"?
3756 ANALYZE_PUTCHAR ('1');
3763 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3764 { // pulse & pause timings correct for "0"?
3766 ANALYZE_PUTCHAR ('0');
3773 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3776 ANALYZE_PUTCHAR (last_value
+ '0');
3779 irmp_store_bit (last_value
);
3783 { // timing incorrect!
3785 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
);
3786 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3788 // irmp_busy_flag = FALSE;
3789 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3790 irmp_pause_time
= 0;
3795 { // timing incorrect!
3797 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
);
3798 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3800 // irmp_busy_flag = FALSE;
3801 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3802 irmp_pause_time
= 0;
3806 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3808 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3809 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
3811 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
3814 ANALYZE_PUTCHAR ('0');
3815 ANALYZE_PUTCHAR ('0');
3820 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
3823 ANALYZE_PUTCHAR ('0');
3824 ANALYZE_PUTCHAR ('1');
3829 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
3832 ANALYZE_PUTCHAR ('1');
3833 ANALYZE_PUTCHAR ('0');
3838 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
3841 ANALYZE_PUTCHAR ('1');
3842 ANALYZE_PUTCHAR ('1');
3848 ANALYZE_PRINTF ("\n");
3855 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3856 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3857 { // pulse & pause timings correct for "1"?
3859 ANALYZE_PUTCHAR ('1');
3865 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3866 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3867 { // pulse & pause timings correct for "0"?
3869 ANALYZE_PUTCHAR ('0');
3876 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3878 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3879 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3880 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3881 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3883 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3890 ANALYZE_PUTCHAR ('S');
3893 irmp_tmp_command
<<= 1;
3898 ANALYZE_PUTCHAR ('S');
3906 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3907 { // timing incorrect!
3909 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3910 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3912 // irmp_busy_flag = FALSE;
3913 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3914 irmp_pause_time
= 0;
3917 irmp_pulse_time
= 1; // set counter to 1, not 0
3921 { // counting the pulse length ...
3922 if (! irmp_input
) // still light?
3924 irmp_pulse_time
++; // increment counter
3928 wait_for_space
= 1; // let's count the time (see above)
3929 irmp_pause_time
= 1; // set pause counter to 1, not 0
3933 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3935 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3937 repetition_frame_number
++;
3941 repetition_frame_number
= 0;
3944 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3945 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3946 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3949 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3950 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3952 key_repetition_len
= 0;
3957 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3958 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3959 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
3962 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3963 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3965 key_repetition_len
= 0;
3970 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3971 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3972 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3975 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3976 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3978 key_repetition_len
= 0;
3983 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3984 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3985 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3988 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3989 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3991 key_repetition_len
= 0;
3996 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3997 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3998 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
4001 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4002 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4004 key_repetition_len
= 0;
4009 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
4010 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4011 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
4014 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4015 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4017 key_repetition_len
= 0;
4024 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
4026 irmp_ir_detected
= TRUE
;
4028 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
4029 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
4030 { // check for repetition frame
4031 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
4033 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
4034 last_irmp_denon_command
= 0;
4036 irmp_protocol
= irmp_param
.protocol
; // store protocol
4037 irmp_address
= irmp_tmp_address
; // store address
4038 irmp_command
= irmp_tmp_command
; // store command
4042 if ((irmp_tmp_command
& 0x01) == 0x00)
4045 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4047 last_irmp_denon_command
= irmp_tmp_command
;
4048 denon_repetition_len
= 0;
4049 irmp_ir_detected
= FALSE
;
4054 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4056 last_irmp_denon_command
= 0;
4057 irmp_ir_detected
= FALSE
;
4062 #endif // IRMP_SUPPORT_DENON_PROTOCOL
4064 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
4065 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
4066 { // Grundig start frame?
4068 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
4070 irmp_ir_detected
= FALSE
;
4073 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
4075 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
4076 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
4077 { // Nokia start frame?
4079 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
4081 irmp_ir_detected
= FALSE
;
4084 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
4086 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4087 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
4089 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
4092 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
4093 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
4095 irmp_tmp_address
= last_irmp_address
; // address is last address
4096 irmp_tmp_command
= last_irmp_command
; // command is last command
4097 irmp_flags
|= IRMP_FLAG_REPETITION
;
4098 key_repetition_len
= 0;
4103 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
4105 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
4106 irmp_ir_detected
= FALSE
;
4109 #endif // IRMP_SUPPORT_NEC_PROTOCOL
4111 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4112 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
4116 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
4118 if (xor_value
!= (xor_check
[2] & 0x0F))
4121 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
4123 irmp_ir_detected
= FALSE
;
4126 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
4128 if (xor_value
!= xor_check
[5])
4131 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
4133 irmp_ir_detected
= FALSE
;
4136 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
4138 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4140 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4141 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
4143 if (parity
== PARITY_CHECK_FAILED
)
4146 ANALYZE_PRINTF ("error 6: parity check failed\n");
4148 irmp_ir_detected
= FALSE
;
4151 if ((irmp_tmp_address
& 0x03) == 0x02)
4154 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
4156 irmp_ir_detected
= FALSE
;
4158 irmp_tmp_address
>>= 2;
4160 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4162 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
4163 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
4165 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
4168 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
4170 irmp_protocol
= irmp_param
.protocol
;
4173 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
4174 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
4176 if (irmp_tmp_command
& 0x000F) // released key?
4178 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
4182 irmp_tmp_command
>>= 4; // no, it's a pressed key
4184 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
4185 irmp_tmp_address
&= 0x003F;
4189 irmp_address
= irmp_tmp_address
; // store address
4190 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4191 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
4193 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4197 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
4198 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
4200 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4203 irmp_command
= irmp_tmp_command
; // store command
4205 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4206 irmp_id
= irmp_tmp_id
;
4211 if (irmp_ir_detected
)
4213 if (last_irmp_command
== irmp_tmp_command
&&
4214 last_irmp_address
== irmp_tmp_address
&&
4215 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
4217 irmp_flags
|= IRMP_FLAG_REPETITION
;
4220 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4221 last_irmp_command
= irmp_tmp_command
; // store as last command, too
4223 key_repetition_len
= 0;
4228 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4232 // irmp_busy_flag = FALSE;
4233 irmp_start_bit_detected
= 0; // and wait for next start bit
4234 irmp_tmp_command
= 0;
4235 irmp_pulse_time
= 0;
4236 irmp_pause_time
= 0;
4238 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
4239 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
4240 { // set pulse time here!
4241 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
4243 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
4248 #if defined(STELLARIS_ARM_CORTEX_M4)
4249 // Clear the timer interrupt
4250 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
4253 return (irmp_ir_detected
);
4258 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4259 * main functions - for Unix/Linux + Windows only!
4263 * Compile it under linux with:
4266 * usage: ./irmp [-v|-s|-a|-l|-p] < file
4272 * -l list pulse/pauses
4274 *---------------------------------------------------------------------------------------------------------------------------------------------------
4278 print_timings (void)
4280 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
4281 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
4283 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
4284 printf ("====================================================================================\n");
4285 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4286 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4287 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4288 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4290 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4291 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4292 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4293 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4295 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4296 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
,
4297 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4298 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4300 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4301 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4302 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4303 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4305 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4306 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4307 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4308 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4310 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4311 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4312 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4313 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4315 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4316 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4317 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4318 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4320 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4321 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4322 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4324 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4325 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4326 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4327 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4329 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4330 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4331 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4332 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4334 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4335 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4336 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4338 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4339 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4340 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4341 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4343 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4344 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4345 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4346 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4348 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4349 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4350 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4351 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4353 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4354 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4355 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4357 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4358 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4359 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4361 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4362 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4363 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4365 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4366 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4367 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4369 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4370 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4371 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4373 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4374 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4375 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4376 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4378 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4379 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4380 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4381 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4382 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4383 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4384 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4386 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4387 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4388 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4389 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4391 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4392 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4393 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4394 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4396 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4397 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4398 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4399 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4401 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4402 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4403 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4404 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4407 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4408 printf ("================================================================================================\n");
4409 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4410 (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4411 (uint8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4412 (uint8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4413 (uint8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4414 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4415 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4416 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4417 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4418 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4422 print_spectrum (char * text
, int * buf
, int is_pulse
)
4435 puts ("-------------------------------------------------------------------------------");
4436 printf ("%s:\n", text
);
4438 for (i
= 0; i
< 256; i
++)
4440 if (buf
[i
] > max_value
)
4446 for (i
= 1; i
< 200; i
++)
4451 value
= (buf
[i
] * 60) / max_value
;
4453 for (j
= 0; j
< value
; j
++)
4457 printf (" %d\n", buf
[i
]);
4468 average
= (float) sum
/ (float) counter
;
4479 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
4480 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
4481 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
4483 tolerance
= (max
- average
);
4485 if (average
- min
> tolerance
)
4487 tolerance
= average
- min
;
4490 tolerance
= tolerance
* 100 / average
;
4491 printf ("tol: %4.1f%%\n", tolerance
);
4501 #define STATE_LEFT_SHIFT 0x01
4502 #define STATE_RIGHT_SHIFT 0x02
4503 #define STATE_LEFT_CTRL 0x04
4504 #define STATE_LEFT_ALT 0x08
4505 #define STATE_RIGHT_ALT 0x10
4507 #define KEY_ESCAPE 0x1B // keycode = 0x006e
4508 #define KEY_MENUE 0x80 // keycode = 0x0070
4509 #define KEY_BACK 0x81 // keycode = 0x0071
4510 #define KEY_FORWARD 0x82 // keycode = 0x0072
4511 #define KEY_ADDRESS 0x83 // keycode = 0x0073
4512 #define KEY_WINDOW 0x84 // keycode = 0x0074
4513 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
4514 #define KEY_STOP 0x86 // keycode = 0x0076
4515 #define KEY_MAIL 0x87 // keycode = 0x0077
4516 #define KEY_FAVORITES 0x88 // keycode = 0x0078
4517 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
4518 #define KEY_SETUP 0x8A // keycode = 0x007a
4519 #define KEY_FONT 0x8B // keycode = 0x007b
4520 #define KEY_PRINT 0x8C // keycode = 0x007c
4521 #define KEY_ON_OFF 0x8E // keycode = 0x007c
4523 #define KEY_INSERT 0x90 // keycode = 0x004b
4524 #define KEY_DELETE 0x91 // keycode = 0x004c
4525 #define KEY_LEFT 0x92 // keycode = 0x004f
4526 #define KEY_HOME 0x93 // keycode = 0x0050
4527 #define KEY_END 0x94 // keycode = 0x0051
4528 #define KEY_UP 0x95 // keycode = 0x0053
4529 #define KEY_DOWN 0x96 // keycode = 0x0054
4530 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
4531 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
4532 #define KEY_RIGHT 0x99 // keycode = 0x0059
4533 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
4534 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
4537 get_fdc_key (uint16_t cmd
)
4539 static uint8_t key_table
[128] =
4541 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
4542 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
4543 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
4544 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
4545 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
4547 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
4548 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
4549 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
4550 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
4552 static uint8_t state
;
4558 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
4559 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
4560 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
4561 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
4562 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
4563 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
4564 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
4565 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
4566 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
4567 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
4569 case 0x006e: key
= KEY_ESCAPE
; break;
4570 case 0x004b: key
= KEY_INSERT
; break;
4571 case 0x004c: key
= KEY_DELETE
; break;
4572 case 0x004f: key
= KEY_LEFT
; break;
4573 case 0x0050: key
= KEY_HOME
; break;
4574 case 0x0051: key
= KEY_END
; break;
4575 case 0x0053: key
= KEY_UP
; break;
4576 case 0x0054: key
= KEY_DOWN
; break;
4577 case 0x0055: key
= KEY_PAGE_UP
; break;
4578 case 0x0056: key
= KEY_PAGE_DOWN
; break;
4579 case 0x0059: key
= KEY_RIGHT
; break;
4580 case 0x0400: key
= KEY_MOUSE_1
; break;
4581 case 0x0800: key
= KEY_MOUSE_2
; break;
4585 if (!(cmd
& 0x80)) // pressed key
4587 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
4589 key
= cmd
+ 0x10; // 7x -> 8x
4591 else if (cmd
< 64) // key listed in key_table
4593 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
4597 case 0x0003: key
= '²'; break;
4598 case 0x0008: key
= '{'; break;
4599 case 0x0009: key
= '['; break;
4600 case 0x000A: key
= ']'; break;
4601 case 0x000B: key
= '}'; break;
4602 case 0x000C: key
= '\\'; break;
4603 case 0x001C: key
= '~'; break;
4604 case 0x002D: key
= '|'; break;
4605 case 0x0034: key
= 0xB5; break; // Mu
4608 else if (state
& (STATE_LEFT_CTRL
))
4610 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4612 key
= key_table
[cmd
] - 'a' + 1;
4616 key
= key_table
[cmd
];
4621 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4625 key
= key_table
[idx
];
4637 static int analyze
= FALSE
;
4638 static int list
= FALSE
;
4639 static IRMP_DATA irmp_data
;
4640 static int expected_protocol
;
4641 static int expected_address
;
4642 static int expected_command
;
4643 static int do_check_expected_values
;
4648 if (! analyze
&& ! list
)
4652 if (irmp_get_data (&irmp_data
))
4657 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4662 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4665 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4667 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4669 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4670 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4672 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4674 char * p
= (char *) NULL
;
4678 case '\t' : p
= "TAB"; break;
4679 case '\r' : p
= "CR"; break;
4680 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4681 case KEY_MENUE
: p
= "MENUE"; break;
4682 case KEY_BACK
: p
= "BACK"; break;
4683 case KEY_FORWARD
: p
= "FORWARD"; break;
4684 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4685 case KEY_WINDOW
: p
= "WINDOW"; break;
4686 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4687 case KEY_STOP
: p
= "STOP"; break;
4688 case KEY_MAIL
: p
= "MAIL"; break;
4689 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4690 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4691 case KEY_SETUP
: p
= "SETUP"; break;
4692 case KEY_FONT
: p
= "FONT"; break;
4693 case KEY_PRINT
: p
= "PRINT"; break;
4694 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4696 case KEY_INSERT
: p
= "INSERT"; break;
4697 case KEY_DELETE
: p
= "DELETE"; break;
4698 case KEY_LEFT
: p
= "LEFT"; break;
4699 case KEY_HOME
: p
= "HOME"; break;
4700 case KEY_END
: p
= "END"; break;
4701 case KEY_UP
: p
= "UP"; break;
4702 case KEY_DOWN
: p
= "DOWN"; break;
4703 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
4704 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
4705 case KEY_RIGHT
: p
= "RIGHT"; break;
4706 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
4707 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
4708 default : p
= "<UNKNWON>"; break;
4711 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
4712 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
4716 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
4717 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
4722 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
4723 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
4726 if (do_check_expected_values
)
4728 if (irmp_data
.protocol
!= expected_protocol
||
4729 irmp_data
.address
!= expected_address
||
4730 irmp_data
.command
!= expected_command
)
4732 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
4733 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
4737 printf (" checked!\n");
4739 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
4750 main (int argc
, char ** argv
)
4758 int start_pulses
[256];
4759 int start_pauses
[256];
4763 int first_pulse
= TRUE
;
4764 int first_pause
= TRUE
;
4768 if (! strcmp (argv
[1], "-v"))
4772 else if (! strcmp (argv
[1], "-l"))
4776 else if (! strcmp (argv
[1], "-a"))
4780 else if (! strcmp (argv
[1], "-s"))
4784 else if (! strcmp (argv
[1], "-p"))
4789 else if (! strcmp (argv
[1], "-r"))
4795 for (i
= 0; i
< 256; i
++)
4797 start_pulses
[i
] = 0;
4798 start_pauses
[i
] = 0;
4805 while ((ch
= getchar ()) != EOF
)
4807 if (ch
== '_' || ch
== '0')
4815 printf ("pause: %d\n", pause
);
4824 start_pauses
[pause
]++;
4826 first_pause
= FALSE
;
4842 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
4848 printf ("pulse: %d ", pulse
);
4857 start_pulses
[pulse
]++;
4859 first_pulse
= FALSE
;
4875 else if (ch
== '\n')
4880 if (list
&& pause
> 0)
4882 printf ("pause: %d\n", pause
);
4888 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
4902 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4913 puts ("-------------------------------------------------------------------");
4917 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4919 if (ch
!= '\r') // ignore CR in DOS/Windows files
4921 if (ch
== '[' && idx
== -1)
4929 do_check_expected_values
= FALSE
;
4933 expected_protocol
= atoi (buf
);
4935 if (expected_protocol
> 0)
4944 if (sscanf (p
, "%x", &expected_address
) == 1)
4946 do_check_expected_values
= TRUE
;
4953 if (do_check_expected_values
)
4955 do_check_expected_values
= FALSE
;
4963 if (sscanf (p
, "%x", &expected_command
) == 1)
4965 do_check_expected_values
= TRUE
;
4972 if (do_check_expected_values
)
4974 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4979 else if (idx
< 1024 - 2)
4999 print_spectrum ("START PULSES", start_pulses
, TRUE
);
5000 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
5001 print_spectrum ("PULSES", pulses
, TRUE
);
5002 print_spectrum ("PAUSES", pauses
, FALSE
);
5003 puts ("-------------------------------------------------------------------------------");