1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
4 * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.c,v 1.152 2014/07/01 08:33:10 fm Exp $
10 * Supported mikrocontrollers:
15 * ATmega8, ATmega16, ATmega32
17 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284, ATmega1284P
18 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *---------------------------------------------------------------------------------------------------------------------------------------------------
29 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
30 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
32 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
35 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
36 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
38 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
41 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
42 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
43 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
44 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
45 IRMP_SUPPORT_IR60_PROTOCOL == 1 || \
46 IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1 || \
47 IRMP_SUPPORT_ORTEK_PROTOCOL == 1
48 # define IRMP_SUPPORT_MANCHESTER 1
50 # define IRMP_SUPPORT_MANCHESTER 0
53 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
54 # define IRMP_SUPPORT_SERIAL 1
56 # define IRMP_SUPPORT_SERIAL 0
59 #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
61 #define MIN_TOLERANCE_00 1.0 // -0%
62 #define MAX_TOLERANCE_00 1.0 // +0%
64 #define MIN_TOLERANCE_05 0.95 // -5%
65 #define MAX_TOLERANCE_05 1.05 // +5%
67 #define MIN_TOLERANCE_10 0.9 // -10%
68 #define MAX_TOLERANCE_10 1.1 // +10%
70 #define MIN_TOLERANCE_15 0.85 // -15%
71 #define MAX_TOLERANCE_15 1.15 // +15%
73 #define MIN_TOLERANCE_20 0.8 // -20%
74 #define MAX_TOLERANCE_20 1.2 // +20%
76 #define MIN_TOLERANCE_30 0.7 // -30%
77 #define MAX_TOLERANCE_30 1.3 // +30%
79 #define MIN_TOLERANCE_40 0.6 // -40%
80 #define MAX_TOLERANCE_40 1.4 // +40%
82 #define MIN_TOLERANCE_50 0.5 // -50%
83 #define MAX_TOLERANCE_50 1.5 // +50%
85 #define MIN_TOLERANCE_60 0.4 // -60%
86 #define MAX_TOLERANCE_60 1.6 // +60%
88 #define MIN_TOLERANCE_70 0.3 // -70%
89 #define MAX_TOLERANCE_70 1.7 // +70%
91 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
92 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
93 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
94 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
95 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
96 #else // only 5% + 1 to avoid conflict with RC6:
97 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
99 #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
100 #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
101 #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
102 #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
103 #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
104 #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
106 #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
107 #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
108 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
109 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
110 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
111 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
112 #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
113 #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
114 #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
115 #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
116 #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
117 #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
118 // autodetect nec repetition frame within 50 msec:
119 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
121 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
123 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
126 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
127 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
128 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
129 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
130 #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
131 #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
132 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
133 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
134 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
135 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
137 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
138 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
139 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
140 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
141 #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
142 #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
143 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
144 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
145 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
146 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
148 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
149 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
150 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
151 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
152 #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
153 #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
154 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
155 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
156 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
157 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
159 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
160 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
161 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
162 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
163 #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
164 #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
165 #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
166 #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
167 #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
168 #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
171 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
172 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
173 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
175 #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
176 #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
179 #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
180 #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
182 #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
183 #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
184 #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
185 #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
186 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
187 #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
188 #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
189 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
191 #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
192 #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
193 #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
194 #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
195 #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
196 #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
198 #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
199 #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
200 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
201 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
202 #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
203 #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
204 #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
205 #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
206 #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
207 #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
209 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
210 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
211 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
212 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
213 #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
214 #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
215 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
216 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
217 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
218 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
220 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
221 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
222 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
223 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
224 #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
225 #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
226 #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
227 #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
228 #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
229 #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
230 #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
231 #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
233 #define SPEAKER_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
234 #define SPEAKER_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
235 #define SPEAKER_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
236 #define SPEAKER_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
237 #define SPEAKER_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
238 #define SPEAKER_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
239 #define SPEAKER_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
240 #define SPEAKER_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
241 #define SPEAKER_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
242 #define SPEAKER_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
243 #define SPEAKER_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
244 #define SPEAKER_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
246 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
247 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
248 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
249 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
250 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
251 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
252 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
253 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
254 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
255 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
256 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
257 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((PAUSE_LEN)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // value must be below IRMP_TIMEOUT
258 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
259 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
260 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
261 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
262 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
263 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
264 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
265 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
266 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
267 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
268 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
269 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
270 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
271 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
273 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
274 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
275 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
276 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
277 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
278 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
279 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
281 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
282 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
283 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
284 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
285 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
286 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
287 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
288 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
290 #define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
291 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
292 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
293 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
294 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
295 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
296 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
297 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
299 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
301 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
303 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
305 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
306 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
307 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
308 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
309 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
310 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
311 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
312 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
313 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
314 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
316 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
317 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
318 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
319 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!
320 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
321 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
322 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
323 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
324 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
325 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
326 // autodetect JVC repetition frame within 50 msec:
327 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
329 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
330 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
331 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
332 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
333 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
334 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
335 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
336 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
337 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
338 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
339 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
340 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
341 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
343 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
344 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
345 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
346 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
347 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
348 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
349 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
350 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
351 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
352 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
353 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
354 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
355 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
356 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
358 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
359 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
360 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
361 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
362 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
363 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
364 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
365 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
367 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
368 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
369 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
370 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
371 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
372 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
373 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
374 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
375 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
376 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
378 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
379 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
380 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
381 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
382 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
383 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
384 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
385 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
386 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
387 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
388 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
390 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
391 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
392 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
393 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
394 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
395 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
396 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
397 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
399 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
400 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
401 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
402 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
403 #define ORTEK_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
404 #define ORTEK_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
405 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
406 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
408 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
409 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
410 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
411 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
412 #define TELEFUNKEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
413 #define TELEFUNKEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
414 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
415 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
416 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
417 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
418 // autodetect TELEFUNKEN repetition frame within 50 msec:
419 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
421 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
422 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
423 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
424 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
425 #define ROOMBA_1_PAUSE_LEN_EXACT ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))
426 #define ROOMBA_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
427 #define ROOMBA_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
428 #define ROOMBA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
429 #define ROOMBA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
430 #define ROOMBA_0_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
431 #define ROOMBA_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
432 #define ROOMBA_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
433 #define ROOMBA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
434 #define ROOMBA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
436 #define RCMM32_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
437 #define RCMM32_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
438 #define RCMM32_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
439 #define RCMM32_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
440 #define RCMM32_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
441 #define RCMM32_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
442 #define RCMM32_BIT_00_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
443 #define RCMM32_BIT_00_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
444 #define RCMM32_BIT_01_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
445 #define RCMM32_BIT_01_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
446 #define RCMM32_BIT_10_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
447 #define RCMM32_BIT_10_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
448 #define RCMM32_BIT_11_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
449 #define RCMM32_BIT_11_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
451 #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
452 #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
453 #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
454 #define RADIO1_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
455 #define RADIO1_1_PAUSE_LEN_EXACT ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))
456 #define RADIO1_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
457 #define RADIO1_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
458 #define RADIO1_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
459 #define RADIO1_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
460 #define RADIO1_0_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))
461 #define RADIO1_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
462 #define RADIO1_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
463 #define RADIO1_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
464 #define RADIO1_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
466 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
469 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
470 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
471 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
472 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
473 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
475 static int time_counter
;
478 /******************************* not every PIC compiler knows variadic macros :-(
480 # define ANALYZE_PUTCHAR(a)
481 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
482 # define ANALYZE_PRINTF(...)
483 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
485 # define ANALYZE_NEWLINE()
486 *********************************/
489 #if IRMP_USE_CALLBACK == 1
490 static void (*irmp_callback_ptr
) (uint8_t);
491 #endif // IRMP_USE_CALLBACK == 1
493 #define PARITY_CHECK_OK 1
494 #define PARITY_CHECK_FAILED 0
496 /*---------------------------------------------------------------------------------------------------------------------------------------------------
498 *---------------------------------------------------------------------------------------------------------------------------------------------------
500 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
502 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
550 /*---------------------------------------------------------------------------------------------------------------------------------------------------
552 *---------------------------------------------------------------------------------------------------------------------------------------------------
554 #if IRMP_LOGGING == 1 // logging via UART
556 #if IRMP_EXT_LOGGING == 1 // use external logging
557 #include "irmpextlog.h"
558 #else // normal UART log (IRMP_EXT_LOGGING == 0)
560 #ifndef UNIX_OR_WINDOWS
561 #include <util/setbaud.h>
566 #define UART0_UBRRH UBRR0H
567 #define UART0_UBRRL UBRR0L
568 #define UART0_UCSRA UCSR0A
569 #define UART0_UCSRB UCSR0B
570 #define UART0_UCSRC UCSR0C
571 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
572 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
573 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
575 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
577 #define UART0_URSEL_BIT_VALUE (0)
579 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
580 #define UART0_UDR UDR0
581 #define UART0_U2X U2X0
585 #define UART0_UBRRH UBRRH
586 #define UART0_UBRRL UBRRL
587 #define UART0_UCSRA UCSRA
588 #define UART0_UCSRB UCSRB
589 #define UART0_UCSRC UCSRC
590 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
591 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
592 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
594 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
596 #define UART0_URSEL_BIT_VALUE (0)
598 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
599 #define UART0_UDR UDR
600 #define UART0_U2X U2X
603 #endif //IRMP_EXT_LOGGING
605 /*---------------------------------------------------------------------------------------------------------------------------------------------------
607 * @details Initializes UART
608 *---------------------------------------------------------------------------------------------------------------------------------------------------
611 irmp_uart_init (void)
613 #ifndef UNIX_OR_WINDOWS
614 #if (IRMP_EXT_LOGGING == 0) // use UART
615 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
616 UART0_UBRRL
= UBRRL_VALUE
;
619 UART0_UCSRA
|= (1<<UART0_U2X
);
621 UART0_UCSRA
&= ~(1<<UART0_U2X
);
624 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
625 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
626 #else // other log method
628 #endif //IRMP_EXT_LOGGING
629 #endif // UNIX_OR_WINDOWS
632 /*---------------------------------------------------------------------------------------------------------------------------------------------------
634 * @details Sends character
635 * @param ch character to be transmitted
636 *---------------------------------------------------------------------------------------------------------------------------------------------------
639 irmp_uart_putc (unsigned char ch
)
641 #ifndef UNIX_OR_WINDOWS
642 #if (IRMP_EXT_LOGGING == 0)
643 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
650 sendextlog(ch
); //Use external log
654 #endif // UNIX_OR_WINDOWS
657 /*---------------------------------------------------------------------------------------------------------------------------------------------------
659 *---------------------------------------------------------------------------------------------------------------------------------------------------
662 #define STARTCYCLES 2 // min count of zeros before start of logging
663 #define ENDBITS 1000 // number of sequenced highbits to detect end
664 #define DATALEN 700 // log buffer size
666 #if 0 // old log routine
669 irmp_log (uint8_t val
)
671 static uint8_t buf
[DATALEN
]; // logging buffer
672 static uint16_t buf_idx
; // number of written bits
673 static uint8_t startcycles
; // current number of start-zeros
674 static uint16_t cnt
; // counts sequenced highbits - to detect end
676 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
684 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
686 if (buf_idx
< DATALEN
* 8) // index in range?
690 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
694 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
701 { // if high received then look at log-stop condition
705 { // if stop condition is true, output on uart
708 for (i
= 0; i
< STARTCYCLES
; i
++)
710 irmp_uart_putc ('0'); // the ignored starting zeros
713 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
718 for (j
= 0; j
< 8; j
++)
720 irmp_uart_putc ((d
& 1) + '0');
725 irmp_uart_putc ('\n');
737 #else // new log routine
740 irmp_log (uint8_t val
)
742 static uint8_t buf
[DATALEN
]; // logging buffer
743 static uint16_t buf_idx
; // index
744 static uint8_t startcycles
; // current number of start-zeros
745 static uint16_t cnt
; // counts sequenced highbits - to detect end
746 static uint8_t last_val
= 1;
748 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
756 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
762 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
763 { // if stop condition is true, output on uart
770 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
772 irmp_uart_putc ('0'); // the ignored starting zeros
775 for (i
= 0; i
< buf_idx
; i
++)
784 d
|= ((uint16_t) buf
[i
] << 8);
787 for (j
= 0; j
< d
; j
++)
792 v
= (v
== '1') ? '0' : '1';
795 for (i8
= 0; i8
< 20; i8
++)
797 irmp_uart_putc ('1');
800 irmp_uart_putc ('\n');
806 else if (buf_idx
< DATALEN
- 3)
810 buf
[buf_idx
++] = 0xff;
811 buf
[buf_idx
++] = (cnt
& 0xff);
812 buf
[buf_idx
] = (cnt
>> 8);
830 #define irmp_log(val)
831 #endif //IRMP_LOGGING
835 uint8_t protocol
; // ir protocol
836 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
837 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
838 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
839 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
840 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
841 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
842 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
843 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
844 uint8_t address_offset
; // address offset
845 uint8_t address_end
; // end of address
846 uint8_t command_offset
; // command offset
847 uint8_t command_end
; // end of command
848 uint8_t complete_len
; // complete length of frame
849 uint8_t stop_bit
; // flag: frame has stop bit
850 uint8_t lsb_first
; // flag: LSB first
851 uint8_t flags
; // some flags
854 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
856 static const PROGMEM IRMP_PARAMETER sircs_param
=
858 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
859 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
860 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
861 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
862 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
863 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
864 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
865 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
866 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
867 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
868 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
869 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
870 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
871 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
872 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
873 SIRCS_LSB
, // lsb_first: flag: LSB first
874 SIRCS_FLAGS
// flags: some flags
879 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
881 static const PROGMEM IRMP_PARAMETER nec_param
=
883 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
884 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
885 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
886 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
887 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
888 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
889 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
890 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
891 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
892 NEC_ADDRESS_OFFSET
, // address_offset: address offset
893 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
894 NEC_COMMAND_OFFSET
, // command_offset: command offset
895 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
896 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
897 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
898 NEC_LSB
, // lsb_first: flag: LSB first
899 NEC_FLAGS
// flags: some flags
902 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
904 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
905 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
906 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
907 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
908 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
909 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
910 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
911 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
912 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
913 0, // address_offset: address offset
914 0, // address_end: end of address
915 0, // command_offset: command offset
916 0, // command_end: end of command
917 0, // complete_len: complete length of frame
918 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
919 NEC_LSB
, // lsb_first: flag: LSB first
920 NEC_FLAGS
// flags: some flags
925 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
927 static const PROGMEM IRMP_PARAMETER nec42_param
=
929 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
930 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
931 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
932 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
933 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
934 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
935 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
936 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
937 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
938 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
939 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
940 NEC42_COMMAND_OFFSET
, // command_offset: command offset
941 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
942 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
943 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
944 NEC_LSB
, // lsb_first: flag: LSB first
945 NEC_FLAGS
// flags: some flags
950 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
952 static const PROGMEM IRMP_PARAMETER lgair_param
=
954 IRMP_LGAIR_PROTOCOL
, // protocol: ir protocol
955 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
956 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
957 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
958 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
959 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
960 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
961 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
962 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
963 LGAIR_ADDRESS_OFFSET
, // address_offset: address offset
964 LGAIR_ADDRESS_OFFSET
+ LGAIR_ADDRESS_LEN
, // address_end: end of address
965 LGAIR_COMMAND_OFFSET
, // command_offset: command offset
966 LGAIR_COMMAND_OFFSET
+ LGAIR_COMMAND_LEN
, // command_end: end of command
967 LGAIR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
968 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
969 NEC_LSB
, // lsb_first: flag: LSB first
970 NEC_FLAGS
// flags: some flags
975 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
977 static const PROGMEM IRMP_PARAMETER samsung_param
=
979 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
980 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
981 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
982 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
983 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
984 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
985 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
986 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
987 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
988 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
989 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
990 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
991 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
992 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
993 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
994 SAMSUNG_LSB
, // lsb_first: flag: LSB first
995 SAMSUNG_FLAGS
// flags: some flags
1000 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
1002 static const PROGMEM IRMP_PARAMETER telefunken_param
=
1004 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
1005 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1006 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1007 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1008 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1009 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1010 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1011 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1012 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1013 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
1014 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
1015 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
1016 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
1017 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1018 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1019 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
1020 TELEFUNKEN_FLAGS
// flags: some flags
1025 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
1027 static const PROGMEM IRMP_PARAMETER matsushita_param
=
1029 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
1030 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1031 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1032 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1033 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1034 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1035 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1036 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1037 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1038 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
1039 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
1040 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
1041 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
1042 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1043 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1044 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
1045 MATSUSHITA_FLAGS
// flags: some flags
1050 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1052 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
1054 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
1055 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1056 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1057 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1058 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1059 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1060 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1061 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1062 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1063 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
1064 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
1065 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
1066 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
1067 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1068 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1069 KASEIKYO_LSB
, // lsb_first: flag: LSB first
1070 KASEIKYO_FLAGS
// flags: some flags
1075 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
1077 static const PROGMEM IRMP_PARAMETER recs80_param
=
1079 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1080 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1081 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1082 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1083 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1084 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1085 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1086 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1087 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1088 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1089 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1090 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1091 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1092 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1093 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1094 RECS80_LSB
, // lsb_first: flag: LSB first
1095 RECS80_FLAGS
// flags: some flags
1100 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1102 static const PROGMEM IRMP_PARAMETER rc5_param
=
1104 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1105 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1106 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1107 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1108 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1109 0, // pulse_0_len_min: here: not used
1110 0, // pulse_0_len_max: here: not used
1111 0, // pause_0_len_min: here: not used
1112 0, // pause_0_len_max: here: not used
1113 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1114 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1115 RC5_COMMAND_OFFSET
, // command_offset: command offset
1116 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1117 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1118 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1119 RC5_LSB
, // lsb_first: flag: LSB first
1120 RC5_FLAGS
// flags: some flags
1125 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1127 static const PROGMEM IRMP_PARAMETER denon_param
=
1129 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1130 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1131 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1132 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1133 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1134 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1135 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1136 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1137 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1138 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1139 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1140 DENON_COMMAND_OFFSET
, // command_offset: command offset
1141 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1142 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1143 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1144 DENON_LSB
, // lsb_first: flag: LSB first
1145 DENON_FLAGS
// flags: some flags
1150 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1152 static const PROGMEM IRMP_PARAMETER rc6_param
=
1154 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1156 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1157 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1158 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1159 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1160 0, // pulse_0_len_min: here: not used
1161 0, // pulse_0_len_max: here: not used
1162 0, // pause_0_len_min: here: not used
1163 0, // pause_0_len_max: here: not used
1164 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1165 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1166 RC6_COMMAND_OFFSET
, // command_offset: command offset
1167 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1168 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1169 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1170 RC6_LSB
, // lsb_first: flag: LSB first
1171 RC6_FLAGS
// flags: some flags
1176 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1178 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1180 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1181 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1182 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1183 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1184 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1185 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1186 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1187 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1188 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1189 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1190 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1191 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1192 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1193 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1194 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1195 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1196 RECS80EXT_FLAGS
// flags: some flags
1201 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1203 static const PROGMEM IRMP_PARAMETER nubert_param
=
1205 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1206 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1207 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1208 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1209 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1210 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1211 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1212 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1213 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1214 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1215 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1216 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1217 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1218 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1219 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1220 NUBERT_LSB
, // lsb_first: flag: LSB first
1221 NUBERT_FLAGS
// flags: some flags
1226 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
1228 static const PROGMEM IRMP_PARAMETER speaker_param
=
1230 IRMP_SPEAKER_PROTOCOL
, // protocol: ir protocol
1231 SPEAKER_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1232 SPEAKER_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1233 SPEAKER_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1234 SPEAKER_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1235 SPEAKER_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1236 SPEAKER_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1237 SPEAKER_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1238 SPEAKER_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1239 SPEAKER_ADDRESS_OFFSET
, // address_offset: address offset
1240 SPEAKER_ADDRESS_OFFSET
+ SPEAKER_ADDRESS_LEN
, // address_end: end of address
1241 SPEAKER_COMMAND_OFFSET
, // command_offset: command offset
1242 SPEAKER_COMMAND_OFFSET
+ SPEAKER_COMMAND_LEN
, // command_end: end of command
1243 SPEAKER_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1244 SPEAKER_STOP_BIT
, // stop_bit: flag: frame has stop bit
1245 SPEAKER_LSB
, // lsb_first: flag: LSB first
1246 SPEAKER_FLAGS
// flags: some flags
1251 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1253 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1255 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1256 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1257 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1258 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1259 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1260 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1261 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1262 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1263 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1264 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1265 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1266 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1267 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1268 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1269 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1270 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1271 BANG_OLUFSEN_FLAGS
// flags: some flags
1276 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1278 static uint8_t first_bit
;
1280 static const PROGMEM IRMP_PARAMETER grundig_param
=
1282 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1284 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1285 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1286 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1287 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1288 0, // pulse_0_len_min: here: not used
1289 0, // pulse_0_len_max: here: not used
1290 0, // pause_0_len_min: here: not used
1291 0, // pause_0_len_max: here: not used
1292 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1293 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1294 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1295 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1296 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1297 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1298 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1299 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1304 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1306 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1308 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1309 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1310 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1311 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1312 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1313 0, // pulse_0_len_min: here: not used
1314 0, // pulse_0_len_max: here: not used
1315 0, // pause_0_len_min: here: not used
1316 0, // pause_0_len_max: here: not used
1317 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1318 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1319 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1320 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1321 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1322 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1323 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1324 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1329 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1331 static const PROGMEM IRMP_PARAMETER fdc_param
=
1333 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1334 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1335 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1336 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1337 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1338 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1339 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1340 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1341 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1342 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1343 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1344 FDC_COMMAND_OFFSET
, // command_offset: command offset
1345 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1346 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1347 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1348 FDC_LSB
, // lsb_first: flag: LSB first
1349 FDC_FLAGS
// flags: some flags
1354 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1356 static const PROGMEM IRMP_PARAMETER rccar_param
=
1358 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1359 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1360 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1361 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1362 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1363 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1364 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1365 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1366 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1367 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1368 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1369 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1370 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1371 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1372 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1373 RCCAR_LSB
, // lsb_first: flag: LSB first
1374 RCCAR_FLAGS
// flags: some flags
1379 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1381 static const PROGMEM IRMP_PARAMETER nikon_param
=
1383 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1384 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1385 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1386 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1387 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1388 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1389 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1390 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1391 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1392 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1393 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1394 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1395 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1396 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1397 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1398 NIKON_LSB
, // lsb_first: flag: LSB first
1399 NIKON_FLAGS
// flags: some flags
1404 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1406 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1408 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1409 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1410 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1411 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1412 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1413 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1414 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1415 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1416 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1417 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1418 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1419 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1420 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1421 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1422 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1423 KATHREIN_LSB
, // lsb_first: flag: LSB first
1424 KATHREIN_FLAGS
// flags: some flags
1429 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1431 static const PROGMEM IRMP_PARAMETER netbox_param
=
1433 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1434 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1435 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1436 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1437 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1438 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1439 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1440 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1441 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1442 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1443 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1444 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1445 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1446 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1447 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1448 NETBOX_LSB
, // lsb_first: flag: LSB first
1449 NETBOX_FLAGS
// flags: some flags
1454 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1456 static const PROGMEM IRMP_PARAMETER lego_param
=
1458 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1459 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1460 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1461 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1462 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1463 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1464 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1465 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1466 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1467 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1468 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1469 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1470 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1471 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1472 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1473 LEGO_LSB
, // lsb_first: flag: LSB first
1474 LEGO_FLAGS
// flags: some flags
1479 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1481 static const PROGMEM IRMP_PARAMETER thomson_param
=
1483 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1484 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1485 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1486 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1487 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1488 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1489 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1490 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1491 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1492 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1493 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1494 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1495 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1496 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1497 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1498 THOMSON_LSB
, // lsb_first: flag: LSB first
1499 THOMSON_FLAGS
// flags: some flags
1504 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1506 static const PROGMEM IRMP_PARAMETER bose_param
=
1508 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1509 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1510 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1511 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1512 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1513 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1514 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1515 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1516 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1517 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1518 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1519 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1520 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1521 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1522 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1523 BOSE_LSB
, // lsb_first: flag: LSB first
1524 BOSE_FLAGS
// flags: some flags
1529 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1531 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1533 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1535 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1536 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1537 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1538 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1539 0, // pulse_0_len_min: here: not used
1540 0, // pulse_0_len_max: here: not used
1541 0, // pause_0_len_min: here: not used
1542 0, // pause_0_len_max: here: not used
1543 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1544 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1545 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1546 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1547 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1548 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1549 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1550 A1TVBOX_FLAGS
// flags: some flags
1555 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1557 static const PROGMEM IRMP_PARAMETER ortek_param
=
1559 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1561 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1562 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1563 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1564 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1565 0, // pulse_0_len_min: here: not used
1566 0, // pulse_0_len_max: here: not used
1567 0, // pause_0_len_min: here: not used
1568 0, // pause_0_len_max: here: not used
1569 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1570 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1571 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1572 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1573 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1574 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1575 ORTEK_LSB
, // lsb_first: flag: LSB first
1576 ORTEK_FLAGS
// flags: some flags
1581 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1583 static const PROGMEM IRMP_PARAMETER roomba_param
=
1585 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1586 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1587 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1588 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1589 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1590 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1591 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1592 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1593 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1594 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1595 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1596 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1597 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1598 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1599 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1600 ROOMBA_LSB
, // lsb_first: flag: LSB first
1601 ROOMBA_FLAGS
// flags: some flags
1606 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
1608 static const PROGMEM IRMP_PARAMETER rcmm_param
=
1610 IRMP_RCMM32_PROTOCOL
, // protocol: ir protocol
1612 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1613 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1614 0, // pause_1_len_min: here: minimum length of short pause
1615 0, // pause_1_len_max: here: maximum length of short pause
1616 RCMM32_BIT_PULSE_LEN_MIN
, // pulse_0_len_min: here: not used
1617 RCMM32_BIT_PULSE_LEN_MAX
, // pulse_0_len_max: here: not used
1618 0, // pause_0_len_min: here: not used
1619 0, // pause_0_len_max: here: not used
1620 RCMM32_ADDRESS_OFFSET
, // address_offset: address offset
1621 RCMM32_ADDRESS_OFFSET
+ RCMM32_ADDRESS_LEN
, // address_end: end of address
1622 RCMM32_COMMAND_OFFSET
, // command_offset: command offset
1623 RCMM32_COMMAND_OFFSET
+ RCMM32_COMMAND_LEN
, // command_end: end of command
1624 RCMM32_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1625 RCMM32_STOP_BIT
, // stop_bit: flag: frame has stop bit
1626 RCMM32_LSB
, // lsb_first: flag: LSB first
1627 RCMM32_FLAGS
// flags: some flags
1632 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
1634 static const PROGMEM IRMP_PARAMETER radio1_param
=
1636 IRMP_RADIO1_PROTOCOL
, // protocol: ir protocol
1638 RADIO1_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1639 RADIO1_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1640 RADIO1_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1641 RADIO1_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1642 RADIO1_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1643 RADIO1_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1644 RADIO1_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1645 RADIO1_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1646 RADIO1_ADDRESS_OFFSET
, // address_offset: address offset
1647 RADIO1_ADDRESS_OFFSET
+ RADIO1_ADDRESS_LEN
, // address_end: end of address
1648 RADIO1_COMMAND_OFFSET
, // command_offset: command offset
1649 RADIO1_COMMAND_OFFSET
+ RADIO1_COMMAND_LEN
, // command_end: end of command
1650 RADIO1_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1651 RADIO1_STOP_BIT
, // stop_bit: flag: frame has stop bit
1652 RADIO1_LSB
, // lsb_first: flag: LSB first
1653 RADIO1_FLAGS
// flags: some flags
1658 static uint8_t irmp_bit
; // current bit position
1659 static IRMP_PARAMETER irmp_param
;
1661 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1662 static IRMP_PARAMETER irmp_param2
;
1665 static volatile uint8_t irmp_ir_detected
;
1666 static volatile uint8_t irmp_protocol
;
1667 static volatile uint16_t irmp_address
;
1668 static volatile uint16_t irmp_command
;
1669 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1670 static volatile uint8_t irmp_flags
;
1671 // static volatile uint8_t irmp_busy_flag;
1674 #define input(x) (x)
1675 static uint8_t IRMP_PIN
;
1676 static uint8_t radio
;
1679 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1680 * Initialize IRMP decoder
1681 * @details Configures IRMP input pin
1682 *---------------------------------------------------------------------------------------------------------------------------------------------------
1688 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1689 #elif defined (ARM_STM32) // STM32
1690 GPIO_InitTypeDef GPIO_InitStructure
;
1692 /* GPIOx clock enable */
1693 #if defined (ARM_STM32L1XX)
1694 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1695 #elif defined (ARM_STM32F10X)
1696 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1697 #elif defined (ARM_STM32F4XX)
1698 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1701 /* GPIO Configuration */
1702 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1703 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1704 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1705 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1706 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1707 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1708 #elif defined (ARM_STM32F10X)
1709 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1710 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1712 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1713 #elif defined(STELLARIS_ARM_CORTEX_M4)
1714 // Enable the GPIO port
1715 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1718 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1719 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1721 GPIO_PIN_TYPE_STD_WPU
);
1723 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1724 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1727 #if IRMP_LOGGING == 1
1732 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1734 * @details gets decoded IRMP data
1735 * @param pointer in order to store IRMP data
1736 * @return TRUE: successful, FALSE: failed
1737 *---------------------------------------------------------------------------------------------------------------------------------------------------
1740 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1742 uint8_t rtc
= FALSE
;
1744 if (irmp_ir_detected
)
1746 switch (irmp_protocol
)
1748 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1749 case IRMP_SAMSUNG_PROTOCOL
:
1750 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1752 irmp_command
&= 0xff;
1753 irmp_command
|= irmp_id
<< 8;
1758 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1759 case IRMP_NEC_PROTOCOL
:
1760 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1762 irmp_command
&= 0xff;
1765 else if (irmp_address
== 0x87EE)
1768 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1770 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1771 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1772 irmp_command
&= 0x00FF;
1777 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1778 case IRMP_BOSE_PROTOCOL
:
1779 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1781 irmp_command
&= 0xff;
1786 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1787 case IRMP_SIEMENS_PROTOCOL
:
1788 case IRMP_RUWIDO_PROTOCOL
:
1789 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1796 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1797 case IRMP_KATHREIN_PROTOCOL
:
1798 if (irmp_command
!= 0x0000)
1804 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1805 case IRMP_RC5_PROTOCOL
:
1806 irmp_address
&= ~0x20; // clear toggle bit
1810 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1811 case IRMP_IR60_PROTOCOL
:
1812 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1819 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1824 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1825 case IRMP_RCCAR_PROTOCOL
:
1826 // frame in irmp_data:
1827 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1828 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1829 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1830 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1831 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1832 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1833 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1837 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1838 case IRMP_NETBOX_PROTOCOL
:
1839 if (irmp_command
& 0x1000) // last bit set?
1841 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1844 irmp_command
&= 0x7F;
1847 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1850 irmp_command
|= 0x80;
1856 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1863 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1868 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1869 case IRMP_LEGO_PROTOCOL
:
1871 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1873 if ((irmp_command
& 0x000F) == crc
)
1881 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1883 // rtc = TRUE; // don't accept codes with CRC errors
1898 irmp_data_p
->protocol
= irmp_protocol
;
1899 irmp_data_p
->address
= irmp_address
;
1900 irmp_data_p
->command
= irmp_command
;
1901 irmp_data_p
->flags
= irmp_flags
;
1907 irmp_ir_detected
= FALSE
;
1914 // irmp_is_busy (void)
1916 // return irmp_busy_flag;
1919 #if IRMP_USE_CALLBACK == 1
1921 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1923 irmp_callback_ptr
= cb
;
1925 #endif // IRMP_USE_CALLBACK == 1
1927 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1928 static uint16_t irmp_tmp_address
; // ir address
1929 static uint16_t irmp_tmp_command
; // ir command
1931 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1932 static uint16_t irmp_tmp_address2
; // ir address
1933 static uint16_t irmp_tmp_command2
; // ir command
1936 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
1937 static uint16_t irmp_lgair_address
; // ir address
1938 static uint16_t irmp_lgair_command
; // ir command
1941 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1942 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1944 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1945 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1946 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1949 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1950 static uint8_t parity
; // number of '1' of the first 14 bits, check if even.
1953 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1955 * @details store bit in temp address or temp command
1956 * @param value to store: 0 or 1
1957 *---------------------------------------------------------------------------------------------------------------------------------------------------
1959 // verhindert, dass irmp_store_bit() inline compiliert wird:
1960 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1963 irmp_store_bit (uint8_t value
)
1965 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1966 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
1975 else if (irmp_bit
== 14)
1977 if (value
) // value == 1: even parity
1981 parity
= PARITY_CHECK_FAILED
;
1985 parity
= PARITY_CHECK_OK
;
1990 if (parity
& 0x01) // value == 0: odd parity
1992 parity
= PARITY_CHECK_OK
;
1996 parity
= PARITY_CHECK_FAILED
;
2003 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2004 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
2011 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
2013 if (irmp_param
.lsb_first
)
2015 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
2019 irmp_tmp_address
<<= 1;
2020 irmp_tmp_address
|= value
;
2023 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
2025 if (irmp_param
.lsb_first
)
2027 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
2031 irmp_tmp_command
<<= 1;
2032 irmp_tmp_command
|= value
;
2036 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2037 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
|| irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
)
2041 irmp_lgair_address
<<= 1; // LGAIR uses MSB
2042 irmp_lgair_address
|= value
;
2044 else if (irmp_bit
< 24)
2046 irmp_lgair_command
<<= 1; // LGAIR uses MSB
2047 irmp_lgair_command
|= value
;
2053 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2054 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
2056 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
2061 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2062 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
2064 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
2069 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2070 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
2072 if (irmp_bit
>= 20 && irmp_bit
< 24)
2074 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
2076 else if (irmp_bit
>= 24 && irmp_bit
< 28)
2078 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
2081 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
2085 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
2089 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
2102 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2104 * @details store bit in temp address or temp command
2105 * @param value to store: 0 or 1
2106 *---------------------------------------------------------------------------------------------------------------------------------------------------
2108 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2110 irmp_store_bit2 (uint8_t value
)
2114 if (irmp_param
.protocol
)
2116 irmp_bit2
= irmp_bit
- 2;
2120 irmp_bit2
= irmp_bit
- 1;
2123 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
2125 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
2127 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
2129 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
2132 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2134 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2136 * @details ISR routine, called 10000 times per second
2137 *---------------------------------------------------------------------------------------------------------------------------------------------------
2142 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
2143 static uint8_t wait_for_space
; // flag: wait for data bit space
2144 static uint8_t wait_for_start_space
; // flag: wait for start bit space
2145 static uint8_t irmp_pulse_time
; // count bit time for pulse
2146 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
2147 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
2148 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
2149 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
2150 static uint8_t repetition_frame_number
;
2151 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2152 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
2153 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
2155 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2156 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
2158 #if IRMP_SUPPORT_MANCHESTER == 1
2159 static PAUSE_LEN last_pause
; // last pause value
2161 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2162 static uint8_t last_value
; // last bit value
2164 uint8_t irmp_input
; // input value
2170 irmp_input
= input(IRMP_PIN
);
2172 #if IRMP_USE_CALLBACK == 1
2173 if (irmp_callback_ptr
)
2175 static uint8_t last_inverted_input
;
2177 if (last_inverted_input
!= !irmp_input
)
2179 (*irmp_callback_ptr
) (! irmp_input
);
2180 last_inverted_input
= !irmp_input
;
2183 #endif // IRMP_USE_CALLBACK == 1
2185 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
2187 if (! irmp_ir_detected
) // ir code already detected?
2189 if (! irmp_start_bit_detected
) // start bit detected?
2191 if (! irmp_input
) // receiving burst?
2193 // irmp_busy_flag = TRUE;
2195 if (! irmp_pulse_time
)
2198 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2202 irmp_pulse_time
++; // increment counter
2206 if (irmp_pulse_time
) // it's dark....
2207 { // set flags for counting the time of darkness...
2208 irmp_start_bit_detected
= 1;
2209 wait_for_start_space
= 1;
2211 irmp_tmp_command
= 0;
2212 irmp_tmp_address
= 0;
2213 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2217 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2218 irmp_tmp_command2
= 0;
2219 irmp_tmp_address2
= 0;
2221 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
2222 irmp_lgair_command
= 0;
2223 irmp_lgair_address
= 0;
2226 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2227 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2228 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2233 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2235 key_repetition_len
++;
2237 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2238 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2240 denon_repetition_len
++;
2242 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2245 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2247 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2248 last_irmp_denon_command
= 0;
2249 denon_repetition_len
= 0xFFFF;
2252 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2259 if (wait_for_start_space
) // we have received start bit...
2260 { // ...and are counting the time of darkness
2261 if (irmp_input
) // still dark?
2263 irmp_pause_time
++; // increment counter
2265 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2266 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
) ||
2267 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2269 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2272 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2273 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2278 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2281 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
);
2282 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2285 // irmp_busy_flag = FALSE;
2286 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2287 irmp_pulse_time
= 0;
2288 irmp_pause_time
= 0;
2292 { // receiving first data pulse!
2293 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
2295 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2296 irmp_param2
.protocol
= 0;
2300 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2303 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2304 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2305 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2308 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2309 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2310 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2312 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
2315 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2317 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2318 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2319 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2320 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2323 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2324 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2325 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2327 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2330 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2332 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2333 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2334 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2336 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2338 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2339 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2340 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2342 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2345 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2346 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2347 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2349 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2352 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2353 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2355 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2356 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2357 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2359 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2360 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2361 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2363 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2366 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2369 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2370 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2371 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2374 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2379 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2380 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2381 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2382 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2383 { // it's JVC repetition type 3
2385 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2386 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2387 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2389 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2392 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2394 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2396 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2397 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2398 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2401 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2402 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2403 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2405 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2408 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2410 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2411 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2412 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2415 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2416 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2417 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2419 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2422 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2424 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2425 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2426 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2429 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2430 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2431 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2433 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2436 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2438 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2439 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2440 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2443 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2444 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2445 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2447 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2450 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2452 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2453 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2454 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2455 { // it's MATSUSHITA
2457 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2458 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2459 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2461 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2464 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2466 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2467 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2468 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2471 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2472 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2473 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2475 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2478 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2480 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
2481 if (irmp_pulse_time
>= RADIO1_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RADIO1_START_BIT_PULSE_LEN_MAX
&&
2482 irmp_pause_time
>= RADIO1_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RADIO1_START_BIT_PAUSE_LEN_MAX
)
2485 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2486 RADIO1_START_BIT_PULSE_LEN_MIN
, RADIO1_START_BIT_PULSE_LEN_MAX
,
2487 RADIO1_START_BIT_PAUSE_LEN_MIN
, RADIO1_START_BIT_PAUSE_LEN_MAX
);
2489 irmp_param_p
= (IRMP_PARAMETER
*) &radio1_param
;
2492 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
2494 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2495 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2496 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2499 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2500 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2501 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2503 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2506 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2508 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2509 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2510 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2511 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2512 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2514 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2515 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2516 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2519 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2520 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2521 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2522 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2523 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2524 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2525 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2527 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2530 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2532 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2533 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2534 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2537 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2538 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2539 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2540 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2541 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2542 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2543 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2545 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2548 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2551 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2552 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2553 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2554 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2555 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2559 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2560 last_pause
= irmp_pause_time
;
2562 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2563 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2566 rc5_cmd_bit6
= 1<<6;
2574 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2576 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2577 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2578 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2579 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2582 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2583 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2584 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2585 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2587 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2590 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2592 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2593 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2594 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2595 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2598 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2599 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2600 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2601 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2603 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2606 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2608 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2609 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2610 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2613 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2614 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2615 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2617 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2620 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2622 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2623 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2624 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2627 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2628 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2629 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2631 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2636 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2638 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2639 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2640 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2643 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2644 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2645 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2647 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2650 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2652 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2653 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2654 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2657 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2658 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2659 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2661 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2664 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2666 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2667 if (irmp_pulse_time
>= SPEAKER_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SPEAKER_START_BIT_PULSE_LEN_MAX
&&
2668 irmp_pause_time
>= SPEAKER_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SPEAKER_START_BIT_PAUSE_LEN_MAX
)
2671 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2672 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
,
2673 SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
);
2675 irmp_param_p
= (IRMP_PARAMETER
*) &speaker_param
;
2678 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
2680 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2681 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2682 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2683 { // it's BANG_OLUFSEN
2685 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2686 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2687 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2688 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2689 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2690 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2691 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2692 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2693 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2694 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2695 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2696 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2697 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2699 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2703 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2705 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2706 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2707 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2710 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2711 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2712 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2714 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2715 last_pause
= irmp_pause_time
;
2719 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2721 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2722 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2723 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2724 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2725 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2726 { // it's RUWIDO or SIEMENS
2728 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2729 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2730 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2731 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2732 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2734 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2735 last_pause
= irmp_pause_time
;
2739 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2741 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2742 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2743 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2746 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2747 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2748 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2750 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2753 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2755 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2756 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2757 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2760 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2761 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2762 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2764 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2767 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2769 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2770 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2771 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2774 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2775 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2776 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2778 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2781 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2783 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2784 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2785 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2788 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2789 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2790 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2792 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2795 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2797 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2798 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2799 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2802 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2803 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2804 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2806 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2809 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2811 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2812 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
2813 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
2816 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2817 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
2818 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
2820 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
2825 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2827 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2828 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
2829 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
2830 { // it's ORTEK (Hama)
2832 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2833 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
2834 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
2836 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
2842 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2844 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
2845 if (irmp_pulse_time
>= RCMM32_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCMM32_START_BIT_PULSE_LEN_MAX
&&
2846 irmp_pause_time
>= RCMM32_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_START_BIT_PAUSE_LEN_MAX
)
2849 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2850 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
,
2851 RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
);
2853 irmp_param_p
= (IRMP_PARAMETER
*) &rcmm_param
;
2856 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
2859 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2861 // irmp_busy_flag = FALSE;
2862 irmp_start_bit_detected
= 0; // wait for another start bit...
2865 if (irmp_start_bit_detected
)
2867 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2869 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2872 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2873 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2879 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2880 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2881 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2882 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2886 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2887 if (irmp_param2
.protocol
)
2890 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2891 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2892 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2893 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2899 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2900 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2903 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2908 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2911 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2912 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2918 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2919 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2920 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2921 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2925 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2926 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2929 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2930 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2936 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2937 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2938 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2939 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2945 #if IRMP_SUPPORT_MANCHESTER == 1
2946 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2947 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2948 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2950 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2953 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2954 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2957 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2959 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2962 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2963 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2966 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2970 #endif // IRMP_SUPPORT_MANCHESTER == 1
2972 #if IRMP_SUPPORT_SERIAL == 1
2973 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2978 #endif // IRMP_SUPPORT_SERIAL == 1
2981 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2982 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2985 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2988 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2989 { // pause timings correct for "1"?
2991 ANALYZE_PUTCHAR ('1'); // yes, store 1
2996 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2997 { // pause timings correct for "0"?
2999 ANALYZE_PUTCHAR ('0'); // yes, store 0
3006 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
3007 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3008 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
3011 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3014 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
3015 { // pause timings correct for "1"?
3017 ANALYZE_PUTCHAR ('1'); // yes, store 1
3022 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
3023 { // pause timings correct for "0"?
3025 ANALYZE_PUTCHAR ('0'); // yes, store 0
3032 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
3034 ; // else do nothing
3037 irmp_pulse_time
= 1; // set counter to 1, not 0
3038 irmp_pause_time
= 0;
3039 wait_for_start_space
= 0;
3042 else if (wait_for_space
) // the data section....
3043 { // counting the time of darkness....
3044 uint8_t got_light
= FALSE
;
3046 if (irmp_input
) // still dark?
3048 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
3051 #if IRMP_SUPPORT_MANCHESTER == 1
3052 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
3054 #if IRMP_SUPPORT_SERIAL == 1
3055 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
3057 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
3060 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
3063 ANALYZE_PRINTF ("stop bit detected\n");
3067 irmp_param
.stop_bit
= 0;
3072 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",
3074 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
3076 // irmp_busy_flag = FALSE;
3077 irmp_start_bit_detected
= 0; // wait for another start bit...
3078 irmp_pulse_time
= 0;
3079 irmp_pause_time
= 0;
3084 irmp_pause_time
++; // increment counter
3086 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3087 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
3088 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
3089 irmp_bit
>= 12 - 1) // pause too long?
3090 { // yes, break and close this frame
3091 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
3092 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3093 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
3094 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
3095 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
3099 #if IRMP_SUPPORT_SERIAL == 1
3100 // NETBOX generates no stop bit, here is the timeout condition:
3101 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
3102 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
3104 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3108 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
3109 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
3111 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
3114 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
3116 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3117 irmp_param
.stop_bit
= TRUE
; // set flag
3119 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
3120 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
3121 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
3122 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
3123 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
3124 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
3126 irmp_tmp_command
<<= 1;
3127 irmp_tmp_command
|= first_bit
;
3129 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
3130 { // special manchester decoder
3131 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
3132 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3133 irmp_param
.stop_bit
= TRUE
; // set flag
3135 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
3138 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
3140 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
3141 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
3142 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
3143 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
3144 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
3146 if (irmp_tmp_command
& 0x300)
3148 irmp_tmp_address
= (irmp_tmp_command
>> 8);
3149 irmp_tmp_command
&= 0xFF;
3155 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
3156 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
3158 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
3159 { // special manchester decoder
3160 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
3161 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3162 irmp_param
.stop_bit
= TRUE
; // set flag
3164 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
3167 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
3169 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
3170 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
3171 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
3172 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
3173 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
3176 // RUWIDO: AAAAAAAAACCCCCCCp
3177 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
3178 irmp_tmp_address
<<= 2;
3179 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
3180 irmp_tmp_command
&= 0x003F;
3181 // irmp_tmp_command <<= 4;
3182 irmp_tmp_command
|= last_value
;
3187 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
3188 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
3189 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last data bit...
3190 { // break and close this frame
3191 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
3193 irmp_pause_time
= ROOMBA_1_PAUSE_LEN_EXACT
;
3195 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
3197 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
3200 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
3204 #if IRMP_SUPPORT_MANCHESTER == 1
3205 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
3206 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
3207 { // special manchester decoder
3208 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
3209 irmp_param
.stop_bit
= TRUE
; // set flag
3212 #endif // IRMP_SUPPORT_MANCHESTER == 1
3213 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
3215 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
3219 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3220 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3223 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3225 irmp_param
.stop_bit
= TRUE
; // set flag
3226 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3227 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3228 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
3229 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3230 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3232 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3233 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3234 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 28 || irmp_bit
== 29)) // it was a LGAIR stop bit
3237 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit
);
3239 irmp_param
.stop_bit
= TRUE
; // set flag
3240 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3241 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3242 irmp_tmp_command
= irmp_lgair_command
; // set command: upper 8 bits are command bits
3243 irmp_tmp_address
= irmp_lgair_address
; // lower 4 bits are address bits
3244 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
3246 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3248 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3249 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3250 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
3253 ANALYZE_PRINTF ("Switching to NEC protocol\n");
3255 irmp_param
.stop_bit
= TRUE
; // set flag
3256 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
3257 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3259 // 0123456789ABC0123456789ABC0123456701234567
3260 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3261 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
3262 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
3263 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
3265 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
3266 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3267 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 28) // it was a NEC stop bit
3270 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
3272 irmp_param
.stop_bit
= TRUE
; // set flag
3273 irmp_param
.protocol
= IRMP_LGAIR_PROTOCOL
; // switch protocol
3274 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3275 irmp_tmp_address
= irmp_lgair_address
;
3276 irmp_tmp_command
= irmp_lgair_command
;
3278 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
3279 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3280 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
3283 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
3285 irmp_param
.stop_bit
= TRUE
; // set flag
3286 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
3287 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
3289 // 0123456789ABC0123456789ABC0123456701234567
3290 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
3291 // JVC: AAAACCCCCCCCCCCC
3292 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
3293 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
3295 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3296 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3297 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3298 else if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
&& (irmp_bit
== 12 || irmp_bit
== 24)) // it was a RCMM stop bit
3302 irmp_tmp_command
= (irmp_tmp_address
& 0xFF); // set command: lower 8 bits are command bits
3303 irmp_tmp_address
>>= 8; // upper 4 bits are address bits
3306 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit
);
3308 irmp_param
.protocol
= IRMP_RCMM12_PROTOCOL
; // switch protocol
3310 else // if ((irmp_bit == 24)
3313 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit
);
3315 irmp_param
.protocol
= IRMP_RCMM24_PROTOCOL
; // switch protocol
3317 irmp_param
.stop_bit
= TRUE
; // set flag
3318 irmp_param
.complete_len
= irmp_bit
; // patch length
3320 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
3324 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
3325 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3328 // irmp_busy_flag = FALSE;
3329 irmp_start_bit_detected
= 0; // wait for another start bit...
3330 irmp_pulse_time
= 0;
3331 irmp_pause_time
= 0;
3344 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3347 #if IRMP_SUPPORT_MANCHESTER == 1
3348 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
3351 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
3352 #else // better, but some IR-RCs use asymmetric timings :-/
3353 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
3354 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
3357 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3358 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3361 ANALYZE_PUTCHAR ('T');
3363 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
3378 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3381 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
3383 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
3385 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3386 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
3389 ANALYZE_PUTCHAR ('T');
3393 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
3406 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3409 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
3411 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
3412 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3413 if (! irmp_param2
.protocol
)
3420 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3424 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3425 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3427 uint8_t manchester_value
;
3429 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3431 manchester_value
= last_value
? 0 : 1;
3432 last_value
= manchester_value
;
3436 manchester_value
= last_value
;
3440 ANALYZE_PUTCHAR (manchester_value
+ '0');
3443 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3444 if (! irmp_param2
.protocol
)
3452 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3453 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3456 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3458 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3459 irmp_param
.address_offset
= 5;
3460 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3461 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3462 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3463 irmp_tmp_address
= 0;
3465 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3467 irmp_store_bit (manchester_value
);
3471 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3472 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3473 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3474 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3475 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3478 ANALYZE_PUTCHAR ('?');
3480 irmp_param
.protocol
= 0; // switch to FDC, see below
3483 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3484 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3485 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3486 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3487 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3488 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3491 ANALYZE_PUTCHAR ('?');
3493 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3496 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3499 ANALYZE_PUTCHAR ('?');
3501 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3502 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3504 // irmp_busy_flag = FALSE;
3505 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3506 irmp_pause_time
= 0;
3510 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3511 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3513 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3516 ANALYZE_PRINTF (" 1 (FDC)\n");
3518 irmp_store_bit2 (1);
3520 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3523 ANALYZE_PRINTF (" 0 (FDC)\n");
3525 irmp_store_bit2 (0);
3528 if (! irmp_param
.protocol
)
3531 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3533 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3534 irmp_param2
.protocol
= 0;
3535 irmp_tmp_address
= irmp_tmp_address2
;
3536 irmp_tmp_command
= irmp_tmp_command2
;
3539 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3540 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3541 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3543 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3546 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3548 irmp_store_bit2 (1);
3550 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3553 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3555 irmp_store_bit2 (0);
3558 if (! irmp_param
.protocol
)
3561 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3563 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3564 irmp_param2
.protocol
= 0;
3565 irmp_tmp_address
= irmp_tmp_address2
;
3566 irmp_tmp_command
= irmp_tmp_command2
;
3569 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3571 last_pause
= irmp_pause_time
;
3575 #endif // IRMP_SUPPORT_MANCHESTER == 1
3577 #if IRMP_SUPPORT_SERIAL == 1
3578 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3580 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3583 ANALYZE_PUTCHAR ('1');
3587 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3589 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3593 irmp_pulse_time
= 0;
3597 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3600 ANALYZE_PUTCHAR ('0');
3604 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3606 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3610 irmp_pause_time
= 0;
3619 #endif // IRMP_SUPPORT_SERIAL == 1
3621 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3622 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3624 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3625 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3628 ANALYZE_PRINTF ("SYNC\n");
3634 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3636 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3637 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3638 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3639 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3641 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3644 ANALYZE_PUTCHAR ('1');
3653 ANALYZE_PUTCHAR ('0');
3661 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3665 { // timing incorrect!
3667 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3668 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3670 // irmp_busy_flag = FALSE;
3671 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3672 irmp_pause_time
= 0;
3676 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3678 #if IRMP_SUPPORT_NEC16_PROTOCOL
3679 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3680 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3681 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3682 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3683 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3684 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3687 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3689 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3690 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3691 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3692 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3693 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3694 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3698 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3700 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3701 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3703 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3705 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3707 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3710 ANALYZE_PRINTF ("3rd start bit\n");
3716 { // timing incorrect!
3718 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
);
3719 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3721 // irmp_busy_flag = FALSE;
3722 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3723 irmp_pause_time
= 0;
3726 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3728 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3731 ANALYZE_PRINTF ("trailer bit\n");
3737 { // timing incorrect!
3739 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
);
3740 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3742 // irmp_busy_flag = FALSE;
3743 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3744 irmp_pause_time
= 0;
3749 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3750 { // pulse & pause timings correct for "1"?
3752 ANALYZE_PUTCHAR ('1');
3759 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3760 { // pulse & pause timings correct for "0"?
3762 ANALYZE_PUTCHAR ('0');
3769 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3772 ANALYZE_PUTCHAR (last_value
+ '0');
3775 irmp_store_bit (last_value
);
3779 { // timing incorrect!
3781 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
);
3782 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3784 // irmp_busy_flag = FALSE;
3785 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3786 irmp_pause_time
= 0;
3791 { // timing incorrect!
3793 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
);
3794 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3796 // irmp_busy_flag = FALSE;
3797 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3798 irmp_pause_time
= 0;
3802 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3804 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
3805 if (irmp_param
.protocol
== IRMP_RCMM32_PROTOCOL
)
3807 if (irmp_pause_time
>= RCMM32_BIT_00_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_00_PAUSE_LEN_MAX
)
3810 ANALYZE_PUTCHAR ('0');
3811 ANALYZE_PUTCHAR ('0');
3816 else if (irmp_pause_time
>= RCMM32_BIT_01_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_01_PAUSE_LEN_MAX
)
3819 ANALYZE_PUTCHAR ('0');
3820 ANALYZE_PUTCHAR ('1');
3825 else if (irmp_pause_time
>= RCMM32_BIT_10_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_10_PAUSE_LEN_MAX
)
3828 ANALYZE_PUTCHAR ('1');
3829 ANALYZE_PUTCHAR ('0');
3834 else if (irmp_pause_time
>= RCMM32_BIT_11_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCMM32_BIT_11_PAUSE_LEN_MAX
)
3837 ANALYZE_PUTCHAR ('1');
3838 ANALYZE_PUTCHAR ('1');
3844 ANALYZE_PRINTF ("\n");
3851 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3852 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3853 { // pulse & pause timings correct for "1"?
3855 ANALYZE_PUTCHAR ('1');
3861 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3862 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3863 { // pulse & pause timings correct for "0"?
3865 ANALYZE_PUTCHAR ('0');
3872 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3874 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3875 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3876 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3877 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3879 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3886 ANALYZE_PUTCHAR ('S');
3889 irmp_tmp_command
<<= 1;
3894 ANALYZE_PUTCHAR ('S');
3902 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3903 { // timing incorrect!
3905 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3906 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3908 // irmp_busy_flag = FALSE;
3909 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3910 irmp_pause_time
= 0;
3913 irmp_pulse_time
= 1; // set counter to 1, not 0
3917 { // counting the pulse length ...
3918 if (! irmp_input
) // still light?
3920 irmp_pulse_time
++; // increment counter
3924 wait_for_space
= 1; // let's count the time (see above)
3925 irmp_pause_time
= 1; // set pause counter to 1, not 0
3929 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3931 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3933 repetition_frame_number
++;
3937 repetition_frame_number
= 0;
3940 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3941 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3942 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3945 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3946 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3948 key_repetition_len
= 0;
3953 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3954 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3955 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
3958 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3959 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3961 key_repetition_len
= 0;
3966 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3967 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3968 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3971 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3972 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3974 key_repetition_len
= 0;
3979 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3980 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3981 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3984 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3985 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3987 key_repetition_len
= 0;
3992 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3993 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3994 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3997 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3998 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4000 key_repetition_len
= 0;
4005 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
4006 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
4007 if (irmp_param
.protocol
== IRMP_SPEAKER_PROTOCOL
&& (repetition_frame_number
& 0x01))
4010 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
4011 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
4013 key_repetition_len
= 0;
4020 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
4022 irmp_ir_detected
= TRUE
;
4024 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
4025 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
4026 { // check for repetition frame
4027 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
4029 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
4030 last_irmp_denon_command
= 0;
4032 irmp_protocol
= irmp_param
.protocol
; // store protocol
4033 irmp_address
= irmp_tmp_address
; // store address
4034 irmp_command
= irmp_tmp_command
; // store command
4038 if ((irmp_tmp_command
& 0x01) == 0x00)
4041 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4043 last_irmp_denon_command
= irmp_tmp_command
;
4044 denon_repetition_len
= 0;
4045 irmp_ir_detected
= FALSE
;
4050 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4052 last_irmp_denon_command
= 0;
4053 irmp_ir_detected
= FALSE
;
4058 #endif // IRMP_SUPPORT_DENON_PROTOCOL
4060 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
4061 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
4062 { // Grundig start frame?
4064 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
4066 irmp_ir_detected
= FALSE
;
4069 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
4071 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
4072 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
4073 { // Nokia start frame?
4075 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
4077 irmp_ir_detected
= FALSE
;
4080 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
4082 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4083 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
4085 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
4088 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
4089 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
4091 irmp_tmp_address
= last_irmp_address
; // address is last address
4092 irmp_tmp_command
= last_irmp_command
; // command is last command
4093 irmp_flags
|= IRMP_FLAG_REPETITION
;
4094 key_repetition_len
= 0;
4099 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
4101 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
4102 irmp_ir_detected
= FALSE
;
4105 #endif // IRMP_SUPPORT_NEC_PROTOCOL
4107 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4108 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
4112 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
4114 if (xor_value
!= (xor_check
[2] & 0x0F))
4117 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
4119 irmp_ir_detected
= FALSE
;
4122 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
4124 if (xor_value
!= xor_check
[5])
4127 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
4129 irmp_ir_detected
= FALSE
;
4132 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
4134 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
4136 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4137 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
4139 if (parity
== PARITY_CHECK_FAILED
)
4142 ANALYZE_PRINTF ("error 6: parity check failed\n");
4144 irmp_ir_detected
= FALSE
;
4147 if ((irmp_tmp_address
& 0x03) == 0x02)
4150 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
4152 irmp_ir_detected
= FALSE
;
4154 irmp_tmp_address
>>= 2;
4156 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
4158 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
4159 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
4161 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
4164 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
4166 irmp_protocol
= irmp_param
.protocol
;
4169 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
4170 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
4172 if (irmp_tmp_command
& 0x000F) // released key?
4174 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
4178 irmp_tmp_command
>>= 4; // no, it's a pressed key
4180 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
4181 irmp_tmp_address
&= 0x003F;
4185 irmp_address
= irmp_tmp_address
; // store address
4186 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
4187 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
4189 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4193 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
4194 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
4196 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
4199 irmp_command
= irmp_tmp_command
; // store command
4201 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
4202 irmp_id
= irmp_tmp_id
;
4207 if (irmp_ir_detected
)
4209 if (last_irmp_command
== irmp_tmp_command
&&
4210 last_irmp_address
== irmp_tmp_address
&&
4211 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
4213 irmp_flags
|= IRMP_FLAG_REPETITION
;
4216 last_irmp_address
= irmp_tmp_address
; // store as last address, too
4217 last_irmp_command
= irmp_tmp_command
; // store as last command, too
4219 key_repetition_len
= 0;
4224 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
4228 // irmp_busy_flag = FALSE;
4229 irmp_start_bit_detected
= 0; // and wait for next start bit
4230 irmp_tmp_command
= 0;
4231 irmp_pulse_time
= 0;
4232 irmp_pause_time
= 0;
4234 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
4235 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
4236 { // set pulse time here!
4237 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
4239 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
4244 #if defined(STELLARIS_ARM_CORTEX_M4)
4245 // Clear the timer interrupt
4246 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
4249 return (irmp_ir_detected
);
4254 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4255 * main functions - for Unix/Linux + Windows only!
4259 * Compile it under linux with:
4262 * usage: ./irmp [-v|-s|-a|-l|-p] < file
4268 * -l list pulse/pauses
4270 *---------------------------------------------------------------------------------------------------------------------------------------------------
4274 print_timings (void)
4276 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
4277 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
4279 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
4280 printf ("====================================================================================\n");
4281 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4282 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
4283 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
4284 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
4286 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4287 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
4288 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4289 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4291 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4292 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
,
4293 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
4294 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
4296 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4297 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
4298 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
4299 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
4301 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4302 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
4303 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
4304 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
4306 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4307 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
4308 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
4309 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
4311 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4312 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
4313 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
4314 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
4316 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
4317 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
4318 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
4320 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4321 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
4322 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
4323 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
4325 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4326 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
4327 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
4328 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
4330 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4331 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
4332 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
4334 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4335 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
4336 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
4337 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
4339 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4340 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
4341 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
4342 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
4344 printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4345 SPEAKER_START_BIT_PULSE_LEN_MIN
, SPEAKER_START_BIT_PULSE_LEN_MAX
, SPEAKER_START_BIT_PAUSE_LEN_MIN
, SPEAKER_START_BIT_PAUSE_LEN_MAX
,
4346 SPEAKER_0_PULSE_LEN_MIN
, SPEAKER_0_PULSE_LEN_MAX
, SPEAKER_0_PAUSE_LEN_MIN
, SPEAKER_0_PAUSE_LEN_MAX
,
4347 SPEAKER_1_PULSE_LEN_MIN
, SPEAKER_1_PULSE_LEN_MAX
, SPEAKER_1_PAUSE_LEN_MIN
, SPEAKER_1_PAUSE_LEN_MAX
);
4349 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
4350 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
4351 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
4353 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
4354 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
4355 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
4357 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
4358 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
4359 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
4361 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
4362 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
4363 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
4365 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4366 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
4367 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
4369 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
4370 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
4371 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
4372 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
4374 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4375 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
4376 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
4377 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4378 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
4379 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
4380 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
4382 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4383 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
4384 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
4385 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
4387 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4388 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
4389 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
4390 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
4392 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4393 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
4394 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
4395 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
4397 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4398 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
4399 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
4400 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
4403 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n");
4404 printf ("================================================================================================\n");
4405 printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n",
4406 (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PULSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_START_BIT_PAUSE_TIME
),
4407 (uint8_t)(F_INTERRUPTS
* RCMM32_PULSE_TIME
),
4408 (uint8_t)(F_INTERRUPTS
* RCMM32_00_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_01_PAUSE_TIME
),
4409 (uint8_t)(F_INTERRUPTS
* RCMM32_10_PAUSE_TIME
), (uint8_t)(F_INTERRUPTS
* RCMM32_11_PAUSE_TIME
));
4410 printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
4411 RCMM32_START_BIT_PULSE_LEN_MIN
, RCMM32_START_BIT_PULSE_LEN_MAX
, RCMM32_START_BIT_PAUSE_LEN_MIN
, RCMM32_START_BIT_PAUSE_LEN_MAX
,
4412 RCMM32_BIT_PULSE_LEN_MIN
, RCMM32_BIT_PULSE_LEN_MAX
, RCMM32_BIT_00_PAUSE_LEN_MIN
, RCMM32_BIT_00_PAUSE_LEN_MAX
,
4413 RCMM32_BIT_01_PAUSE_LEN_MIN
, RCMM32_BIT_01_PAUSE_LEN_MAX
, RCMM32_BIT_10_PAUSE_LEN_MIN
, RCMM32_BIT_10_PAUSE_LEN_MAX
,
4414 RCMM32_BIT_11_PAUSE_LEN_MIN
, RCMM32_BIT_11_PAUSE_LEN_MAX
);
4418 print_spectrum (char * text
, int * buf
, int is_pulse
)
4431 puts ("-------------------------------------------------------------------------------");
4432 printf ("%s:\n", text
);
4434 for (i
= 0; i
< 256; i
++)
4436 if (buf
[i
] > max_value
)
4442 for (i
= 1; i
< 200; i
++)
4447 value
= (buf
[i
] * 60) / max_value
;
4449 for (j
= 0; j
< value
; j
++)
4453 printf (" %d\n", buf
[i
]);
4464 average
= (float) sum
/ (float) counter
;
4475 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
4476 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
4477 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
4479 tolerance
= (max
- average
);
4481 if (average
- min
> tolerance
)
4483 tolerance
= average
- min
;
4486 tolerance
= tolerance
* 100 / average
;
4487 printf ("tol: %4.1f%%\n", tolerance
);
4497 #define STATE_LEFT_SHIFT 0x01
4498 #define STATE_RIGHT_SHIFT 0x02
4499 #define STATE_LEFT_CTRL 0x04
4500 #define STATE_LEFT_ALT 0x08
4501 #define STATE_RIGHT_ALT 0x10
4503 #define KEY_ESCAPE 0x1B // keycode = 0x006e
4504 #define KEY_MENUE 0x80 // keycode = 0x0070
4505 #define KEY_BACK 0x81 // keycode = 0x0071
4506 #define KEY_FORWARD 0x82 // keycode = 0x0072
4507 #define KEY_ADDRESS 0x83 // keycode = 0x0073
4508 #define KEY_WINDOW 0x84 // keycode = 0x0074
4509 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
4510 #define KEY_STOP 0x86 // keycode = 0x0076
4511 #define KEY_MAIL 0x87 // keycode = 0x0077
4512 #define KEY_FAVORITES 0x88 // keycode = 0x0078
4513 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
4514 #define KEY_SETUP 0x8A // keycode = 0x007a
4515 #define KEY_FONT 0x8B // keycode = 0x007b
4516 #define KEY_PRINT 0x8C // keycode = 0x007c
4517 #define KEY_ON_OFF 0x8E // keycode = 0x007c
4519 #define KEY_INSERT 0x90 // keycode = 0x004b
4520 #define KEY_DELETE 0x91 // keycode = 0x004c
4521 #define KEY_LEFT 0x92 // keycode = 0x004f
4522 #define KEY_HOME 0x93 // keycode = 0x0050
4523 #define KEY_END 0x94 // keycode = 0x0051
4524 #define KEY_UP 0x95 // keycode = 0x0053
4525 #define KEY_DOWN 0x96 // keycode = 0x0054
4526 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
4527 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
4528 #define KEY_RIGHT 0x99 // keycode = 0x0059
4529 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
4530 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
4533 get_fdc_key (uint16_t cmd
)
4535 static uint8_t key_table
[128] =
4537 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
4538 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
4539 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
4540 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
4541 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
4543 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
4544 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
4545 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
4546 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
4548 static uint8_t state
;
4554 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
4555 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
4556 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
4557 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
4558 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
4559 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
4560 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
4561 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
4562 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
4563 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
4565 case 0x006e: key
= KEY_ESCAPE
; break;
4566 case 0x004b: key
= KEY_INSERT
; break;
4567 case 0x004c: key
= KEY_DELETE
; break;
4568 case 0x004f: key
= KEY_LEFT
; break;
4569 case 0x0050: key
= KEY_HOME
; break;
4570 case 0x0051: key
= KEY_END
; break;
4571 case 0x0053: key
= KEY_UP
; break;
4572 case 0x0054: key
= KEY_DOWN
; break;
4573 case 0x0055: key
= KEY_PAGE_UP
; break;
4574 case 0x0056: key
= KEY_PAGE_DOWN
; break;
4575 case 0x0059: key
= KEY_RIGHT
; break;
4576 case 0x0400: key
= KEY_MOUSE_1
; break;
4577 case 0x0800: key
= KEY_MOUSE_2
; break;
4581 if (!(cmd
& 0x80)) // pressed key
4583 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
4585 key
= cmd
+ 0x10; // 7x -> 8x
4587 else if (cmd
< 64) // key listed in key_table
4589 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
4593 case 0x0003: key
= '²'; break;
4594 case 0x0008: key
= '{'; break;
4595 case 0x0009: key
= '['; break;
4596 case 0x000A: key
= ']'; break;
4597 case 0x000B: key
= '}'; break;
4598 case 0x000C: key
= '\\'; break;
4599 case 0x001C: key
= '~'; break;
4600 case 0x002D: key
= '|'; break;
4601 case 0x0034: key
= 0xB5; break; // Mu
4604 else if (state
& (STATE_LEFT_CTRL
))
4606 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4608 key
= key_table
[cmd
] - 'a' + 1;
4612 key
= key_table
[cmd
];
4617 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4621 key
= key_table
[idx
];
4633 static int analyze
= FALSE
;
4634 static int list
= FALSE
;
4635 static IRMP_DATA irmp_data
;
4636 static int expected_protocol
;
4637 static int expected_address
;
4638 static int expected_command
;
4639 static int do_check_expected_values
;
4644 if (! analyze
&& ! list
)
4648 if (irmp_get_data (&irmp_data
))
4653 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4658 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4661 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4663 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4665 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4666 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4668 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4670 char * p
= (char *) NULL
;
4674 case '\t' : p
= "TAB"; break;
4675 case '\r' : p
= "CR"; break;
4676 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4677 case KEY_MENUE
: p
= "MENUE"; break;
4678 case KEY_BACK
: p
= "BACK"; break;
4679 case KEY_FORWARD
: p
= "FORWARD"; break;
4680 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4681 case KEY_WINDOW
: p
= "WINDOW"; break;
4682 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4683 case KEY_STOP
: p
= "STOP"; break;
4684 case KEY_MAIL
: p
= "MAIL"; break;
4685 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4686 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4687 case KEY_SETUP
: p
= "SETUP"; break;
4688 case KEY_FONT
: p
= "FONT"; break;
4689 case KEY_PRINT
: p
= "PRINT"; break;
4690 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4692 case KEY_INSERT
: p
= "INSERT"; break;
4693 case KEY_DELETE
: p
= "DELETE"; break;
4694 case KEY_LEFT
: p
= "LEFT"; break;
4695 case KEY_HOME
: p
= "HOME"; break;
4696 case KEY_END
: p
= "END"; break;
4697 case KEY_UP
: p
= "UP"; break;
4698 case KEY_DOWN
: p
= "DOWN"; break;
4699 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
4700 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
4701 case KEY_RIGHT
: p
= "RIGHT"; break;
4702 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
4703 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
4704 default : p
= "<UNKNWON>"; break;
4707 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
4708 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
4712 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
4713 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
4718 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
4719 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
4722 if (do_check_expected_values
)
4724 if (irmp_data
.protocol
!= expected_protocol
||
4725 irmp_data
.address
!= expected_address
||
4726 irmp_data
.command
!= expected_command
)
4728 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
4729 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
4733 printf (" checked!\n");
4735 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
4746 main (int argc
, char ** argv
)
4754 int start_pulses
[256];
4755 int start_pauses
[256];
4759 int first_pulse
= TRUE
;
4760 int first_pause
= TRUE
;
4764 if (! strcmp (argv
[1], "-v"))
4768 else if (! strcmp (argv
[1], "-l"))
4772 else if (! strcmp (argv
[1], "-a"))
4776 else if (! strcmp (argv
[1], "-s"))
4780 else if (! strcmp (argv
[1], "-p"))
4785 else if (! strcmp (argv
[1], "-r"))
4791 for (i
= 0; i
< 256; i
++)
4793 start_pulses
[i
] = 0;
4794 start_pauses
[i
] = 0;
4801 while ((ch
= getchar ()) != EOF
)
4803 if (ch
== '_' || ch
== '0')
4811 printf ("pause: %d\n", pause
);
4820 start_pauses
[pause
]++;
4822 first_pause
= FALSE
;
4838 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
4844 printf ("pulse: %d ", pulse
);
4853 start_pulses
[pulse
]++;
4855 first_pulse
= FALSE
;
4871 else if (ch
== '\n')
4876 if (list
&& pause
> 0)
4878 printf ("pause: %d\n", pause
);
4884 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
4898 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4909 puts ("-------------------------------------------------------------------");
4913 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4915 if (ch
!= '\r') // ignore CR in DOS/Windows files
4917 if (ch
== '[' && idx
== -1)
4925 do_check_expected_values
= FALSE
;
4929 expected_protocol
= atoi (buf
);
4931 if (expected_protocol
> 0)
4940 if (sscanf (p
, "%x", &expected_address
) == 1)
4942 do_check_expected_values
= TRUE
;
4949 if (do_check_expected_values
)
4951 do_check_expected_values
= FALSE
;
4959 if (sscanf (p
, "%x", &expected_command
) == 1)
4961 do_check_expected_values
= TRUE
;
4968 if (do_check_expected_values
)
4970 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4975 else if (idx
< 1024 - 2)
4995 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4996 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4997 print_spectrum ("PULSES", pulses
, TRUE
);
4998 print_spectrum ("PAUSES", pauses
, FALSE
);
4999 puts ("-------------------------------------------------------------------------------");