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.172 2015/05/27 09:33:14 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_RC6_PROTOCOL == 1 || \
41 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
42 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
43 IRMP_SUPPORT_IR60_PROTOCOL == 1 || \
44 IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1 || \
45 IRMP_SUPPORT_MERLIN_PROTOCOL == 1 || \
46 IRMP_SUPPORT_ORTEK_PROTOCOL == 1
47 # define IRMP_SUPPORT_MANCHESTER 1
49 # define IRMP_SUPPORT_MANCHESTER 0
52 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
53 # define IRMP_SUPPORT_SERIAL 1
55 # define IRMP_SUPPORT_SERIAL 0
58 #define IRMP_KEY_REPETITION_LEN (uint_fast16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
60 #define MIN_TOLERANCE_00 1.0 // -0%
61 #define MAX_TOLERANCE_00 1.0 // +0%
63 #define MIN_TOLERANCE_05 0.95 // -5%
64 #define MAX_TOLERANCE_05 1.05 // +5%
66 #define MIN_TOLERANCE_10 0.9 // -10%
67 #define MAX_TOLERANCE_10 1.1 // +10%
69 #define MIN_TOLERANCE_15 0.85 // -15%
70 #define MAX_TOLERANCE_15 1.15 // +15%
72 #define MIN_TOLERANCE_20 0.8 // -20%
73 #define MAX_TOLERANCE_20 1.2 // +20%
75 #define MIN_TOLERANCE_30 0.7 // -30%
76 #define MAX_TOLERANCE_30 1.3 // +30%
78 #define MIN_TOLERANCE_40 0.6 // -40%
79 #define MAX_TOLERANCE_40 1.4 // +40%
81 #define MIN_TOLERANCE_50 0.5 // -50%
82 #define MAX_TOLERANCE_50 1.5 // +50%
84 #define MIN_TOLERANCE_60 0.4 // -60%
85 #define MAX_TOLERANCE_60 1.6 // +60%
87 #define MIN_TOLERANCE_70 0.3 // -70%
88 #define MAX_TOLERANCE_70 1.7 // +70%
90 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
91 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
92 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
93 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
94 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
95 #else // only 5% + 1 to avoid conflict with RC6:
96 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
98 #define SIRCS_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
99 #define SIRCS_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
100 #define SIRCS_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
101 #define SIRCS_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
102 #define SIRCS_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
103 #define SIRCS_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
105 #define NEC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
106 #define NEC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
107 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
108 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
109 #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)
110 #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)
111 #define NEC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
112 #define NEC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
113 #define NEC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
114 #define NEC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
115 #define NEC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
116 #define NEC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
117 // autodetect nec repetition frame within 50 msec:
118 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
120 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
122 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
125 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
126 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
127 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
128 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
129 #define SAMSUNG_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
130 #define SAMSUNG_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
131 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
132 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
133 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
134 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
136 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
137 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
138 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
139 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
140 #define MATSUSHITA_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
141 #define MATSUSHITA_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
142 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
143 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
144 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
145 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
147 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
148 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
149 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
150 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
151 #define KASEIKYO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
152 #define KASEIKYO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
153 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
154 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
155 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
156 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
158 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
159 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
160 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
161 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
162 #define RECS80_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
163 #define RECS80_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
164 #define RECS80_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
165 #define RECS80_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
166 #define RECS80_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
167 #define RECS80_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
170 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
171 #define RC5_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
172 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
174 #define RC5_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
175 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
178 #define RC5_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
179 #define RC5_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
181 #define DENON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
182 #define DENON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
183 #define DENON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
184 #define DENON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
185 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
186 #define DENON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
187 #define DENON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
188 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint_fast16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
190 #define THOMSON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
191 #define THOMSON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
192 #define THOMSON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
193 #define THOMSON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
194 #define THOMSON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
195 #define THOMSON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
197 #define RC6_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
198 #define RC6_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
199 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
200 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
201 #define RC6_TOGGLE_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
202 #define RC6_TOGGLE_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
203 #define RC6_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
204 #define RC6_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
205 #define RC6_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
206 #define RC6_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
208 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
209 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
210 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
211 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
212 #define RECS80EXT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
213 #define RECS80EXT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
214 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
215 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
216 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
217 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
219 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
220 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
221 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
222 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
223 #define NUBERT_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
224 #define NUBERT_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
225 #define NUBERT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
226 #define NUBERT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
227 #define NUBERT_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
228 #define NUBERT_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
229 #define NUBERT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
230 #define NUBERT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
232 #define FAN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
233 #define FAN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
234 #define FAN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
235 #define FAN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
236 #define FAN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
237 #define FAN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
238 #define FAN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
239 #define FAN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
240 #define FAN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
241 #define FAN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
242 #define FAN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
243 #define FAN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
245 #define SPEAKER_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
246 #define SPEAKER_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
247 #define SPEAKER_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
248 #define SPEAKER_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
249 #define SPEAKER_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
250 #define SPEAKER_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
251 #define SPEAKER_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
252 #define SPEAKER_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
253 #define SPEAKER_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
254 #define SPEAKER_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
255 #define SPEAKER_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
256 #define SPEAKER_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
258 #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)
259 #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)
260 #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)
261 #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)
262 #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)
263 #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)
264 #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)
265 #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)
266 #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)
267 #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)
268 #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)
269 #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
270 #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)
271 #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)
272 #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)
273 #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)
274 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
275 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
276 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
277 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
278 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
279 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
280 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
281 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
282 #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)
283 #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)
285 #define IR60_TIMEOUT_LEN ((uint_fast8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
286 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
287 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
288 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
289 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #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)
291 #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)
293 #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)
294 #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)
295 #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)
296 #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)
297 #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)
298 #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)
299 #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)
300 #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)
302 #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
303 #define FDC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
304 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
305 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
306 #define FDC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
307 #define FDC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
308 #define FDC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
309 #define FDC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
311 #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
313 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
315 #define FDC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
317 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
318 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
319 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
320 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
321 #define RCCAR_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
322 #define RCCAR_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
323 #define RCCAR_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
324 #define RCCAR_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
325 #define RCCAR_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
326 #define RCCAR_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
328 #define JVC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
329 #define JVC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
330 #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!
331 #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!
332 #define JVC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
333 #define JVC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
334 #define JVC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
335 #define JVC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
336 #define JVC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
337 #define JVC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
338 // autodetect JVC repetition frame within 50 msec:
339 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
341 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
342 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
343 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
344 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
345 #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)
346 #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)
347 #define NIKON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
348 #define NIKON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
349 #define NIKON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
350 #define NIKON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
351 #define NIKON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
352 #define NIKON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
353 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
355 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
356 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
357 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
358 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
359 #define KATHREIN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
360 #define KATHREIN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
361 #define KATHREIN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
362 #define KATHREIN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
363 #define KATHREIN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
364 #define KATHREIN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
365 #define KATHREIN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
366 #define KATHREIN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
367 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
368 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
370 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
371 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
372 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
373 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
374 #define NETBOX_PULSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
375 #define NETBOX_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
376 #define NETBOX_PULSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
377 #define NETBOX_PAUSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
379 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
380 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
381 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
382 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
383 #define LEGO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
384 #define LEGO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
385 #define LEGO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
386 #define LEGO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
387 #define LEGO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
388 #define LEGO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
390 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
391 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
392 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
393 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
394 #define BOSE_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
395 #define BOSE_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
396 #define BOSE_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
397 #define BOSE_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
398 #define BOSE_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
399 #define BOSE_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
400 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
402 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
403 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
404 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
405 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
406 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
407 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
408 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
409 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
411 #define MERLIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
412 #define MERLIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
413 #define MERLIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
414 #define MERLIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
415 #define MERLIN_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
416 #define MERLIN_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
417 #define MERLIN_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
418 #define MERLIN_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
420 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
421 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
422 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
423 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
424 #define ORTEK_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
425 #define ORTEK_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
426 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
427 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
429 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
430 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
431 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
432 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
433 #define TELEFUNKEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
434 #define TELEFUNKEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
435 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
436 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
437 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
438 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
439 // autodetect TELEFUNKEN repetition frame within 50 msec:
440 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
442 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
443 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
444 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
445 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
446 #define ROOMBA_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))
447 #define ROOMBA_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
448 #define ROOMBA_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
449 #define ROOMBA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
450 #define ROOMBA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
451 #define ROOMBA_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
452 #define ROOMBA_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
453 #define ROOMBA_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
454 #define ROOMBA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
455 #define ROOMBA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
457 #define RCMM32_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
458 #define RCMM32_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
459 #define RCMM32_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
460 #define RCMM32_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
461 #define RCMM32_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
462 #define RCMM32_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
463 #define RCMM32_BIT_00_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
464 #define RCMM32_BIT_00_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
465 #define RCMM32_BIT_01_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
466 #define RCMM32_BIT_01_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
467 #define RCMM32_BIT_10_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
468 #define RCMM32_BIT_10_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
469 #define RCMM32_BIT_11_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
470 #define RCMM32_BIT_11_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
472 #define PENTAX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
473 #define PENTAX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
474 #define PENTAX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
475 #define PENTAX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
476 #define PENTAX_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME + 0.5))
477 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
478 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
479 #define PENTAX_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
480 #define PENTAX_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
481 #define PENTAX_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME))
482 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
483 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
484 #define PENTAX_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
485 #define PENTAX_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
487 #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
488 #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
489 #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
490 #define RADIO1_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
491 #define RADIO1_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))
492 #define RADIO1_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
493 #define RADIO1_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
494 #define RADIO1_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
495 #define RADIO1_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
496 #define RADIO1_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))
497 #define RADIO1_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
498 #define RADIO1_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
499 #define RADIO1_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
500 #define RADIO1_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
502 #define AUTO_FRAME_REPETITION_LEN (uint_fast16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint_fast16_t!
505 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
506 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
507 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
508 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
509 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
511 static int time_counter
;
514 /******************************* not every PIC compiler knows variadic macros :-(
516 # define ANALYZE_PUTCHAR(a)
517 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
518 # define ANALYZE_PRINTF(...)
519 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
521 # define ANALYZE_NEWLINE()
522 *********************************/
525 #if IRMP_USE_CALLBACK == 1
526 static void (*irmp_callback_ptr
) (uint_fast8_t);
527 #endif // IRMP_USE_CALLBACK == 1
529 #define PARITY_CHECK_OK 1
530 #define PARITY_CHECK_FAILED 0
532 /*---------------------------------------------------------------------------------------------------------------------------------------------------
534 *---------------------------------------------------------------------------------------------------------------------------------------------------
536 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
537 static const char proto_unknown
[] PROGMEM
= "UNKNOWN";
538 static const char proto_sircs
[] PROGMEM
= "SIRCS";
539 static const char proto_nec
[] PROGMEM
= "NEC";
540 static const char proto_samsung
[] PROGMEM
= "SAMSUNG";
541 static const char proto_matsushita
[] PROGMEM
= "MATSUSH";
542 static const char proto_kaseikyo
[] PROGMEM
= "KASEIKYO";
543 static const char proto_recs80
[] PROGMEM
= "RECS80";
544 static const char proto_rc5
[] PROGMEM
= "RC5";
545 static const char proto_denon
[] PROGMEM
= "DENON";
546 static const char proto_rc6
[] PROGMEM
= "RC6";
547 static const char proto_samsung32
[] PROGMEM
= "SAMSG32";
548 static const char proto_apple
[] PROGMEM
= "APPLE";
549 static const char proto_recs80ext
[] PROGMEM
= "RECS80EX";
550 static const char proto_nubert
[] PROGMEM
= "NUBERT";
551 static const char proto_bang_olufsen
[] PROGMEM
= "BANG OLU";
552 static const char proto_grundig
[] PROGMEM
= "GRUNDIG";
553 static const char proto_nokia
[] PROGMEM
= "NOKIA";
554 static const char proto_siemens
[] PROGMEM
= "SIEMENS";
555 static const char proto_fdc
[] PROGMEM
= "FDC";
556 static const char proto_rccar
[] PROGMEM
= "RCCAR";
557 static const char proto_jvc
[] PROGMEM
= "JVC";
558 static const char proto_rc6a
[] PROGMEM
= "RC6A";
559 static const char proto_nikon
[] PROGMEM
= "NIKON";
560 static const char proto_ruwido
[] PROGMEM
= "RUWIDO";
561 static const char proto_ir60
[] PROGMEM
= "IR60";
562 static const char proto_kathrein
[] PROGMEM
= "KATHREIN";
563 static const char proto_netbox
[] PROGMEM
= "NETBOX";
564 static const char proto_nec16
[] PROGMEM
= "NEC16";
565 static const char proto_nec42
[] PROGMEM
= "NEC42";
566 static const char proto_lego
[] PROGMEM
= "LEGO";
567 static const char proto_thomson
[] PROGMEM
= "THOMSON";
568 static const char proto_bose
[] PROGMEM
= "BOSE";
569 static const char proto_a1tvbox
[] PROGMEM
= "A1TVBOX";
570 static const char proto_ortek
[] PROGMEM
= "ORTEK";
571 static const char proto_telefunken
[] PROGMEM
= "TELEFUNKEN";
572 static const char proto_roomba
[] PROGMEM
= "ROOMBA";
573 static const char proto_rcmm32
[] PROGMEM
= "RCMM32";
574 static const char proto_rcmm24
[] PROGMEM
= "RCMM24";
575 static const char proto_rcmm12
[] PROGMEM
= "RCMM12";
576 static const char proto_speaker
[] PROGMEM
= "SPEAKER";
577 static const char proto_lgair
[] PROGMEM
= "LGAIR";
578 static const char proto_samsung48
[] PROGMEM
= "SAMSG48";
579 static const char proto_merlin
[] PROGMEM
= "MERLIN";
580 static const char proto_pentax
[] PROGMEM
= "PENTAX";
581 static const char proto_fan
[] PROGMEM
= "FAN";
583 static const char proto_radio1
[] PROGMEM
= "RADIO1";
586 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] PROGMEM
=
638 /*---------------------------------------------------------------------------------------------------------------------------------------------------
640 *---------------------------------------------------------------------------------------------------------------------------------------------------
642 #if IRMP_LOGGING == 1 // logging via UART
644 #if defined(ARM_STM32F4XX)
645 # define STM32_GPIO_CLOCK RCC_AHB1Periph_GPIOA // UART2 on PA2
646 # define STM32_UART_CLOCK RCC_APB1Periph_USART2
647 # define STM32_GPIO_PORT GPIOA
648 # define STM32_GPIO_PIN GPIO_Pin_2
649 # define STM32_GPIO_SOURCE GPIO_PinSource2
650 # define STM32_UART_AF GPIO_AF_USART2
651 # define STM32_UART_COM USART2
652 # define STM32_UART_BAUD 115200 // 115200 Baud
653 # include "stm32f4xx_usart.h"
654 #elif defined(ARM_STM32F10X)
655 # define STM32_UART_COM USART3 // UART3 on PB10
657 # if IRMP_EXT_LOGGING == 1 // use external logging
658 # include "irmpextlog.h"
659 # else // normal UART log (IRMP_EXT_LOGGING == 0)
661 # ifndef UNIX_OR_WINDOWS
662 # include <util/setbaud.h>
667 #define UART0_UBRRH UBRR0H
668 #define UART0_UBRRL UBRR0L
669 #define UART0_UCSRA UCSR0A
670 #define UART0_UCSRB UCSR0B
671 #define UART0_UCSRC UCSR0C
672 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
673 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
674 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
676 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
678 #define UART0_URSEL_BIT_VALUE (0)
680 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
681 #define UART0_UDR UDR0
682 #define UART0_U2X U2X0
686 #define UART0_UBRRH UBRRH
687 #define UART0_UBRRL UBRRL
688 #define UART0_UCSRA UCSRA
689 #define UART0_UCSRB UCSRB
690 #define UART0_UCSRC UCSRC
691 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
692 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
693 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
695 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
697 #define UART0_URSEL_BIT_VALUE (0)
699 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
700 #define UART0_UDR UDR
701 #define UART0_U2X U2X
704 #endif //IRMP_EXT_LOGGING
705 #endif //ARM_STM32F4XX
707 /*---------------------------------------------------------------------------------------------------------------------------------------------------
709 * @details Initializes UART
710 *---------------------------------------------------------------------------------------------------------------------------------------------------
713 irmp_uart_init (void)
715 #ifndef UNIX_OR_WINDOWS
716 #if defined(ARM_STM32F4XX)
717 GPIO_InitTypeDef GPIO_InitStructure
;
718 USART_InitTypeDef USART_InitStructure
;
720 // Clock enable vom TX Pin
721 RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK
, ENABLE
);
723 // Clock enable der UART
724 RCC_APB1PeriphClockCmd(STM32_UART_CLOCK
, ENABLE
);
726 // UART Alternative-Funktion mit dem IO-Pin verbinden
727 GPIO_PinAFConfig(STM32_GPIO_PORT
,STM32_GPIO_SOURCE
,STM32_UART_AF
);
729 // UART als Alternative-Funktion mit PushPull
730 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_AF
;
731 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_100MHz
;
732 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
733 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_UP
;
736 GPIO_InitStructure
.GPIO_Pin
= STM32_GPIO_PIN
;
737 GPIO_Init(STM32_GPIO_PORT
, &GPIO_InitStructure
);
740 USART_OverSampling8Cmd(STM32_UART_COM
, ENABLE
);
742 // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS
743 USART_InitStructure
.USART_BaudRate
= STM32_UART_BAUD
;
744 USART_InitStructure
.USART_WordLength
= USART_WordLength_8b
;
745 USART_InitStructure
.USART_StopBits
= USART_StopBits_1
;
746 USART_InitStructure
.USART_Parity
= USART_Parity_No
;
747 USART_InitStructure
.USART_HardwareFlowControl
= USART_HardwareFlowControl_None
;
748 USART_InitStructure
.USART_Mode
= USART_Mode_Tx
;
749 USART_Init(STM32_UART_COM
, &USART_InitStructure
);
752 USART_Cmd(STM32_UART_COM
, ENABLE
);
754 #elif defined(ARM_STM32F10X)
755 GPIO_InitTypeDef GPIO_InitStructure
;
756 USART_InitTypeDef USART_InitStructure
;
758 // Clock enable vom TX Pin
759 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB
, ENABLE
); // UART3 an PB10
761 // Clock enable der UART
762 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3
, ENABLE
);
764 // UART als Alternative-Funktion mit PushPull
765 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_AF_PP
;
766 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_50MHz
;
769 GPIO_InitStructure
.GPIO_Pin
= GPIO_Pin_10
;
770 GPIO_Init(GPIOB
, &GPIO_InitStructure
);
773 USART_OverSampling8Cmd(STM32_UART_COM
, ENABLE
);
775 // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS
776 USART_InitStructure
.USART_BaudRate
= 115200;
777 USART_InitStructure
.USART_WordLength
= USART_WordLength_8b
;
778 USART_InitStructure
.USART_StopBits
= USART_StopBits_1
;
779 USART_InitStructure
.USART_Parity
= USART_Parity_No
;
780 USART_InitStructure
.USART_HardwareFlowControl
= USART_HardwareFlowControl_None
;
781 USART_InitStructure
.USART_Mode
= USART_Mode_Tx
;
782 USART_Init(STM32_UART_COM
, &USART_InitStructure
);
785 USART_Cmd(STM32_UART_COM
, ENABLE
);
788 #if (IRMP_EXT_LOGGING == 0) // use UART
789 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
790 UART0_UBRRL
= UBRRL_VALUE
;
793 UART0_UCSRA
|= (1<<UART0_U2X
);
795 UART0_UCSRA
&= ~(1<<UART0_U2X
);
798 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
799 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
800 #else // other log method
802 #endif //IRMP_EXT_LOGGING
803 #endif //ARM_STM32F4XX
804 #endif // UNIX_OR_WINDOWS
807 /*---------------------------------------------------------------------------------------------------------------------------------------------------
809 * @details Sends character
810 * @param ch character to be transmitted
811 *---------------------------------------------------------------------------------------------------------------------------------------------------
814 irmp_uart_putc (unsigned char ch
)
816 #ifndef UNIX_OR_WINDOWS
817 #if defined(ARM_STM32F4XX) || defined(ARM_STM32F10X)
818 // warten bis altes Byte gesendet wurde
819 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
)
824 USART_SendData(STM32_UART_COM
, ch
);
828 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
);
829 USART_SendData(STM32_UART_COM
, '\r');
833 #if (IRMP_EXT_LOGGING == 0)
835 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
844 sendextlog(ch
); // use external log
846 #endif //IRMP_EXT_LOGGING
847 #endif //ARM_STM32F4XX
850 #endif // UNIX_OR_WINDOWS
853 /*---------------------------------------------------------------------------------------------------------------------------------------------------
855 *---------------------------------------------------------------------------------------------------------------------------------------------------
858 #define STARTCYCLES 2 // min count of zeros before start of logging
859 #define ENDBITS 1000 // number of sequenced highbits to detect end
860 #define DATALEN 700 // log buffer size
863 irmp_log (uint_fast8_t val
)
865 static uint8_t buf
[DATALEN
]; // logging buffer
866 static uint_fast16_t buf_idx
; // index
867 static uint_fast8_t startcycles
; // current number of start-zeros
868 static uint_fast16_t cnt
; // counts sequenced highbits - to detect end
869 static uint_fast8_t last_val
= 1;
871 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
879 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
885 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
886 { // if stop condition is true, output on uart
890 uint_fast8_t v
= '1';
893 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
895 irmp_uart_putc ('0'); // the ignored starting zeros
898 for (i
= 0; i
< buf_idx
; i
++)
907 d
|= ((uint_fast16_t) buf
[i
] << 8);
910 for (j
= 0; j
< d
; j
++)
915 v
= (v
== '1') ? '0' : '1';
918 for (i8
= 0; i8
< 20; i8
++)
920 irmp_uart_putc ('1');
923 irmp_uart_putc ('\n');
929 else if (buf_idx
< DATALEN
- 3)
933 buf
[buf_idx
++] = 0xff;
934 buf
[buf_idx
++] = (cnt
& 0xff);
935 buf
[buf_idx
] = (cnt
>> 8);
951 #define irmp_log(val)
952 #endif //IRMP_LOGGING
956 uint_fast8_t protocol
; // ir protocol
957 uint_fast8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
958 uint_fast8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
959 uint_fast8_t pause_1_len_min
; // minimum length of pause with bit value 1
960 uint_fast8_t pause_1_len_max
; // maximum length of pause with bit value 1
961 uint_fast8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
962 uint_fast8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
963 uint_fast8_t pause_0_len_min
; // minimum length of pause with bit value 0
964 uint_fast8_t pause_0_len_max
; // maximum length of pause with bit value 0
965 uint_fast8_t address_offset
; // address offset
966 uint_fast8_t address_end
; // end of address
967 uint_fast8_t command_offset
; // command offset
968 uint_fast8_t command_end
; // end of command
969 uint_fast8_t complete_len
; // complete length of frame
970 uint_fast8_t stop_bit
; // flag: frame has stop bit
971 uint_fast8_t lsb_first
; // flag: LSB first
972 uint_fast8_t flags
; // some flags
975 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
977 static const PROGMEM IRMP_PARAMETER sircs_param
=
979 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
980 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
981 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
982 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
983 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
984 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
985 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
986 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
987 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
988 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
989 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
990 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
991 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
992 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
993 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
994 SIRCS_LSB
, // lsb_first: flag: LSB first
995 SIRCS_FLAGS
// flags: some flags
1000 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1002 static const PROGMEM IRMP_PARAMETER nec_param
=
1004 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1005 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1006 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1007 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1008 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1009 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1010 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1011 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1012 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1013 NEC_ADDRESS_OFFSET
, // address_offset: address offset
1014 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
1015 NEC_COMMAND_OFFSET
, // command_offset: command offset
1016 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
1017 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1018 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1019 NEC_LSB
, // lsb_first: flag: LSB first
1020 NEC_FLAGS
// flags: some flags
1023 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
1025 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1026 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1027 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1028 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1029 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1030 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1031 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1032 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1033 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1034 0, // address_offset: address offset
1035 0, // address_end: end of address
1036 0, // command_offset: command offset
1037 0, // command_end: end of command
1038 0, // complete_len: complete length of frame
1039 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1040 NEC_LSB
, // lsb_first: flag: LSB first
1041 NEC_FLAGS
// flags: some flags
1046 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1048 static const PROGMEM IRMP_PARAMETER nec42_param
=
1050 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
1051 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1052 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1053 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1054 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1055 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1056 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1057 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1058 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1059 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
1060 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
1061 NEC42_COMMAND_OFFSET
, // command_offset: command offset
1062 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
1063 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1064 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1065 NEC_LSB
, // lsb_first: flag: LSB first
1066 NEC_FLAGS
// flags: some flags
1071 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1073 static const PROGMEM IRMP_PARAMETER lgair_param
=
1075 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
1076 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1077 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1078 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1079 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1080 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1081 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1082 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1083 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1084 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
1085 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
1086 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
1087 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
1088 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1089 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1090 NEC_LSB
, // lsb_first: flag: LSB first
1091 NEC_FLAGS
// flags: some flags
1096 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1098 static const PROGMEM IRMP_PARAMETER samsung_param
=
1100 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
1101 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1102 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1103 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1104 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1105 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1106 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1107 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1108 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1109 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
1110 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
1111 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
1112 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
1113 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1114 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
1115 SAMSUNG_LSB
, // lsb_first: flag: LSB first
1116 SAMSUNG_FLAGS
// flags: some flags
1121 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
1123 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1125 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1126 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1127 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1128 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1129 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1130 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1131 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1132 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1133 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1134 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1135 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1136 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1137 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1138 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1139 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1140 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1141 TELEFUNKEN_FLAGS
// flags: some flags
1146 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1148 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1150 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1151 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1152 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1153 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1154 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1155 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1156 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1157 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1158 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1159 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1160 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1161 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1162 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1163 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1164 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1165 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1166 MATSUSHITA_FLAGS
// flags: some flags
1171 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1173 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1175 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1176 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1177 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1178 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1179 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1180 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1181 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1182 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1183 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1184 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1185 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1186 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1187 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1188 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1189 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1190 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1191 KASEIKYO_FLAGS
// flags: some flags
1196 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1198 static const PROGMEM IRMP_PARAMETER recs80_param
=
1200 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1201 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1202 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1203 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1204 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1205 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1206 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1207 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1208 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1209 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1210 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1211 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1212 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1213 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1214 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1215 RECS80_LSB
, // lsb_first: flag: LSB first
1216 RECS80_FLAGS
// flags: some flags
1221 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1223 static const PROGMEM IRMP_PARAMETER rc5_param
=
1225 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1226 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1227 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1228 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1229 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1230 0, // pulse_0_len_min: here: not used
1231 0, // pulse_0_len_max: here: not used
1232 0, // pause_0_len_min: here: not used
1233 0, // pause_0_len_max: here: not used
1234 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1235 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1236 RC5_COMMAND_OFFSET
, // command_offset: command offset
1237 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1238 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1239 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1240 RC5_LSB
, // lsb_first: flag: LSB first
1241 RC5_FLAGS
// flags: some flags
1246 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1248 static const PROGMEM IRMP_PARAMETER denon_param
=
1250 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1251 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1252 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1253 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1254 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1255 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1256 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1257 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1258 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1259 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1260 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1261 DENON_COMMAND_OFFSET
, // command_offset: command offset
1262 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1263 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1264 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1265 DENON_LSB
, // lsb_first: flag: LSB first
1266 DENON_FLAGS
// flags: some flags
1271 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1273 static const PROGMEM IRMP_PARAMETER rc6_param
=
1275 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1277 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1278 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1279 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1280 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1281 0, // pulse_0_len_min: here: not used
1282 0, // pulse_0_len_max: here: not used
1283 0, // pause_0_len_min: here: not used
1284 0, // pause_0_len_max: here: not used
1285 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1286 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1287 RC6_COMMAND_OFFSET
, // command_offset: command offset
1288 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1289 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1290 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1291 RC6_LSB
, // lsb_first: flag: LSB first
1292 RC6_FLAGS
// flags: some flags
1297 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1299 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1301 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1302 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1303 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1304 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1305 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1306 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1307 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1308 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1309 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1310 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1311 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1312 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1313 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1314 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1315 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1316 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1317 RECS80EXT_FLAGS
// flags: some flags
1322 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1324 static const PROGMEM IRMP_PARAMETER nubert_param
=
1326 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1327 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1328 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1329 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1330 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1331 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1332 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1333 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1334 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1335 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1336 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1337 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1338 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1339 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1340 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1341 NUBERT_LSB
, // lsb_first: flag: LSB first
1342 NUBERT_FLAGS
// flags: some flags
1347 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
1349 static const PROGMEM IRMP_PARAMETER fan_param
=
1351 IRMP_FAN_PROTOCOL
, // protocol: ir protocol
1352 FAN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1353 FAN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1354 FAN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1355 FAN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1356 FAN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1357 FAN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1358 FAN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1359 FAN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1360 FAN_ADDRESS_OFFSET
, // address_offset: address offset
1361 FAN_ADDRESS_OFFSET
+ FAN_ADDRESS_LEN
, // address_end: end of address
1362 FAN_COMMAND_OFFSET
, // command_offset: command offset
1363 FAN_COMMAND_OFFSET
+ FAN_COMMAND_LEN
, // command_end: end of command
1364 FAN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1365 FAN_STOP_BIT
, // stop_bit: flag: frame has NO stop bit
1366 FAN_LSB
, // lsb_first: flag: LSB first
1367 FAN_FLAGS
// flags: some flags
1372 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1374 static const PROGMEM IRMP_PARAMETER speaker_param
=
1376 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1377 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1378 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1379 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1380 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1381 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1382 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1383 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1384 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1385 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1386 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1387 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1388 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1389 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1390 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1391 SPEAKER_LSB
, // lsb_first: flag: LSB first
1392 SPEAKER_FLAGS
// flags: some flags
1397 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1399 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1401 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1402 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1403 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1404 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1405 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1406 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1407 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1408 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1409 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1410 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1411 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1412 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1413 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1414 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1415 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1416 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1417 BANG_OLUFSEN_FLAGS
// flags: some flags
1422 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1424 static uint_fast8_t first_bit
;
1426 static const PROGMEM IRMP_PARAMETER grundig_param
=
1428 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1430 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1431 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1432 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1433 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1434 0, // pulse_0_len_min: here: not used
1435 0, // pulse_0_len_max: here: not used
1436 0, // pause_0_len_min: here: not used
1437 0, // pause_0_len_max: here: not used
1438 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1439 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1440 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1441 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1442 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1443 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1444 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1445 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1450 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1452 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1454 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1455 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1456 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1457 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1458 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1459 0, // pulse_0_len_min: here: not used
1460 0, // pulse_0_len_max: here: not used
1461 0, // pause_0_len_min: here: not used
1462 0, // pause_0_len_max: here: not used
1463 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1464 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1465 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1466 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1467 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1468 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1469 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1470 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1475 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1477 static const PROGMEM IRMP_PARAMETER fdc_param
=
1479 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1480 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1481 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1482 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1483 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1484 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1485 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1486 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1487 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1488 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1489 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1490 FDC_COMMAND_OFFSET
, // command_offset: command offset
1491 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1492 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1493 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1494 FDC_LSB
, // lsb_first: flag: LSB first
1495 FDC_FLAGS
// flags: some flags
1500 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1502 static const PROGMEM IRMP_PARAMETER rccar_param
=
1504 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1505 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1506 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1507 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1508 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1509 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1510 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1511 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1512 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1513 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1514 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1515 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1516 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1517 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1518 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1519 RCCAR_LSB
, // lsb_first: flag: LSB first
1520 RCCAR_FLAGS
// flags: some flags
1525 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1527 static const PROGMEM IRMP_PARAMETER nikon_param
=
1529 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1530 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1531 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1532 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1533 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1534 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1535 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1536 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1537 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1538 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1539 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1540 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1541 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1542 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1543 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1544 NIKON_LSB
, // lsb_first: flag: LSB first
1545 NIKON_FLAGS
// flags: some flags
1550 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1552 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1554 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1555 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1556 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1557 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1558 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1559 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1560 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1561 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1562 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1563 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1564 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1565 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1566 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1567 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1568 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1569 KATHREIN_LSB
, // lsb_first: flag: LSB first
1570 KATHREIN_FLAGS
// flags: some flags
1575 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1577 static const PROGMEM IRMP_PARAMETER netbox_param
=
1579 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1580 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1581 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1582 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1583 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1584 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1585 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1586 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1587 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1588 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1589 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1590 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1591 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1592 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1593 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1594 NETBOX_LSB
, // lsb_first: flag: LSB first
1595 NETBOX_FLAGS
// flags: some flags
1600 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1602 static const PROGMEM IRMP_PARAMETER lego_param
=
1604 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1605 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1606 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1607 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1608 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1609 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1610 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1611 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1612 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1613 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1614 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1615 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1616 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1617 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1618 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1619 LEGO_LSB
, // lsb_first: flag: LSB first
1620 LEGO_FLAGS
// flags: some flags
1625 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1627 static const PROGMEM IRMP_PARAMETER thomson_param
=
1629 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1630 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1631 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1632 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1633 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1634 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1635 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1636 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1637 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1638 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1639 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1640 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1641 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1642 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1643 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1644 THOMSON_LSB
, // lsb_first: flag: LSB first
1645 THOMSON_FLAGS
// flags: some flags
1650 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1652 static const PROGMEM IRMP_PARAMETER bose_param
=
1654 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1655 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1656 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1657 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1658 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1659 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1660 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1661 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1662 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1663 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1664 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1665 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1666 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1667 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1668 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1669 BOSE_LSB
, // lsb_first: flag: LSB first
1670 BOSE_FLAGS
// flags: some flags
1675 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1677 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1679 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1681 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1682 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1683 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1684 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1685 0, // pulse_0_len_min: here: not used
1686 0, // pulse_0_len_max: here: not used
1687 0, // pause_0_len_min: here: not used
1688 0, // pause_0_len_max: here: not used
1689 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1690 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1691 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1692 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1693 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1694 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1695 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1696 A1TVBOX_FLAGS
// flags: some flags
1701 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
1703 static const PROGMEM IRMP_PARAMETER merlin_param
=
1705 IRMP_MERLIN_PROTOCOL
, // protocol: ir protocol
1707 MERLIN_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1708 MERLIN_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1709 MERLIN_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1710 MERLIN_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1711 0, // pulse_0_len_min: here: not used
1712 0, // pulse_0_len_max: here: not used
1713 0, // pause_0_len_min: here: not used
1714 0, // pause_0_len_max: here: not used
1715 MERLIN_ADDRESS_OFFSET
, // address_offset: address offset
1716 MERLIN_ADDRESS_OFFSET
+ MERLIN_ADDRESS_LEN
, // address_end: end of address
1717 MERLIN_COMMAND_OFFSET
, // command_offset: command offset
1718 MERLIN_COMMAND_OFFSET
+ MERLIN_COMMAND_LEN
, // command_end: end of command
1719 MERLIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1720 MERLIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1721 MERLIN_LSB
, // lsb_first: flag: LSB first
1722 MERLIN_FLAGS
// flags: some flags
1727 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1729 static const PROGMEM IRMP_PARAMETER ortek_param
=
1731 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1733 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1734 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1735 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1736 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1737 0, // pulse_0_len_min: here: not used
1738 0, // pulse_0_len_max: here: not used
1739 0, // pause_0_len_min: here: not used
1740 0, // pause_0_len_max: here: not used
1741 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1742 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1743 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1744 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1745 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1746 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1747 ORTEK_LSB
, // lsb_first: flag: LSB first
1748 ORTEK_FLAGS
// flags: some flags
1753 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1755 static const PROGMEM IRMP_PARAMETER roomba_param
=
1757 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1758 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1759 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1760 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1761 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1762 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1763 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1764 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1765 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1766 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1767 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1768 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1769 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1770 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1771 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1772 ROOMBA_LSB
, // lsb_first: flag: LSB first
1773 ROOMBA_FLAGS
// flags: some flags
1778 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1780 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1782 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1784 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1785 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1786 0, // pause_1_len_min: here: minimum length of short pause
1787 0, // pause_1_len_max: here: maximum length of short pause
1788 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1789 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1790 0, // pause_0_len_min: here: not used
1791 0, // pause_0_len_max: here: not used
1792 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1793 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1794 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1795 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1796 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1797 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1798 RCMM32_LSB
, // lsb_first: flag: LSB first
1799 RCMM32_FLAGS
// flags: some flags
1804 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
1806 static const PROGMEM IRMP_PARAMETER pentax_param
=
1808 IRMP_PENTAX_PROTOCOL
, // protocol: ir protocol
1809 PENTAX_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1810 PENTAX_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1811 PENTAX_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1812 PENTAX_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1813 PENTAX_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1814 PENTAX_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1815 PENTAX_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1816 PENTAX_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1817 PENTAX_ADDRESS_OFFSET
, // address_offset: address offset
1818 PENTAX_ADDRESS_OFFSET
+ PENTAX_ADDRESS_LEN
, // address_end: end of address
1819 PENTAX_COMMAND_OFFSET
, // command_offset: command offset
1820 PENTAX_COMMAND_OFFSET
+ PENTAX_COMMAND_LEN
, // command_end: end of command
1821 PENTAX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1822 PENTAX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1823 PENTAX_LSB
, // lsb_first: flag: LSB first
1824 PENTAX_FLAGS
// flags: some flags
1829 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1831 static const PROGMEM IRMP_PARAMETER radio1_param
=
1833 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1835 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1836 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1837 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1838 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1839 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1840 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1841 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1842 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1843 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1844 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1845 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1846 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1847 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1848 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1849 RADIO1_LSB
, // lsb_first: flag: LSB first
1850 RADIO1_FLAGS
// flags: some flags
1855 static uint_fast8_t irmp_bit
; // current bit position
1856 static IRMP_PARAMETER irmp_param
;
1858 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1859 static IRMP_PARAMETER irmp_param2
;
1862 static volatile uint_fast8_t irmp_ir_detected
= FALSE
;
1863 static volatile uint_fast8_t irmp_protocol
;
1864 static volatile uint_fast16_t irmp_address
;
1865 static volatile uint_fast16_t irmp_command
;
1866 static volatile uint_fast16_t irmp_id
; // only used for SAMSUNG protocol
1867 static volatile uint_fast8_t irmp_flags
;
1868 // static volatile uint_fast8_t irmp_busy_flag;
1871 #define input(x) (x)
1872 static uint_fast8_t IRMP_PIN
;
1873 static uint_fast8_t radio
;
1876 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1877 * Initialize IRMP decoder
1878 * @details Configures IRMP input pin
1879 *---------------------------------------------------------------------------------------------------------------------------------------------------
1885 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1886 #elif defined (ARM_STM32) // STM32
1887 GPIO_InitTypeDef GPIO_InitStructure
;
1889 /* GPIOx clock enable */
1890 #if defined (ARM_STM32L1XX)
1891 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1892 #elif defined (ARM_STM32F10X)
1893 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1894 #elif defined (ARM_STM32F4XX)
1895 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1898 /* GPIO Configuration */
1899 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1900 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1901 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1902 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1903 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1904 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1905 #elif defined (ARM_STM32F10X)
1906 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1907 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1909 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1910 #elif defined(STELLARIS_ARM_CORTEX_M4)
1911 // Enable the GPIO port
1912 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1915 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1916 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1918 GPIO_PIN_TYPE_STD_WPU
);
1920 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1921 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1924 #if IRMP_LOGGING == 1
1929 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1931 * @details gets decoded IRMP data
1932 * @param pointer in order to store IRMP data
1933 * @return TRUE: successful, FALSE: failed
1934 *---------------------------------------------------------------------------------------------------------------------------------------------------
1937 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1939 uint_fast8_t rtc
= FALSE
;
1941 if (irmp_ir_detected
)
1943 switch (irmp_protocol
)
1945 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1946 case IRMP_SAMSUNG_PROTOCOL
:
1947 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1949 irmp_command
&= 0xff;
1950 irmp_command
|= irmp_id
<< 8;
1955 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
1956 case IRMP_SAMSUNG48_PROTOCOL
:
1957 irmp_command
= (irmp_command
& 0x00FF) | ((irmp_id
& 0x00FF) << 8);
1963 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1964 case IRMP_NEC_PROTOCOL
:
1965 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1967 irmp_command
&= 0xff;
1970 else if (irmp_address
== 0x87EE)
1973 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1975 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1976 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1977 irmp_command
&= 0x00FF;
1982 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1983 case IRMP_BOSE_PROTOCOL
:
1984 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1986 irmp_command
&= 0xff;
1991 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1992 case IRMP_SIEMENS_PROTOCOL
:
1993 case IRMP_RUWIDO_PROTOCOL
:
1994 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
2001 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2002 case IRMP_KATHREIN_PROTOCOL
:
2003 if (irmp_command
!= 0x0000)
2009 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2010 case IRMP_RC5_PROTOCOL
:
2011 irmp_address
&= ~0x20; // clear toggle bit
2015 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
2016 case IRMP_IR60_PROTOCOL
:
2017 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
2024 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
2029 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2030 case IRMP_RCCAR_PROTOCOL
:
2031 // frame in irmp_data:
2032 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
2033 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
2034 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
2035 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
2036 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
2037 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
2038 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
2042 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
2043 case IRMP_NETBOX_PROTOCOL
:
2044 if (irmp_command
& 0x1000) // last bit set?
2046 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
2049 irmp_command
&= 0x7F;
2052 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
2055 irmp_command
|= 0x80;
2061 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
2068 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
2073 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2074 case IRMP_LEGO_PROTOCOL
:
2076 uint_fast8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
2078 if ((irmp_command
& 0x000F) == crc
)
2086 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
2088 // rtc = TRUE; // don't accept codes with CRC errors
2103 irmp_data_p
->protocol
= irmp_protocol
;
2104 irmp_data_p
->address
= irmp_address
;
2105 irmp_data_p
->command
= irmp_command
;
2106 irmp_data_p
->flags
= irmp_flags
;
2112 irmp_ir_detected
= FALSE
;
2118 #if IRMP_USE_CALLBACK == 1
2120 irmp_set_callback_ptr (void (*cb
)(uint_fast8_t))
2122 irmp_callback_ptr
= cb
;
2124 #endif // IRMP_USE_CALLBACK == 1
2126 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
2127 static uint_fast16_t irmp_tmp_address
; // ir address
2128 static uint_fast16_t irmp_tmp_command
; // ir command
2130 #if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2131 static uint_fast16_t irmp_tmp_address2
; // ir address
2132 static uint_fast16_t irmp_tmp_command2
; // ir command
2135 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2136 static uint_fast16_t irmp_lgair_address
; // ir address
2137 static uint_fast16_t irmp_lgair_command
; // ir command
2140 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2141 static uint_fast16_t irmp_tmp_id
; // ir id (only SAMSUNG)
2143 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2144 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
2145 static uint_fast8_t genre2
; // save genre2 bits here, later copied to MSB in flags
2148 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2149 static uint_fast8_t parity
; // number of '1' of the first 14 bits, check if even.
2152 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2154 * @details store bit in temp address or temp command
2155 * @param value to store: 0 or 1
2156 *---------------------------------------------------------------------------------------------------------------------------------------------------
2158 // verhindert, dass irmp_store_bit() inline compiliert wird:
2159 // static void irmp_store_bit (uint_fast8_t) __attribute__ ((noinline));
2162 irmp_store_bit (uint_fast8_t value
)
2164 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2165 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
2174 else if (irmp_bit
== 14)
2176 if (value
) // value == 1: even parity
2180 parity
= PARITY_CHECK_FAILED
;
2184 parity
= PARITY_CHECK_OK
;
2189 if (parity
& 0x01) // value == 0: odd parity
2191 parity
= PARITY_CHECK_OK
;
2195 parity
= PARITY_CHECK_FAILED
;
2202 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2203 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
2210 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
2212 if (irmp_param
.lsb_first
)
2214 irmp_tmp_address
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2218 irmp_tmp_address
<<= 1;
2219 irmp_tmp_address
|= value
;
2222 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2224 if (irmp_param
.lsb_first
)
2226 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
2227 if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
>= 32)
2229 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 32)); // CV wants cast
2234 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2239 irmp_tmp_command
<<= 1;
2240 irmp_tmp_command
|= value
;
2244 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2245 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2249 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2250 irmp_lgair_address
|= value
;
2252 else if (irmp_bit
< 24)
2254 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2255 irmp_lgair_command
|= value
;
2261 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2262 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2264 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2269 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2270 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2272 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2277 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2278 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2280 if (irmp_bit
>= 20 && irmp_bit
< 24)
2282 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2284 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2286 genre2
|= (((uint_fast8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2289 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2293 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2297 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2310 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2312 * @details store bit in temp address or temp command
2313 * @param value to store: 0 or 1
2314 *---------------------------------------------------------------------------------------------------------------------------------------------------
2316 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2318 irmp_store_bit2 (uint_fast8_t value
)
2320 uint_fast8_t irmp_bit2
;
2322 if (irmp_param
.protocol
)
2324 irmp_bit2
= irmp_bit
- 2;
2328 irmp_bit2
= irmp_bit
- 1;
2331 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2333 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2335 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2337 irmp_tmp_command2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2340 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2342 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2344 * @details ISR routine, called 10000 times per second
2345 *---------------------------------------------------------------------------------------------------------------------------------------------------
2350 static uint_fast8_t irmp_start_bit_detected
; // flag: start bit detected
2351 static uint_fast8_t wait_for_space
; // flag: wait for data bit space
2352 static uint_fast8_t wait_for_start_space
; // flag: wait for start bit space
2353 static uint_fast8_t irmp_pulse_time
; // count bit time for pulse
2354 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2355 static uint_fast16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2356 static uint_fast16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2357 static uint_fast16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2358 static uint_fast8_t repetition_frame_number
;
2359 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2360 static uint_fast16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2361 static uint_fast16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2363 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2364 static uint_fast8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2366 #if IRMP_SUPPORT_MANCHESTER == 1
2367 static PAUSE_LEN last_pause
; // last pause value
2369 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2370 static uint_fast8_t last_value
; // last bit value
2372 uint_fast8_t irmp_input
; // input value
2378 irmp_input
= input(IRMP_PIN
);
2380 #if IRMP_USE_CALLBACK == 1
2381 if (irmp_callback_ptr
)
2383 static uint_fast8_t last_inverted_input
;
2385 if (last_inverted_input
!= !irmp_input
)
2387 (*irmp_callback_ptr
) (! irmp_input
);
2388 last_inverted_input
= !irmp_input
;
2391 #endif // IRMP_USE_CALLBACK == 1
2393 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2395 if (! irmp_ir_detected
) // ir code already detected?
2397 if (! irmp_start_bit_detected
) // start bit detected?
2399 if (! irmp_input
) // receiving burst?
2401 // irmp_busy_flag = TRUE;
2403 if (! irmp_pulse_time
)
2405 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2408 irmp_pulse_time
++; // increment counter
2412 if (irmp_pulse_time
) // it's dark....
2413 { // set flags for counting the time of darkness...
2414 irmp_start_bit_detected
= 1;
2415 wait_for_start_space
= 1;
2417 irmp_tmp_command
= 0;
2418 irmp_tmp_address
= 0;
2419 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2422 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2426 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2427 irmp_tmp_command2
= 0;
2428 irmp_tmp_address2
= 0;
2430 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2431 irmp_lgair_command
= 0;
2432 irmp_lgair_address
= 0;
2435 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2436 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2437 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2442 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2444 key_repetition_len
++;
2446 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2447 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2449 denon_repetition_len
++;
2451 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2454 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2455 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2457 last_irmp_denon_command
= 0;
2458 denon_repetition_len
= 0xFFFF;
2461 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2468 if (wait_for_start_space
) // we have received start bit...
2469 { // ...and are counting the time of darkness
2470 if (irmp_input
) // still dark?
2472 irmp_pause_time
++; // increment counter
2474 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2475 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
) ||
2476 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2478 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2481 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2482 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2487 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2490 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
);
2491 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2495 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2496 irmp_pulse_time
= 0;
2497 irmp_pause_time
= 0;
2501 { // receiving first data pulse!
2502 IRMP_PARAMETER
* irmp_param_p
;
2503 irmp_param_p
= (IRMP_PARAMETER
*) 0;
2505 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2506 irmp_param2
.protocol
= 0;
2510 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2513 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2514 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2515 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2518 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2519 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2520 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2522 irmp_param_p
= (IRMP_PARAMETER
*) &sircs_param
;
2525 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2527 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2528 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2529 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2530 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2533 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2534 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2535 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2537 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2540 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2542 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2543 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2544 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2546 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2548 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2549 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2550 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2552 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2555 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2556 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2557 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2559 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2562 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2563 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2565 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2566 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2567 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2569 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2570 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2571 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2573 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2576 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2579 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2580 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2581 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2584 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2589 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2590 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2591 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2592 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2593 { // it's JVC repetition type 3
2595 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2596 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2597 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2599 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2602 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2604 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2606 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2607 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2608 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2611 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2612 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2613 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2615 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2618 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2620 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2621 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2622 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2625 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2626 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2627 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2629 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2632 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2634 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2635 if (irmp_pulse_time
>= PENTAX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= PENTAX_START_BIT_PULSE_LEN_MAX
&&
2636 irmp_pause_time
>= PENTAX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= PENTAX_START_BIT_PAUSE_LEN_MAX
)
2639 ANALYZE_PRINTF ("protocol = PENTAX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2640 PENTAX_START_BIT_PULSE_LEN_MIN
, PENTAX_START_BIT_PULSE_LEN_MAX
,
2641 PENTAX_START_BIT_PAUSE_LEN_MIN
, PENTAX_START_BIT_PAUSE_LEN_MAX
);
2643 irmp_param_p
= (IRMP_PARAMETER
*) &pentax_param
;
2646 #endif // IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2648 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2649 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2650 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2653 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2654 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2655 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2657 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2660 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2662 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2663 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2664 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2667 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2668 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2669 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2671 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2674 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2676 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2677 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2678 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2679 { // it's MATSUSHITA
2681 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2682 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2683 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2685 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2688 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2690 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2691 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2692 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2695 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2696 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2697 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2699 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2702 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2704 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2705 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2706 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2709 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2710 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2711 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2713 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2716 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2718 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2719 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2720 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2723 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2724 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2725 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2727 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2730 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2732 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2733 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2734 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2735 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2736 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2738 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2739 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2740 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2743 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2744 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2745 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2746 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2747 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2748 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2749 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2751 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2754 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2756 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2757 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2758 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2761 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2762 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2763 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2764 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2765 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2766 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2767 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2769 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2772 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2775 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2776 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2777 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2778 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2779 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2783 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2784 last_pause
= irmp_pause_time
;
2786 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2787 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2790 rc5_cmd_bit6
= 1<<6;
2798 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2800 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2801 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2802 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2803 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2806 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2807 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2808 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2809 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2811 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2814 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2816 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2817 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2818 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2819 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2822 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2823 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2824 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2825 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2827 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2830 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2832 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2833 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2834 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2837 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2838 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2839 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2841 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2844 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2846 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2847 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2848 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2851 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2852 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2853 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2855 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2860 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2862 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2863 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2864 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2867 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2868 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2869 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2871 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2874 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2876 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2877 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2878 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2881 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2882 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2883 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2885 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2888 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2890 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
2891 if (irmp_pulse_time
>= FAN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FAN_START_BIT_PULSE_LEN_MAX
&&
2892 irmp_pause_time
>= FAN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FAN_START_BIT_PAUSE_LEN_MAX
)
2895 ANALYZE_PRINTF ("protocol = FAN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2896 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
,
2897 FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
);
2899 irmp_param_p
= (IRMP_PARAMETER
*) &fan_param
;
2902 #endif // IRMP_SUPPORT_FAN_PROTOCOL == 1
2904 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2905 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
2906 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
2909 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2910 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
2911 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
2913 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
2916 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2918 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2919 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2920 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2921 { // it's BANG_OLUFSEN
2923 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2924 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2925 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2926 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2927 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2928 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2929 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2930 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2931 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2932 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2933 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2934 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2935 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2937 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2941 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2943 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2944 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2945 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2948 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2949 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2950 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2952 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2953 last_pause
= irmp_pause_time
;
2957 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2959 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 // check MERLIN before RUWIDO!
2960 if (irmp_pulse_time
>= MERLIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MERLIN_START_BIT_PULSE_LEN_MAX
&&
2961 irmp_pause_time
>= MERLIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MERLIN_START_BIT_PAUSE_LEN_MAX
)
2964 ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2965 MERLIN_START_BIT_PULSE_LEN_MIN
, MERLIN_START_BIT_PULSE_LEN_MAX
,
2966 MERLIN_START_BIT_PAUSE_LEN_MIN
, MERLIN_START_BIT_PAUSE_LEN_MAX
);
2968 irmp_param_p
= (IRMP_PARAMETER
*) &merlin_param
;
2973 #endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1
2975 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2976 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2977 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2978 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2979 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2980 { // it's RUWIDO or SIEMENS
2982 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2983 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2984 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2985 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2986 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2988 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2989 last_pause
= irmp_pause_time
;
2993 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2995 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2996 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2997 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
3000 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3001 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
3002 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
3004 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
3007 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3009 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3010 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
3011 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
3014 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3015 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
3016 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
3018 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
3021 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3023 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3024 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
3025 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
3028 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3029 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
3030 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
3032 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
3035 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3037 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3038 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
3039 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
3042 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3043 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
3044 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
3046 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
3049 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3051 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
3052 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
3053 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
3056 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3057 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
3058 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
3060 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
3063 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
3065 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3066 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
3067 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
3070 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3071 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
3072 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
3074 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
3079 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3081 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3082 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
3083 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
3084 { // it's ORTEK (Hama)
3086 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3087 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
3088 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
3090 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
3096 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3098 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3099 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
3100 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
3103 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3104 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
3105 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
3107 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
3110 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3113 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
3115 irmp_start_bit_detected
= 0; // wait for another start bit...
3118 if (irmp_start_bit_detected
)
3120 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
3122 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3125 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
3126 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
3132 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
3133 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
3134 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
3135 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
3139 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3140 if (irmp_param2
.protocol
)
3143 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
3144 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
3145 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
3146 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
3152 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3153 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
3156 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
3161 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3164 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3165 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
3171 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
3172 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
3173 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
3174 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
3179 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3180 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3182 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3183 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
3187 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
3188 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
3189 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
3190 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
3196 #if IRMP_SUPPORT_MANCHESTER == 1
3197 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3198 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
3199 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
3201 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
3204 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3205 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3208 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
3210 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
3213 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3214 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3217 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
3221 #endif // IRMP_SUPPORT_MANCHESTER == 1
3223 #if IRMP_SUPPORT_SERIAL == 1
3224 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3229 #endif // IRMP_SUPPORT_SERIAL == 1
3232 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3233 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3236 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3239 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
3240 { // pause timings correct for "1"?
3242 ANALYZE_PUTCHAR ('1'); // yes, store 1
3247 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
3248 { // pause timings correct for "0"?
3250 ANALYZE_PUTCHAR ('0'); // yes, store 0
3257 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3258 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3259 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
3262 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3265 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
3266 { // pause timings correct for "1"?
3268 ANALYZE_PUTCHAR ('1'); // yes, store 1
3273 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
3274 { // pause timings correct for "0"?
3276 ANALYZE_PUTCHAR ('0'); // yes, store 0
3283 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3285 ; // else do nothing
3288 irmp_pulse_time
= 1; // set counter to 1, not 0
3289 irmp_pause_time
= 0;
3290 wait_for_start_space
= 0;
3293 else if (wait_for_space
) // the data section....
3294 { // counting the time of darkness....
3295 uint_fast8_t got_light
= FALSE
;
3297 if (irmp_input
) // still dark?
3299 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
3302 #if IRMP_SUPPORT_MANCHESTER == 1
3303 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
3305 #if IRMP_SUPPORT_SERIAL == 1
3306 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
3308 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
3311 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3313 ANALYZE_PRINTF ("stop bit detected\n");
3316 irmp_param
.stop_bit
= 0;
3321 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",
3322 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3324 irmp_start_bit_detected
= 0; // wait for another start bit...
3325 irmp_pulse_time
= 0;
3326 irmp_pause_time
= 0;
3331 irmp_pause_time
++; // increment counter
3333 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3334 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
3335 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
3336 irmp_bit
>= 12 - 1) // pause too long?
3337 { // yes, break and close this frame
3338 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
3339 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3340 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
3341 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
3342 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
3346 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
3347 if (irmp_param
.protocol
== IRMP_FAN_PROTOCOL
&& // FAN has no stop bit.
3348 irmp_bit
>= FAN_COMPLETE_DATA_LEN
- 1) // last bit in frame
3349 { // yes, break and close this frame
3350 if (irmp_pulse_time
<= FAN_0_PULSE_LEN_MAX
&& irmp_pause_time
>= FAN_0_PAUSE_LEN_MIN
)
3352 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3353 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3355 else if (irmp_pulse_time
>= FAN_1_PULSE_LEN_MIN
&& irmp_pause_time
>= FAN_1_PAUSE_LEN_MIN
)
3357 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3358 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3363 #if IRMP_SUPPORT_SERIAL == 1
3364 // NETBOX generates no stop bit, here is the timeout condition:
3365 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
3366 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
3368 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3372 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3373 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
3375 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
3378 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
3380 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3381 irmp_param
.stop_bit
= TRUE
; // set flag
3383 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
3384 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
3385 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
3386 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
3387 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
3388 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
3390 irmp_tmp_command
<<= 1;
3391 irmp_tmp_command
|= first_bit
;
3393 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
3394 { // special manchester decoder
3395 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3396 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3397 irmp_param
.stop_bit
= TRUE
; // set flag
3399 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3402 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
3404 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3405 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3406 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3407 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3408 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3410 if (irmp_tmp_command
& 0x300)
3412 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3413 irmp_tmp_command
&= 0xFF;
3419 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3420 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3422 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3423 { // special manchester decoder
3424 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3425 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3426 irmp_param
.stop_bit
= TRUE
; // set flag
3428 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3431 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3433 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3434 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3435 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3436 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3437 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3440 // RUWIDO: AAAAAAAAACCCCCCCp
3441 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3442 irmp_tmp_address
<<= 2;
3443 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3444 irmp_tmp_command
&= 0x003F;
3445 // irmp_tmp_command <<= 4;
3446 irmp_tmp_command
|= last_value
;
3451 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3452 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3453 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3454 { // break and close this frame
3455 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3457 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3459 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3461 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3464 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3468 #if IRMP_SUPPORT_MANCHESTER == 1
3469 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3470 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3471 { // special manchester decoder
3472 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3473 irmp_param
.stop_bit
= TRUE
; // set flag
3476 #endif // IRMP_SUPPORT_MANCHESTER == 1
3477 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3479 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3483 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3484 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3487 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3489 irmp_param
.stop_bit
= TRUE
; // set flag
3490 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3491 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3492 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3493 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3494 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3496 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3497 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3498 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3501 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3503 irmp_param
.stop_bit
= TRUE
; // set flag
3504 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3505 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3506 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3507 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3508 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3510 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3512 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3513 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3514 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3517 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3519 irmp_param
.stop_bit
= TRUE
; // set flag
3520 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3521 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3523 // 0123456789ABC0123456789ABC0123456701234567
3524 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3525 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3526 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3527 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3529 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3530 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3531 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3534 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3536 irmp_param
.stop_bit
= TRUE
; // set flag
3537 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3538 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3539 irmp_tmp_address
= irmp_lgair_address
;
3540 irmp_tmp_command
= irmp_lgair_command
;
3542 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3543 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3544 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3547 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3549 irmp_param
.stop_bit
= TRUE
; // set flag
3550 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3551 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3553 // 0123456789ABC0123456789ABC0123456701234567
3554 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3555 // JVC: AAAACCCCCCCCCCCC
3556 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3557 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3559 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3560 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3562 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
3563 else if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
== 32) // it was a SAMSUNG32 stop bit
3566 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3568 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3569 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3570 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3571 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3573 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3575 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3576 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3580 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3581 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3584 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3586 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3588 else // if ((irmp_bit == 24)
3591 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3593 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3595 irmp_param
.stop_bit
= TRUE
; // set flag
3596 irmp_param
.complete_len
= irmp_bit
; // patch length
3598 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3602 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3603 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3605 irmp_start_bit_detected
= 0; // wait for another start bit...
3606 irmp_pulse_time
= 0;
3607 irmp_pause_time
= 0;
3620 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3623 #if IRMP_SUPPORT_MANCHESTER == 1
3624 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3627 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3628 #else // better, but some IR-RCs use asymmetric timings :-/
3629 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3630 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3633 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3634 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3637 ANALYZE_PUTCHAR ('T');
3639 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3654 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3657 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3659 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3661 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3662 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3665 ANALYZE_PUTCHAR ('T');
3669 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3682 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3685 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3687 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3688 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3689 if (! irmp_param2
.protocol
)
3696 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3700 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3701 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3703 uint_fast8_t manchester_value
;
3705 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3707 manchester_value
= last_value
? 0 : 1;
3708 last_value
= manchester_value
;
3712 manchester_value
= last_value
;
3716 ANALYZE_PUTCHAR (manchester_value
+ '0');
3719 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3720 if (! irmp_param2
.protocol
)
3728 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3729 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3732 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3734 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3735 irmp_param
.address_offset
= 5;
3736 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3737 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3738 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3739 irmp_tmp_address
= 0;
3741 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3743 irmp_store_bit (manchester_value
);
3747 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3748 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3749 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3750 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3751 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3754 ANALYZE_PUTCHAR ('?');
3756 irmp_param
.protocol
= 0; // switch to FDC, see below
3759 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3760 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3761 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3762 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3763 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3764 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3767 ANALYZE_PUTCHAR ('?');
3769 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3772 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3775 ANALYZE_PUTCHAR ('?');
3777 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3778 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3780 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3781 irmp_pause_time
= 0;
3785 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3786 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3788 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3791 ANALYZE_PRINTF (" 1 (FDC)\n");
3793 irmp_store_bit2 (1);
3795 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3798 ANALYZE_PRINTF (" 0 (FDC)\n");
3800 irmp_store_bit2 (0);
3803 if (! irmp_param
.protocol
)
3806 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3808 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3809 irmp_param2
.protocol
= 0;
3810 irmp_tmp_address
= irmp_tmp_address2
;
3811 irmp_tmp_command
= irmp_tmp_command2
;
3814 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3815 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3816 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3818 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3821 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3823 irmp_store_bit2 (1);
3825 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3828 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3830 irmp_store_bit2 (0);
3833 if (! irmp_param
.protocol
)
3836 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3838 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3839 irmp_param2
.protocol
= 0;
3840 irmp_tmp_address
= irmp_tmp_address2
;
3841 irmp_tmp_command
= irmp_tmp_command2
;
3844 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3846 last_pause
= irmp_pause_time
;
3850 #endif // IRMP_SUPPORT_MANCHESTER == 1
3852 #if IRMP_SUPPORT_SERIAL == 1
3853 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3855 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3858 ANALYZE_PUTCHAR ('1');
3862 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3864 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3868 irmp_pulse_time
= 0;
3872 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3875 ANALYZE_PUTCHAR ('0');
3879 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3881 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3885 irmp_pause_time
= 0;
3894 #endif // IRMP_SUPPORT_SERIAL == 1
3896 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3897 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3899 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3900 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3903 ANALYZE_PRINTF ("SYNC\n");
3908 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3910 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
3912 ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol ");
3914 irmp_param
.protocol
= IRMP_SAMSUNG48_PROTOCOL
;
3915 irmp_param
.command_offset
= SAMSUNG48_COMMAND_OFFSET
;
3916 irmp_param
.command_end
= SAMSUNG48_COMMAND_OFFSET
+ SAMSUNG48_COMMAND_LEN
;
3917 irmp_param
.complete_len
= SAMSUNG48_COMPLETE_DATA_LEN
;
3920 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol ");
3922 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3923 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3924 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3925 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3927 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3930 ANALYZE_PUTCHAR ('1');
3939 ANALYZE_PUTCHAR ('0');
3947 { // timing incorrect!
3949 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3950 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3952 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3953 irmp_pause_time
= 0;
3957 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3959 #if IRMP_SUPPORT_NEC16_PROTOCOL
3960 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3961 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3962 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3963 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3964 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3965 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3968 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3970 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3971 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3972 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3973 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3974 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3975 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3979 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3981 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3982 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3984 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3986 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3988 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3991 ANALYZE_PRINTF ("3rd start bit\n");
3997 { // timing incorrect!
3999 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
);
4000 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4002 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4003 irmp_pause_time
= 0;
4006 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
4008 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
4011 ANALYZE_PRINTF ("trailer bit\n");
4017 { // timing incorrect!
4019 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
);
4020 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4022 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4023 irmp_pause_time
= 0;
4028 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
4029 { // pulse & pause timings correct for "1"?
4031 ANALYZE_PUTCHAR ('1');
4038 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
4039 { // pulse & pause timings correct for "0"?
4041 ANALYZE_PUTCHAR ('0');
4048 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
4051 ANALYZE_PUTCHAR (last_value
+ '0');
4054 irmp_store_bit (last_value
);
4058 { // timing incorrect!
4060 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
);
4061 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4063 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4064 irmp_pause_time
= 0;
4069 { // timing incorrect!
4071 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
);
4072 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4074 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4075 irmp_pause_time
= 0;
4079 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
4081 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
4082 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
4084 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
4087 ANALYZE_PUTCHAR ('0');
4088 ANALYZE_PUTCHAR ('0');
4093 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
4096 ANALYZE_PUTCHAR ('0');
4097 ANALYZE_PUTCHAR ('1');
4102 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
4105 ANALYZE_PUTCHAR ('1');
4106 ANALYZE_PUTCHAR ('0');
4111 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
4114 ANALYZE_PUTCHAR ('1');
4115 ANALYZE_PUTCHAR ('1');
4121 ANALYZE_PRINTF ("\n");
4128 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
4129 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
4130 { // pulse & pause timings correct for "1"?
4132 ANALYZE_PUTCHAR ('1');
4138 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
4139 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
4140 { // pulse & pause timings correct for "0"?
4142 ANALYZE_PUTCHAR ('0');
4149 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
4151 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
4152 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
4153 (((irmp_bit
== 8 || irmp_bit
== 6) &&
4154 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
4156 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
4163 ANALYZE_PUTCHAR ('S');
4166 irmp_tmp_command
<<= 1;
4171 ANALYZE_PUTCHAR ('S');
4179 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
4180 { // timing incorrect!
4182 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
4183 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4185 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4186 irmp_pause_time
= 0;
4189 irmp_pulse_time
= 1; // set counter to 1, not 0
4193 { // counting the pulse length ...
4194 if (! irmp_input
) // still light?
4196 irmp_pulse_time
++; // increment counter
4200 wait_for_space
= 1; // let's count the time (see above)
4201 irmp_pause_time
= 1; // set pause counter to 1, not 0
4205 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
4207 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
4209 repetition_frame_number
++;
4213 repetition_frame_number
= 0;
4216 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
4217 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
4218 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
4221 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4222 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4224 key_repetition_len
= 0;
4229 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4230 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4231 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
4234 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4235 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4237 key_repetition_len
= 0;
4242 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4243 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4244 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
4247 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4248 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4250 key_repetition_len
= 0;
4255 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4256 // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4257 if ((irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
|| irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
) && (repetition_frame_number
& 0x01))
4260 ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4261 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4263 key_repetition_len
= 0;
4268 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
4269 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4270 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
4273 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4274 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4276 key_repetition_len
= 0;
4281 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
4282 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4283 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
4286 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4287 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4289 key_repetition_len
= 0;
4296 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
4298 irmp_ir_detected
= TRUE
;
4300 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
4301 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
4302 { // check for repetition frame
4303 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
4305 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
4306 last_irmp_denon_command
= 0;
4308 irmp_protocol
= irmp_param
.protocol
; // store protocol
4309 irmp_address
= irmp_tmp_address
; // store address
4310 irmp_command
= irmp_tmp_command
; // store command
4314 if ((irmp_tmp_command
& 0x01) == 0x00)
4317 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4319 last_irmp_denon_command
= irmp_tmp_command
;
4320 denon_repetition_len
= 0;
4321 irmp_ir_detected
= FALSE
;
4326 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4328 last_irmp_denon_command
= 0;
4329 irmp_ir_detected
= FALSE
;
4334 #endif // IRMP_SUPPORT_DENON_PROTOCOL
4336 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
4337 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
4338 { // Grundig start frame?
4340 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
4342 irmp_ir_detected
= FALSE
;
4345 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
4347 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
4348 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
4349 { // Nokia start frame?
4351 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
4353 irmp_ir_detected
= FALSE
;
4356 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
4358 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4359 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
4361 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
4364 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
4365 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
4367 irmp_tmp_address
= last_irmp_address
; // address is last address
4368 irmp_tmp_command
= last_irmp_command
; // command is last command
4369 irmp_flags
|= IRMP_FLAG_REPETITION
;
4370 key_repetition_len
= 0;
4375 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
4376 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
4378 irmp_ir_detected
= FALSE
;
4381 #endif // IRMP_SUPPORT_NEC_PROTOCOL
4383 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4384 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
4386 uint_fast8_t xor_value
;
4388 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
4390 if (xor_value
!= (xor_check
[2] & 0x0F))
4393 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
4395 irmp_ir_detected
= FALSE
;
4398 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
4400 if (xor_value
!= xor_check
[5])
4403 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
4405 irmp_ir_detected
= FALSE
;
4408 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
4410 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4412 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4413 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
4415 if (parity
== PARITY_CHECK_FAILED
)
4418 ANALYZE_PRINTF ("error 6: parity check failed\n");
4420 irmp_ir_detected
= FALSE
;
4423 if ((irmp_tmp_address
& 0x03) == 0x02)
4426 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
4428 irmp_ir_detected
= FALSE
;
4430 irmp_tmp_address
>>= 2;
4432 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4434 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
4435 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
4437 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
4440 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
4442 irmp_protocol
= irmp_param
.protocol
;
4445 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
4446 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
4448 if (irmp_tmp_command
& 0x000F) // released key?
4450 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
4454 irmp_tmp_command
>>= 4; // no, it's a pressed key
4456 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
4457 irmp_tmp_address
&= 0x003F;
4461 irmp_address
= irmp_tmp_address
; // store address
4462 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4463 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
4465 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4469 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
4470 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
4472 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4475 irmp_command
= irmp_tmp_command
; // store command
4477 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4478 irmp_id
= irmp_tmp_id
;
4483 if (irmp_ir_detected
)
4485 if (last_irmp_command
== irmp_tmp_command
&&
4486 last_irmp_address
== irmp_tmp_address
&&
4487 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
4489 irmp_flags
|= IRMP_FLAG_REPETITION
;
4492 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4493 last_irmp_command
= irmp_tmp_command
; // store as last command, too
4495 key_repetition_len
= 0;
4500 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4504 irmp_start_bit_detected
= 0; // and wait for next start bit
4505 irmp_tmp_command
= 0;
4506 irmp_pulse_time
= 0;
4507 irmp_pause_time
= 0;
4509 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
4510 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
4511 { // set pulse time here!
4512 irmp_pulse_time
= ((uint_fast8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
4514 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
4519 #if defined(STELLARIS_ARM_CORTEX_M4)
4520 // Clear the timer interrupt
4521 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
4524 return (irmp_ir_detected
);
4529 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4530 * main functions - for Unix/Linux + Windows only!
4534 * Compile it under linux with:
4537 * usage: ./irmp [-v|-s|-a|-l|-p] < file
4543 * -l list pulse/pauses
4545 *---------------------------------------------------------------------------------------------------------------------------------------------------
4549 print_timings (void)
4551 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
4552 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
4554 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
4555 printf ("====================================================================================\n");
4556 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4557 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4558 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4559 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4561 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4562 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4563 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4564 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4566 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4567 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
,
4568 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4569 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4571 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4572 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4573 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4574 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4576 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4577 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4578 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4579 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4581 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4582 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4583 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4584 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4586 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4587 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4588 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4589 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4591 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4592 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4593 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4595 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4596 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4597 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4598 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4600 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4601 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4602 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4603 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4605 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4606 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4607 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4609 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4610 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4611 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4612 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4614 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4615 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4616 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4617 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4619 printf ("FAN 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4620 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
, FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
,
4621 FAN_0_PULSE_LEN_MIN
, FAN_0_PULSE_LEN_MAX
, FAN_0_PAUSE_LEN_MIN
, FAN_0_PAUSE_LEN_MAX
,
4622 FAN_1_PULSE_LEN_MIN
, FAN_1_PULSE_LEN_MAX
, FAN_1_PAUSE_LEN_MIN
, FAN_1_PAUSE_LEN_MAX
);
4624 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4625 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4626 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4627 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4629 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4630 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4631 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4633 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4634 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4635 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4637 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4638 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4639 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4641 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4642 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4643 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4645 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4646 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4647 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4649 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4650 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4651 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4652 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4654 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4655 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4656 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4657 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4658 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4659 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4660 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4662 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4663 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4664 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4665 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4667 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4668 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4669 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4670 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4672 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4673 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4674 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4675 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4677 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4678 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4679 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4680 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4683 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4684 printf ("================================================================================================\n");
4685 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4686 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4687 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4688 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4689 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4690 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4691 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4692 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4693 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4694 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4698 print_spectrum (char * text
, int * buf
, int is_pulse
)
4711 puts ("-------------------------------------------------------------------------------");
4712 printf ("%s:\n", text
);
4714 for (i
= 0; i
< 256; i
++)
4716 if (buf
[i
] > max_value
)
4722 for (i
= 1; i
< 200; i
++)
4727 value
= (buf
[i
] * 60) / max_value
;
4729 for (j
= 0; j
< value
; j
++)
4733 printf (" %d\n", buf
[i
]);
4744 average
= (float) sum
/ (float) counter
;
4755 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
4756 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
4757 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
4759 tolerance
= (max
- average
);
4761 if (average
- min
> tolerance
)
4763 tolerance
= average
- min
;
4766 tolerance
= tolerance
* 100 / average
;
4767 printf ("tol: %4.1f%%\n", tolerance
);
4777 #define STATE_LEFT_SHIFT 0x01
4778 #define STATE_RIGHT_SHIFT 0x02
4779 #define STATE_LEFT_CTRL 0x04
4780 #define STATE_LEFT_ALT 0x08
4781 #define STATE_RIGHT_ALT 0x10
4783 #define KEY_ESCAPE 0x1B // keycode = 0x006e
4784 #define KEY_MENUE 0x80 // keycode = 0x0070
4785 #define KEY_BACK 0x81 // keycode = 0x0071
4786 #define KEY_FORWARD 0x82 // keycode = 0x0072
4787 #define KEY_ADDRESS 0x83 // keycode = 0x0073
4788 #define KEY_WINDOW 0x84 // keycode = 0x0074
4789 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
4790 #define KEY_STOP 0x86 // keycode = 0x0076
4791 #define KEY_MAIL 0x87 // keycode = 0x0077
4792 #define KEY_FAVORITES 0x88 // keycode = 0x0078
4793 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
4794 #define KEY_SETUP 0x8A // keycode = 0x007a
4795 #define KEY_FONT 0x8B // keycode = 0x007b
4796 #define KEY_PRINT 0x8C // keycode = 0x007c
4797 #define KEY_ON_OFF 0x8E // keycode = 0x007c
4799 #define KEY_INSERT 0x90 // keycode = 0x004b
4800 #define KEY_DELETE 0x91 // keycode = 0x004c
4801 #define KEY_LEFT 0x92 // keycode = 0x004f
4802 #define KEY_HOME 0x93 // keycode = 0x0050
4803 #define KEY_END 0x94 // keycode = 0x0051
4804 #define KEY_UP 0x95 // keycode = 0x0053
4805 #define KEY_DOWN 0x96 // keycode = 0x0054
4806 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
4807 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
4808 #define KEY_RIGHT 0x99 // keycode = 0x0059
4809 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
4810 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
4813 get_fdc_key (uint_fast16_t cmd
)
4815 static uint8_t key_table
[128] =
4817 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
4818 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
4819 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
4820 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
4821 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
4823 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
4824 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
4825 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
4826 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
4828 static uint_fast8_t state
;
4830 uint_fast8_t key
= 0;
4834 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
4835 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
4836 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
4837 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
4838 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
4839 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
4840 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
4841 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
4842 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
4843 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
4845 case 0x006e: key
= KEY_ESCAPE
; break;
4846 case 0x004b: key
= KEY_INSERT
; break;
4847 case 0x004c: key
= KEY_DELETE
; break;
4848 case 0x004f: key
= KEY_LEFT
; break;
4849 case 0x0050: key
= KEY_HOME
; break;
4850 case 0x0051: key
= KEY_END
; break;
4851 case 0x0053: key
= KEY_UP
; break;
4852 case 0x0054: key
= KEY_DOWN
; break;
4853 case 0x0055: key
= KEY_PAGE_UP
; break;
4854 case 0x0056: key
= KEY_PAGE_DOWN
; break;
4855 case 0x0059: key
= KEY_RIGHT
; break;
4856 case 0x0400: key
= KEY_MOUSE_1
; break;
4857 case 0x0800: key
= KEY_MOUSE_2
; break;
4861 if (!(cmd
& 0x80)) // pressed key
4863 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
4865 key
= cmd
+ 0x10; // 7x -> 8x
4867 else if (cmd
< 64) // key listed in key_table
4869 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
4873 case 0x0003: key
= '²'; break;
4874 case 0x0008: key
= '{'; break;
4875 case 0x0009: key
= '['; break;
4876 case 0x000A: key
= ']'; break;
4877 case 0x000B: key
= '}'; break;
4878 case 0x000C: key
= '\\'; break;
4879 case 0x001C: key
= '~'; break;
4880 case 0x002D: key
= '|'; break;
4881 case 0x0034: key
= 0xB5; break; // Mu
4884 else if (state
& (STATE_LEFT_CTRL
))
4886 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4888 key
= key_table
[cmd
] - 'a' + 1;
4892 key
= key_table
[cmd
];
4897 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4901 key
= key_table
[idx
];
4913 static int analyze
= FALSE
;
4914 static int list
= FALSE
;
4915 static IRMP_DATA irmp_data
;
4916 static int expected_protocol
;
4917 static int expected_address
;
4918 static int expected_command
;
4919 static int do_check_expected_values
;
4924 if (! analyze
&& ! list
)
4928 if (irmp_get_data (&irmp_data
))
4932 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4936 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4939 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4941 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4943 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4944 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4946 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4948 char * p
= (char *) NULL
;
4952 case '\t' : p
= "TAB"; break;
4953 case '\r' : p
= "CR"; break;
4954 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4955 case KEY_MENUE
: p
= "MENUE"; break;
4956 case KEY_BACK
: p
= "BACK"; break;
4957 case KEY_FORWARD
: p
= "FORWARD"; break;
4958 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4959 case KEY_WINDOW
: p
= "WINDOW"; break;
4960 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4961 case KEY_STOP
: p
= "STOP"; break;
4962 case KEY_MAIL
: p
= "MAIL"; break;
4963 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4964 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4965 case KEY_SETUP
: p
= "SETUP"; break;
4966 case KEY_FONT
: p
= "FONT"; break;
4967 case KEY_PRINT
: p
= "PRINT"; break;
4968 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4970 case KEY_INSERT
: p
= "INSERT"; break;
4971 case KEY_DELETE
: p
= "DELETE"; break;
4972 case KEY_LEFT
: p
= "LEFT"; break;
4973 case KEY_HOME
: p
= "HOME"; break;
4974 case KEY_END
: p
= "END"; break;
4975 case KEY_UP
: p
= "UP"; break;
4976 case KEY_DOWN
: p
= "DOWN"; break;
4977 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
4978 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
4979 case KEY_RIGHT
: p
= "RIGHT"; break;
4980 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
4981 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
4982 default : p
= "<UNKNWON>"; break;
4985 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
4986 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
4990 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
4991 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
4996 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
4997 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
5000 if (do_check_expected_values
)
5002 if (irmp_data
.protocol
!= expected_protocol
||
5003 irmp_data
.address
!= expected_address
||
5004 irmp_data
.command
!= expected_command
)
5006 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
5007 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
5011 printf (" checked!\n");
5013 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
5024 main (int argc
, char ** argv
)
5032 int start_pulses
[256];
5033 int start_pauses
[256];
5037 int first_pulse
= TRUE
;
5038 int first_pause
= TRUE
;
5042 if (! strcmp (argv
[1], "-v"))
5046 else if (! strcmp (argv
[1], "-l"))
5050 else if (! strcmp (argv
[1], "-a"))
5054 else if (! strcmp (argv
[1], "-s"))
5058 else if (! strcmp (argv
[1], "-p"))
5063 else if (! strcmp (argv
[1], "-r"))
5069 for (i
= 0; i
< 256; i
++)
5071 start_pulses
[i
] = 0;
5072 start_pauses
[i
] = 0;
5079 while ((ch
= getchar ()) != EOF
)
5081 if (ch
== '_' || ch
== '0')
5089 printf ("pause: %d\n", pause
);
5098 start_pauses
[pause
]++;
5100 first_pause
= FALSE
;
5116 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
5122 printf ("pulse: %d ", pulse
);
5131 start_pulses
[pulse
]++;
5133 first_pulse
= FALSE
;
5149 else if (ch
== '\n')
5154 if (list
&& pause
> 0)
5156 printf ("pause: %d\n", pause
);
5162 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
5176 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5187 puts ("-------------------------------------------------------------------");
5191 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5193 if (ch
!= '\r') // ignore CR in DOS/Windows files
5195 if (ch
== '[' && idx
== -1)
5203 do_check_expected_values
= FALSE
;
5207 expected_protocol
= atoi (buf
);
5209 if (expected_protocol
> 0)
5218 if (sscanf (p
, "%x", &expected_address
) == 1)
5220 do_check_expected_values
= TRUE
;
5227 if (do_check_expected_values
)
5229 do_check_expected_values
= FALSE
;
5237 if (sscanf (p
, "%x", &expected_command
) == 1)
5239 do_check_expected_values
= TRUE
;
5246 if (do_check_expected_values
)
5248 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
5253 else if (idx
< 1024 - 2)
5273 print_spectrum ("START PULSES", start_pulses
, TRUE
);
5274 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
5275 print_spectrum ("PULSES", pulses
, TRUE
);
5276 print_spectrum ("PAUSES", pauses
, FALSE
);
5277 puts ("-------------------------------------------------------------------------------");