1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.178 2015/11/10 08:39:27 fm Exp $
8 * Supported AVR mikrocontrollers:
13 * ATmega8, ATmega16, ATmega32
15 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284, ATmega1284P
16 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *---------------------------------------------------------------------------------------------------------------------------------------------------
27 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
28 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
30 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
33 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
34 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
36 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
39 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
40 IRMP_SUPPORT_S100_PROTOCOL == 1 || \
41 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
42 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
43 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
44 IRMP_SUPPORT_IR60_PROTOCOL == 1 || \
45 IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1 || \
46 IRMP_SUPPORT_MERLIN_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 (uint_fast16_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 ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
92 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
93 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint_fast8_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 ((uint_fast8_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 ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
99 #define SIRCS_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
100 #define SIRCS_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
101 #define SIRCS_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
102 #define SIRCS_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
103 #define SIRCS_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
104 #define SIRCS_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
106 #define NEC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
107 #define NEC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
108 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
109 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
110 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
111 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
112 #define NEC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
113 #define NEC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
114 #define NEC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
115 #define NEC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
116 #define NEC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
117 #define NEC_0_PAUSE_LEN_MAX ((uint_fast8_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 (uint_fast16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
123 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
126 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
127 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
128 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
129 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
130 #define SAMSUNG_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
131 #define SAMSUNG_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
132 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
133 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
134 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
135 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
137 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
138 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
139 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
140 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
141 #define MATSUSHITA_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
142 #define MATSUSHITA_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
143 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
144 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
145 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
146 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
148 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
149 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
150 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
151 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
152 #define KASEIKYO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
153 #define KASEIKYO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
154 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
155 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
156 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
157 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
159 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
160 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
161 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
162 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
163 #define RECS80_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
164 #define RECS80_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
165 #define RECS80_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
166 #define RECS80_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
167 #define RECS80_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
168 #define RECS80_0_PAUSE_LEN_MAX ((uint_fast8_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 ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
173 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
175 #define RC5_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
176 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
179 #define RC5_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
180 #define RC5_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
182 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with S100, so keep tolerance for S100 minimal here:
183 #define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
184 #define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
186 #define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
187 #define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
190 #define S100_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
191 #define S100_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define DENON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define DENON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
195 #define DENON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
196 #define DENON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
197 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
198 #define DENON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define DENON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
200 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint_fast16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
202 #define THOMSON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
203 #define THOMSON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
204 #define THOMSON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define THOMSON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
206 #define THOMSON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
207 #define THOMSON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
209 #define RC6_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
210 #define RC6_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
211 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
212 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
213 #define RC6_TOGGLE_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
214 #define RC6_TOGGLE_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
215 #define RC6_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
216 #define RC6_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
217 #define RC6_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
218 #define RC6_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
220 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
223 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
224 #define RECS80EXT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
225 #define RECS80EXT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
226 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
227 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
228 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
229 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
231 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
232 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
233 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
234 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
235 #define NUBERT_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
236 #define NUBERT_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
237 #define NUBERT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
238 #define NUBERT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
239 #define NUBERT_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
240 #define NUBERT_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
241 #define NUBERT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
242 #define NUBERT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
244 #define FAN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
245 #define FAN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
246 #define FAN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
247 #define FAN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
248 #define FAN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
249 #define FAN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
250 #define FAN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
251 #define FAN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
252 #define FAN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
253 #define FAN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
254 #define FAN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
255 #define FAN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
257 #define SPEAKER_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
258 #define SPEAKER_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
259 #define SPEAKER_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
260 #define SPEAKER_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
261 #define SPEAKER_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
262 #define SPEAKER_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
263 #define SPEAKER_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
264 #define SPEAKER_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
265 #define SPEAKER_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
266 #define SPEAKER_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
267 #define SPEAKER_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
268 #define SPEAKER_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
270 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
271 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
272 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
273 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
274 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
275 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
276 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
277 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
278 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
279 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
280 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
281 #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
282 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
283 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
284 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
285 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
286 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
287 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
288 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
289 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
291 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
292 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
293 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
294 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
295 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
297 #define IR60_TIMEOUT_LEN ((uint_fast8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
298 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
299 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
300 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
301 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
302 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
303 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
305 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
306 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
307 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
308 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
309 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
310 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
311 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
312 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
314 #define FDC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
315 #define FDC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
316 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
317 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
318 #define FDC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
319 #define FDC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
320 #define FDC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
321 #define FDC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
323 #define FDC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
325 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
327 #define FDC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
329 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
330 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
331 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
332 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
333 #define RCCAR_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
334 #define RCCAR_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
335 #define RCCAR_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
336 #define RCCAR_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
337 #define RCCAR_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
338 #define RCCAR_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
340 #define JVC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
341 #define JVC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
342 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
343 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!
344 #define JVC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
345 #define JVC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
346 #define JVC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
347 #define JVC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
348 #define JVC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
349 #define JVC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
350 // autodetect JVC repetition frame within 50 msec:
351 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
353 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
354 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
355 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
356 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
357 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
358 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
359 #define NIKON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
360 #define NIKON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
361 #define NIKON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
362 #define NIKON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
363 #define NIKON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
364 #define NIKON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
365 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
367 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
368 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
369 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
370 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
371 #define KATHREIN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
372 #define KATHREIN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
373 #define KATHREIN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
374 #define KATHREIN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
375 #define KATHREIN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
376 #define KATHREIN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
377 #define KATHREIN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
378 #define KATHREIN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
379 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
380 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
382 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
383 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
384 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
385 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
386 #define NETBOX_PULSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
387 #define NETBOX_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
388 #define NETBOX_PULSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
389 #define NETBOX_PAUSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
391 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
392 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
393 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
394 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
395 #define LEGO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
396 #define LEGO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
397 #define LEGO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
398 #define LEGO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
399 #define LEGO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
400 #define LEGO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
402 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
403 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
404 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
405 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
406 #define BOSE_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
407 #define BOSE_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
408 #define BOSE_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
409 #define BOSE_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
410 #define BOSE_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
411 #define BOSE_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
412 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
414 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
415 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
416 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
417 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
418 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
419 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
420 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
421 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
423 #define MERLIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
424 #define MERLIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
425 #define MERLIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
426 #define MERLIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
427 #define MERLIN_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
428 #define MERLIN_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
429 #define MERLIN_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
430 #define MERLIN_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
432 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
433 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
434 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
435 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
436 #define ORTEK_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
437 #define ORTEK_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
438 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
439 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
441 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
442 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
443 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
444 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
445 #define TELEFUNKEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
446 #define TELEFUNKEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
447 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
448 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
449 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
450 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
451 // autodetect TELEFUNKEN repetition frame within 50 msec:
452 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
454 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
455 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
456 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
457 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
458 #define ROOMBA_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))
459 #define ROOMBA_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
460 #define ROOMBA_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
461 #define ROOMBA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
462 #define ROOMBA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
463 #define ROOMBA_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
464 #define ROOMBA_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
465 #define ROOMBA_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
466 #define ROOMBA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
467 #define ROOMBA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
469 #define RCMM32_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
470 #define RCMM32_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
471 #define RCMM32_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
472 #define RCMM32_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
473 #define RCMM32_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
474 #define RCMM32_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
475 #define RCMM32_BIT_00_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
476 #define RCMM32_BIT_00_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
477 #define RCMM32_BIT_01_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
478 #define RCMM32_BIT_01_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
479 #define RCMM32_BIT_10_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
480 #define RCMM32_BIT_10_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
481 #define RCMM32_BIT_11_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
482 #define RCMM32_BIT_11_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
484 #define PENTAX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
485 #define PENTAX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
486 #define PENTAX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
487 #define PENTAX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
488 #define PENTAX_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME + 0.5))
489 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
490 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
491 #define PENTAX_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
492 #define PENTAX_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
493 #define PENTAX_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME))
494 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
495 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
496 #define PENTAX_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
497 #define PENTAX_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
499 #define ACP24_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
500 #define ACP24_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
501 #define ACP24_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
502 #define ACP24_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
503 #define ACP24_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
504 #define ACP24_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
505 #define ACP24_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
506 #define ACP24_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
507 #define ACP24_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
508 #define ACP24_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
510 #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
511 #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
512 #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
513 #define RADIO1_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
514 #define RADIO1_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))
515 #define RADIO1_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
516 #define RADIO1_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
517 #define RADIO1_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
518 #define RADIO1_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
519 #define RADIO1_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))
520 #define RADIO1_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
521 #define RADIO1_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
522 #define RADIO1_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
523 #define RADIO1_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
525 #define AUTO_FRAME_REPETITION_LEN (uint_fast16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint_fast16_t!
528 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
529 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
530 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
531 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
532 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
534 static int time_counter
;
537 /******************************* not every PIC compiler knows variadic macros :-(
539 # define ANALYZE_PUTCHAR(a)
540 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
541 # define ANALYZE_PRINTF(...)
542 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
544 # define ANALYZE_NEWLINE()
545 *********************************/
548 #if IRMP_USE_CALLBACK == 1
549 static void (*irmp_callback_ptr
) (uint_fast8_t);
550 #endif // IRMP_USE_CALLBACK == 1
552 #define PARITY_CHECK_OK 1
553 #define PARITY_CHECK_FAILED 0
555 /*---------------------------------------------------------------------------------------------------------------------------------------------------
557 *---------------------------------------------------------------------------------------------------------------------------------------------------
559 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
560 static const char proto_unknown
[] PROGMEM
= "UNKNOWN";
561 static const char proto_sircs
[] PROGMEM
= "SIRCS";
562 static const char proto_nec
[] PROGMEM
= "NEC";
563 static const char proto_samsung
[] PROGMEM
= "SAMSUNG";
564 static const char proto_matsushita
[] PROGMEM
= "MATSUSH";
565 static const char proto_kaseikyo
[] PROGMEM
= "KASEIKYO";
566 static const char proto_recs80
[] PROGMEM
= "RECS80";
567 static const char proto_rc5
[] PROGMEM
= "RC5";
568 static const char proto_denon
[] PROGMEM
= "DENON";
569 static const char proto_rc6
[] PROGMEM
= "RC6";
570 static const char proto_samsung32
[] PROGMEM
= "SAMSG32";
571 static const char proto_apple
[] PROGMEM
= "APPLE";
572 static const char proto_recs80ext
[] PROGMEM
= "RECS80EX";
573 static const char proto_nubert
[] PROGMEM
= "NUBERT";
574 static const char proto_bang_olufsen
[] PROGMEM
= "BANG OLU";
575 static const char proto_grundig
[] PROGMEM
= "GRUNDIG";
576 static const char proto_nokia
[] PROGMEM
= "NOKIA";
577 static const char proto_siemens
[] PROGMEM
= "SIEMENS";
578 static const char proto_fdc
[] PROGMEM
= "FDC";
579 static const char proto_rccar
[] PROGMEM
= "RCCAR";
580 static const char proto_jvc
[] PROGMEM
= "JVC";
581 static const char proto_rc6a
[] PROGMEM
= "RC6A";
582 static const char proto_nikon
[] PROGMEM
= "NIKON";
583 static const char proto_ruwido
[] PROGMEM
= "RUWIDO";
584 static const char proto_ir60
[] PROGMEM
= "IR60";
585 static const char proto_kathrein
[] PROGMEM
= "KATHREIN";
586 static const char proto_netbox
[] PROGMEM
= "NETBOX";
587 static const char proto_nec16
[] PROGMEM
= "NEC16";
588 static const char proto_nec42
[] PROGMEM
= "NEC42";
589 static const char proto_lego
[] PROGMEM
= "LEGO";
590 static const char proto_thomson
[] PROGMEM
= "THOMSON";
591 static const char proto_bose
[] PROGMEM
= "BOSE";
592 static const char proto_a1tvbox
[] PROGMEM
= "A1TVBOX";
593 static const char proto_ortek
[] PROGMEM
= "ORTEK";
594 static const char proto_telefunken
[] PROGMEM
= "TELEFUNKEN";
595 static const char proto_roomba
[] PROGMEM
= "ROOMBA";
596 static const char proto_rcmm32
[] PROGMEM
= "RCMM32";
597 static const char proto_rcmm24
[] PROGMEM
= "RCMM24";
598 static const char proto_rcmm12
[] PROGMEM
= "RCMM12";
599 static const char proto_speaker
[] PROGMEM
= "SPEAKER";
600 static const char proto_lgair
[] PROGMEM
= "LGAIR";
601 static const char proto_samsung48
[] PROGMEM
= "SAMSG48";
602 static const char proto_merlin
[] PROGMEM
= "MERLIN";
603 static const char proto_pentax
[] PROGMEM
= "PENTAX";
604 static const char proto_fan
[] PROGMEM
= "FAN";
605 static const char proto_s100
[] PROGMEM
= "S100";
606 static const char proto_acp24
[] PROGMEM
= "ACP24";
607 static const char proto_technics
[] PROGMEM
= "TECHNICS";
609 static const char proto_radio1
[] PROGMEM
= "RADIO1";
612 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] PROGMEM
=
667 /*---------------------------------------------------------------------------------------------------------------------------------------------------
669 *---------------------------------------------------------------------------------------------------------------------------------------------------
671 #if IRMP_LOGGING == 1 // logging via UART
673 #if defined(ARM_STM32F4XX)
674 # define STM32_GPIO_CLOCK RCC_AHB1Periph_GPIOA // UART2 on PA2
675 # define STM32_UART_CLOCK RCC_APB1Periph_USART2
676 # define STM32_GPIO_PORT GPIOA
677 # define STM32_GPIO_PIN GPIO_Pin_2
678 # define STM32_GPIO_SOURCE GPIO_PinSource2
679 # define STM32_UART_AF GPIO_AF_USART2
680 # define STM32_UART_COM USART2
681 # define STM32_UART_BAUD 115200 // 115200 Baud
682 # include "stm32f4xx_usart.h"
683 #elif defined(ARM_STM32F10X)
684 # define STM32_UART_COM USART3 // UART3 on PB10
686 # if IRMP_EXT_LOGGING == 1 // use external logging
687 # include "irmpextlog.h"
688 # else // normal UART log (IRMP_EXT_LOGGING == 0)
690 # ifndef UNIX_OR_WINDOWS
691 # include <util/setbaud.h>
696 #define UART0_UBRRH UBRR0H
697 #define UART0_UBRRL UBRR0L
698 #define UART0_UCSRA UCSR0A
699 #define UART0_UCSRB UCSR0B
700 #define UART0_UCSRC UCSR0C
701 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
702 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
703 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
705 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
707 #define UART0_URSEL_BIT_VALUE (0)
709 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
710 #define UART0_UDR UDR0
711 #define UART0_U2X U2X0
715 #define UART0_UBRRH UBRRH
716 #define UART0_UBRRL UBRRL
717 #define UART0_UCSRA UCSRA
718 #define UART0_UCSRB UCSRB
719 #define UART0_UCSRC UCSRC
720 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
721 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
722 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
724 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
726 #define UART0_URSEL_BIT_VALUE (0)
728 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
729 #define UART0_UDR UDR
730 #define UART0_U2X U2X
733 #endif //IRMP_EXT_LOGGING
734 #endif //ARM_STM32F4XX
736 /*---------------------------------------------------------------------------------------------------------------------------------------------------
738 * @details Initializes UART
739 *---------------------------------------------------------------------------------------------------------------------------------------------------
742 irmp_uart_init (void)
744 #ifndef UNIX_OR_WINDOWS
745 #if defined(ARM_STM32F4XX)
746 GPIO_InitTypeDef GPIO_InitStructure
;
747 USART_InitTypeDef USART_InitStructure
;
749 // Clock enable vom TX Pin
750 RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK
, ENABLE
);
752 // Clock enable der UART
753 RCC_APB1PeriphClockCmd(STM32_UART_CLOCK
, ENABLE
);
755 // UART Alternative-Funktion mit dem IO-Pin verbinden
756 GPIO_PinAFConfig(STM32_GPIO_PORT
,STM32_GPIO_SOURCE
,STM32_UART_AF
);
758 // UART als Alternative-Funktion mit PushPull
759 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_AF
;
760 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_100MHz
;
761 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
762 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_UP
;
765 GPIO_InitStructure
.GPIO_Pin
= STM32_GPIO_PIN
;
766 GPIO_Init(STM32_GPIO_PORT
, &GPIO_InitStructure
);
769 USART_OverSampling8Cmd(STM32_UART_COM
, ENABLE
);
771 // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS
772 USART_InitStructure
.USART_BaudRate
= STM32_UART_BAUD
;
773 USART_InitStructure
.USART_WordLength
= USART_WordLength_8b
;
774 USART_InitStructure
.USART_StopBits
= USART_StopBits_1
;
775 USART_InitStructure
.USART_Parity
= USART_Parity_No
;
776 USART_InitStructure
.USART_HardwareFlowControl
= USART_HardwareFlowControl_None
;
777 USART_InitStructure
.USART_Mode
= USART_Mode_Tx
;
778 USART_Init(STM32_UART_COM
, &USART_InitStructure
);
781 USART_Cmd(STM32_UART_COM
, ENABLE
);
783 #elif defined(ARM_STM32F10X)
784 GPIO_InitTypeDef GPIO_InitStructure
;
785 USART_InitTypeDef USART_InitStructure
;
787 // Clock enable vom TX Pin
788 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB
, ENABLE
); // UART3 an PB10
790 // Clock enable der UART
791 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3
, ENABLE
);
793 // UART als Alternative-Funktion mit PushPull
794 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_AF_PP
;
795 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_50MHz
;
798 GPIO_InitStructure
.GPIO_Pin
= GPIO_Pin_10
;
799 GPIO_Init(GPIOB
, &GPIO_InitStructure
);
802 USART_OverSampling8Cmd(STM32_UART_COM
, ENABLE
);
804 // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS
805 USART_InitStructure
.USART_BaudRate
= 115200;
806 USART_InitStructure
.USART_WordLength
= USART_WordLength_8b
;
807 USART_InitStructure
.USART_StopBits
= USART_StopBits_1
;
808 USART_InitStructure
.USART_Parity
= USART_Parity_No
;
809 USART_InitStructure
.USART_HardwareFlowControl
= USART_HardwareFlowControl_None
;
810 USART_InitStructure
.USART_Mode
= USART_Mode_Tx
;
811 USART_Init(STM32_UART_COM
, &USART_InitStructure
);
814 USART_Cmd(STM32_UART_COM
, ENABLE
);
816 #elif defined (__AVR_XMEGA__)
818 PMIC
.CTRL
|= PMIC_HILVLEN_bm
;
820 USARTC1
.BAUDCTRLB
= 0;
821 USARTC1
.BAUDCTRLA
= F_CPU
/153600-1;
822 USARTC1
.CTRLA
= USART_RXCINTLVL_HI_gc
; // High Level (Empfangen)
823 USARTC1
.CTRLB
= USART_TXEN_bm
| USART_RXEN_bm
; //Aktiviert Senden und Empfangen
824 USARTC1
.CTRLC
= USART_CHSIZE_8BIT_gc
; //Größe der Zeichen: 8 Bit
825 PORTC
.DIR |= (1<<7); //TXD als Ausgang setzen
826 PORTC
.DIR &= ~(1<<6);
830 #if (IRMP_EXT_LOGGING == 0) // use UART
831 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
832 UART0_UBRRL
= UBRRL_VALUE
;
835 UART0_UCSRA
|= (1<<UART0_U2X
);
837 UART0_UCSRA
&= ~(1<<UART0_U2X
);
840 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
841 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
842 #else // other log method
844 #endif //IRMP_EXT_LOGGING
845 #endif //ARM_STM32F4XX
846 #endif // UNIX_OR_WINDOWS
849 /*---------------------------------------------------------------------------------------------------------------------------------------------------
851 * @details Sends character
852 * @param ch character to be transmitted
853 *---------------------------------------------------------------------------------------------------------------------------------------------------
856 irmp_uart_putc (unsigned char ch
)
858 #ifndef UNIX_OR_WINDOWS
859 #if defined(ARM_STM32F4XX) || defined(ARM_STM32F10X)
860 // warten bis altes Byte gesendet wurde
861 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
)
866 USART_SendData(STM32_UART_COM
, ch
);
870 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
);
871 USART_SendData(STM32_UART_COM
, '\r');
875 #if (IRMP_EXT_LOGGING == 0)
877 # if defined (__AVR_XMEGA__)
878 while (!(USARTC1
.STATUS
& USART_DREIF_bm
));
882 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
888 #endif //__AVR_XMEGA__
891 sendextlog(ch
); // use external log
893 #endif //IRMP_EXT_LOGGING
894 #endif //ARM_STM32F4XX
897 #endif // UNIX_OR_WINDOWS
900 /*---------------------------------------------------------------------------------------------------------------------------------------------------
902 *---------------------------------------------------------------------------------------------------------------------------------------------------
905 #define STARTCYCLES 2 // min count of zeros before start of logging
906 #define ENDBITS 1000 // number of sequenced highbits to detect end
907 #define DATALEN 700 // log buffer size
910 irmp_log (uint_fast8_t val
)
912 static uint8_t buf
[DATALEN
]; // logging buffer
913 static uint_fast16_t buf_idx
; // index
914 static uint_fast8_t startcycles
; // current number of start-zeros
915 static uint_fast16_t cnt
; // counts sequenced highbits - to detect end
916 static uint_fast8_t last_val
= 1;
918 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
926 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
932 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
933 { // if stop condition is true, output on uart
937 uint_fast8_t v
= '1';
940 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
942 irmp_uart_putc ('0'); // the ignored starting zeros
945 for (i
= 0; i
< buf_idx
; i
++)
954 d
|= ((uint_fast16_t) buf
[i
] << 8);
957 for (j
= 0; j
< d
; j
++)
962 v
= (v
== '1') ? '0' : '1';
965 for (i8
= 0; i8
< 20; i8
++)
967 irmp_uart_putc ('1');
970 irmp_uart_putc ('\n');
976 else if (buf_idx
< DATALEN
- 3)
980 buf
[buf_idx
++] = 0xff;
981 buf
[buf_idx
++] = (cnt
& 0xff);
982 buf
[buf_idx
] = (cnt
>> 8);
998 #define irmp_log(val)
999 #endif //IRMP_LOGGING
1003 uint_fast8_t protocol
; // ir protocol
1004 uint_fast8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
1005 uint_fast8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
1006 uint_fast8_t pause_1_len_min
; // minimum length of pause with bit value 1
1007 uint_fast8_t pause_1_len_max
; // maximum length of pause with bit value 1
1008 uint_fast8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
1009 uint_fast8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
1010 uint_fast8_t pause_0_len_min
; // minimum length of pause with bit value 0
1011 uint_fast8_t pause_0_len_max
; // maximum length of pause with bit value 0
1012 uint_fast8_t address_offset
; // address offset
1013 uint_fast8_t address_end
; // end of address
1014 uint_fast8_t command_offset
; // command offset
1015 uint_fast8_t command_end
; // end of command
1016 uint_fast8_t complete_len
; // complete length of frame
1017 uint_fast8_t stop_bit
; // flag: frame has stop bit
1018 uint_fast8_t lsb_first
; // flag: LSB first
1019 uint_fast8_t flags
; // some flags
1022 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
1024 static const PROGMEM IRMP_PARAMETER sircs_param
=
1026 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
1027 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1028 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1029 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1030 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1031 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1032 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1033 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1034 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1035 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
1036 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
1037 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
1038 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
1039 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1040 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
1041 SIRCS_LSB
, // lsb_first: flag: LSB first
1042 SIRCS_FLAGS
// flags: some flags
1047 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1049 static const PROGMEM IRMP_PARAMETER nec_param
=
1051 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1052 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1053 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1054 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1055 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1056 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1057 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1058 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1059 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1060 NEC_ADDRESS_OFFSET
, // address_offset: address offset
1061 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
1062 NEC_COMMAND_OFFSET
, // command_offset: command offset
1063 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
1064 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1065 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1066 NEC_LSB
, // lsb_first: flag: LSB first
1067 NEC_FLAGS
// flags: some flags
1070 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
1072 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1073 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1074 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1075 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1076 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1077 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1078 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1079 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1080 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1081 0, // address_offset: address offset
1082 0, // address_end: end of address
1083 0, // command_offset: command offset
1084 0, // command_end: end of command
1085 0, // complete_len: complete length of frame
1086 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1087 NEC_LSB
, // lsb_first: flag: LSB first
1088 NEC_FLAGS
// flags: some flags
1093 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1095 static const PROGMEM IRMP_PARAMETER nec42_param
=
1097 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
1098 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1099 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1100 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1101 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1102 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1103 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1104 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1105 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1106 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
1107 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
1108 NEC42_COMMAND_OFFSET
, // command_offset: command offset
1109 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
1110 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1111 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1112 NEC_LSB
, // lsb_first: flag: LSB first
1113 NEC_FLAGS
// flags: some flags
1118 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1120 static const PROGMEM IRMP_PARAMETER lgair_param
=
1122 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
1123 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1124 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1125 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1126 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1127 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1128 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1129 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1130 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1131 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
1132 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
1133 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
1134 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
1135 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1136 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1137 NEC_LSB
, // lsb_first: flag: LSB first
1138 NEC_FLAGS
// flags: some flags
1143 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1145 static const PROGMEM IRMP_PARAMETER samsung_param
=
1147 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
1148 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1149 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1150 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1151 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1152 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1153 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1154 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1155 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1156 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
1157 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
1158 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
1159 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
1160 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1161 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
1162 SAMSUNG_LSB
, // lsb_first: flag: LSB first
1163 SAMSUNG_FLAGS
// flags: some flags
1168 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
1170 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1172 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1173 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1174 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1175 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1176 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1177 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1178 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1179 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1180 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1181 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1182 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1183 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1184 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1185 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1186 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1187 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1188 TELEFUNKEN_FLAGS
// flags: some flags
1193 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1195 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1197 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1198 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1199 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1200 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1201 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1202 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1203 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1204 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1205 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1206 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1207 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1208 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1209 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1210 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1211 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1212 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1213 MATSUSHITA_FLAGS
// flags: some flags
1218 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1220 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1222 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1223 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1224 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1225 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1226 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1227 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1228 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1229 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1230 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1231 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1232 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1233 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1234 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1235 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1236 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1237 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1238 KASEIKYO_FLAGS
// flags: some flags
1243 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1245 static const PROGMEM IRMP_PARAMETER recs80_param
=
1247 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1248 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1249 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1250 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1251 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1252 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1253 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1254 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1255 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1256 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1257 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1258 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1259 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1260 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1261 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1262 RECS80_LSB
, // lsb_first: flag: LSB first
1263 RECS80_FLAGS
// flags: some flags
1268 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1270 static const PROGMEM IRMP_PARAMETER rc5_param
=
1272 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1273 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1274 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1275 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1276 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1277 0, // pulse_0_len_min: here: not used
1278 0, // pulse_0_len_max: here: not used
1279 0, // pause_0_len_min: here: not used
1280 0, // pause_0_len_max: here: not used
1281 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1282 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1283 RC5_COMMAND_OFFSET
, // command_offset: command offset
1284 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1285 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1286 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1287 RC5_LSB
, // lsb_first: flag: LSB first
1288 RC5_FLAGS
// flags: some flags
1293 #if IRMP_SUPPORT_S100_PROTOCOL == 1
1295 static const PROGMEM IRMP_PARAMETER s100_param
=
1297 IRMP_S100_PROTOCOL
, // protocol: ir protocol
1298 S100_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1299 S100_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1300 S100_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1301 S100_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1302 0, // pulse_0_len_min: here: not used
1303 0, // pulse_0_len_max: here: not used
1304 0, // pause_0_len_min: here: not used
1305 0, // pause_0_len_max: here: not used
1306 S100_ADDRESS_OFFSET
, // address_offset: address offset
1307 S100_ADDRESS_OFFSET
+ S100_ADDRESS_LEN
, // address_end: end of address
1308 S100_COMMAND_OFFSET
, // command_offset: command offset
1309 S100_COMMAND_OFFSET
+ S100_COMMAND_LEN
, // command_end: end of command
1310 S100_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1311 S100_STOP_BIT
, // stop_bit: flag: frame has stop bit
1312 S100_LSB
, // lsb_first: flag: LSB first
1313 S100_FLAGS
// flags: some flags
1318 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1320 static const PROGMEM IRMP_PARAMETER denon_param
=
1322 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1323 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1324 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1325 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1326 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1327 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1328 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1329 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1330 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1331 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1332 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1333 DENON_COMMAND_OFFSET
, // command_offset: command offset
1334 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1335 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1336 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1337 DENON_LSB
, // lsb_first: flag: LSB first
1338 DENON_FLAGS
// flags: some flags
1343 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1345 static const PROGMEM IRMP_PARAMETER rc6_param
=
1347 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1349 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1350 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1351 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1352 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1353 0, // pulse_0_len_min: here: not used
1354 0, // pulse_0_len_max: here: not used
1355 0, // pause_0_len_min: here: not used
1356 0, // pause_0_len_max: here: not used
1357 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1358 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1359 RC6_COMMAND_OFFSET
, // command_offset: command offset
1360 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1361 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1362 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1363 RC6_LSB
, // lsb_first: flag: LSB first
1364 RC6_FLAGS
// flags: some flags
1369 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1371 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1373 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1374 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1375 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1376 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1377 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1378 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1379 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1380 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1381 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1382 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1383 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1384 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1385 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1386 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1387 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1388 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1389 RECS80EXT_FLAGS
// flags: some flags
1394 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1396 static const PROGMEM IRMP_PARAMETER nubert_param
=
1398 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1399 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1400 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1401 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1402 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1403 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1404 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1405 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1406 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1407 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1408 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1409 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1410 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1411 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1412 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1413 NUBERT_LSB
, // lsb_first: flag: LSB first
1414 NUBERT_FLAGS
// flags: some flags
1419 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
1421 static const PROGMEM IRMP_PARAMETER fan_param
=
1423 IRMP_FAN_PROTOCOL
, // protocol: ir protocol
1424 FAN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1425 FAN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1426 FAN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1427 FAN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1428 FAN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1429 FAN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1430 FAN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1431 FAN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1432 FAN_ADDRESS_OFFSET
, // address_offset: address offset
1433 FAN_ADDRESS_OFFSET
+ FAN_ADDRESS_LEN
, // address_end: end of address
1434 FAN_COMMAND_OFFSET
, // command_offset: command offset
1435 FAN_COMMAND_OFFSET
+ FAN_COMMAND_LEN
, // command_end: end of command
1436 FAN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1437 FAN_STOP_BIT
, // stop_bit: flag: frame has NO stop bit
1438 FAN_LSB
, // lsb_first: flag: LSB first
1439 FAN_FLAGS
// flags: some flags
1444 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1446 static const PROGMEM IRMP_PARAMETER speaker_param
=
1448 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1449 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1450 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1451 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1452 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1453 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1454 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1455 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1456 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1457 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1458 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1459 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1460 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1461 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1462 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1463 SPEAKER_LSB
, // lsb_first: flag: LSB first
1464 SPEAKER_FLAGS
// flags: some flags
1469 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1471 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1473 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1474 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1475 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1476 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1477 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1478 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1479 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1480 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1481 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1482 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1483 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1484 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1485 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1486 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1487 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1488 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1489 BANG_OLUFSEN_FLAGS
// flags: some flags
1494 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1496 static uint_fast8_t first_bit
;
1498 static const PROGMEM IRMP_PARAMETER grundig_param
=
1500 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1502 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1503 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1504 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1505 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1506 0, // pulse_0_len_min: here: not used
1507 0, // pulse_0_len_max: here: not used
1508 0, // pause_0_len_min: here: not used
1509 0, // pause_0_len_max: here: not used
1510 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1511 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1512 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1513 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1514 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1515 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1516 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1517 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1522 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1524 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1526 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1527 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1528 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1529 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1530 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1531 0, // pulse_0_len_min: here: not used
1532 0, // pulse_0_len_max: here: not used
1533 0, // pause_0_len_min: here: not used
1534 0, // pause_0_len_max: here: not used
1535 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1536 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1537 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1538 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1539 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1540 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1541 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1542 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1547 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1549 static const PROGMEM IRMP_PARAMETER fdc_param
=
1551 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1552 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1553 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1554 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1555 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1556 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1557 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1558 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1559 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1560 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1561 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1562 FDC_COMMAND_OFFSET
, // command_offset: command offset
1563 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1564 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1565 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1566 FDC_LSB
, // lsb_first: flag: LSB first
1567 FDC_FLAGS
// flags: some flags
1572 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1574 static const PROGMEM IRMP_PARAMETER rccar_param
=
1576 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1577 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1578 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1579 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1580 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1581 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1582 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1583 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1584 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1585 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1586 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1587 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1588 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1589 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1590 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1591 RCCAR_LSB
, // lsb_first: flag: LSB first
1592 RCCAR_FLAGS
// flags: some flags
1597 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1599 static const PROGMEM IRMP_PARAMETER nikon_param
=
1601 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1602 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1603 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1604 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1605 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1606 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1607 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1608 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1609 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1610 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1611 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1612 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1613 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1614 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1615 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1616 NIKON_LSB
, // lsb_first: flag: LSB first
1617 NIKON_FLAGS
// flags: some flags
1622 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1624 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1626 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1627 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1628 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1629 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1630 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1631 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1632 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1633 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1634 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1635 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1636 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1637 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1638 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1639 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1640 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1641 KATHREIN_LSB
, // lsb_first: flag: LSB first
1642 KATHREIN_FLAGS
// flags: some flags
1647 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1649 static const PROGMEM IRMP_PARAMETER netbox_param
=
1651 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1652 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1653 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1654 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1655 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1656 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1657 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1658 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1659 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1660 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1661 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1662 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1663 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1664 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1665 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1666 NETBOX_LSB
, // lsb_first: flag: LSB first
1667 NETBOX_FLAGS
// flags: some flags
1672 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1674 static const PROGMEM IRMP_PARAMETER lego_param
=
1676 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1677 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1678 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1679 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1680 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1681 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1682 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1683 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1684 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1685 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1686 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1687 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1688 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1689 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1690 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1691 LEGO_LSB
, // lsb_first: flag: LSB first
1692 LEGO_FLAGS
// flags: some flags
1697 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1699 static const PROGMEM IRMP_PARAMETER thomson_param
=
1701 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1702 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1703 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1704 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1705 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1706 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1707 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1708 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1709 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1710 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1711 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1712 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1713 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1714 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1715 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1716 THOMSON_LSB
, // lsb_first: flag: LSB first
1717 THOMSON_FLAGS
// flags: some flags
1722 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1724 static const PROGMEM IRMP_PARAMETER bose_param
=
1726 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1727 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1728 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1729 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1730 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1731 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1732 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1733 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1734 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1735 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1736 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1737 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1738 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1739 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1740 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1741 BOSE_LSB
, // lsb_first: flag: LSB first
1742 BOSE_FLAGS
// flags: some flags
1747 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1749 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1751 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1753 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1754 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1755 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1756 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1757 0, // pulse_0_len_min: here: not used
1758 0, // pulse_0_len_max: here: not used
1759 0, // pause_0_len_min: here: not used
1760 0, // pause_0_len_max: here: not used
1761 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1762 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1763 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1764 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1765 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1766 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1767 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1768 A1TVBOX_FLAGS
// flags: some flags
1773 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
1775 static const PROGMEM IRMP_PARAMETER merlin_param
=
1777 IRMP_MERLIN_PROTOCOL
, // protocol: ir protocol
1779 MERLIN_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1780 MERLIN_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1781 MERLIN_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1782 MERLIN_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1783 0, // pulse_0_len_min: here: not used
1784 0, // pulse_0_len_max: here: not used
1785 0, // pause_0_len_min: here: not used
1786 0, // pause_0_len_max: here: not used
1787 MERLIN_ADDRESS_OFFSET
, // address_offset: address offset
1788 MERLIN_ADDRESS_OFFSET
+ MERLIN_ADDRESS_LEN
, // address_end: end of address
1789 MERLIN_COMMAND_OFFSET
, // command_offset: command offset
1790 MERLIN_COMMAND_OFFSET
+ MERLIN_COMMAND_LEN
, // command_end: end of command
1791 MERLIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1792 MERLIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1793 MERLIN_LSB
, // lsb_first: flag: LSB first
1794 MERLIN_FLAGS
// flags: some flags
1799 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1801 static const PROGMEM IRMP_PARAMETER ortek_param
=
1803 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1805 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1806 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1807 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1808 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1809 0, // pulse_0_len_min: here: not used
1810 0, // pulse_0_len_max: here: not used
1811 0, // pause_0_len_min: here: not used
1812 0, // pause_0_len_max: here: not used
1813 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1814 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1815 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1816 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1817 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1818 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1819 ORTEK_LSB
, // lsb_first: flag: LSB first
1820 ORTEK_FLAGS
// flags: some flags
1825 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1827 static const PROGMEM IRMP_PARAMETER roomba_param
=
1829 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1830 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1831 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1832 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1833 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1834 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1835 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1836 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1837 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1838 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1839 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1840 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1841 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1842 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1843 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1844 ROOMBA_LSB
, // lsb_first: flag: LSB first
1845 ROOMBA_FLAGS
// flags: some flags
1850 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1852 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1854 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1856 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1857 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1858 0, // pause_1_len_min: here: minimum length of short pause
1859 0, // pause_1_len_max: here: maximum length of short pause
1860 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1861 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1862 0, // pause_0_len_min: here: not used
1863 0, // pause_0_len_max: here: not used
1864 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1865 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1866 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1867 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1868 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1869 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1870 RCMM32_LSB
, // lsb_first: flag: LSB first
1871 RCMM32_FLAGS
// flags: some flags
1876 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
1878 static const PROGMEM IRMP_PARAMETER pentax_param
=
1880 IRMP_PENTAX_PROTOCOL
, // protocol: ir protocol
1881 PENTAX_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1882 PENTAX_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1883 PENTAX_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1884 PENTAX_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1885 PENTAX_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1886 PENTAX_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1887 PENTAX_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1888 PENTAX_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1889 PENTAX_ADDRESS_OFFSET
, // address_offset: address offset
1890 PENTAX_ADDRESS_OFFSET
+ PENTAX_ADDRESS_LEN
, // address_end: end of address
1891 PENTAX_COMMAND_OFFSET
, // command_offset: command offset
1892 PENTAX_COMMAND_OFFSET
+ PENTAX_COMMAND_LEN
, // command_end: end of command
1893 PENTAX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1894 PENTAX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1895 PENTAX_LSB
, // lsb_first: flag: LSB first
1896 PENTAX_FLAGS
// flags: some flags
1901 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
1903 static const PROGMEM IRMP_PARAMETER acp24_param
=
1905 IRMP_ACP24_PROTOCOL
, // protocol: ir protocol
1906 ACP24_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1907 ACP24_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1908 ACP24_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1909 ACP24_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1910 ACP24_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1911 ACP24_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1912 ACP24_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1913 ACP24_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1914 ACP24_ADDRESS_OFFSET
, // address_offset: address offset
1915 ACP24_ADDRESS_OFFSET
+ ACP24_ADDRESS_LEN
, // address_end: end of address
1916 ACP24_COMMAND_OFFSET
, // command_offset: command offset
1917 ACP24_COMMAND_OFFSET
+ ACP24_COMMAND_LEN
, // command_end: end of command
1918 ACP24_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1919 ACP24_STOP_BIT
, // stop_bit: flag: frame has stop bit
1920 ACP24_LSB
, // lsb_first: flag: LSB first
1921 ACP24_FLAGS
// flags: some flags
1926 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1928 static const PROGMEM IRMP_PARAMETER radio1_param
=
1930 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1932 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1933 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1934 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1935 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1936 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1937 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1938 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1939 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1940 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1941 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1942 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1943 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1944 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1945 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1946 RADIO1_LSB
, // lsb_first: flag: LSB first
1947 RADIO1_FLAGS
// flags: some flags
1952 static uint_fast8_t irmp_bit
; // current bit position
1953 static IRMP_PARAMETER irmp_param
;
1955 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1956 static IRMP_PARAMETER irmp_param2
;
1959 static volatile uint_fast8_t irmp_ir_detected
= FALSE
;
1960 static volatile uint_fast8_t irmp_protocol
;
1961 static volatile uint_fast16_t irmp_address
;
1962 static volatile uint_fast16_t irmp_command
;
1963 static volatile uint_fast16_t irmp_id
; // only used for SAMSUNG protocol
1964 static volatile uint_fast8_t irmp_flags
;
1965 // static volatile uint_fast8_t irmp_busy_flag;
1968 #define input(x) (x)
1969 static uint_fast8_t IRMP_PIN
;
1970 static uint_fast8_t radio
;
1973 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1974 * Initialize IRMP decoder
1975 * @details Configures IRMP input pin
1976 *---------------------------------------------------------------------------------------------------------------------------------------------------
1982 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1983 #elif defined (ARM_STM32) // STM32
1984 GPIO_InitTypeDef GPIO_InitStructure
;
1986 /* GPIOx clock enable */
1987 #if defined (ARM_STM32L1XX)
1988 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1989 #elif defined (ARM_STM32F10X)
1990 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1991 #elif defined (ARM_STM32F4XX)
1992 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1995 /* GPIO Configuration */
1996 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1997 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1998 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1999 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
2000 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
2001 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
2002 #elif defined (ARM_STM32F10X)
2003 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
2004 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
2006 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
2007 #elif defined(STELLARIS_ARM_CORTEX_M4)
2008 // Enable the GPIO port
2009 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
2012 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
2013 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
2015 GPIO_PIN_TYPE_STD_WPU
);
2016 #elif defined(__SDCC_stm8) // STM8
2017 IRMP_GPIO_STRUCT
->CR1
|= (1<<IRMP_BIT
); // activate pullup
2018 IRMP_GPIO_STRUCT
->DDR
&= ~(1<<IRMP_BIT
); // pin is input
2020 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
2021 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
2024 #if IRMP_LOGGING == 1
2029 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2031 * @details gets decoded IRMP data
2032 * @param pointer in order to store IRMP data
2033 * @return TRUE: successful, FALSE: failed
2034 *---------------------------------------------------------------------------------------------------------------------------------------------------
2037 irmp_get_data (IRMP_DATA
* irmp_data_p
)
2039 uint_fast8_t rtc
= FALSE
;
2041 if (irmp_ir_detected
)
2043 switch (irmp_protocol
)
2045 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2046 case IRMP_SAMSUNG_PROTOCOL
:
2047 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
2049 irmp_command
&= 0xff;
2050 irmp_command
|= irmp_id
<< 8;
2055 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
2056 case IRMP_SAMSUNG48_PROTOCOL
:
2057 irmp_command
= (irmp_command
& 0x00FF) | ((irmp_id
& 0x00FF) << 8);
2063 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2064 case IRMP_NEC_PROTOCOL
:
2065 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
2067 irmp_command
&= 0xff;
2070 else if (irmp_address
== 0x87EE)
2073 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
2075 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
2076 irmp_address
= (irmp_command
& 0xFF00) >> 8;
2077 irmp_command
&= 0x00FF;
2082 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2083 case IRMP_BOSE_PROTOCOL
:
2084 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
2086 irmp_command
&= 0xff;
2091 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2092 case IRMP_SIEMENS_PROTOCOL
:
2093 case IRMP_RUWIDO_PROTOCOL
:
2094 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
2101 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2102 case IRMP_KATHREIN_PROTOCOL
:
2103 if (irmp_command
!= 0x0000)
2109 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2110 case IRMP_RC5_PROTOCOL
:
2111 irmp_address
&= ~0x20; // clear toggle bit
2115 #if IRMP_SUPPORT_S100_PROTOCOL == 1
2116 case IRMP_S100_PROTOCOL
:
2117 irmp_address
&= ~0x20; // clear toggle bit
2121 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
2122 case IRMP_IR60_PROTOCOL
:
2123 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
2130 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
2135 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2136 case IRMP_RCCAR_PROTOCOL
:
2137 // frame in irmp_data:
2138 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
2139 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
2140 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
2141 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
2142 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
2143 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
2144 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
2148 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
2149 case IRMP_NETBOX_PROTOCOL
:
2150 if (irmp_command
& 0x1000) // last bit set?
2152 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
2155 irmp_command
&= 0x7F;
2158 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
2161 irmp_command
|= 0x80;
2167 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
2174 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
2179 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2180 case IRMP_LEGO_PROTOCOL
:
2182 uint_fast8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
2184 if ((irmp_command
& 0x000F) == crc
)
2192 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
2194 // rtc = TRUE; // don't accept codes with CRC errors
2209 irmp_data_p
->protocol
= irmp_protocol
;
2210 irmp_data_p
->address
= irmp_address
;
2211 irmp_data_p
->command
= irmp_command
;
2212 irmp_data_p
->flags
= irmp_flags
;
2218 irmp_ir_detected
= FALSE
;
2224 #if IRMP_USE_CALLBACK == 1
2226 irmp_set_callback_ptr (void (*cb
)(uint_fast8_t))
2228 irmp_callback_ptr
= cb
;
2230 #endif // IRMP_USE_CALLBACK == 1
2232 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
2233 static uint_fast16_t irmp_tmp_address
; // ir address
2234 static uint_fast16_t irmp_tmp_command
; // ir command
2236 #if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2237 static uint_fast16_t irmp_tmp_address2
; // ir address
2238 static uint_fast16_t irmp_tmp_command2
; // ir command
2241 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2242 static uint_fast16_t irmp_lgair_address
; // ir address
2243 static uint_fast16_t irmp_lgair_command
; // ir command
2246 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2247 static uint_fast16_t irmp_tmp_id
; // ir id (only SAMSUNG)
2249 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2250 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
2251 static uint_fast8_t genre2
; // save genre2 bits here, later copied to MSB in flags
2254 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2255 static uint_fast8_t parity
; // number of '1' of the first 14 bits, check if even.
2258 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2260 * @details store bit in temp address or temp command
2261 * @param value to store: 0 or 1
2262 *---------------------------------------------------------------------------------------------------------------------------------------------------
2264 // verhindert, dass irmp_store_bit() inline compiliert wird:
2265 // static void irmp_store_bit (uint_fast8_t) __attribute__ ((noinline));
2268 irmp_store_bit (uint_fast8_t value
)
2270 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
2271 if (irmp_param
.protocol
== IRMP_ACP24_PROTOCOL
) // squeeze 64 bits into 16 bits:
2277 // 0123456789012345678901234567890123456789012345678901234567890123456789
2278 // N VVMMM ? ??? t vmA x y TTTT
2280 // irmp_data_p->command:
2287 case 0: irmp_tmp_command
|= (1<<15); break; // N
2288 case 2: irmp_tmp_command
|= (1<<13); break; // V
2289 case 3: irmp_tmp_command
|= (1<<12); break; // V
2290 case 4: irmp_tmp_command
|= (1<<10); break; // M
2291 case 5: irmp_tmp_command
|= (1<< 9); break; // M
2292 case 6: irmp_tmp_command
|= (1<< 8); break; // M
2293 case 20: irmp_tmp_command
|= (1<< 6); break; // t
2294 case 22: irmp_tmp_command
|= (1<<11); break; // v
2295 case 23: irmp_tmp_command
|= (1<< 7); break; // m
2296 case 24: irmp_tmp_command
|= (1<<14); break; // A
2297 case 26: irmp_tmp_command
|= (1<< 5); break; // x
2298 case 44: irmp_tmp_command
|= (1<< 4); break; // y
2299 case 66: irmp_tmp_command
|= (1<< 3); break; // T
2300 case 67: irmp_tmp_command
|= (1<< 2); break; // T
2301 case 68: irmp_tmp_command
|= (1<< 1); break; // T
2302 case 69: irmp_tmp_command
|= (1<< 0); break; // T
2307 #endif // IRMP_SUPPORT_ACP24_PROTOCOL
2309 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2310 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
2319 else if (irmp_bit
== 14)
2321 if (value
) // value == 1: even parity
2325 parity
= PARITY_CHECK_FAILED
;
2329 parity
= PARITY_CHECK_OK
;
2334 if (parity
& 0x01) // value == 0: odd parity
2336 parity
= PARITY_CHECK_OK
;
2340 parity
= PARITY_CHECK_FAILED
;
2351 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2352 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
2359 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
2361 if (irmp_param
.lsb_first
)
2363 irmp_tmp_address
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2367 irmp_tmp_address
<<= 1;
2368 irmp_tmp_address
|= value
;
2371 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2373 if (irmp_param
.lsb_first
)
2375 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
2376 if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
>= 32)
2378 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 32)); // CV wants cast
2383 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2388 irmp_tmp_command
<<= 1;
2389 irmp_tmp_command
|= value
;
2393 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2394 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2398 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2399 irmp_lgair_address
|= value
;
2401 else if (irmp_bit
< 24)
2403 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2404 irmp_lgair_command
|= value
;
2410 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2411 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2413 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2418 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2419 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2421 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2426 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2427 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2429 if (irmp_bit
>= 20 && irmp_bit
< 24)
2431 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2433 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2435 genre2
|= (((uint_fast8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2438 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2442 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2446 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2459 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2461 * @details store bit in temp address or temp command
2462 * @param value to store: 0 or 1
2463 *---------------------------------------------------------------------------------------------------------------------------------------------------
2465 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2467 irmp_store_bit2 (uint_fast8_t value
)
2469 uint_fast8_t irmp_bit2
;
2471 if (irmp_param
.protocol
)
2473 irmp_bit2
= irmp_bit
- 2;
2477 irmp_bit2
= irmp_bit
- 1;
2480 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2482 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2484 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2486 irmp_tmp_command2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2489 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2491 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2493 * @details ISR routine, called 10000 times per second
2494 *---------------------------------------------------------------------------------------------------------------------------------------------------
2499 static uint_fast8_t irmp_start_bit_detected
; // flag: start bit detected
2500 static uint_fast8_t wait_for_space
; // flag: wait for data bit space
2501 static uint_fast8_t wait_for_start_space
; // flag: wait for start bit space
2502 static uint_fast8_t irmp_pulse_time
; // count bit time for pulse
2503 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2504 static uint_fast16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2505 static uint_fast16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2506 static uint_fast16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2507 static uint_fast8_t repetition_frame_number
;
2508 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2509 static uint_fast16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2510 static uint_fast16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2512 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
2513 static uint_fast8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2515 #if IRMP_SUPPORT_MANCHESTER == 1
2516 static PAUSE_LEN last_pause
; // last pause value
2518 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2519 static uint_fast8_t last_value
; // last bit value
2521 uint_fast8_t irmp_input
; // input value
2527 #if defined(__SDCC_stm8)
2528 irmp_input
= input(IRMP_GPIO_STRUCT
->IDR
)
2530 irmp_input
= input(IRMP_PIN
);
2533 #if IRMP_USE_CALLBACK == 1
2534 if (irmp_callback_ptr
)
2536 static uint_fast8_t last_inverted_input
;
2538 if (last_inverted_input
!= !irmp_input
)
2540 (*irmp_callback_ptr
) (! irmp_input
);
2541 last_inverted_input
= !irmp_input
;
2544 #endif // IRMP_USE_CALLBACK == 1
2546 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2548 if (! irmp_ir_detected
) // ir code already detected?
2550 if (! irmp_start_bit_detected
) // start bit detected?
2552 if (! irmp_input
) // receiving burst?
2554 // irmp_busy_flag = TRUE;
2556 if (! irmp_pulse_time
)
2558 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2561 irmp_pulse_time
++; // increment counter
2565 if (irmp_pulse_time
) // it's dark....
2566 { // set flags for counting the time of darkness...
2567 irmp_start_bit_detected
= 1;
2568 wait_for_start_space
= 1;
2570 irmp_tmp_command
= 0;
2571 irmp_tmp_address
= 0;
2572 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2575 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2579 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2580 irmp_tmp_command2
= 0;
2581 irmp_tmp_address2
= 0;
2583 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2584 irmp_lgair_command
= 0;
2585 irmp_lgair_address
= 0;
2588 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2589 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
2590 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2595 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2597 key_repetition_len
++;
2599 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2600 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2602 denon_repetition_len
++;
2604 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2607 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2608 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2610 last_irmp_denon_command
= 0;
2611 denon_repetition_len
= 0xFFFF;
2614 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2621 if (wait_for_start_space
) // we have received start bit...
2622 { // ...and are counting the time of darkness
2623 if (irmp_input
) // still dark?
2625 irmp_pause_time
++; // increment counter
2627 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2628 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
) ||
2629 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2631 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2634 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2635 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2640 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2643 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
);
2644 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2648 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2649 irmp_pulse_time
= 0;
2650 irmp_pause_time
= 0;
2654 { // receiving first data pulse!
2655 IRMP_PARAMETER
* irmp_param_p
;
2656 irmp_param_p
= (IRMP_PARAMETER
*) 0;
2658 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2659 irmp_param2
.protocol
= 0;
2663 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2666 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2667 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2668 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2671 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2672 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2673 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2675 irmp_param_p
= (IRMP_PARAMETER
*) &sircs_param
;
2678 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2680 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2681 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2682 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2683 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2686 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2687 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2688 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2690 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2693 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2695 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2696 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2697 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2699 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2701 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2702 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2703 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2705 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2708 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2709 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2710 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2712 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2715 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2716 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2718 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2719 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2720 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2722 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2723 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2724 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2726 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2729 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2732 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2733 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2734 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2737 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2742 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2743 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2744 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2745 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2746 { // it's JVC repetition type 3
2748 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2749 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2750 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2752 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2755 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2757 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2759 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2760 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2761 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2764 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2765 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2766 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2768 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2771 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2773 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2774 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2775 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2778 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2779 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2780 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2782 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2785 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2787 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
2788 if (irmp_pulse_time
>= ACP24_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ACP24_START_BIT_PULSE_LEN_MAX
&&
2789 irmp_pause_time
>= ACP24_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ACP24_START_BIT_PAUSE_LEN_MAX
)
2792 ANALYZE_PRINTF ("protocol = ACP24, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2793 ACP24_START_BIT_PULSE_LEN_MIN
, ACP24_START_BIT_PULSE_LEN_MAX
,
2794 ACP24_START_BIT_PAUSE_LEN_MIN
, ACP24_START_BIT_PAUSE_LEN_MAX
);
2796 irmp_param_p
= (IRMP_PARAMETER
*) &acp24_param
;
2799 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2801 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2802 if (irmp_pulse_time
>= PENTAX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= PENTAX_START_BIT_PULSE_LEN_MAX
&&
2803 irmp_pause_time
>= PENTAX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= PENTAX_START_BIT_PAUSE_LEN_MAX
)
2806 ANALYZE_PRINTF ("protocol = PENTAX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2807 PENTAX_START_BIT_PULSE_LEN_MIN
, PENTAX_START_BIT_PULSE_LEN_MAX
,
2808 PENTAX_START_BIT_PAUSE_LEN_MIN
, PENTAX_START_BIT_PAUSE_LEN_MAX
);
2810 irmp_param_p
= (IRMP_PARAMETER
*) &pentax_param
;
2813 #endif // IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2815 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2816 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2817 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2820 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2821 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2822 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2824 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2827 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2829 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2830 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2831 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2834 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2835 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2836 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2838 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2841 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2843 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2844 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2845 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2846 { // it's MATSUSHITA
2848 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2849 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2850 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2852 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2855 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2857 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2858 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2859 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2862 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2863 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2864 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2866 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2869 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2871 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2872 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2873 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2876 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2877 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2878 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2880 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2883 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2885 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2886 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2887 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2890 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2891 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2892 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2894 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2897 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2899 #if IRMP_SUPPORT_S100_PROTOCOL == 1
2900 if (((irmp_pulse_time
>= S100_START_BIT_LEN_MIN
&& irmp_pulse_time
<= S100_START_BIT_LEN_MAX
) ||
2901 (irmp_pulse_time
>= 2 * S100_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * S100_START_BIT_LEN_MAX
)) &&
2902 ((irmp_pause_time
>= S100_START_BIT_LEN_MIN
&& irmp_pause_time
<= S100_START_BIT_LEN_MAX
) ||
2903 (irmp_pause_time
>= 2 * S100_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * S100_START_BIT_LEN_MAX
)))
2906 ANALYZE_PRINTF ("protocol = S100, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2907 S100_START_BIT_LEN_MIN
, S100_START_BIT_LEN_MAX
,
2908 2 * S100_START_BIT_LEN_MIN
, 2 * S100_START_BIT_LEN_MAX
,
2909 S100_START_BIT_LEN_MIN
, S100_START_BIT_LEN_MAX
,
2910 2 * S100_START_BIT_LEN_MIN
, 2 * S100_START_BIT_LEN_MAX
);
2913 irmp_param_p
= (IRMP_PARAMETER
*) &s100_param
;
2914 last_pause
= irmp_pause_time
;
2916 if ((irmp_pulse_time
> S100_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * S100_START_BIT_LEN_MAX
) ||
2917 (irmp_pause_time
> S100_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * S100_START_BIT_LEN_MAX
))
2920 rc5_cmd_bit6
= 1<<6;
2928 #endif // IRMP_SUPPORT_S100_PROTOCOL == 1
2930 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2931 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2932 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2933 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2934 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2936 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2937 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2938 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2941 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2942 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2943 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2944 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2945 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2946 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2947 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2949 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2952 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2954 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2955 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2956 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2959 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2960 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2961 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2962 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2963 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2964 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2965 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2967 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2970 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2973 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2974 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2975 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2976 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2977 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2981 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2982 last_pause
= irmp_pause_time
;
2984 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2985 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2988 rc5_cmd_bit6
= 1<<6;
2996 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2998 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2999 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
3000 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
3001 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
3004 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
3005 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3006 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
3007 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
3009 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
3012 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3014 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3015 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
3016 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
3017 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
3020 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
3021 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3022 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
3023 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
3025 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
3028 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3030 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
3031 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
3032 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
3035 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3036 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
3037 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
3039 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
3042 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
3044 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3045 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
3046 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
3049 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3050 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
3051 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
3053 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
3058 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3060 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
3061 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
3062 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
3065 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3066 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
3067 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
3069 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
3072 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
3074 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3075 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
3076 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
3079 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3080 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
3081 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
3083 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
3086 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3088 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
3089 if (irmp_pulse_time
>= FAN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FAN_START_BIT_PULSE_LEN_MAX
&&
3090 irmp_pause_time
>= FAN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FAN_START_BIT_PAUSE_LEN_MAX
)
3093 ANALYZE_PRINTF ("protocol = FAN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3094 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
,
3095 FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
);
3097 irmp_param_p
= (IRMP_PARAMETER
*) &fan_param
;
3100 #endif // IRMP_SUPPORT_FAN_PROTOCOL == 1
3102 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
3103 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
3104 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
3107 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3108 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
3109 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
3111 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
3114 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
3116 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3117 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
3118 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
3119 { // it's BANG_OLUFSEN
3121 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
3122 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3123 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3124 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3125 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3126 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3127 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3128 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3129 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3130 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3131 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3132 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3133 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3135 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
3139 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3141 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3142 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
3143 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
3146 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3147 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3148 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
3150 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
3151 last_pause
= irmp_pause_time
;
3155 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3157 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 // check MERLIN before RUWIDO!
3158 if (irmp_pulse_time
>= MERLIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MERLIN_START_BIT_PULSE_LEN_MAX
&&
3159 irmp_pause_time
>= MERLIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MERLIN_START_BIT_PAUSE_LEN_MAX
)
3162 ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3163 MERLIN_START_BIT_PULSE_LEN_MIN
, MERLIN_START_BIT_PULSE_LEN_MAX
,
3164 MERLIN_START_BIT_PAUSE_LEN_MIN
, MERLIN_START_BIT_PAUSE_LEN_MAX
);
3166 irmp_param_p
= (IRMP_PARAMETER
*) &merlin_param
;
3171 #endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1
3173 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3174 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
3175 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
3176 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
3177 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
3178 { // it's RUWIDO or SIEMENS
3180 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
3181 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3182 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3183 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3184 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
3186 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
3187 last_pause
= irmp_pause_time
;
3191 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3193 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3194 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
3195 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
3198 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3199 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
3200 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
3202 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
3205 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3207 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3208 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
3209 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
3212 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3213 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
3214 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
3216 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
3219 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3221 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3222 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
3223 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
3226 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3227 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
3228 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
3230 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
3233 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3235 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3236 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
3237 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
3240 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3241 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
3242 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
3244 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
3247 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3249 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
3250 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
3251 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
3254 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3255 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
3256 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
3258 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
3261 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
3263 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3264 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
3265 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
3268 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3269 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
3270 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
3272 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
3277 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3279 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3280 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
3281 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
3282 { // it's ORTEK (Hama)
3284 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3285 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
3286 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
3288 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
3294 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3296 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3297 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
3298 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
3301 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3302 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
3303 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
3305 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
3308 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3311 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
3313 irmp_start_bit_detected
= 0; // wait for another start bit...
3316 if (irmp_start_bit_detected
)
3318 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
3320 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3323 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
3324 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
3330 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
3331 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
3332 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
3333 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
3337 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3338 if (irmp_param2
.protocol
)
3341 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
3342 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
3343 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
3344 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
3350 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3351 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
3354 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
3359 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3362 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3363 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
3369 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
3370 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
3371 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
3372 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
3377 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3378 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3380 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3381 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
3385 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
3386 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
3387 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
3388 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
3394 #if IRMP_SUPPORT_MANCHESTER == 1
3395 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3396 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
3397 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
3399 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
3402 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3403 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3406 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
3408 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
3411 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3412 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);
3419 #endif // IRMP_SUPPORT_MANCHESTER == 1
3421 #if IRMP_SUPPORT_SERIAL == 1
3422 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3427 #endif // IRMP_SUPPORT_SERIAL == 1
3430 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3431 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3434 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3437 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
3438 { // pause timings correct for "1"?
3440 ANALYZE_PUTCHAR ('1'); // yes, store 1
3445 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
3446 { // pause timings correct for "0"?
3448 ANALYZE_PUTCHAR ('0'); // yes, store 0
3455 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3456 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3457 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
3460 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3463 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
3464 { // pause timings correct for "1"?
3466 ANALYZE_PUTCHAR ('1'); // yes, store 1
3471 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
3472 { // pause timings correct for "0"?
3474 ANALYZE_PUTCHAR ('0'); // yes, store 0
3481 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3483 ; // else do nothing
3486 irmp_pulse_time
= 1; // set counter to 1, not 0
3487 irmp_pause_time
= 0;
3488 wait_for_start_space
= 0;
3491 else if (wait_for_space
) // the data section....
3492 { // counting the time of darkness....
3493 uint_fast8_t got_light
= FALSE
;
3495 if (irmp_input
) // still dark?
3497 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
3500 #if IRMP_SUPPORT_MANCHESTER == 1
3501 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
3503 #if IRMP_SUPPORT_SERIAL == 1
3504 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
3506 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
3509 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3511 ANALYZE_PRINTF ("stop bit detected\n");
3514 irmp_param
.stop_bit
= 0;
3519 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",
3520 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3522 irmp_start_bit_detected
= 0; // wait for another start bit...
3523 irmp_pulse_time
= 0;
3524 irmp_pause_time
= 0;
3529 irmp_pause_time
++; // increment counter
3531 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3532 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
3533 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
3534 irmp_bit
>= 12 - 1) // pause too long?
3535 { // yes, break and close this frame
3536 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
3537 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3538 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
3539 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
3540 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
3544 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
3545 if (irmp_param
.protocol
== IRMP_FAN_PROTOCOL
&& // FAN has no stop bit.
3546 irmp_bit
>= FAN_COMPLETE_DATA_LEN
- 1) // last bit in frame
3547 { // yes, break and close this frame
3548 if (irmp_pulse_time
<= FAN_0_PULSE_LEN_MAX
&& irmp_pause_time
>= FAN_0_PAUSE_LEN_MIN
)
3551 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3553 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3555 else if (irmp_pulse_time
>= FAN_1_PULSE_LEN_MIN
&& irmp_pause_time
>= FAN_1_PAUSE_LEN_MIN
)
3558 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3560 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3565 #if IRMP_SUPPORT_SERIAL == 1
3566 // NETBOX generates no stop bit, here is the timeout condition:
3567 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
3568 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
3570 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3574 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3575 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
3577 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
3580 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
3582 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3583 irmp_param
.stop_bit
= TRUE
; // set flag
3585 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
3586 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
3587 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
3588 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
3589 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
3590 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
3592 irmp_tmp_command
<<= 1;
3593 irmp_tmp_command
|= first_bit
;
3595 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
3596 { // special manchester decoder
3597 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3598 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3599 irmp_param
.stop_bit
= TRUE
; // set flag
3601 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3604 ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit
);
3606 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3607 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3608 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3609 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3610 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3612 if (irmp_tmp_command
& 0x300)
3614 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3615 irmp_tmp_command
&= 0xFF;
3621 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3622 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3624 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3625 { // special manchester decoder
3626 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3627 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3628 irmp_param
.stop_bit
= TRUE
; // set flag
3630 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3633 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3635 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3636 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3637 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3638 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3639 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3642 // RUWIDO: AAAAAAAAACCCCCCCp
3643 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3644 irmp_tmp_address
<<= 2;
3645 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3646 irmp_tmp_command
&= 0x003F;
3647 // irmp_tmp_command <<= 4;
3648 irmp_tmp_command
|= last_value
;
3653 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3654 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3655 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3656 { // break and close this frame
3657 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3659 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3661 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3663 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3666 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3670 #if IRMP_SUPPORT_MANCHESTER == 1
3671 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3672 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3673 { // special manchester decoder
3674 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3675 irmp_param
.stop_bit
= TRUE
; // set flag
3678 #endif // IRMP_SUPPORT_MANCHESTER == 1
3679 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3681 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3685 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3686 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3689 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3691 irmp_param
.stop_bit
= TRUE
; // set flag
3692 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3693 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3694 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3695 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3696 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3698 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3699 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3700 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3703 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3705 irmp_param
.stop_bit
= TRUE
; // set flag
3706 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3707 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3708 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3709 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3710 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3712 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3714 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3715 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3716 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3719 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3721 irmp_param
.stop_bit
= TRUE
; // set flag
3722 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3723 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3725 // 0123456789ABC0123456789ABC0123456701234567
3726 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3727 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3728 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3729 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3731 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3732 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3733 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3736 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3738 irmp_param
.stop_bit
= TRUE
; // set flag
3739 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3740 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3741 irmp_tmp_address
= irmp_lgair_address
;
3742 irmp_tmp_command
= irmp_lgair_command
;
3744 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3745 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3746 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3749 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3751 irmp_param
.stop_bit
= TRUE
; // set flag
3752 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3753 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3755 // 0123456789ABC0123456789ABC0123456701234567
3756 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3757 // JVC: AAAACCCCCCCCCCCC
3758 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3759 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3761 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3762 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3764 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
3765 else if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
== 32) // it was a SAMSUNG32 stop bit
3768 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3770 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3771 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3772 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3773 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3775 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3777 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3778 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3782 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3783 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3786 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3788 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3790 else // if ((irmp_bit == 24)
3793 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3795 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3797 irmp_param
.stop_bit
= TRUE
; // set flag
3798 irmp_param
.complete_len
= irmp_bit
; // patch length
3800 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3802 #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
3803 else if (irmp_param
.protocol
== IRMP_MATSUSHITA_PROTOCOL
&& irmp_bit
== 22) // it was a TECHNICS stop bit
3806 ANALYZE_PRINTF ("Switching to TECHNICS protocol, irmp_bit = %d\n", irmp_bit
);
3809 // The first 12 bits have been stored in irmp_tmp_command (LSB first)
3810 // The following 10 bits have been stored in irmp_tmp_address (LSB first)
3811 // The code of TECHNICS is:
3812 // cccccccccccCCCCCCCCCCC (11 times c and 11 times C)
3813 // ccccccccccccaaaaaaaaaa
3814 // where C is inverted value of c
3816 irmp_tmp_address
<<= 1;
3817 if (irmp_tmp_command
& (1<<11))
3819 irmp_tmp_address
|= 1;
3820 irmp_tmp_command
&= ~(1<<11);
3823 if (irmp_tmp_command
== ((~irmp_tmp_address
) & 0x07FF))
3825 irmp_tmp_address
= 0;
3827 irmp_param
.protocol
= IRMP_TECHNICS_PROTOCOL
; // switch protocol
3828 irmp_param
.complete_len
= irmp_bit
; // patch length
3833 ANALYZE_PRINTF ("error 8: TECHNICS frame error\n");
3834 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3836 irmp_start_bit_detected
= 0; // wait for another start bit...
3837 irmp_pulse_time
= 0;
3838 irmp_pause_time
= 0;
3841 #endif // IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
3845 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3846 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3848 irmp_start_bit_detected
= 0; // wait for another start bit...
3849 irmp_pulse_time
= 0;
3850 irmp_pause_time
= 0;
3863 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3866 #if IRMP_SUPPORT_MANCHESTER == 1
3867 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3870 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3871 #else // better, but some IR-RCs use asymmetric timings :-/
3872 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3873 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3876 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3877 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3880 ANALYZE_PUTCHAR ('T');
3882 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3897 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3900 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3902 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3904 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3905 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3908 ANALYZE_PUTCHAR ('T');
3912 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3925 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3928 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3930 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3931 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3932 if (! irmp_param2
.protocol
)
3939 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3943 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3944 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3946 uint_fast8_t manchester_value
;
3948 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3950 manchester_value
= last_value
? 0 : 1;
3951 last_value
= manchester_value
;
3955 manchester_value
= last_value
;
3959 ANALYZE_PUTCHAR (manchester_value
+ '0');
3962 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3963 if (! irmp_param2
.protocol
)
3971 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3972 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3975 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3977 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3978 irmp_param
.address_offset
= 5;
3979 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3980 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3981 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3982 irmp_tmp_address
= 0;
3984 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3986 irmp_store_bit (manchester_value
);
3990 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3991 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3992 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3993 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3994 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3997 ANALYZE_PUTCHAR ('?');
3999 irmp_param
.protocol
= 0; // switch to FDC, see below
4002 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
4003 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
4004 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
4005 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
4006 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
4007 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
4010 ANALYZE_PUTCHAR ('?');
4012 irmp_param
.protocol
= 0; // switch to RCCAR, see below
4015 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
4018 ANALYZE_PUTCHAR ('?');
4020 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
4021 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4023 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4024 irmp_pause_time
= 0;
4028 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
4029 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
4031 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
4034 ANALYZE_PRINTF (" 1 (FDC)\n");
4036 irmp_store_bit2 (1);
4038 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
4041 ANALYZE_PRINTF (" 0 (FDC)\n");
4043 irmp_store_bit2 (0);
4046 if (! irmp_param
.protocol
)
4049 ANALYZE_PRINTF ("Switching to FDC protocol\n");
4051 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
4052 irmp_param2
.protocol
= 0;
4053 irmp_tmp_address
= irmp_tmp_address2
;
4054 irmp_tmp_command
= irmp_tmp_command2
;
4057 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
4058 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
4059 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
4061 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
4064 ANALYZE_PRINTF (" 1 (RCCAR)\n");
4066 irmp_store_bit2 (1);
4068 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
4071 ANALYZE_PRINTF (" 0 (RCCAR)\n");
4073 irmp_store_bit2 (0);
4076 if (! irmp_param
.protocol
)
4079 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
4081 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
4082 irmp_param2
.protocol
= 0;
4083 irmp_tmp_address
= irmp_tmp_address2
;
4084 irmp_tmp_command
= irmp_tmp_command2
;
4087 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
4089 last_pause
= irmp_pause_time
;
4093 #endif // IRMP_SUPPORT_MANCHESTER == 1
4095 #if IRMP_SUPPORT_SERIAL == 1
4096 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
4098 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
4101 ANALYZE_PUTCHAR ('1');
4105 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
4107 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
4111 irmp_pulse_time
= 0;
4115 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
4118 ANALYZE_PUTCHAR ('0');
4122 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
4124 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
4128 irmp_pause_time
= 0;
4137 #endif // IRMP_SUPPORT_SERIAL == 1
4139 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4140 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
4142 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
4143 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
4146 ANALYZE_PRINTF ("SYNC\n");
4151 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
4153 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
4155 ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol ");
4157 irmp_param
.protocol
= IRMP_SAMSUNG48_PROTOCOL
;
4158 irmp_param
.command_offset
= SAMSUNG48_COMMAND_OFFSET
;
4159 irmp_param
.command_end
= SAMSUNG48_COMMAND_OFFSET
+ SAMSUNG48_COMMAND_LEN
;
4160 irmp_param
.complete_len
= SAMSUNG48_COMPLETE_DATA_LEN
;
4163 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol ");
4165 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
4166 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
4167 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
4168 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
4170 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
4173 ANALYZE_PUTCHAR ('1');
4182 ANALYZE_PUTCHAR ('0');
4190 { // timing incorrect!
4192 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
4193 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4195 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4196 irmp_pause_time
= 0;
4200 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
4202 #if IRMP_SUPPORT_NEC16_PROTOCOL
4203 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
4204 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
4205 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
4206 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
4207 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
4208 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
4211 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
4213 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
4214 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
4215 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
4216 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
4217 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
4218 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
4222 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
4224 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
4225 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
4227 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
4229 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
4231 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
4234 ANALYZE_PRINTF ("3rd start bit\n");
4240 { // timing incorrect!
4242 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
);
4243 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4245 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4246 irmp_pause_time
= 0;
4249 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
4251 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
4254 ANALYZE_PRINTF ("trailer bit\n");
4260 { // timing incorrect!
4262 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
);
4263 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4265 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4266 irmp_pause_time
= 0;
4271 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
4272 { // pulse & pause timings correct for "1"?
4274 ANALYZE_PUTCHAR ('1');
4281 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
4282 { // pulse & pause timings correct for "0"?
4284 ANALYZE_PUTCHAR ('0');
4291 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
4294 ANALYZE_PUTCHAR (last_value
+ '0');
4297 irmp_store_bit (last_value
);
4301 { // timing incorrect!
4303 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
);
4304 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4306 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4307 irmp_pause_time
= 0;
4312 { // timing incorrect!
4314 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
);
4315 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4317 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4318 irmp_pause_time
= 0;
4322 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
4324 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
4325 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
4327 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
4330 ANALYZE_PUTCHAR ('0');
4331 ANALYZE_PUTCHAR ('0');
4336 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
4339 ANALYZE_PUTCHAR ('0');
4340 ANALYZE_PUTCHAR ('1');
4345 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
4348 ANALYZE_PUTCHAR ('1');
4349 ANALYZE_PUTCHAR ('0');
4354 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
4357 ANALYZE_PUTCHAR ('1');
4358 ANALYZE_PUTCHAR ('1');
4364 ANALYZE_PRINTF ("\n");
4371 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
4372 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
4373 { // pulse & pause timings correct for "1"?
4375 ANALYZE_PUTCHAR ('1');
4381 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
4382 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
4383 { // pulse & pause timings correct for "0"?
4385 ANALYZE_PUTCHAR ('0');
4392 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
4394 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
4395 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
4396 (((irmp_bit
== 8 || irmp_bit
== 6) &&
4397 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
4399 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
4406 ANALYZE_PUTCHAR ('S');
4409 irmp_tmp_command
<<= 1;
4414 ANALYZE_PUTCHAR ('S');
4422 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
4423 { // timing incorrect!
4425 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
4426 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4428 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4429 irmp_pause_time
= 0;
4432 irmp_pulse_time
= 1; // set counter to 1, not 0
4436 { // counting the pulse length ...
4437 if (! irmp_input
) // still light?
4439 irmp_pulse_time
++; // increment counter
4443 wait_for_space
= 1; // let's count the time (see above)
4444 irmp_pause_time
= 1; // set pause counter to 1, not 0
4448 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
4450 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
4452 repetition_frame_number
++;
4456 repetition_frame_number
= 0;
4459 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
4460 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
4461 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
4464 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4465 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4467 key_repetition_len
= 0;
4472 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4473 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4474 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
4477 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4478 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4480 key_repetition_len
= 0;
4485 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4486 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4487 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
4490 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4491 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4493 key_repetition_len
= 0;
4498 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4499 // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4500 if ((irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
|| irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
) && (repetition_frame_number
& 0x01))
4503 ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4504 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4506 key_repetition_len
= 0;
4511 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
4512 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4513 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
4516 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4517 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4519 key_repetition_len
= 0;
4524 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
4525 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4526 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
4529 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4530 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4532 key_repetition_len
= 0;
4539 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
4541 irmp_ir_detected
= TRUE
;
4543 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
4544 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
4545 { // check for repetition frame
4546 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
4548 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
4549 last_irmp_denon_command
= 0;
4551 irmp_protocol
= irmp_param
.protocol
; // store protocol
4552 irmp_address
= irmp_tmp_address
; // store address
4553 irmp_command
= irmp_tmp_command
; // store command
4557 if ((irmp_tmp_command
& 0x01) == 0x00)
4560 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4562 last_irmp_denon_command
= irmp_tmp_command
;
4563 denon_repetition_len
= 0;
4564 irmp_ir_detected
= FALSE
;
4569 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4571 last_irmp_denon_command
= 0;
4572 irmp_ir_detected
= FALSE
;
4577 #endif // IRMP_SUPPORT_DENON_PROTOCOL
4579 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
4580 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
4581 { // Grundig start frame?
4583 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
4585 irmp_ir_detected
= FALSE
;
4588 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
4590 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
4591 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
4592 { // Nokia start frame?
4594 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
4596 irmp_ir_detected
= FALSE
;
4599 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
4601 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4602 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
4604 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
4607 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
4608 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
4610 irmp_tmp_address
= last_irmp_address
; // address is last address
4611 irmp_tmp_command
= last_irmp_command
; // command is last command
4612 irmp_flags
|= IRMP_FLAG_REPETITION
;
4613 key_repetition_len
= 0;
4618 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
4619 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
4621 irmp_ir_detected
= FALSE
;
4624 #endif // IRMP_SUPPORT_NEC_PROTOCOL
4626 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4627 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
4629 uint_fast8_t xor_value
;
4631 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
4633 if (xor_value
!= (xor_check
[2] & 0x0F))
4636 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
4638 irmp_ir_detected
= FALSE
;
4641 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
4643 if (xor_value
!= xor_check
[5])
4646 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
4648 irmp_ir_detected
= FALSE
;
4651 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
4653 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4655 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4656 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
4658 if (parity
== PARITY_CHECK_FAILED
)
4661 ANALYZE_PRINTF ("error 6: parity check failed\n");
4663 irmp_ir_detected
= FALSE
;
4666 if ((irmp_tmp_address
& 0x03) == 0x02)
4669 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
4671 irmp_ir_detected
= FALSE
;
4673 irmp_tmp_address
>>= 2;
4675 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4677 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
4678 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
4680 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
4683 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
4685 irmp_protocol
= irmp_param
.protocol
;
4688 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
4689 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
4691 if (irmp_tmp_command
& 0x000F) // released key?
4693 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
4697 irmp_tmp_command
>>= 4; // no, it's a pressed key
4699 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
4700 irmp_tmp_address
&= 0x003F;
4704 irmp_address
= irmp_tmp_address
; // store address
4705 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4706 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
4708 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4712 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
4713 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
4715 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4718 #if IRMP_SUPPORT_S100_PROTOCOL == 1
4719 if (irmp_param
.protocol
== IRMP_S100_PROTOCOL
)
4721 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4724 irmp_command
= irmp_tmp_command
; // store command
4726 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4727 irmp_id
= irmp_tmp_id
;
4732 if (irmp_ir_detected
)
4734 if (last_irmp_command
== irmp_tmp_command
&&
4735 last_irmp_address
== irmp_tmp_address
&&
4736 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
4738 irmp_flags
|= IRMP_FLAG_REPETITION
;
4741 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4742 last_irmp_command
= irmp_tmp_command
; // store as last command, too
4744 key_repetition_len
= 0;
4749 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4753 irmp_start_bit_detected
= 0; // and wait for next start bit
4754 irmp_tmp_command
= 0;
4755 irmp_pulse_time
= 0;
4756 irmp_pause_time
= 0;
4758 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
4759 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
4760 { // set pulse time here!
4761 irmp_pulse_time
= ((uint_fast8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
4763 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
4768 #if defined(STELLARIS_ARM_CORTEX_M4)
4769 // Clear the timer interrupt
4770 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
4773 return (irmp_ir_detected
);
4778 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4779 * main functions - for Unix/Linux + Windows only!
4783 * Compile it under linux with:
4786 * usage: ./irmp [-v|-s|-a|-l|-p] < file
4792 * -l list pulse/pauses
4794 *---------------------------------------------------------------------------------------------------------------------------------------------------
4798 print_timings (void)
4800 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
4801 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
4803 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
4804 printf ("====================================================================================\n");
4805 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4806 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4807 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4808 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4810 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4811 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4812 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4813 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4815 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4816 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
,
4817 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4818 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4820 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4821 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4822 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4823 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4825 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4826 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4827 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4828 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4830 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4831 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4832 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4833 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4835 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4836 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4837 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4838 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4840 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4841 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4842 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4844 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4845 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4846 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4847 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4849 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4850 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4851 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4852 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4854 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4855 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4856 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4858 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4859 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4860 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4861 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4863 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4864 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4865 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4866 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4868 printf ("FAN 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4869 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
, FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
,
4870 FAN_0_PULSE_LEN_MIN
, FAN_0_PULSE_LEN_MAX
, FAN_0_PAUSE_LEN_MIN
, FAN_0_PAUSE_LEN_MAX
,
4871 FAN_1_PULSE_LEN_MIN
, FAN_1_PULSE_LEN_MAX
, FAN_1_PAUSE_LEN_MIN
, FAN_1_PAUSE_LEN_MAX
);
4873 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4874 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4875 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4876 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4878 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4879 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4880 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4882 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4883 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4884 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4886 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4887 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4888 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4890 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4891 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4892 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4894 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4895 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4896 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4898 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4899 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4900 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4901 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4903 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4904 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4905 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4906 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4907 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4908 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4909 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4911 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4912 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4913 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4914 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4916 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4917 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4918 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4919 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4921 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4922 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4923 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4924 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4926 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4927 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4928 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4929 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4932 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4933 printf ("================================================================================================\n");
4934 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4935 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4936 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4937 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4938 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4939 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4940 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4941 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4942 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4943 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4947 print_spectrum (char * text
, int * buf
, int is_pulse
)
4960 puts ("-----------------------------------------------------------------------------");
4961 printf ("%s:\n", text
);
4963 for (i
= 0; i
< 256; i
++)
4965 if (buf
[i
] > max_value
)
4971 for (i
= 1; i
< 200; i
++)
4976 value
= (buf
[i
] * 60) / max_value
;
4978 for (j
= 0; j
< value
; j
++)
4982 printf (" %d\n", buf
[i
]);
4993 average
= (float) sum
/ (float) counter
;
5004 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
5005 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
5006 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
5008 tolerance
= (max
- average
);
5010 if (average
- min
> tolerance
)
5012 tolerance
= average
- min
;
5015 tolerance
= tolerance
* 100 / average
;
5016 printf ("tol: %4.1f%%\n", tolerance
);
5026 #define STATE_LEFT_SHIFT 0x01
5027 #define STATE_RIGHT_SHIFT 0x02
5028 #define STATE_LEFT_CTRL 0x04
5029 #define STATE_LEFT_ALT 0x08
5030 #define STATE_RIGHT_ALT 0x10
5032 #define KEY_ESCAPE 0x1B // keycode = 0x006e
5033 #define KEY_MENUE 0x80 // keycode = 0x0070
5034 #define KEY_BACK 0x81 // keycode = 0x0071
5035 #define KEY_FORWARD 0x82 // keycode = 0x0072
5036 #define KEY_ADDRESS 0x83 // keycode = 0x0073
5037 #define KEY_WINDOW 0x84 // keycode = 0x0074
5038 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
5039 #define KEY_STOP 0x86 // keycode = 0x0076
5040 #define KEY_MAIL 0x87 // keycode = 0x0077
5041 #define KEY_FAVORITES 0x88 // keycode = 0x0078
5042 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
5043 #define KEY_SETUP 0x8A // keycode = 0x007a
5044 #define KEY_FONT 0x8B // keycode = 0x007b
5045 #define KEY_PRINT 0x8C // keycode = 0x007c
5046 #define KEY_ON_OFF 0x8E // keycode = 0x007c
5048 #define KEY_INSERT 0x90 // keycode = 0x004b
5049 #define KEY_DELETE 0x91 // keycode = 0x004c
5050 #define KEY_LEFT 0x92 // keycode = 0x004f
5051 #define KEY_HOME 0x93 // keycode = 0x0050
5052 #define KEY_END 0x94 // keycode = 0x0051
5053 #define KEY_UP 0x95 // keycode = 0x0053
5054 #define KEY_DOWN 0x96 // keycode = 0x0054
5055 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
5056 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
5057 #define KEY_RIGHT 0x99 // keycode = 0x0059
5058 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
5059 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
5062 get_fdc_key (uint_fast16_t cmd
)
5064 static uint8_t key_table
[128] =
5066 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
5067 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
5068 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
5069 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
5070 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
5072 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
5073 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
5074 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
5075 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
5077 static uint_fast8_t state
;
5079 uint_fast8_t key
= 0;
5083 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
5084 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
5085 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
5086 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
5087 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
5088 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
5089 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
5090 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
5091 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
5092 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
5094 case 0x006e: key
= KEY_ESCAPE
; break;
5095 case 0x004b: key
= KEY_INSERT
; break;
5096 case 0x004c: key
= KEY_DELETE
; break;
5097 case 0x004f: key
= KEY_LEFT
; break;
5098 case 0x0050: key
= KEY_HOME
; break;
5099 case 0x0051: key
= KEY_END
; break;
5100 case 0x0053: key
= KEY_UP
; break;
5101 case 0x0054: key
= KEY_DOWN
; break;
5102 case 0x0055: key
= KEY_PAGE_UP
; break;
5103 case 0x0056: key
= KEY_PAGE_DOWN
; break;
5104 case 0x0059: key
= KEY_RIGHT
; break;
5105 case 0x0400: key
= KEY_MOUSE_1
; break;
5106 case 0x0800: key
= KEY_MOUSE_2
; break;
5110 if (!(cmd
& 0x80)) // pressed key
5112 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
5114 key
= cmd
+ 0x10; // 7x -> 8x
5116 else if (cmd
< 64) // key listed in key_table
5118 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
5122 case 0x0003: key
= '²'; break;
5123 case 0x0008: key
= '{'; break;
5124 case 0x0009: key
= '['; break;
5125 case 0x000A: key
= ']'; break;
5126 case 0x000B: key
= '}'; break;
5127 case 0x000C: key
= '\\'; break;
5128 case 0x001C: key
= '~'; break;
5129 case 0x002D: key
= '|'; break;
5130 case 0x0034: key
= 0xB5; break; // Mu
5133 else if (state
& (STATE_LEFT_CTRL
))
5135 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
5137 key
= key_table
[cmd
] - 'a' + 1;
5141 key
= key_table
[cmd
];
5146 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
5150 key
= key_table
[idx
];
5162 static int analyze
= FALSE
;
5163 static int list
= FALSE
;
5164 static IRMP_DATA irmp_data
;
5165 static int expected_protocol
;
5166 static int expected_address
;
5167 static int expected_command
;
5168 static int do_check_expected_values
;
5173 if (! analyze
&& ! list
)
5177 if (irmp_get_data (&irmp_data
))
5181 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
5185 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
5188 if (irmp_data
.protocol
== IRMP_ACP24_PROTOCOL
)
5190 uint16_t temp
= (irmp_data
.command
& 0x000F) + 15;
5192 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, temp=%d",
5193 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, temp
);
5195 else if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
5197 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
5199 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
5200 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
5202 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
5204 char * p
= (char *) NULL
;
5208 case '\t' : p
= "TAB"; break;
5209 case '\r' : p
= "CR"; break;
5210 case KEY_ESCAPE
: p
= "ESCAPE"; break;
5211 case KEY_MENUE
: p
= "MENUE"; break;
5212 case KEY_BACK
: p
= "BACK"; break;
5213 case KEY_FORWARD
: p
= "FORWARD"; break;
5214 case KEY_ADDRESS
: p
= "ADDRESS"; break;
5215 case KEY_WINDOW
: p
= "WINDOW"; break;
5216 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
5217 case KEY_STOP
: p
= "STOP"; break;
5218 case KEY_MAIL
: p
= "MAIL"; break;
5219 case KEY_FAVORITES
: p
= "FAVORITES"; break;
5220 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
5221 case KEY_SETUP
: p
= "SETUP"; break;
5222 case KEY_FONT
: p
= "FONT"; break;
5223 case KEY_PRINT
: p
= "PRINT"; break;
5224 case KEY_ON_OFF
: p
= "ON_OFF"; break;
5226 case KEY_INSERT
: p
= "INSERT"; break;
5227 case KEY_DELETE
: p
= "DELETE"; break;
5228 case KEY_LEFT
: p
= "LEFT"; break;
5229 case KEY_HOME
: p
= "HOME"; break;
5230 case KEY_END
: p
= "END"; break;
5231 case KEY_UP
: p
= "UP"; break;
5232 case KEY_DOWN
: p
= "DOWN"; break;
5233 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
5234 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
5235 case KEY_RIGHT
: p
= "RIGHT"; break;
5236 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
5237 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
5238 default : p
= "<UNKNWON>"; break;
5241 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
5242 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
5246 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
5247 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
5252 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
5253 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
5256 if (do_check_expected_values
)
5258 if (irmp_data
.protocol
!= expected_protocol
||
5259 irmp_data
.address
!= expected_address
||
5260 irmp_data
.command
!= expected_command
)
5262 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
5263 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
5267 printf (" checked!\n");
5269 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
5280 main (int argc
, char ** argv
)
5288 int start_pulses
[256];
5289 int start_pauses
[256];
5293 int first_pulse
= TRUE
;
5294 int first_pause
= TRUE
;
5298 if (! strcmp (argv
[1], "-v"))
5302 else if (! strcmp (argv
[1], "-l"))
5306 else if (! strcmp (argv
[1], "-a"))
5310 else if (! strcmp (argv
[1], "-s"))
5314 else if (! strcmp (argv
[1], "-p"))
5319 else if (! strcmp (argv
[1], "-r"))
5325 for (i
= 0; i
< 256; i
++)
5327 start_pulses
[i
] = 0;
5328 start_pauses
[i
] = 0;
5335 while ((ch
= getchar ()) != EOF
)
5337 if (ch
== '_' || ch
== '0')
5345 printf ("pause: %d\n", pause
);
5354 start_pauses
[pause
]++;
5356 first_pause
= FALSE
;
5372 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
5378 printf ("pulse: %d ", pulse
);
5387 start_pulses
[pulse
]++;
5389 first_pulse
= FALSE
;
5405 else if (ch
== '\n')
5410 if (list
&& pause
> 0)
5412 printf ("pause: %d\n", pause
);
5418 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
5432 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5443 puts ("----------------------------------------------------------------------");
5447 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5449 if (ch
!= '\r') // ignore CR in DOS/Windows files
5451 if (ch
== '[' && idx
== -1)
5459 do_check_expected_values
= FALSE
;
5463 expected_protocol
= atoi (buf
);
5465 if (expected_protocol
> 0)
5474 if (sscanf (p
, "%x", &expected_address
) == 1)
5476 do_check_expected_values
= TRUE
;
5483 if (do_check_expected_values
)
5485 do_check_expected_values
= FALSE
;
5493 if (sscanf (p
, "%x", &expected_command
) == 1)
5495 do_check_expected_values
= TRUE
;
5502 if (do_check_expected_values
)
5504 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
5509 else if (idx
< 1024 - 2)
5529 print_spectrum ("START PULSES", start_pulses
, TRUE
);
5530 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
5531 print_spectrum ("PULSES", pulses
, TRUE
);
5532 print_spectrum ("PAUSES", pauses
, FALSE
);
5533 puts ("-----------------------------------------------------------------------------");