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.174 2015/05/28 06:48:19 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
);
787 #elif defined (__AVR_XMEGA__)
789 PMIC
.CTRL
|= PMIC_HILVLEN_bm
;
791 USARTC1
.BAUDCTRLB
= 0;
792 USARTC1
.BAUDCTRLA
= F_CPU
/153600-1;
793 USARTC1
.CTRLA
= USART_RXCINTLVL_HI_gc
; // High Level (Empfangen)
794 USARTC1
.CTRLB
= USART_TXEN_bm
| USART_RXEN_bm
; //Aktiviert Senden und Empfangen
795 USARTC1
.CTRLC
= USART_CHSIZE_8BIT_gc
; //Größe der Zeichen: 8 Bit
796 PORTC
.DIR |= (1<<7); //TXD als Ausgang setzen
797 PORTC
.DIR &= ~(1<<6);
801 #if (IRMP_EXT_LOGGING == 0) // use UART
802 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
803 UART0_UBRRL
= UBRRL_VALUE
;
806 UART0_UCSRA
|= (1<<UART0_U2X
);
808 UART0_UCSRA
&= ~(1<<UART0_U2X
);
811 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
812 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
813 #else // other log method
815 #endif //IRMP_EXT_LOGGING
816 #endif //ARM_STM32F4XX
817 #endif // UNIX_OR_WINDOWS
820 /*---------------------------------------------------------------------------------------------------------------------------------------------------
822 * @details Sends character
823 * @param ch character to be transmitted
824 *---------------------------------------------------------------------------------------------------------------------------------------------------
827 irmp_uart_putc (unsigned char ch
)
829 #ifndef UNIX_OR_WINDOWS
830 #if defined(ARM_STM32F4XX) || defined(ARM_STM32F10X)
831 // warten bis altes Byte gesendet wurde
832 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
)
837 USART_SendData(STM32_UART_COM
, ch
);
841 while (USART_GetFlagStatus(STM32_UART_COM
, USART_FLAG_TXE
) == RESET
);
842 USART_SendData(STM32_UART_COM
, '\r');
846 #if (IRMP_EXT_LOGGING == 0)
848 # if defined (__AVR_XMEGA__)
849 while (!(USARTC1
.STATUS
& USART_DREIF_bm
));
853 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
859 #endif //__AVR_XMEGA__
862 sendextlog(ch
); // use external log
864 #endif //IRMP_EXT_LOGGING
865 #endif //ARM_STM32F4XX
868 #endif // UNIX_OR_WINDOWS
871 /*---------------------------------------------------------------------------------------------------------------------------------------------------
873 *---------------------------------------------------------------------------------------------------------------------------------------------------
876 #define STARTCYCLES 2 // min count of zeros before start of logging
877 #define ENDBITS 1000 // number of sequenced highbits to detect end
878 #define DATALEN 700 // log buffer size
881 irmp_log (uint_fast8_t val
)
883 static uint8_t buf
[DATALEN
]; // logging buffer
884 static uint_fast16_t buf_idx
; // index
885 static uint_fast8_t startcycles
; // current number of start-zeros
886 static uint_fast16_t cnt
; // counts sequenced highbits - to detect end
887 static uint_fast8_t last_val
= 1;
889 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
897 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
903 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
904 { // if stop condition is true, output on uart
908 uint_fast8_t v
= '1';
911 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
913 irmp_uart_putc ('0'); // the ignored starting zeros
916 for (i
= 0; i
< buf_idx
; i
++)
925 d
|= ((uint_fast16_t) buf
[i
] << 8);
928 for (j
= 0; j
< d
; j
++)
933 v
= (v
== '1') ? '0' : '1';
936 for (i8
= 0; i8
< 20; i8
++)
938 irmp_uart_putc ('1');
941 irmp_uart_putc ('\n');
947 else if (buf_idx
< DATALEN
- 3)
951 buf
[buf_idx
++] = 0xff;
952 buf
[buf_idx
++] = (cnt
& 0xff);
953 buf
[buf_idx
] = (cnt
>> 8);
969 #define irmp_log(val)
970 #endif //IRMP_LOGGING
974 uint_fast8_t protocol
; // ir protocol
975 uint_fast8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
976 uint_fast8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
977 uint_fast8_t pause_1_len_min
; // minimum length of pause with bit value 1
978 uint_fast8_t pause_1_len_max
; // maximum length of pause with bit value 1
979 uint_fast8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
980 uint_fast8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
981 uint_fast8_t pause_0_len_min
; // minimum length of pause with bit value 0
982 uint_fast8_t pause_0_len_max
; // maximum length of pause with bit value 0
983 uint_fast8_t address_offset
; // address offset
984 uint_fast8_t address_end
; // end of address
985 uint_fast8_t command_offset
; // command offset
986 uint_fast8_t command_end
; // end of command
987 uint_fast8_t complete_len
; // complete length of frame
988 uint_fast8_t stop_bit
; // flag: frame has stop bit
989 uint_fast8_t lsb_first
; // flag: LSB first
990 uint_fast8_t flags
; // some flags
993 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
995 static const PROGMEM IRMP_PARAMETER sircs_param
=
997 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
998 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
999 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1000 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1001 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1002 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1003 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1004 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1005 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1006 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
1007 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
1008 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
1009 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
1010 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1011 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
1012 SIRCS_LSB
, // lsb_first: flag: LSB first
1013 SIRCS_FLAGS
// flags: some flags
1018 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1020 static const PROGMEM IRMP_PARAMETER nec_param
=
1022 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1023 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1024 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1025 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1026 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1027 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1028 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1029 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1030 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1031 NEC_ADDRESS_OFFSET
, // address_offset: address offset
1032 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
1033 NEC_COMMAND_OFFSET
, // command_offset: command offset
1034 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
1035 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1036 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1037 NEC_LSB
, // lsb_first: flag: LSB first
1038 NEC_FLAGS
// flags: some flags
1041 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
1043 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
1044 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1045 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1046 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1047 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1048 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1049 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1050 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1051 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1052 0, // address_offset: address offset
1053 0, // address_end: end of address
1054 0, // command_offset: command offset
1055 0, // command_end: end of command
1056 0, // complete_len: complete length of frame
1057 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1058 NEC_LSB
, // lsb_first: flag: LSB first
1059 NEC_FLAGS
// flags: some flags
1064 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1066 static const PROGMEM IRMP_PARAMETER nec42_param
=
1068 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
1069 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1070 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1071 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1072 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1073 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1074 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1075 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1076 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1077 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
1078 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
1079 NEC42_COMMAND_OFFSET
, // command_offset: command offset
1080 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
1081 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1082 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1083 NEC_LSB
, // lsb_first: flag: LSB first
1084 NEC_FLAGS
// flags: some flags
1089 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1091 static const PROGMEM IRMP_PARAMETER lgair_param
=
1093 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
1094 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1095 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1096 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1097 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1098 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1099 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1100 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1101 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1102 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
1103 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
1104 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
1105 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
1106 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1107 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1108 NEC_LSB
, // lsb_first: flag: LSB first
1109 NEC_FLAGS
// flags: some flags
1114 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1116 static const PROGMEM IRMP_PARAMETER samsung_param
=
1118 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
1119 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1120 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1121 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1122 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1123 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1124 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1125 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1126 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1127 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
1128 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
1129 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
1130 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
1131 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1132 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
1133 SAMSUNG_LSB
, // lsb_first: flag: LSB first
1134 SAMSUNG_FLAGS
// flags: some flags
1139 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
1141 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1143 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1144 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1145 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1146 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1147 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1148 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1149 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1150 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1151 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1152 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1153 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1154 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1155 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1156 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1157 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1158 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1159 TELEFUNKEN_FLAGS
// flags: some flags
1164 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1166 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1168 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1169 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1170 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1171 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1172 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1173 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1174 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1175 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1176 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1177 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1178 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1179 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1180 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1181 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1182 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1183 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1184 MATSUSHITA_FLAGS
// flags: some flags
1189 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1191 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1193 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1194 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1195 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1196 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1197 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1198 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1199 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1200 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1201 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1202 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1203 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1204 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1205 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1206 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1207 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1208 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1209 KASEIKYO_FLAGS
// flags: some flags
1214 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1216 static const PROGMEM IRMP_PARAMETER recs80_param
=
1218 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1219 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1220 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1221 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1222 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1223 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1224 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1225 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1226 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1227 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1228 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1229 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1230 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1231 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1232 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1233 RECS80_LSB
, // lsb_first: flag: LSB first
1234 RECS80_FLAGS
// flags: some flags
1239 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1241 static const PROGMEM IRMP_PARAMETER rc5_param
=
1243 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1244 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1245 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1246 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1247 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1248 0, // pulse_0_len_min: here: not used
1249 0, // pulse_0_len_max: here: not used
1250 0, // pause_0_len_min: here: not used
1251 0, // pause_0_len_max: here: not used
1252 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1253 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1254 RC5_COMMAND_OFFSET
, // command_offset: command offset
1255 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1256 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1257 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1258 RC5_LSB
, // lsb_first: flag: LSB first
1259 RC5_FLAGS
// flags: some flags
1264 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1266 static const PROGMEM IRMP_PARAMETER denon_param
=
1268 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1269 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1270 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1271 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1272 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1273 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1274 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1275 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1276 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1277 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1278 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1279 DENON_COMMAND_OFFSET
, // command_offset: command offset
1280 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1281 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1282 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1283 DENON_LSB
, // lsb_first: flag: LSB first
1284 DENON_FLAGS
// flags: some flags
1289 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1291 static const PROGMEM IRMP_PARAMETER rc6_param
=
1293 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1295 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1296 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1297 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1298 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1299 0, // pulse_0_len_min: here: not used
1300 0, // pulse_0_len_max: here: not used
1301 0, // pause_0_len_min: here: not used
1302 0, // pause_0_len_max: here: not used
1303 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1304 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1305 RC6_COMMAND_OFFSET
, // command_offset: command offset
1306 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1307 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1308 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1309 RC6_LSB
, // lsb_first: flag: LSB first
1310 RC6_FLAGS
// flags: some flags
1315 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1317 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1319 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1320 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1321 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1322 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1323 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1324 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1325 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1326 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1327 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1328 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1329 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1330 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1331 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1332 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1333 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1334 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1335 RECS80EXT_FLAGS
// flags: some flags
1340 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1342 static const PROGMEM IRMP_PARAMETER nubert_param
=
1344 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1345 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1346 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1347 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1348 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1349 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1350 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1351 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1352 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1353 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1354 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1355 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1356 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1357 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1358 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1359 NUBERT_LSB
, // lsb_first: flag: LSB first
1360 NUBERT_FLAGS
// flags: some flags
1365 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
1367 static const PROGMEM IRMP_PARAMETER fan_param
=
1369 IRMP_FAN_PROTOCOL
, // protocol: ir protocol
1370 FAN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1371 FAN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1372 FAN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1373 FAN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1374 FAN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1375 FAN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1376 FAN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1377 FAN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1378 FAN_ADDRESS_OFFSET
, // address_offset: address offset
1379 FAN_ADDRESS_OFFSET
+ FAN_ADDRESS_LEN
, // address_end: end of address
1380 FAN_COMMAND_OFFSET
, // command_offset: command offset
1381 FAN_COMMAND_OFFSET
+ FAN_COMMAND_LEN
, // command_end: end of command
1382 FAN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1383 FAN_STOP_BIT
, // stop_bit: flag: frame has NO stop bit
1384 FAN_LSB
, // lsb_first: flag: LSB first
1385 FAN_FLAGS
// flags: some flags
1390 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1392 static const PROGMEM IRMP_PARAMETER speaker_param
=
1394 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1395 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1396 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1397 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1398 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1399 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1400 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1401 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1402 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1403 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1404 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1405 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1406 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1407 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1408 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1409 SPEAKER_LSB
, // lsb_first: flag: LSB first
1410 SPEAKER_FLAGS
// flags: some flags
1415 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1417 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1419 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1420 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1421 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1422 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1423 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1424 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1425 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1426 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1427 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1428 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1429 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1430 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1431 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1432 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1433 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1434 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1435 BANG_OLUFSEN_FLAGS
// flags: some flags
1440 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1442 static uint_fast8_t first_bit
;
1444 static const PROGMEM IRMP_PARAMETER grundig_param
=
1446 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1448 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1449 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1450 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1451 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1452 0, // pulse_0_len_min: here: not used
1453 0, // pulse_0_len_max: here: not used
1454 0, // pause_0_len_min: here: not used
1455 0, // pause_0_len_max: here: not used
1456 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1457 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1458 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1459 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1460 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1461 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1462 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1463 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1468 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1470 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1472 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1473 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1474 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1475 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1476 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1477 0, // pulse_0_len_min: here: not used
1478 0, // pulse_0_len_max: here: not used
1479 0, // pause_0_len_min: here: not used
1480 0, // pause_0_len_max: here: not used
1481 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1482 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1483 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1484 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1485 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1486 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1487 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1488 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1493 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1495 static const PROGMEM IRMP_PARAMETER fdc_param
=
1497 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1498 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1499 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1500 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1501 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1502 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1503 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1504 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1505 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1506 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1507 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1508 FDC_COMMAND_OFFSET
, // command_offset: command offset
1509 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1510 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1511 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1512 FDC_LSB
, // lsb_first: flag: LSB first
1513 FDC_FLAGS
// flags: some flags
1518 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1520 static const PROGMEM IRMP_PARAMETER rccar_param
=
1522 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1523 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1524 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1525 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1526 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1527 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1528 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1529 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1530 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1531 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1532 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1533 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1534 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1535 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1536 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1537 RCCAR_LSB
, // lsb_first: flag: LSB first
1538 RCCAR_FLAGS
// flags: some flags
1543 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1545 static const PROGMEM IRMP_PARAMETER nikon_param
=
1547 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1548 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1549 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1550 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1551 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1552 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1553 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1554 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1555 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1556 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1557 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1558 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1559 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1560 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1561 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1562 NIKON_LSB
, // lsb_first: flag: LSB first
1563 NIKON_FLAGS
// flags: some flags
1568 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1570 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1572 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1573 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1574 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1575 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1576 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1577 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1578 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1579 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1580 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1581 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1582 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1583 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1584 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1585 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1586 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1587 KATHREIN_LSB
, // lsb_first: flag: LSB first
1588 KATHREIN_FLAGS
// flags: some flags
1593 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1595 static const PROGMEM IRMP_PARAMETER netbox_param
=
1597 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1598 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1599 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1600 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1601 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1602 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1603 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1604 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1605 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1606 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1607 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1608 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1609 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1610 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1611 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1612 NETBOX_LSB
, // lsb_first: flag: LSB first
1613 NETBOX_FLAGS
// flags: some flags
1618 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1620 static const PROGMEM IRMP_PARAMETER lego_param
=
1622 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1623 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1624 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1625 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1626 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1627 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1628 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1629 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1630 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1631 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1632 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1633 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1634 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1635 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1636 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1637 LEGO_LSB
, // lsb_first: flag: LSB first
1638 LEGO_FLAGS
// flags: some flags
1643 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1645 static const PROGMEM IRMP_PARAMETER thomson_param
=
1647 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1648 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1649 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1650 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1651 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1652 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1653 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1654 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1655 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1656 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1657 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1658 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1659 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1660 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1661 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1662 THOMSON_LSB
, // lsb_first: flag: LSB first
1663 THOMSON_FLAGS
// flags: some flags
1668 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1670 static const PROGMEM IRMP_PARAMETER bose_param
=
1672 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1673 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1674 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1675 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1676 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1677 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1678 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1679 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1680 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1681 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1682 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1683 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1684 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1685 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1686 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1687 BOSE_LSB
, // lsb_first: flag: LSB first
1688 BOSE_FLAGS
// flags: some flags
1693 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1695 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1697 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1699 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1700 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1701 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1702 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1703 0, // pulse_0_len_min: here: not used
1704 0, // pulse_0_len_max: here: not used
1705 0, // pause_0_len_min: here: not used
1706 0, // pause_0_len_max: here: not used
1707 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1708 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1709 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1710 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1711 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1712 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1713 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1714 A1TVBOX_FLAGS
// flags: some flags
1719 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
1721 static const PROGMEM IRMP_PARAMETER merlin_param
=
1723 IRMP_MERLIN_PROTOCOL
, // protocol: ir protocol
1725 MERLIN_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1726 MERLIN_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1727 MERLIN_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1728 MERLIN_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1729 0, // pulse_0_len_min: here: not used
1730 0, // pulse_0_len_max: here: not used
1731 0, // pause_0_len_min: here: not used
1732 0, // pause_0_len_max: here: not used
1733 MERLIN_ADDRESS_OFFSET
, // address_offset: address offset
1734 MERLIN_ADDRESS_OFFSET
+ MERLIN_ADDRESS_LEN
, // address_end: end of address
1735 MERLIN_COMMAND_OFFSET
, // command_offset: command offset
1736 MERLIN_COMMAND_OFFSET
+ MERLIN_COMMAND_LEN
, // command_end: end of command
1737 MERLIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1738 MERLIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1739 MERLIN_LSB
, // lsb_first: flag: LSB first
1740 MERLIN_FLAGS
// flags: some flags
1745 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1747 static const PROGMEM IRMP_PARAMETER ortek_param
=
1749 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1751 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1752 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1753 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1754 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1755 0, // pulse_0_len_min: here: not used
1756 0, // pulse_0_len_max: here: not used
1757 0, // pause_0_len_min: here: not used
1758 0, // pause_0_len_max: here: not used
1759 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1760 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1761 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1762 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1763 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1764 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1765 ORTEK_LSB
, // lsb_first: flag: LSB first
1766 ORTEK_FLAGS
// flags: some flags
1771 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1773 static const PROGMEM IRMP_PARAMETER roomba_param
=
1775 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1776 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1777 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1778 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1779 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1780 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1781 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1782 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1783 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1784 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1785 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1786 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1787 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1788 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1789 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1790 ROOMBA_LSB
, // lsb_first: flag: LSB first
1791 ROOMBA_FLAGS
// flags: some flags
1796 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1798 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1800 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1802 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1803 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1804 0, // pause_1_len_min: here: minimum length of short pause
1805 0, // pause_1_len_max: here: maximum length of short pause
1806 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1807 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1808 0, // pause_0_len_min: here: not used
1809 0, // pause_0_len_max: here: not used
1810 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1811 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1812 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1813 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1814 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1815 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1816 RCMM32_LSB
, // lsb_first: flag: LSB first
1817 RCMM32_FLAGS
// flags: some flags
1822 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
1824 static const PROGMEM IRMP_PARAMETER pentax_param
=
1826 IRMP_PENTAX_PROTOCOL
, // protocol: ir protocol
1827 PENTAX_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1828 PENTAX_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1829 PENTAX_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1830 PENTAX_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1831 PENTAX_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1832 PENTAX_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1833 PENTAX_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1834 PENTAX_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1835 PENTAX_ADDRESS_OFFSET
, // address_offset: address offset
1836 PENTAX_ADDRESS_OFFSET
+ PENTAX_ADDRESS_LEN
, // address_end: end of address
1837 PENTAX_COMMAND_OFFSET
, // command_offset: command offset
1838 PENTAX_COMMAND_OFFSET
+ PENTAX_COMMAND_LEN
, // command_end: end of command
1839 PENTAX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1840 PENTAX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1841 PENTAX_LSB
, // lsb_first: flag: LSB first
1842 PENTAX_FLAGS
// flags: some flags
1847 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1849 static const PROGMEM IRMP_PARAMETER radio1_param
=
1851 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1853 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1854 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1855 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1856 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1857 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1858 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1859 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1860 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1861 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1862 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1863 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1864 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1865 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1866 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1867 RADIO1_LSB
, // lsb_first: flag: LSB first
1868 RADIO1_FLAGS
// flags: some flags
1873 static uint_fast8_t irmp_bit
; // current bit position
1874 static IRMP_PARAMETER irmp_param
;
1876 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1877 static IRMP_PARAMETER irmp_param2
;
1880 static volatile uint_fast8_t irmp_ir_detected
= FALSE
;
1881 static volatile uint_fast8_t irmp_protocol
;
1882 static volatile uint_fast16_t irmp_address
;
1883 static volatile uint_fast16_t irmp_command
;
1884 static volatile uint_fast16_t irmp_id
; // only used for SAMSUNG protocol
1885 static volatile uint_fast8_t irmp_flags
;
1886 // static volatile uint_fast8_t irmp_busy_flag;
1889 #define input(x) (x)
1890 static uint_fast8_t IRMP_PIN
;
1891 static uint_fast8_t radio
;
1894 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1895 * Initialize IRMP decoder
1896 * @details Configures IRMP input pin
1897 *---------------------------------------------------------------------------------------------------------------------------------------------------
1903 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1904 #elif defined (ARM_STM32) // STM32
1905 GPIO_InitTypeDef GPIO_InitStructure
;
1907 /* GPIOx clock enable */
1908 #if defined (ARM_STM32L1XX)
1909 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1910 #elif defined (ARM_STM32F10X)
1911 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1912 #elif defined (ARM_STM32F4XX)
1913 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1916 /* GPIO Configuration */
1917 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1918 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1919 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1920 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1921 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1922 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1923 #elif defined (ARM_STM32F10X)
1924 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1925 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1927 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1928 #elif defined(STELLARIS_ARM_CORTEX_M4)
1929 // Enable the GPIO port
1930 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1933 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1934 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1936 GPIO_PIN_TYPE_STD_WPU
);
1938 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1939 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1942 #if IRMP_LOGGING == 1
1947 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1949 * @details gets decoded IRMP data
1950 * @param pointer in order to store IRMP data
1951 * @return TRUE: successful, FALSE: failed
1952 *---------------------------------------------------------------------------------------------------------------------------------------------------
1955 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1957 uint_fast8_t rtc
= FALSE
;
1959 if (irmp_ir_detected
)
1961 switch (irmp_protocol
)
1963 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1964 case IRMP_SAMSUNG_PROTOCOL
:
1965 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1967 irmp_command
&= 0xff;
1968 irmp_command
|= irmp_id
<< 8;
1973 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
1974 case IRMP_SAMSUNG48_PROTOCOL
:
1975 irmp_command
= (irmp_command
& 0x00FF) | ((irmp_id
& 0x00FF) << 8);
1981 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1982 case IRMP_NEC_PROTOCOL
:
1983 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1985 irmp_command
&= 0xff;
1988 else if (irmp_address
== 0x87EE)
1991 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1993 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1994 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1995 irmp_command
&= 0x00FF;
2000 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2001 case IRMP_BOSE_PROTOCOL
:
2002 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
2004 irmp_command
&= 0xff;
2009 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2010 case IRMP_SIEMENS_PROTOCOL
:
2011 case IRMP_RUWIDO_PROTOCOL
:
2012 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
2019 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2020 case IRMP_KATHREIN_PROTOCOL
:
2021 if (irmp_command
!= 0x0000)
2027 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2028 case IRMP_RC5_PROTOCOL
:
2029 irmp_address
&= ~0x20; // clear toggle bit
2033 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
2034 case IRMP_IR60_PROTOCOL
:
2035 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
2042 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
2047 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2048 case IRMP_RCCAR_PROTOCOL
:
2049 // frame in irmp_data:
2050 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
2051 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
2052 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
2053 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
2054 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
2055 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
2056 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
2060 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
2061 case IRMP_NETBOX_PROTOCOL
:
2062 if (irmp_command
& 0x1000) // last bit set?
2064 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
2067 irmp_command
&= 0x7F;
2070 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
2073 irmp_command
|= 0x80;
2079 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
2086 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
2091 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2092 case IRMP_LEGO_PROTOCOL
:
2094 uint_fast8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
2096 if ((irmp_command
& 0x000F) == crc
)
2104 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
2106 // rtc = TRUE; // don't accept codes with CRC errors
2121 irmp_data_p
->protocol
= irmp_protocol
;
2122 irmp_data_p
->address
= irmp_address
;
2123 irmp_data_p
->command
= irmp_command
;
2124 irmp_data_p
->flags
= irmp_flags
;
2130 irmp_ir_detected
= FALSE
;
2136 #if IRMP_USE_CALLBACK == 1
2138 irmp_set_callback_ptr (void (*cb
)(uint_fast8_t))
2140 irmp_callback_ptr
= cb
;
2142 #endif // IRMP_USE_CALLBACK == 1
2144 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
2145 static uint_fast16_t irmp_tmp_address
; // ir address
2146 static uint_fast16_t irmp_tmp_command
; // ir command
2148 #if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2149 static uint_fast16_t irmp_tmp_address2
; // ir address
2150 static uint_fast16_t irmp_tmp_command2
; // ir command
2153 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2154 static uint_fast16_t irmp_lgair_address
; // ir address
2155 static uint_fast16_t irmp_lgair_command
; // ir command
2158 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2159 static uint_fast16_t irmp_tmp_id
; // ir id (only SAMSUNG)
2161 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2162 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
2163 static uint_fast8_t genre2
; // save genre2 bits here, later copied to MSB in flags
2166 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2167 static uint_fast8_t parity
; // number of '1' of the first 14 bits, check if even.
2170 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2172 * @details store bit in temp address or temp command
2173 * @param value to store: 0 or 1
2174 *---------------------------------------------------------------------------------------------------------------------------------------------------
2176 // verhindert, dass irmp_store_bit() inline compiliert wird:
2177 // static void irmp_store_bit (uint_fast8_t) __attribute__ ((noinline));
2180 irmp_store_bit (uint_fast8_t value
)
2182 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2183 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
2192 else if (irmp_bit
== 14)
2194 if (value
) // value == 1: even parity
2198 parity
= PARITY_CHECK_FAILED
;
2202 parity
= PARITY_CHECK_OK
;
2207 if (parity
& 0x01) // value == 0: odd parity
2209 parity
= PARITY_CHECK_OK
;
2213 parity
= PARITY_CHECK_FAILED
;
2220 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2221 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
2228 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
2230 if (irmp_param
.lsb_first
)
2232 irmp_tmp_address
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2236 irmp_tmp_address
<<= 1;
2237 irmp_tmp_address
|= value
;
2240 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2242 if (irmp_param
.lsb_first
)
2244 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
2245 if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
>= 32)
2247 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 32)); // CV wants cast
2252 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2257 irmp_tmp_command
<<= 1;
2258 irmp_tmp_command
|= value
;
2262 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2263 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2267 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2268 irmp_lgair_address
|= value
;
2270 else if (irmp_bit
< 24)
2272 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2273 irmp_lgair_command
|= value
;
2279 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2280 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2282 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2287 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2288 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2290 irmp_tmp_id
|= (((uint_fast16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2295 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2296 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2298 if (irmp_bit
>= 20 && irmp_bit
< 24)
2300 irmp_tmp_command
|= (((uint_fast16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2302 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2304 genre2
|= (((uint_fast8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2307 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2311 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2315 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2328 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2330 * @details store bit in temp address or temp command
2331 * @param value to store: 0 or 1
2332 *---------------------------------------------------------------------------------------------------------------------------------------------------
2334 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2336 irmp_store_bit2 (uint_fast8_t value
)
2338 uint_fast8_t irmp_bit2
;
2340 if (irmp_param
.protocol
)
2342 irmp_bit2
= irmp_bit
- 2;
2346 irmp_bit2
= irmp_bit
- 1;
2349 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2351 irmp_tmp_address2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2353 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2355 irmp_tmp_command2
|= (((uint_fast16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2358 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2360 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2362 * @details ISR routine, called 10000 times per second
2363 *---------------------------------------------------------------------------------------------------------------------------------------------------
2368 static uint_fast8_t irmp_start_bit_detected
; // flag: start bit detected
2369 static uint_fast8_t wait_for_space
; // flag: wait for data bit space
2370 static uint_fast8_t wait_for_start_space
; // flag: wait for start bit space
2371 static uint_fast8_t irmp_pulse_time
; // count bit time for pulse
2372 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2373 static uint_fast16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2374 static uint_fast16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2375 static uint_fast16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2376 static uint_fast8_t repetition_frame_number
;
2377 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2378 static uint_fast16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2379 static uint_fast16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2381 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2382 static uint_fast8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2384 #if IRMP_SUPPORT_MANCHESTER == 1
2385 static PAUSE_LEN last_pause
; // last pause value
2387 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2388 static uint_fast8_t last_value
; // last bit value
2390 uint_fast8_t irmp_input
; // input value
2396 irmp_input
= input(IRMP_PIN
);
2398 #if IRMP_USE_CALLBACK == 1
2399 if (irmp_callback_ptr
)
2401 static uint_fast8_t last_inverted_input
;
2403 if (last_inverted_input
!= !irmp_input
)
2405 (*irmp_callback_ptr
) (! irmp_input
);
2406 last_inverted_input
= !irmp_input
;
2409 #endif // IRMP_USE_CALLBACK == 1
2411 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2413 if (! irmp_ir_detected
) // ir code already detected?
2415 if (! irmp_start_bit_detected
) // start bit detected?
2417 if (! irmp_input
) // receiving burst?
2419 // irmp_busy_flag = TRUE;
2421 if (! irmp_pulse_time
)
2423 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2426 irmp_pulse_time
++; // increment counter
2430 if (irmp_pulse_time
) // it's dark....
2431 { // set flags for counting the time of darkness...
2432 irmp_start_bit_detected
= 1;
2433 wait_for_start_space
= 1;
2435 irmp_tmp_command
= 0;
2436 irmp_tmp_address
= 0;
2437 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2440 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2444 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2445 irmp_tmp_command2
= 0;
2446 irmp_tmp_address2
= 0;
2448 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2449 irmp_lgair_command
= 0;
2450 irmp_lgair_address
= 0;
2453 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2454 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2455 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2460 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2462 key_repetition_len
++;
2464 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2465 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2467 denon_repetition_len
++;
2469 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2472 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2473 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2475 last_irmp_denon_command
= 0;
2476 denon_repetition_len
= 0xFFFF;
2479 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2486 if (wait_for_start_space
) // we have received start bit...
2487 { // ...and are counting the time of darkness
2488 if (irmp_input
) // still dark?
2490 irmp_pause_time
++; // increment counter
2492 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2493 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
) ||
2494 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2496 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2499 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2500 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2505 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2508 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
);
2509 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2513 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2514 irmp_pulse_time
= 0;
2515 irmp_pause_time
= 0;
2519 { // receiving first data pulse!
2520 IRMP_PARAMETER
* irmp_param_p
;
2521 irmp_param_p
= (IRMP_PARAMETER
*) 0;
2523 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2524 irmp_param2
.protocol
= 0;
2528 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2531 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2532 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2533 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2536 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2537 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2538 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2540 irmp_param_p
= (IRMP_PARAMETER
*) &sircs_param
;
2543 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2545 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2546 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2547 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2548 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2551 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2552 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2553 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2555 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2558 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2560 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2561 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2562 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2564 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2566 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2567 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2568 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2570 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2573 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2574 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2575 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2577 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2580 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2581 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2583 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2584 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2585 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2587 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2588 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2589 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2591 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2594 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2597 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2598 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2599 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2602 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2607 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2608 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2609 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2610 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2611 { // it's JVC repetition type 3
2613 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2614 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2615 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2617 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2620 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2622 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2624 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2625 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2626 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2629 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2630 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2631 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2633 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2636 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2638 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2639 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2640 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2643 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2644 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2645 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2647 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2650 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2652 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2653 if (irmp_pulse_time
>= PENTAX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= PENTAX_START_BIT_PULSE_LEN_MAX
&&
2654 irmp_pause_time
>= PENTAX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= PENTAX_START_BIT_PAUSE_LEN_MAX
)
2657 ANALYZE_PRINTF ("protocol = PENTAX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2658 PENTAX_START_BIT_PULSE_LEN_MIN
, PENTAX_START_BIT_PULSE_LEN_MAX
,
2659 PENTAX_START_BIT_PAUSE_LEN_MIN
, PENTAX_START_BIT_PAUSE_LEN_MAX
);
2661 irmp_param_p
= (IRMP_PARAMETER
*) &pentax_param
;
2664 #endif // IRMP_SUPPORT_PENTAX_PROTOCOL == 1
2666 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2667 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2668 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2671 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2672 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2673 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2675 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2678 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2680 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2681 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2682 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2685 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2686 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2687 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2689 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2692 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2694 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2695 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2696 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2697 { // it's MATSUSHITA
2699 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2700 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2701 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2703 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2706 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2708 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2709 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2710 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2713 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2714 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2715 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2717 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2720 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2722 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2723 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2724 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2727 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2728 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2729 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2731 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2734 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2736 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2737 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2738 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2741 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2742 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2743 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2745 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2748 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2750 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2751 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2752 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2753 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2754 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2756 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2757 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2758 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2761 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2762 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2763 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2764 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_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
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2772 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2774 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2775 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2776 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2779 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2780 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2781 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2782 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2783 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2784 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2785 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2787 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2790 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2793 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2794 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2795 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2796 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2797 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2801 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2802 last_pause
= irmp_pause_time
;
2804 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2805 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2808 rc5_cmd_bit6
= 1<<6;
2816 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2818 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2819 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2820 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2821 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2824 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2825 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2826 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2827 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2829 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2832 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2834 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2835 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2836 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2837 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2840 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2841 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2842 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2843 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2845 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2848 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2850 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2851 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2852 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2855 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2856 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2857 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2859 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2862 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2864 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2865 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2866 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2869 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2870 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2871 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2873 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2878 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2880 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2881 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2882 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2885 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2886 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2887 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2889 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2892 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2894 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2895 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2896 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2899 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2900 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2901 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2903 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2906 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2908 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
2909 if (irmp_pulse_time
>= FAN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FAN_START_BIT_PULSE_LEN_MAX
&&
2910 irmp_pause_time
>= FAN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FAN_START_BIT_PAUSE_LEN_MAX
)
2913 ANALYZE_PRINTF ("protocol = FAN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2914 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
,
2915 FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
);
2917 irmp_param_p
= (IRMP_PARAMETER
*) &fan_param
;
2920 #endif // IRMP_SUPPORT_FAN_PROTOCOL == 1
2922 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2923 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
2924 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
2927 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2928 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
2929 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
2931 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
2934 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2936 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2937 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2938 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2939 { // it's BANG_OLUFSEN
2941 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2942 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2943 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2944 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2945 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2946 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2947 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2948 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2949 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2950 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2951 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2952 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2953 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2955 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2959 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2961 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2962 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2963 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2966 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2967 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2968 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2970 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2971 last_pause
= irmp_pause_time
;
2975 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2977 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 // check MERLIN before RUWIDO!
2978 if (irmp_pulse_time
>= MERLIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MERLIN_START_BIT_PULSE_LEN_MAX
&&
2979 irmp_pause_time
>= MERLIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MERLIN_START_BIT_PAUSE_LEN_MAX
)
2982 ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2983 MERLIN_START_BIT_PULSE_LEN_MIN
, MERLIN_START_BIT_PULSE_LEN_MAX
,
2984 MERLIN_START_BIT_PAUSE_LEN_MIN
, MERLIN_START_BIT_PAUSE_LEN_MAX
);
2986 irmp_param_p
= (IRMP_PARAMETER
*) &merlin_param
;
2991 #endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1
2993 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2994 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2995 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2996 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2997 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2998 { // it's RUWIDO or SIEMENS
3000 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
3001 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3002 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3003 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3004 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
3006 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
3007 last_pause
= irmp_pause_time
;
3011 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3013 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3014 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
3015 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
3018 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3019 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
3020 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
3022 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
3025 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3027 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3028 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
3029 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
3032 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3033 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
3034 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
3036 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
3039 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3041 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3042 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
3043 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
3046 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3047 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
3048 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
3050 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
3053 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
3055 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3056 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
3057 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
3060 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3061 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
3062 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
3064 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
3067 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
3069 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
3070 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
3071 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
3074 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3075 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
3076 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
3078 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
3081 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
3083 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3084 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
3085 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
3088 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3089 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
3090 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
3092 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
3097 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
3099 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3100 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
3101 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
3102 { // it's ORTEK (Hama)
3104 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3105 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
3106 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
3108 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
3114 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3116 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3117 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
3118 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
3121 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
3122 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
3123 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
3125 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
3128 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3131 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
3133 irmp_start_bit_detected
= 0; // wait for another start bit...
3136 if (irmp_start_bit_detected
)
3138 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
3140 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3143 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
3144 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
3150 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
3151 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
3152 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
3153 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
3157 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3158 if (irmp_param2
.protocol
)
3161 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
3162 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
3163 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
3164 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
3170 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3171 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
3174 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
3179 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3182 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3183 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
3189 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
3190 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
3191 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
3192 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
3197 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3198 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3200 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3201 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
3205 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
3206 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
3207 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
3208 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
3214 #if IRMP_SUPPORT_MANCHESTER == 1
3215 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3216 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
3217 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
3219 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
3222 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3223 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3226 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
3228 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
3231 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3232 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3235 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
3239 #endif // IRMP_SUPPORT_MANCHESTER == 1
3241 #if IRMP_SUPPORT_SERIAL == 1
3242 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3247 #endif // IRMP_SUPPORT_SERIAL == 1
3250 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3251 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3254 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3257 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
3258 { // pause timings correct for "1"?
3260 ANALYZE_PUTCHAR ('1'); // yes, store 1
3265 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
3266 { // pause timings correct for "0"?
3268 ANALYZE_PUTCHAR ('0'); // yes, store 0
3275 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3276 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3277 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
3280 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3283 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
3284 { // pause timings correct for "1"?
3286 ANALYZE_PUTCHAR ('1'); // yes, store 1
3291 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
3292 { // pause timings correct for "0"?
3294 ANALYZE_PUTCHAR ('0'); // yes, store 0
3301 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3303 ; // else do nothing
3306 irmp_pulse_time
= 1; // set counter to 1, not 0
3307 irmp_pause_time
= 0;
3308 wait_for_start_space
= 0;
3311 else if (wait_for_space
) // the data section....
3312 { // counting the time of darkness....
3313 uint_fast8_t got_light
= FALSE
;
3315 if (irmp_input
) // still dark?
3317 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
3320 #if IRMP_SUPPORT_MANCHESTER == 1
3321 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
3323 #if IRMP_SUPPORT_SERIAL == 1
3324 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
3326 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
3329 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3331 ANALYZE_PRINTF ("stop bit detected\n");
3334 irmp_param
.stop_bit
= 0;
3339 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",
3340 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3342 irmp_start_bit_detected
= 0; // wait for another start bit...
3343 irmp_pulse_time
= 0;
3344 irmp_pause_time
= 0;
3349 irmp_pause_time
++; // increment counter
3351 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3352 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
3353 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
3354 irmp_bit
>= 12 - 1) // pause too long?
3355 { // yes, break and close this frame
3356 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
3357 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3358 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
3359 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
3360 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
3364 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
3365 if (irmp_param
.protocol
== IRMP_FAN_PROTOCOL
&& // FAN has no stop bit.
3366 irmp_bit
>= FAN_COMPLETE_DATA_LEN
- 1) // last bit in frame
3367 { // yes, break and close this frame
3368 if (irmp_pulse_time
<= FAN_0_PULSE_LEN_MAX
&& irmp_pause_time
>= FAN_0_PAUSE_LEN_MIN
)
3371 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3373 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3375 else if (irmp_pulse_time
>= FAN_1_PULSE_LEN_MIN
&& irmp_pause_time
>= FAN_1_PAUSE_LEN_MIN
)
3378 ANALYZE_PRINTF ("Generating virtual stop bit\n");
3380 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3385 #if IRMP_SUPPORT_SERIAL == 1
3386 // NETBOX generates no stop bit, here is the timeout condition:
3387 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
3388 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
3390 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3394 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3395 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
3397 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
3400 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
3402 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3403 irmp_param
.stop_bit
= TRUE
; // set flag
3405 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
3406 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
3407 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
3408 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
3409 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
3410 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
3412 irmp_tmp_command
<<= 1;
3413 irmp_tmp_command
|= first_bit
;
3415 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
3416 { // special manchester decoder
3417 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3418 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3419 irmp_param
.stop_bit
= TRUE
; // set flag
3421 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3424 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
3426 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3427 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3428 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3429 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3430 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3432 if (irmp_tmp_command
& 0x300)
3434 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3435 irmp_tmp_command
&= 0xFF;
3441 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3442 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3444 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3445 { // special manchester decoder
3446 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3447 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3448 irmp_param
.stop_bit
= TRUE
; // set flag
3450 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3453 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3455 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3456 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3457 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3458 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3459 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3462 // RUWIDO: AAAAAAAAACCCCCCCp
3463 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3464 irmp_tmp_address
<<= 2;
3465 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3466 irmp_tmp_command
&= 0x003F;
3467 // irmp_tmp_command <<= 4;
3468 irmp_tmp_command
|= last_value
;
3473 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3474 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3475 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3476 { // break and close this frame
3477 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3479 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3481 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3483 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3486 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3490 #if IRMP_SUPPORT_MANCHESTER == 1
3491 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3492 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3493 { // special manchester decoder
3494 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3495 irmp_param
.stop_bit
= TRUE
; // set flag
3498 #endif // IRMP_SUPPORT_MANCHESTER == 1
3499 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3501 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3505 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3506 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3509 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3511 irmp_param
.stop_bit
= TRUE
; // set flag
3512 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3513 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3514 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3515 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3516 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3518 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3519 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3520 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3523 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3525 irmp_param
.stop_bit
= TRUE
; // set flag
3526 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3527 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3528 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3529 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3530 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3532 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3534 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3535 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3536 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3539 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3541 irmp_param
.stop_bit
= TRUE
; // set flag
3542 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3543 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3545 // 0123456789ABC0123456789ABC0123456701234567
3546 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3547 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3548 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3549 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3551 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3552 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3553 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3556 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3558 irmp_param
.stop_bit
= TRUE
; // set flag
3559 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3560 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3561 irmp_tmp_address
= irmp_lgair_address
;
3562 irmp_tmp_command
= irmp_lgair_command
;
3564 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3565 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3566 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3569 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3571 irmp_param
.stop_bit
= TRUE
; // set flag
3572 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3573 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3575 // 0123456789ABC0123456789ABC0123456701234567
3576 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3577 // JVC: AAAACCCCCCCCCCCC
3578 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3579 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3581 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3582 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3584 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
3585 else if (irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
&& irmp_bit
== 32) // it was a SAMSUNG32 stop bit
3588 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3590 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3591 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3592 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3593 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3595 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3597 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3598 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3602 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3603 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3606 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3608 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3610 else // if ((irmp_bit == 24)
3613 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3615 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3617 irmp_param
.stop_bit
= TRUE
; // set flag
3618 irmp_param
.complete_len
= irmp_bit
; // patch length
3620 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3624 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3625 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3627 irmp_start_bit_detected
= 0; // wait for another start bit...
3628 irmp_pulse_time
= 0;
3629 irmp_pause_time
= 0;
3642 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3645 #if IRMP_SUPPORT_MANCHESTER == 1
3646 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3649 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3650 #else // better, but some IR-RCs use asymmetric timings :-/
3651 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3652 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3655 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3656 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3659 ANALYZE_PUTCHAR ('T');
3661 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3676 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3679 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3681 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3683 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3684 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3687 ANALYZE_PUTCHAR ('T');
3691 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3704 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3707 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3709 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3710 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3711 if (! irmp_param2
.protocol
)
3718 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3722 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3723 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3725 uint_fast8_t manchester_value
;
3727 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3729 manchester_value
= last_value
? 0 : 1;
3730 last_value
= manchester_value
;
3734 manchester_value
= last_value
;
3738 ANALYZE_PUTCHAR (manchester_value
+ '0');
3741 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3742 if (! irmp_param2
.protocol
)
3750 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3751 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3754 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3756 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3757 irmp_param
.address_offset
= 5;
3758 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3759 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3760 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3761 irmp_tmp_address
= 0;
3763 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3765 irmp_store_bit (manchester_value
);
3769 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3770 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3771 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3772 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3773 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3776 ANALYZE_PUTCHAR ('?');
3778 irmp_param
.protocol
= 0; // switch to FDC, see below
3781 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3782 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3783 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3784 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3785 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3786 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3789 ANALYZE_PUTCHAR ('?');
3791 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3794 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3797 ANALYZE_PUTCHAR ('?');
3799 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3800 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3802 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3803 irmp_pause_time
= 0;
3807 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3808 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3810 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3813 ANALYZE_PRINTF (" 1 (FDC)\n");
3815 irmp_store_bit2 (1);
3817 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3820 ANALYZE_PRINTF (" 0 (FDC)\n");
3822 irmp_store_bit2 (0);
3825 if (! irmp_param
.protocol
)
3828 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3830 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3831 irmp_param2
.protocol
= 0;
3832 irmp_tmp_address
= irmp_tmp_address2
;
3833 irmp_tmp_command
= irmp_tmp_command2
;
3836 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3837 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3838 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3840 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3843 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3845 irmp_store_bit2 (1);
3847 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3850 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3852 irmp_store_bit2 (0);
3855 if (! irmp_param
.protocol
)
3858 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3860 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3861 irmp_param2
.protocol
= 0;
3862 irmp_tmp_address
= irmp_tmp_address2
;
3863 irmp_tmp_command
= irmp_tmp_command2
;
3866 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3868 last_pause
= irmp_pause_time
;
3872 #endif // IRMP_SUPPORT_MANCHESTER == 1
3874 #if IRMP_SUPPORT_SERIAL == 1
3875 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3877 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3880 ANALYZE_PUTCHAR ('1');
3884 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3886 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3890 irmp_pulse_time
= 0;
3894 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3897 ANALYZE_PUTCHAR ('0');
3901 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3903 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3907 irmp_pause_time
= 0;
3916 #endif // IRMP_SUPPORT_SERIAL == 1
3918 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3919 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3921 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3922 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3925 ANALYZE_PRINTF ("SYNC\n");
3930 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3932 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
3934 ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol ");
3936 irmp_param
.protocol
= IRMP_SAMSUNG48_PROTOCOL
;
3937 irmp_param
.command_offset
= SAMSUNG48_COMMAND_OFFSET
;
3938 irmp_param
.command_end
= SAMSUNG48_COMMAND_OFFSET
+ SAMSUNG48_COMMAND_LEN
;
3939 irmp_param
.complete_len
= SAMSUNG48_COMPLETE_DATA_LEN
;
3942 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol ");
3944 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3945 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3946 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3947 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3949 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3952 ANALYZE_PUTCHAR ('1');
3961 ANALYZE_PUTCHAR ('0');
3969 { // timing incorrect!
3971 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3972 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3974 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3975 irmp_pause_time
= 0;
3979 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3981 #if IRMP_SUPPORT_NEC16_PROTOCOL
3982 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3983 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3984 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3985 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3986 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3987 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3990 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3992 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3993 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3994 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3995 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3996 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3997 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
4001 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
4003 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
4004 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
4006 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
4008 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
4010 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
4013 ANALYZE_PRINTF ("3rd start bit\n");
4019 { // timing incorrect!
4021 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
);
4022 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4024 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4025 irmp_pause_time
= 0;
4028 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
4030 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
4033 ANALYZE_PRINTF ("trailer bit\n");
4039 { // timing incorrect!
4041 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
);
4042 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4044 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4045 irmp_pause_time
= 0;
4050 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
4051 { // pulse & pause timings correct for "1"?
4053 ANALYZE_PUTCHAR ('1');
4060 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
4061 { // pulse & pause timings correct for "0"?
4063 ANALYZE_PUTCHAR ('0');
4070 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
4073 ANALYZE_PUTCHAR (last_value
+ '0');
4076 irmp_store_bit (last_value
);
4080 { // timing incorrect!
4082 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
);
4083 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4085 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4086 irmp_pause_time
= 0;
4091 { // timing incorrect!
4093 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
);
4094 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4096 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4097 irmp_pause_time
= 0;
4101 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
4103 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
4104 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
4106 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
4109 ANALYZE_PUTCHAR ('0');
4110 ANALYZE_PUTCHAR ('0');
4115 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
4118 ANALYZE_PUTCHAR ('0');
4119 ANALYZE_PUTCHAR ('1');
4124 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
4127 ANALYZE_PUTCHAR ('1');
4128 ANALYZE_PUTCHAR ('0');
4133 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
4136 ANALYZE_PUTCHAR ('1');
4137 ANALYZE_PUTCHAR ('1');
4143 ANALYZE_PRINTF ("\n");
4150 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
4151 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
4152 { // pulse & pause timings correct for "1"?
4154 ANALYZE_PUTCHAR ('1');
4160 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
4161 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
4162 { // pulse & pause timings correct for "0"?
4164 ANALYZE_PUTCHAR ('0');
4171 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
4173 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
4174 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
4175 (((irmp_bit
== 8 || irmp_bit
== 6) &&
4176 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
4178 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
4185 ANALYZE_PUTCHAR ('S');
4188 irmp_tmp_command
<<= 1;
4193 ANALYZE_PUTCHAR ('S');
4201 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
4202 { // timing incorrect!
4204 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
4205 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4207 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
4208 irmp_pause_time
= 0;
4211 irmp_pulse_time
= 1; // set counter to 1, not 0
4215 { // counting the pulse length ...
4216 if (! irmp_input
) // still light?
4218 irmp_pulse_time
++; // increment counter
4222 wait_for_space
= 1; // let's count the time (see above)
4223 irmp_pause_time
= 1; // set pause counter to 1, not 0
4227 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
4229 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
4231 repetition_frame_number
++;
4235 repetition_frame_number
= 0;
4238 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
4239 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
4240 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
4243 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4244 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4246 key_repetition_len
= 0;
4251 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4252 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4253 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
4256 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4257 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4259 key_repetition_len
= 0;
4264 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4265 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
4266 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
4269 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4270 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4272 key_repetition_len
= 0;
4277 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4278 // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4279 if ((irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
|| irmp_param
.protocol
== IRMP_SAMSUNG48_PROTOCOL
) && (repetition_frame_number
& 0x01))
4282 ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4283 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4285 key_repetition_len
= 0;
4290 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
4291 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4292 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
4295 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4296 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4298 key_repetition_len
= 0;
4303 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
4304 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4305 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
4308 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4309 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4311 key_repetition_len
= 0;
4318 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
4320 irmp_ir_detected
= TRUE
;
4322 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
4323 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
4324 { // check for repetition frame
4325 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
4327 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
4328 last_irmp_denon_command
= 0;
4330 irmp_protocol
= irmp_param
.protocol
; // store protocol
4331 irmp_address
= irmp_tmp_address
; // store address
4332 irmp_command
= irmp_tmp_command
; // store command
4336 if ((irmp_tmp_command
& 0x01) == 0x00)
4339 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4341 last_irmp_denon_command
= irmp_tmp_command
;
4342 denon_repetition_len
= 0;
4343 irmp_ir_detected
= FALSE
;
4348 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4350 last_irmp_denon_command
= 0;
4351 irmp_ir_detected
= FALSE
;
4356 #endif // IRMP_SUPPORT_DENON_PROTOCOL
4358 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
4359 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
4360 { // Grundig start frame?
4362 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
4364 irmp_ir_detected
= FALSE
;
4367 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
4369 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
4370 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
4371 { // Nokia start frame?
4373 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
4375 irmp_ir_detected
= FALSE
;
4378 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
4380 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4381 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
4383 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
4386 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
4387 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
4389 irmp_tmp_address
= last_irmp_address
; // address is last address
4390 irmp_tmp_command
= last_irmp_command
; // command is last command
4391 irmp_flags
|= IRMP_FLAG_REPETITION
;
4392 key_repetition_len
= 0;
4397 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
4398 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
4400 irmp_ir_detected
= FALSE
;
4403 #endif // IRMP_SUPPORT_NEC_PROTOCOL
4405 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4406 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
4408 uint_fast8_t xor_value
;
4410 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
4412 if (xor_value
!= (xor_check
[2] & 0x0F))
4415 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
4417 irmp_ir_detected
= FALSE
;
4420 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
4422 if (xor_value
!= xor_check
[5])
4425 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
4427 irmp_ir_detected
= FALSE
;
4430 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
4432 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4434 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4435 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
4437 if (parity
== PARITY_CHECK_FAILED
)
4440 ANALYZE_PRINTF ("error 6: parity check failed\n");
4442 irmp_ir_detected
= FALSE
;
4445 if ((irmp_tmp_address
& 0x03) == 0x02)
4448 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
4450 irmp_ir_detected
= FALSE
;
4452 irmp_tmp_address
>>= 2;
4454 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4456 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
4457 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
4459 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
4462 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
4464 irmp_protocol
= irmp_param
.protocol
;
4467 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
4468 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
4470 if (irmp_tmp_command
& 0x000F) // released key?
4472 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
4476 irmp_tmp_command
>>= 4; // no, it's a pressed key
4478 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
4479 irmp_tmp_address
&= 0x003F;
4483 irmp_address
= irmp_tmp_address
; // store address
4484 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4485 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
4487 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4491 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
4492 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
4494 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4497 irmp_command
= irmp_tmp_command
; // store command
4499 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4500 irmp_id
= irmp_tmp_id
;
4505 if (irmp_ir_detected
)
4507 if (last_irmp_command
== irmp_tmp_command
&&
4508 last_irmp_address
== irmp_tmp_address
&&
4509 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
4511 irmp_flags
|= IRMP_FLAG_REPETITION
;
4514 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4515 last_irmp_command
= irmp_tmp_command
; // store as last command, too
4517 key_repetition_len
= 0;
4522 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4526 irmp_start_bit_detected
= 0; // and wait for next start bit
4527 irmp_tmp_command
= 0;
4528 irmp_pulse_time
= 0;
4529 irmp_pause_time
= 0;
4531 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
4532 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
4533 { // set pulse time here!
4534 irmp_pulse_time
= ((uint_fast8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
4536 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
4541 #if defined(STELLARIS_ARM_CORTEX_M4)
4542 // Clear the timer interrupt
4543 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
4546 return (irmp_ir_detected
);
4551 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4552 * main functions - for Unix/Linux + Windows only!
4556 * Compile it under linux with:
4559 * usage: ./irmp [-v|-s|-a|-l|-p] < file
4565 * -l list pulse/pauses
4567 *---------------------------------------------------------------------------------------------------------------------------------------------------
4571 print_timings (void)
4573 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
4574 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
4576 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
4577 printf ("====================================================================================\n");
4578 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4579 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4580 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4581 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4583 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4584 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4585 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4586 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4588 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4589 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
,
4590 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4591 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4593 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4594 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4595 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4596 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4598 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4599 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4600 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4601 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4603 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4604 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4605 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4606 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4608 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4609 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4610 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4611 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4613 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4614 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4615 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4617 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4618 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4619 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4620 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4622 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4623 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4624 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4625 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4627 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4628 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4629 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4631 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4632 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4633 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4634 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4636 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4637 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4638 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4639 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4641 printf ("FAN 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4642 FAN_START_BIT_PULSE_LEN_MIN
, FAN_START_BIT_PULSE_LEN_MAX
, FAN_START_BIT_PAUSE_LEN_MIN
, FAN_START_BIT_PAUSE_LEN_MAX
,
4643 FAN_0_PULSE_LEN_MIN
, FAN_0_PULSE_LEN_MAX
, FAN_0_PAUSE_LEN_MIN
, FAN_0_PAUSE_LEN_MAX
,
4644 FAN_1_PULSE_LEN_MIN
, FAN_1_PULSE_LEN_MAX
, FAN_1_PAUSE_LEN_MIN
, FAN_1_PAUSE_LEN_MAX
);
4646 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4647 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4648 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4649 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4651 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4652 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4653 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4655 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4656 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4657 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4659 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4660 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4661 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4663 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4664 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4665 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4667 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4668 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4669 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4671 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4672 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4673 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4674 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4676 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4677 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4678 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4679 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4680 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4681 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4682 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4684 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4685 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4686 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4687 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4689 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4690 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4691 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4692 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4694 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4695 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4696 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4697 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4699 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4700 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4701 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4702 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4705 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4706 printf ("================================================================================================\n");
4707 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4708 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4709 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4710 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4711 (uint_fast8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint_fast8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4712 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4713 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4714 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4715 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4716 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4720 print_spectrum (char * text
, int * buf
, int is_pulse
)
4733 puts ("-------------------------------------------------------------------------------");
4734 printf ("%s:\n", text
);
4736 for (i
= 0; i
< 256; i
++)
4738 if (buf
[i
] > max_value
)
4744 for (i
= 1; i
< 200; i
++)
4749 value
= (buf
[i
] * 60) / max_value
;
4751 for (j
= 0; j
< value
; j
++)
4755 printf (" %d\n", buf
[i
]);
4766 average
= (float) sum
/ (float) counter
;
4777 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
4778 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
4779 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
4781 tolerance
= (max
- average
);
4783 if (average
- min
> tolerance
)
4785 tolerance
= average
- min
;
4788 tolerance
= tolerance
* 100 / average
;
4789 printf ("tol: %4.1f%%\n", tolerance
);
4799 #define STATE_LEFT_SHIFT 0x01
4800 #define STATE_RIGHT_SHIFT 0x02
4801 #define STATE_LEFT_CTRL 0x04
4802 #define STATE_LEFT_ALT 0x08
4803 #define STATE_RIGHT_ALT 0x10
4805 #define KEY_ESCAPE 0x1B // keycode = 0x006e
4806 #define KEY_MENUE 0x80 // keycode = 0x0070
4807 #define KEY_BACK 0x81 // keycode = 0x0071
4808 #define KEY_FORWARD 0x82 // keycode = 0x0072
4809 #define KEY_ADDRESS 0x83 // keycode = 0x0073
4810 #define KEY_WINDOW 0x84 // keycode = 0x0074
4811 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
4812 #define KEY_STOP 0x86 // keycode = 0x0076
4813 #define KEY_MAIL 0x87 // keycode = 0x0077
4814 #define KEY_FAVORITES 0x88 // keycode = 0x0078
4815 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
4816 #define KEY_SETUP 0x8A // keycode = 0x007a
4817 #define KEY_FONT 0x8B // keycode = 0x007b
4818 #define KEY_PRINT 0x8C // keycode = 0x007c
4819 #define KEY_ON_OFF 0x8E // keycode = 0x007c
4821 #define KEY_INSERT 0x90 // keycode = 0x004b
4822 #define KEY_DELETE 0x91 // keycode = 0x004c
4823 #define KEY_LEFT 0x92 // keycode = 0x004f
4824 #define KEY_HOME 0x93 // keycode = 0x0050
4825 #define KEY_END 0x94 // keycode = 0x0051
4826 #define KEY_UP 0x95 // keycode = 0x0053
4827 #define KEY_DOWN 0x96 // keycode = 0x0054
4828 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
4829 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
4830 #define KEY_RIGHT 0x99 // keycode = 0x0059
4831 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
4832 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
4835 get_fdc_key (uint_fast16_t cmd
)
4837 static uint8_t key_table
[128] =
4839 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
4840 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
4841 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
4842 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
4843 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
4845 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
4846 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
4847 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
4848 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
4850 static uint_fast8_t state
;
4852 uint_fast8_t key
= 0;
4856 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
4857 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
4858 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
4859 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
4860 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
4861 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
4862 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
4863 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
4864 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
4865 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
4867 case 0x006e: key
= KEY_ESCAPE
; break;
4868 case 0x004b: key
= KEY_INSERT
; break;
4869 case 0x004c: key
= KEY_DELETE
; break;
4870 case 0x004f: key
= KEY_LEFT
; break;
4871 case 0x0050: key
= KEY_HOME
; break;
4872 case 0x0051: key
= KEY_END
; break;
4873 case 0x0053: key
= KEY_UP
; break;
4874 case 0x0054: key
= KEY_DOWN
; break;
4875 case 0x0055: key
= KEY_PAGE_UP
; break;
4876 case 0x0056: key
= KEY_PAGE_DOWN
; break;
4877 case 0x0059: key
= KEY_RIGHT
; break;
4878 case 0x0400: key
= KEY_MOUSE_1
; break;
4879 case 0x0800: key
= KEY_MOUSE_2
; break;
4883 if (!(cmd
& 0x80)) // pressed key
4885 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
4887 key
= cmd
+ 0x10; // 7x -> 8x
4889 else if (cmd
< 64) // key listed in key_table
4891 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
4895 case 0x0003: key
= '²'; break;
4896 case 0x0008: key
= '{'; break;
4897 case 0x0009: key
= '['; break;
4898 case 0x000A: key
= ']'; break;
4899 case 0x000B: key
= '}'; break;
4900 case 0x000C: key
= '\\'; break;
4901 case 0x001C: key
= '~'; break;
4902 case 0x002D: key
= '|'; break;
4903 case 0x0034: key
= 0xB5; break; // Mu
4906 else if (state
& (STATE_LEFT_CTRL
))
4908 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4910 key
= key_table
[cmd
] - 'a' + 1;
4914 key
= key_table
[cmd
];
4919 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4923 key
= key_table
[idx
];
4935 static int analyze
= FALSE
;
4936 static int list
= FALSE
;
4937 static IRMP_DATA irmp_data
;
4938 static int expected_protocol
;
4939 static int expected_address
;
4940 static int expected_command
;
4941 static int do_check_expected_values
;
4946 if (! analyze
&& ! list
)
4950 if (irmp_get_data (&irmp_data
))
4954 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4958 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4961 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4963 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4965 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4966 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4968 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4970 char * p
= (char *) NULL
;
4974 case '\t' : p
= "TAB"; break;
4975 case '\r' : p
= "CR"; break;
4976 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4977 case KEY_MENUE
: p
= "MENUE"; break;
4978 case KEY_BACK
: p
= "BACK"; break;
4979 case KEY_FORWARD
: p
= "FORWARD"; break;
4980 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4981 case KEY_WINDOW
: p
= "WINDOW"; break;
4982 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4983 case KEY_STOP
: p
= "STOP"; break;
4984 case KEY_MAIL
: p
= "MAIL"; break;
4985 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4986 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4987 case KEY_SETUP
: p
= "SETUP"; break;
4988 case KEY_FONT
: p
= "FONT"; break;
4989 case KEY_PRINT
: p
= "PRINT"; break;
4990 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4992 case KEY_INSERT
: p
= "INSERT"; break;
4993 case KEY_DELETE
: p
= "DELETE"; break;
4994 case KEY_LEFT
: p
= "LEFT"; break;
4995 case KEY_HOME
: p
= "HOME"; break;
4996 case KEY_END
: p
= "END"; break;
4997 case KEY_UP
: p
= "UP"; break;
4998 case KEY_DOWN
: p
= "DOWN"; break;
4999 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
5000 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
5001 case KEY_RIGHT
: p
= "RIGHT"; break;
5002 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
5003 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
5004 default : p
= "<UNKNWON>"; break;
5007 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
5008 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
5012 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
5013 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
5018 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
5019 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
5022 if (do_check_expected_values
)
5024 if (irmp_data
.protocol
!= expected_protocol
||
5025 irmp_data
.address
!= expected_address
||
5026 irmp_data
.command
!= expected_command
)
5028 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
5029 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
5033 printf (" checked!\n");
5035 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
5046 main (int argc
, char ** argv
)
5054 int start_pulses
[256];
5055 int start_pauses
[256];
5059 int first_pulse
= TRUE
;
5060 int first_pause
= TRUE
;
5064 if (! strcmp (argv
[1], "-v"))
5068 else if (! strcmp (argv
[1], "-l"))
5072 else if (! strcmp (argv
[1], "-a"))
5076 else if (! strcmp (argv
[1], "-s"))
5080 else if (! strcmp (argv
[1], "-p"))
5085 else if (! strcmp (argv
[1], "-r"))
5091 for (i
= 0; i
< 256; i
++)
5093 start_pulses
[i
] = 0;
5094 start_pauses
[i
] = 0;
5101 while ((ch
= getchar ()) != EOF
)
5103 if (ch
== '_' || ch
== '0')
5111 printf ("pause: %d\n", pause
);
5120 start_pauses
[pause
]++;
5122 first_pause
= FALSE
;
5138 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
5144 printf ("pulse: %d ", pulse
);
5153 start_pulses
[pulse
]++;
5155 first_pulse
= FALSE
;
5171 else if (ch
== '\n')
5176 if (list
&& pause
> 0)
5178 printf ("pause: %d\n", pause
);
5184 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
5198 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5209 puts ("-------------------------------------------------------------------");
5213 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
5215 if (ch
!= '\r') // ignore CR in DOS/Windows files
5217 if (ch
== '[' && idx
== -1)
5225 do_check_expected_values
= FALSE
;
5229 expected_protocol
= atoi (buf
);
5231 if (expected_protocol
> 0)
5240 if (sscanf (p
, "%x", &expected_address
) == 1)
5242 do_check_expected_values
= TRUE
;
5249 if (do_check_expected_values
)
5251 do_check_expected_values
= FALSE
;
5259 if (sscanf (p
, "%x", &expected_command
) == 1)
5261 do_check_expected_values
= TRUE
;
5268 if (do_check_expected_values
)
5270 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
5275 else if (idx
< 1024 - 2)
5295 print_spectrum ("START PULSES", start_pulses
, TRUE
);
5296 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
5297 print_spectrum ("PULSES", pulses
, TRUE
);
5298 print_spectrum ("PAUSES", pauses
, FALSE
);
5299 puts ("-------------------------------------------------------------------------------");