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.141 2013/04/09 11:55:39 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 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
234 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
235 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
236 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
237 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
238 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
239 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
240 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
241 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
242 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
243 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
244 #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
245 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
246 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
247 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
248 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
249 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
250 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
251 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
252 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
253 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
254 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
255 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
256 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
257 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
258 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
260 #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
261 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
262 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
263 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
264 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
265 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
266 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
268 #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)
269 #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)
270 #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)
271 #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)
272 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
273 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
274 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
275 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
277 #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
278 #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
279 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
280 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
281 #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
282 #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
283 #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
284 #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
286 #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
288 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
290 #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
292 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
293 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
294 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
295 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
296 #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
297 #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
298 #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
299 #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
300 #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
301 #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
303 #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
304 #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
305 #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!
306 #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!
307 #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
308 #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
309 #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
310 #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
311 #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
312 #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
313 // autodetect JVC repetition frame within 50 msec:
314 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
316 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
317 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
318 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
319 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
320 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
321 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
322 #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
323 #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
324 #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
325 #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
326 #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
327 #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
328 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
330 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
331 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
332 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
333 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
334 #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
335 #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
336 #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
337 #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
338 #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
339 #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
340 #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
341 #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
342 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
343 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
345 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
346 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
347 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
348 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
349 #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
350 #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
351 #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
352 #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
354 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
355 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
356 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
357 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
358 #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
359 #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
360 #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
361 #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
362 #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
363 #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
365 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
366 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
367 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
368 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
369 #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
370 #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
371 #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
372 #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
373 #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
374 #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
375 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
377 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
378 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
379 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
380 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
381 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
382 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
383 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
384 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
386 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
387 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
388 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
389 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
390 #define ORTEK_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
391 #define ORTEK_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
392 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
393 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
395 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
396 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
397 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
398 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
399 #define TELEFUNKEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
400 #define TELEFUNKEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
401 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
402 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
403 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
404 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
405 // autodetect TELEFUNKEN repetition frame within 50 msec:
406 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
408 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
409 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
410 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
411 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
412 #define ROOMBA_1_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME))
413 #define ROOMBA_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
414 #define ROOMBA_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
415 #define ROOMBA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
416 #define ROOMBA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
417 #define ROOMBA_0_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
418 #define ROOMBA_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
419 #define ROOMBA_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
420 #define ROOMBA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
421 #define ROOMBA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
423 #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
426 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
427 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
428 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
429 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
430 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
432 static int time_counter
;
435 # define ANALYZE_PUTCHAR(a)
436 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
437 # define ANALYZE_PRINTF(...)
438 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
439 # define ANALYZE_NEWLINE()
442 #if IRMP_USE_CALLBACK == 1
443 static void (*irmp_callback_ptr
) (uint8_t);
444 #endif // IRMP_USE_CALLBACK == 1
446 #define PARITY_CHECK_OK 1
447 #define PARITY_CHECK_FAILED 0
449 /*---------------------------------------------------------------------------------------------------------------------------------------------------
451 *---------------------------------------------------------------------------------------------------------------------------------------------------
453 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
455 irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] =
497 /*---------------------------------------------------------------------------------------------------------------------------------------------------
499 *---------------------------------------------------------------------------------------------------------------------------------------------------
501 #if IRMP_LOGGING == 1 // logging via UART
503 #if IRMP_EXT_LOGGING == 1 // use external logging
504 #include "irmpextlog.h"
505 #else // normal UART log (IRMP_EXT_LOGGING == 0)
507 #ifndef UNIX_OR_WINDOWS
508 #include <util/setbaud.h>
513 #define UART0_UBRRH UBRR0H
514 #define UART0_UBRRL UBRR0L
515 #define UART0_UCSRA UCSR0A
516 #define UART0_UCSRB UCSR0B
517 #define UART0_UCSRC UCSR0C
518 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
519 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
520 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
522 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
524 #define UART0_URSEL_BIT_VALUE (0)
526 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
527 #define UART0_UDR UDR0
528 #define UART0_U2X U2X0
532 #define UART0_UBRRH UBRRH
533 #define UART0_UBRRL UBRRL
534 #define UART0_UCSRA UCSRA
535 #define UART0_UCSRB UCSRB
536 #define UART0_UCSRC UCSRC
537 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
538 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
539 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
541 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
543 #define UART0_URSEL_BIT_VALUE (0)
545 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
546 #define UART0_UDR UDR
547 #define UART0_U2X U2X
550 #endif //IRMP_EXT_LOGGING
552 /*---------------------------------------------------------------------------------------------------------------------------------------------------
554 * @details Initializes UART
555 *---------------------------------------------------------------------------------------------------------------------------------------------------
558 irmp_uart_init (void)
560 #ifndef UNIX_OR_WINDOWS
561 #if (IRMP_EXT_LOGGING == 0) // use UART
562 UART0_UBRRH
= UBRRH_VALUE
; // set baud rate
563 UART0_UBRRL
= UBRRL_VALUE
;
566 UART0_UCSRA
|= (1<<UART0_U2X
);
568 UART0_UCSRA
&= ~(1<<UART0_U2X
);
571 UART0_UCSRC
= UART0_UCSZ1_BIT_VALUE
| UART0_UCSZ0_BIT_VALUE
| UART0_URSEL_BIT_VALUE
;
572 UART0_UCSRB
|= UART0_TXEN_BIT_VALUE
; // enable UART TX
573 #else // other log method
575 #endif //IRMP_EXT_LOGGING
576 #endif // UNIX_OR_WINDOWS
579 /*---------------------------------------------------------------------------------------------------------------------------------------------------
581 * @details Sends character
582 * @param ch character to be transmitted
583 *---------------------------------------------------------------------------------------------------------------------------------------------------
586 irmp_uart_putc (unsigned char ch
)
588 #ifndef UNIX_OR_WINDOWS
589 #if (IRMP_EXT_LOGGING == 0)
590 while (!(UART0_UCSRA
& UART0_UDRE_BIT_VALUE
))
597 sendextlog(ch
); //Use external log
601 #endif // UNIX_OR_WINDOWS
604 /*---------------------------------------------------------------------------------------------------------------------------------------------------
606 *---------------------------------------------------------------------------------------------------------------------------------------------------
609 #define STARTCYCLES 2 // min count of zeros before start of logging
610 #define ENDBITS 1000 // number of sequenced highbits to detect end
611 #define DATALEN 700 // log buffer size
613 #if 0 // old log routine
616 irmp_log (uint8_t val
)
618 static uint8_t buf
[DATALEN
]; // logging buffer
619 static uint16_t buf_idx
; // number of written bits
620 static uint8_t startcycles
; // current number of start-zeros
621 static uint16_t cnt
; // counts sequenced highbits - to detect end
623 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
631 if (! val
|| (val
&& buf_idx
!= 0)) // start or continue logging on "0", "1" cannot init logging
633 if (buf_idx
< DATALEN
* 8) // index in range?
637 buf
[(buf_idx
/ 8)] |= (1<<(buf_idx
% 8)); // set bit
641 buf
[(buf_idx
/ 8)] &= ~(1<<(buf_idx
% 8)); // reset bit
648 { // if high received then look at log-stop condition
652 { // if stop condition is true, output on uart
655 for (i
= 0; i
< STARTCYCLES
; i
++)
657 irmp_uart_putc ('0'); // the ignored starting zeros
660 for (i
= 0; i
< (buf_idx
- ENDBITS
+ 20) / 8; i
++) // transform bitset into uart chars
665 for (j
= 0; j
< 8; j
++)
667 irmp_uart_putc ((d
& 1) + '0');
672 irmp_uart_putc ('\n');
684 #else // new log routine
687 irmp_log (uint8_t val
)
689 static uint8_t buf
[DATALEN
]; // logging buffer
690 static uint16_t buf_idx
; // index
691 static uint8_t startcycles
; // current number of start-zeros
692 static uint16_t cnt
; // counts sequenced highbits - to detect end
693 static uint8_t last_val
= 1;
695 if (! val
&& (startcycles
< STARTCYCLES
) && !buf_idx
) // prevent that single random zeros init logging
703 if (! val
|| buf_idx
!= 0) // start or continue logging on "0", "1" cannot init logging
709 if (val
&& cnt
> ENDBITS
) // if high received then look at log-stop condition
710 { // if stop condition is true, output on uart
717 for (i8
= 0; i8
< STARTCYCLES
; i8
++)
719 irmp_uart_putc ('0'); // the ignored starting zeros
722 for (i
= 0; i
< buf_idx
; i
++)
731 d
|= ((uint16_t) buf
[i
] << 8);
734 for (j
= 0; j
< d
; j
++)
739 v
= (v
== '1') ? '0' : '1';
742 for (i8
= 0; i8
< 20; i8
++)
744 irmp_uart_putc ('1');
747 irmp_uart_putc ('\n');
753 else if (buf_idx
< DATALEN
- 3)
757 buf
[buf_idx
++] = 0xff;
758 buf
[buf_idx
++] = (cnt
& 0xff);
759 buf
[buf_idx
] = (cnt
>> 8);
777 #define irmp_log(val)
778 #endif //IRMP_LOGGING
782 uint8_t protocol
; // ir protocol
783 uint8_t pulse_1_len_min
; // minimum length of pulse with bit value 1
784 uint8_t pulse_1_len_max
; // maximum length of pulse with bit value 1
785 uint8_t pause_1_len_min
; // minimum length of pause with bit value 1
786 uint8_t pause_1_len_max
; // maximum length of pause with bit value 1
787 uint8_t pulse_0_len_min
; // minimum length of pulse with bit value 0
788 uint8_t pulse_0_len_max
; // maximum length of pulse with bit value 0
789 uint8_t pause_0_len_min
; // minimum length of pause with bit value 0
790 uint8_t pause_0_len_max
; // maximum length of pause with bit value 0
791 uint8_t address_offset
; // address offset
792 uint8_t address_end
; // end of address
793 uint8_t command_offset
; // command offset
794 uint8_t command_end
; // end of command
795 uint8_t complete_len
; // complete length of frame
796 uint8_t stop_bit
; // flag: frame has stop bit
797 uint8_t lsb_first
; // flag: LSB first
798 uint8_t flags
; // some flags
801 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
803 static const PROGMEM IRMP_PARAMETER sircs_param
=
805 IRMP_SIRCS_PROTOCOL
, // protocol: ir protocol
806 SIRCS_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
807 SIRCS_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
808 SIRCS_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
809 SIRCS_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
810 SIRCS_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
811 SIRCS_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
812 SIRCS_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
813 SIRCS_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
814 SIRCS_ADDRESS_OFFSET
, // address_offset: address offset
815 SIRCS_ADDRESS_OFFSET
+ SIRCS_ADDRESS_LEN
, // address_end: end of address
816 SIRCS_COMMAND_OFFSET
, // command_offset: command offset
817 SIRCS_COMMAND_OFFSET
+ SIRCS_COMMAND_LEN
, // command_end: end of command
818 SIRCS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
819 SIRCS_STOP_BIT
, // stop_bit: flag: frame has stop bit
820 SIRCS_LSB
, // lsb_first: flag: LSB first
821 SIRCS_FLAGS
// flags: some flags
826 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
828 static const PROGMEM IRMP_PARAMETER nec_param
=
830 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
831 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
832 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
833 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
834 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
835 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
836 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
837 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
838 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
839 NEC_ADDRESS_OFFSET
, // address_offset: address offset
840 NEC_ADDRESS_OFFSET
+ NEC_ADDRESS_LEN
, // address_end: end of address
841 NEC_COMMAND_OFFSET
, // command_offset: command offset
842 NEC_COMMAND_OFFSET
+ NEC_COMMAND_LEN
, // command_end: end of command
843 NEC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
844 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
845 NEC_LSB
, // lsb_first: flag: LSB first
846 NEC_FLAGS
// flags: some flags
849 static const PROGMEM IRMP_PARAMETER nec_rep_param
=
851 IRMP_NEC_PROTOCOL
, // protocol: ir protocol
852 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
853 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
854 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
855 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
856 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
857 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
858 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
859 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
860 0, // address_offset: address offset
861 0, // address_end: end of address
862 0, // command_offset: command offset
863 0, // command_end: end of command
864 0, // complete_len: complete length of frame
865 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
866 NEC_LSB
, // lsb_first: flag: LSB first
867 NEC_FLAGS
// flags: some flags
872 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
874 static const PROGMEM IRMP_PARAMETER nec42_param
=
876 IRMP_NEC42_PROTOCOL
, // protocol: ir protocol
877 NEC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
878 NEC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
879 NEC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
880 NEC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
881 NEC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
882 NEC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
883 NEC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
884 NEC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
885 NEC42_ADDRESS_OFFSET
, // address_offset: address offset
886 NEC42_ADDRESS_OFFSET
+ NEC42_ADDRESS_LEN
, // address_end: end of address
887 NEC42_COMMAND_OFFSET
, // command_offset: command offset
888 NEC42_COMMAND_OFFSET
+ NEC42_COMMAND_LEN
, // command_end: end of command
889 NEC42_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
890 NEC_STOP_BIT
, // stop_bit: flag: frame has stop bit
891 NEC_LSB
, // lsb_first: flag: LSB first
892 NEC_FLAGS
// flags: some flags
897 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
899 static const PROGMEM IRMP_PARAMETER samsung_param
=
901 IRMP_SAMSUNG_PROTOCOL
, // protocol: ir protocol
902 SAMSUNG_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
903 SAMSUNG_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
904 SAMSUNG_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
905 SAMSUNG_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
906 SAMSUNG_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
907 SAMSUNG_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
908 SAMSUNG_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
909 SAMSUNG_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
910 SAMSUNG_ADDRESS_OFFSET
, // address_offset: address offset
911 SAMSUNG_ADDRESS_OFFSET
+ SAMSUNG_ADDRESS_LEN
, // address_end: end of address
912 SAMSUNG_COMMAND_OFFSET
, // command_offset: command offset
913 SAMSUNG_COMMAND_OFFSET
+ SAMSUNG_COMMAND_LEN
, // command_end: end of command
914 SAMSUNG_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
915 SAMSUNG_STOP_BIT
, // stop_bit: flag: frame has stop bit
916 SAMSUNG_LSB
, // lsb_first: flag: LSB first
917 SAMSUNG_FLAGS
// flags: some flags
922 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
924 static const PROGMEM IRMP_PARAMETER telefunken_param
=
926 IRMP_TELEFUNKEN_PROTOCOL
, // protocol: ir protocol
927 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
928 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
929 TELEFUNKEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
930 TELEFUNKEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
931 TELEFUNKEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
932 TELEFUNKEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
933 TELEFUNKEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
934 TELEFUNKEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
935 TELEFUNKEN_ADDRESS_OFFSET
, // address_offset: address offset
936 TELEFUNKEN_ADDRESS_OFFSET
+ TELEFUNKEN_ADDRESS_LEN
, // address_end: end of address
937 TELEFUNKEN_COMMAND_OFFSET
, // command_offset: command offset
938 TELEFUNKEN_COMMAND_OFFSET
+ TELEFUNKEN_COMMAND_LEN
, // command_end: end of command
939 TELEFUNKEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
940 TELEFUNKEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
941 TELEFUNKEN_LSB
, // lsb_first: flag: LSB first
942 TELEFUNKEN_FLAGS
// flags: some flags
947 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
949 static const PROGMEM IRMP_PARAMETER matsushita_param
=
951 IRMP_MATSUSHITA_PROTOCOL
, // protocol: ir protocol
952 MATSUSHITA_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
953 MATSUSHITA_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
954 MATSUSHITA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
955 MATSUSHITA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
956 MATSUSHITA_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
957 MATSUSHITA_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
958 MATSUSHITA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
959 MATSUSHITA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
960 MATSUSHITA_ADDRESS_OFFSET
, // address_offset: address offset
961 MATSUSHITA_ADDRESS_OFFSET
+ MATSUSHITA_ADDRESS_LEN
, // address_end: end of address
962 MATSUSHITA_COMMAND_OFFSET
, // command_offset: command offset
963 MATSUSHITA_COMMAND_OFFSET
+ MATSUSHITA_COMMAND_LEN
, // command_end: end of command
964 MATSUSHITA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
965 MATSUSHITA_STOP_BIT
, // stop_bit: flag: frame has stop bit
966 MATSUSHITA_LSB
, // lsb_first: flag: LSB first
967 MATSUSHITA_FLAGS
// flags: some flags
972 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
974 static const PROGMEM IRMP_PARAMETER kaseikyo_param
=
976 IRMP_KASEIKYO_PROTOCOL
, // protocol: ir protocol
977 KASEIKYO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
978 KASEIKYO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
979 KASEIKYO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
980 KASEIKYO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
981 KASEIKYO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
982 KASEIKYO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
983 KASEIKYO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
984 KASEIKYO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
985 KASEIKYO_ADDRESS_OFFSET
, // address_offset: address offset
986 KASEIKYO_ADDRESS_OFFSET
+ KASEIKYO_ADDRESS_LEN
, // address_end: end of address
987 KASEIKYO_COMMAND_OFFSET
, // command_offset: command offset
988 KASEIKYO_COMMAND_OFFSET
+ KASEIKYO_COMMAND_LEN
, // command_end: end of command
989 KASEIKYO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
990 KASEIKYO_STOP_BIT
, // stop_bit: flag: frame has stop bit
991 KASEIKYO_LSB
, // lsb_first: flag: LSB first
992 KASEIKYO_FLAGS
// flags: some flags
997 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
999 static const PROGMEM IRMP_PARAMETER recs80_param
=
1001 IRMP_RECS80_PROTOCOL
, // protocol: ir protocol
1002 RECS80_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1003 RECS80_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1004 RECS80_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1005 RECS80_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1006 RECS80_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1007 RECS80_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1008 RECS80_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1009 RECS80_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1010 RECS80_ADDRESS_OFFSET
, // address_offset: address offset
1011 RECS80_ADDRESS_OFFSET
+ RECS80_ADDRESS_LEN
, // address_end: end of address
1012 RECS80_COMMAND_OFFSET
, // command_offset: command offset
1013 RECS80_COMMAND_OFFSET
+ RECS80_COMMAND_LEN
, // command_end: end of command
1014 RECS80_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1015 RECS80_STOP_BIT
, // stop_bit: flag: frame has stop bit
1016 RECS80_LSB
, // lsb_first: flag: LSB first
1017 RECS80_FLAGS
// flags: some flags
1022 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1024 static const PROGMEM IRMP_PARAMETER rc5_param
=
1026 IRMP_RC5_PROTOCOL
, // protocol: ir protocol
1027 RC5_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1028 RC5_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1029 RC5_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1030 RC5_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1031 0, // pulse_0_len_min: here: not used
1032 0, // pulse_0_len_max: here: not used
1033 0, // pause_0_len_min: here: not used
1034 0, // pause_0_len_max: here: not used
1035 RC5_ADDRESS_OFFSET
, // address_offset: address offset
1036 RC5_ADDRESS_OFFSET
+ RC5_ADDRESS_LEN
, // address_end: end of address
1037 RC5_COMMAND_OFFSET
, // command_offset: command offset
1038 RC5_COMMAND_OFFSET
+ RC5_COMMAND_LEN
, // command_end: end of command
1039 RC5_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1040 RC5_STOP_BIT
, // stop_bit: flag: frame has stop bit
1041 RC5_LSB
, // lsb_first: flag: LSB first
1042 RC5_FLAGS
// flags: some flags
1047 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1049 static const PROGMEM IRMP_PARAMETER denon_param
=
1051 IRMP_DENON_PROTOCOL
, // protocol: ir protocol
1052 DENON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1053 DENON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1054 DENON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1055 DENON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1056 DENON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1057 DENON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1058 DENON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1059 DENON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1060 DENON_ADDRESS_OFFSET
, // address_offset: address offset
1061 DENON_ADDRESS_OFFSET
+ DENON_ADDRESS_LEN
, // address_end: end of address
1062 DENON_COMMAND_OFFSET
, // command_offset: command offset
1063 DENON_COMMAND_OFFSET
+ DENON_COMMAND_LEN
, // command_end: end of command
1064 DENON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1065 DENON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1066 DENON_LSB
, // lsb_first: flag: LSB first
1067 DENON_FLAGS
// flags: some flags
1072 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
1074 static const PROGMEM IRMP_PARAMETER rc6_param
=
1076 IRMP_RC6_PROTOCOL
, // protocol: ir protocol
1078 RC6_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1079 RC6_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1080 RC6_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1081 RC6_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1082 0, // pulse_0_len_min: here: not used
1083 0, // pulse_0_len_max: here: not used
1084 0, // pause_0_len_min: here: not used
1085 0, // pause_0_len_max: here: not used
1086 RC6_ADDRESS_OFFSET
, // address_offset: address offset
1087 RC6_ADDRESS_OFFSET
+ RC6_ADDRESS_LEN
, // address_end: end of address
1088 RC6_COMMAND_OFFSET
, // command_offset: command offset
1089 RC6_COMMAND_OFFSET
+ RC6_COMMAND_LEN
, // command_end: end of command
1090 RC6_COMPLETE_DATA_LEN_SHORT
, // complete_len: complete length of frame
1091 RC6_STOP_BIT
, // stop_bit: flag: frame has stop bit
1092 RC6_LSB
, // lsb_first: flag: LSB first
1093 RC6_FLAGS
// flags: some flags
1098 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
1100 static const PROGMEM IRMP_PARAMETER recs80ext_param
=
1102 IRMP_RECS80EXT_PROTOCOL
, // protocol: ir protocol
1103 RECS80EXT_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1104 RECS80EXT_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1105 RECS80EXT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1106 RECS80EXT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1107 RECS80EXT_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1108 RECS80EXT_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1109 RECS80EXT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1110 RECS80EXT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1111 RECS80EXT_ADDRESS_OFFSET
, // address_offset: address offset
1112 RECS80EXT_ADDRESS_OFFSET
+ RECS80EXT_ADDRESS_LEN
, // address_end: end of address
1113 RECS80EXT_COMMAND_OFFSET
, // command_offset: command offset
1114 RECS80EXT_COMMAND_OFFSET
+ RECS80EXT_COMMAND_LEN
, // command_end: end of command
1115 RECS80EXT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1116 RECS80EXT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1117 RECS80EXT_LSB
, // lsb_first: flag: LSB first
1118 RECS80EXT_FLAGS
// flags: some flags
1123 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
1125 static const PROGMEM IRMP_PARAMETER nubert_param
=
1127 IRMP_NUBERT_PROTOCOL
, // protocol: ir protocol
1128 NUBERT_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1129 NUBERT_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1130 NUBERT_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1131 NUBERT_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1132 NUBERT_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1133 NUBERT_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1134 NUBERT_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1135 NUBERT_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1136 NUBERT_ADDRESS_OFFSET
, // address_offset: address offset
1137 NUBERT_ADDRESS_OFFSET
+ NUBERT_ADDRESS_LEN
, // address_end: end of address
1138 NUBERT_COMMAND_OFFSET
, // command_offset: command offset
1139 NUBERT_COMMAND_OFFSET
+ NUBERT_COMMAND_LEN
, // command_end: end of command
1140 NUBERT_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1141 NUBERT_STOP_BIT
, // stop_bit: flag: frame has stop bit
1142 NUBERT_LSB
, // lsb_first: flag: LSB first
1143 NUBERT_FLAGS
// flags: some flags
1148 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1150 static const PROGMEM IRMP_PARAMETER bang_olufsen_param
=
1152 IRMP_BANG_OLUFSEN_PROTOCOL
, // protocol: ir protocol
1153 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1154 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1155 BANG_OLUFSEN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1156 BANG_OLUFSEN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1157 BANG_OLUFSEN_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1158 BANG_OLUFSEN_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1159 BANG_OLUFSEN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1160 BANG_OLUFSEN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1161 BANG_OLUFSEN_ADDRESS_OFFSET
, // address_offset: address offset
1162 BANG_OLUFSEN_ADDRESS_OFFSET
+ BANG_OLUFSEN_ADDRESS_LEN
, // address_end: end of address
1163 BANG_OLUFSEN_COMMAND_OFFSET
, // command_offset: command offset
1164 BANG_OLUFSEN_COMMAND_OFFSET
+ BANG_OLUFSEN_COMMAND_LEN
, // command_end: end of command
1165 BANG_OLUFSEN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1166 BANG_OLUFSEN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1167 BANG_OLUFSEN_LSB
, // lsb_first: flag: LSB first
1168 BANG_OLUFSEN_FLAGS
// flags: some flags
1173 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1175 static uint8_t first_bit
;
1177 static const PROGMEM IRMP_PARAMETER grundig_param
=
1179 IRMP_GRUNDIG_PROTOCOL
, // protocol: ir protocol
1181 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1182 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1183 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1184 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1185 0, // pulse_0_len_min: here: not used
1186 0, // pulse_0_len_max: here: not used
1187 0, // pause_0_len_min: here: not used
1188 0, // pause_0_len_max: here: not used
1189 GRUNDIG_ADDRESS_OFFSET
, // address_offset: address offset
1190 GRUNDIG_ADDRESS_OFFSET
+ GRUNDIG_ADDRESS_LEN
, // address_end: end of address
1191 GRUNDIG_COMMAND_OFFSET
, // command_offset: command offset
1192 GRUNDIG_COMMAND_OFFSET
+ GRUNDIG_COMMAND_LEN
+ 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
1193 NOKIA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
1194 GRUNDIG_NOKIA_IR60_STOP_BIT
, // stop_bit: flag: frame has stop bit
1195 GRUNDIG_NOKIA_IR60_LSB
, // lsb_first: flag: LSB first
1196 GRUNDIG_NOKIA_IR60_FLAGS
// flags: some flags
1201 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1203 static const PROGMEM IRMP_PARAMETER ruwido_param
=
1205 IRMP_RUWIDO_PROTOCOL
, // protocol: ir protocol
1206 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1207 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1208 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1209 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1210 0, // pulse_0_len_min: here: not used
1211 0, // pulse_0_len_max: here: not used
1212 0, // pause_0_len_min: here: not used
1213 0, // pause_0_len_max: here: not used
1214 RUWIDO_ADDRESS_OFFSET
, // address_offset: address offset
1215 RUWIDO_ADDRESS_OFFSET
+ RUWIDO_ADDRESS_LEN
, // address_end: end of address
1216 RUWIDO_COMMAND_OFFSET
, // command_offset: command offset
1217 RUWIDO_COMMAND_OFFSET
+ RUWIDO_COMMAND_LEN
, // command_end: end of command
1218 SIEMENS_COMPLETE_DATA_LEN
, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
1219 SIEMENS_OR_RUWIDO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1220 SIEMENS_OR_RUWIDO_LSB
, // lsb_first: flag: LSB first
1221 SIEMENS_OR_RUWIDO_FLAGS
// flags: some flags
1226 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
1228 static const PROGMEM IRMP_PARAMETER fdc_param
=
1230 IRMP_FDC_PROTOCOL
, // protocol: ir protocol
1231 FDC_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1232 FDC_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1233 FDC_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1234 FDC_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1235 FDC_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1236 FDC_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1237 FDC_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1238 FDC_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1239 FDC_ADDRESS_OFFSET
, // address_offset: address offset
1240 FDC_ADDRESS_OFFSET
+ FDC_ADDRESS_LEN
, // address_end: end of address
1241 FDC_COMMAND_OFFSET
, // command_offset: command offset
1242 FDC_COMMAND_OFFSET
+ FDC_COMMAND_LEN
, // command_end: end of command
1243 FDC_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1244 FDC_STOP_BIT
, // stop_bit: flag: frame has stop bit
1245 FDC_LSB
, // lsb_first: flag: LSB first
1246 FDC_FLAGS
// flags: some flags
1251 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1253 static const PROGMEM IRMP_PARAMETER rccar_param
=
1255 IRMP_RCCAR_PROTOCOL
, // protocol: ir protocol
1256 RCCAR_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1257 RCCAR_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1258 RCCAR_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1259 RCCAR_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1260 RCCAR_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1261 RCCAR_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1262 RCCAR_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1263 RCCAR_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1264 RCCAR_ADDRESS_OFFSET
, // address_offset: address offset
1265 RCCAR_ADDRESS_OFFSET
+ RCCAR_ADDRESS_LEN
, // address_end: end of address
1266 RCCAR_COMMAND_OFFSET
, // command_offset: command offset
1267 RCCAR_COMMAND_OFFSET
+ RCCAR_COMMAND_LEN
, // command_end: end of command
1268 RCCAR_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1269 RCCAR_STOP_BIT
, // stop_bit: flag: frame has stop bit
1270 RCCAR_LSB
, // lsb_first: flag: LSB first
1271 RCCAR_FLAGS
// flags: some flags
1276 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
1278 static const PROGMEM IRMP_PARAMETER nikon_param
=
1280 IRMP_NIKON_PROTOCOL
, // protocol: ir protocol
1281 NIKON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1282 NIKON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1283 NIKON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1284 NIKON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1285 NIKON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1286 NIKON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1287 NIKON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1288 NIKON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1289 NIKON_ADDRESS_OFFSET
, // address_offset: address offset
1290 NIKON_ADDRESS_OFFSET
+ NIKON_ADDRESS_LEN
, // address_end: end of address
1291 NIKON_COMMAND_OFFSET
, // command_offset: command offset
1292 NIKON_COMMAND_OFFSET
+ NIKON_COMMAND_LEN
, // command_end: end of command
1293 NIKON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1294 NIKON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1295 NIKON_LSB
, // lsb_first: flag: LSB first
1296 NIKON_FLAGS
// flags: some flags
1301 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1303 static const PROGMEM IRMP_PARAMETER kathrein_param
=
1305 IRMP_KATHREIN_PROTOCOL
, // protocol: ir protocol
1306 KATHREIN_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1307 KATHREIN_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1308 KATHREIN_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1309 KATHREIN_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1310 KATHREIN_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1311 KATHREIN_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1312 KATHREIN_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1313 KATHREIN_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1314 KATHREIN_ADDRESS_OFFSET
, // address_offset: address offset
1315 KATHREIN_ADDRESS_OFFSET
+ KATHREIN_ADDRESS_LEN
, // address_end: end of address
1316 KATHREIN_COMMAND_OFFSET
, // command_offset: command offset
1317 KATHREIN_COMMAND_OFFSET
+ KATHREIN_COMMAND_LEN
, // command_end: end of command
1318 KATHREIN_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1319 KATHREIN_STOP_BIT
, // stop_bit: flag: frame has stop bit
1320 KATHREIN_LSB
, // lsb_first: flag: LSB first
1321 KATHREIN_FLAGS
// flags: some flags
1326 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
1328 static const PROGMEM IRMP_PARAMETER netbox_param
=
1330 IRMP_NETBOX_PROTOCOL
, // protocol: ir protocol
1331 NETBOX_PULSE_LEN
, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
1332 NETBOX_PULSE_REST_LEN
, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
1333 NETBOX_PAUSE_LEN
, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
1334 NETBOX_PAUSE_REST_LEN
, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
1335 NETBOX_PULSE_LEN
, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
1336 NETBOX_PULSE_REST_LEN
, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
1337 NETBOX_PAUSE_LEN
, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
1338 NETBOX_PAUSE_REST_LEN
, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
1339 NETBOX_ADDRESS_OFFSET
, // address_offset: address offset
1340 NETBOX_ADDRESS_OFFSET
+ NETBOX_ADDRESS_LEN
, // address_end: end of address
1341 NETBOX_COMMAND_OFFSET
, // command_offset: command offset
1342 NETBOX_COMMAND_OFFSET
+ NETBOX_COMMAND_LEN
, // command_end: end of command
1343 NETBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1344 NETBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1345 NETBOX_LSB
, // lsb_first: flag: LSB first
1346 NETBOX_FLAGS
// flags: some flags
1351 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1353 static const PROGMEM IRMP_PARAMETER lego_param
=
1355 IRMP_LEGO_PROTOCOL
, // protocol: ir protocol
1356 LEGO_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1357 LEGO_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1358 LEGO_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1359 LEGO_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1360 LEGO_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1361 LEGO_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1362 LEGO_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1363 LEGO_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1364 LEGO_ADDRESS_OFFSET
, // address_offset: address offset
1365 LEGO_ADDRESS_OFFSET
+ LEGO_ADDRESS_LEN
, // address_end: end of address
1366 LEGO_COMMAND_OFFSET
, // command_offset: command offset
1367 LEGO_COMMAND_OFFSET
+ LEGO_COMMAND_LEN
, // command_end: end of command
1368 LEGO_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1369 LEGO_STOP_BIT
, // stop_bit: flag: frame has stop bit
1370 LEGO_LSB
, // lsb_first: flag: LSB first
1371 LEGO_FLAGS
// flags: some flags
1376 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
1378 static const PROGMEM IRMP_PARAMETER thomson_param
=
1380 IRMP_THOMSON_PROTOCOL
, // protocol: ir protocol
1381 THOMSON_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1382 THOMSON_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1383 THOMSON_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1384 THOMSON_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1385 THOMSON_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1386 THOMSON_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1387 THOMSON_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1388 THOMSON_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1389 THOMSON_ADDRESS_OFFSET
, // address_offset: address offset
1390 THOMSON_ADDRESS_OFFSET
+ THOMSON_ADDRESS_LEN
, // address_end: end of address
1391 THOMSON_COMMAND_OFFSET
, // command_offset: command offset
1392 THOMSON_COMMAND_OFFSET
+ THOMSON_COMMAND_LEN
, // command_end: end of command
1393 THOMSON_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1394 THOMSON_STOP_BIT
, // stop_bit: flag: frame has stop bit
1395 THOMSON_LSB
, // lsb_first: flag: LSB first
1396 THOMSON_FLAGS
// flags: some flags
1401 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1403 static const PROGMEM IRMP_PARAMETER bose_param
=
1405 IRMP_BOSE_PROTOCOL
, // protocol: ir protocol
1406 BOSE_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1407 BOSE_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1408 BOSE_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1409 BOSE_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1410 BOSE_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1411 BOSE_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1412 BOSE_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1413 BOSE_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1414 BOSE_ADDRESS_OFFSET
, // address_offset: address offset
1415 BOSE_ADDRESS_OFFSET
+ BOSE_ADDRESS_LEN
, // address_end: end of address
1416 BOSE_COMMAND_OFFSET
, // command_offset: command offset
1417 BOSE_COMMAND_OFFSET
+ BOSE_COMMAND_LEN
, // command_end: end of command
1418 BOSE_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1419 BOSE_STOP_BIT
, // stop_bit: flag: frame has stop bit
1420 BOSE_LSB
, // lsb_first: flag: LSB first
1421 BOSE_FLAGS
// flags: some flags
1426 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
1428 static const PROGMEM IRMP_PARAMETER a1tvbox_param
=
1430 IRMP_A1TVBOX_PROTOCOL
, // protocol: ir protocol
1432 A1TVBOX_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1433 A1TVBOX_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1434 A1TVBOX_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1435 A1TVBOX_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1436 0, // pulse_0_len_min: here: not used
1437 0, // pulse_0_len_max: here: not used
1438 0, // pause_0_len_min: here: not used
1439 0, // pause_0_len_max: here: not used
1440 A1TVBOX_ADDRESS_OFFSET
, // address_offset: address offset
1441 A1TVBOX_ADDRESS_OFFSET
+ A1TVBOX_ADDRESS_LEN
, // address_end: end of address
1442 A1TVBOX_COMMAND_OFFSET
, // command_offset: command offset
1443 A1TVBOX_COMMAND_OFFSET
+ A1TVBOX_COMMAND_LEN
, // command_end: end of command
1444 A1TVBOX_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1445 A1TVBOX_STOP_BIT
, // stop_bit: flag: frame has stop bit
1446 A1TVBOX_LSB
, // lsb_first: flag: LSB first
1447 A1TVBOX_FLAGS
// flags: some flags
1452 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1454 static const PROGMEM IRMP_PARAMETER ortek_param
=
1456 IRMP_ORTEK_PROTOCOL
, // protocol: ir protocol
1458 ORTEK_BIT_PULSE_LEN_MIN
, // pulse_1_len_min: here: minimum length of short pulse
1459 ORTEK_BIT_PULSE_LEN_MAX
, // pulse_1_len_max: here: maximum length of short pulse
1460 ORTEK_BIT_PAUSE_LEN_MIN
, // pause_1_len_min: here: minimum length of short pause
1461 ORTEK_BIT_PAUSE_LEN_MAX
, // pause_1_len_max: here: maximum length of short pause
1462 0, // pulse_0_len_min: here: not used
1463 0, // pulse_0_len_max: here: not used
1464 0, // pause_0_len_min: here: not used
1465 0, // pause_0_len_max: here: not used
1466 ORTEK_ADDRESS_OFFSET
, // address_offset: address offset
1467 ORTEK_ADDRESS_OFFSET
+ ORTEK_ADDRESS_LEN
, // address_end: end of address
1468 ORTEK_COMMAND_OFFSET
, // command_offset: command offset
1469 ORTEK_COMMAND_OFFSET
+ ORTEK_COMMAND_LEN
, // command_end: end of command
1470 ORTEK_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1471 ORTEK_STOP_BIT
, // stop_bit: flag: frame has stop bit
1472 ORTEK_LSB
, // lsb_first: flag: LSB first
1473 ORTEK_FLAGS
// flags: some flags
1478 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
1480 static const PROGMEM IRMP_PARAMETER roomba_param
=
1482 IRMP_ROOMBA_PROTOCOL
, // protocol: ir protocol
1483 ROOMBA_1_PULSE_LEN_MIN
, // pulse_1_len_min: minimum length of pulse with bit value 1
1484 ROOMBA_1_PULSE_LEN_MAX
, // pulse_1_len_max: maximum length of pulse with bit value 1
1485 ROOMBA_1_PAUSE_LEN_MIN
, // pause_1_len_min: minimum length of pause with bit value 1
1486 ROOMBA_1_PAUSE_LEN_MAX
, // pause_1_len_max: maximum length of pause with bit value 1
1487 ROOMBA_0_PULSE_LEN_MIN
, // pulse_0_len_min: minimum length of pulse with bit value 0
1488 ROOMBA_0_PULSE_LEN_MAX
, // pulse_0_len_max: maximum length of pulse with bit value 0
1489 ROOMBA_0_PAUSE_LEN_MIN
, // pause_0_len_min: minimum length of pause with bit value 0
1490 ROOMBA_0_PAUSE_LEN_MAX
, // pause_0_len_max: maximum length of pause with bit value 0
1491 ROOMBA_ADDRESS_OFFSET
, // address_offset: address offset
1492 ROOMBA_ADDRESS_OFFSET
+ ROOMBA_ADDRESS_LEN
, // address_end: end of address
1493 ROOMBA_COMMAND_OFFSET
, // command_offset: command offset
1494 ROOMBA_COMMAND_OFFSET
+ ROOMBA_COMMAND_LEN
, // command_end: end of command
1495 ROOMBA_COMPLETE_DATA_LEN
, // complete_len: complete length of frame
1496 ROOMBA_STOP_BIT
, // stop_bit: flag: frame has stop bit
1497 ROOMBA_LSB
, // lsb_first: flag: LSB first
1498 ROOMBA_FLAGS
// flags: some flags
1503 static uint8_t irmp_bit
; // current bit position
1504 static IRMP_PARAMETER irmp_param
;
1506 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1507 static IRMP_PARAMETER irmp_param2
;
1510 static volatile uint8_t irmp_ir_detected
;
1511 static volatile uint8_t irmp_protocol
;
1512 static volatile uint16_t irmp_address
;
1513 static volatile uint16_t irmp_command
;
1514 static volatile uint16_t irmp_id
; // only used for SAMSUNG protocol
1515 static volatile uint8_t irmp_flags
;
1516 // static volatile uint8_t irmp_busy_flag;
1519 #define input(x) (x)
1520 static uint8_t IRMP_PIN
;
1523 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1524 * Initialize IRMP decoder
1525 * @details Configures IRMP input pin
1526 *---------------------------------------------------------------------------------------------------------------------------------------------------
1532 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
1533 #elif defined (ARM_STM32) // STM32
1534 GPIO_InitTypeDef GPIO_InitStructure
;
1536 /* GPIOx clock enable */
1537 #if defined (ARM_STM32L1XX)
1538 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1539 #elif defined (ARM_STM32F10X)
1540 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1541 #elif defined (ARM_STM32F4XX)
1542 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC
, ENABLE
);
1545 /* GPIO Configuration */
1546 GPIO_InitStructure
.GPIO_Pin
= IRMP_BIT
;
1547 #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
1548 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN
;
1549 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1550 GPIO_InitStructure
.GPIO_OType
= GPIO_OType_PP
;
1551 GPIO_InitStructure
.GPIO_PuPd
= GPIO_PuPd_NOPULL
;
1552 #elif defined (ARM_STM32F10X)
1553 GPIO_InitStructure
.GPIO_Speed
= GPIO_Speed_2MHz
;
1554 GPIO_InitStructure
.GPIO_Mode
= GPIO_Mode_IN_FLOATING
;
1556 GPIO_Init(IRMP_PORT
, &GPIO_InitStructure
);
1557 #elif defined(STELLARIS_ARM_CORTEX_M4)
1558 // Enable the GPIO port
1559 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH
);
1562 ROM_GPIODirModeSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
, GPIO_DIR_MODE_IN
);
1563 ROM_GPIOPadConfigSet(IRMP_PORT_BASE
, IRMP_PORT_PIN
,
1565 GPIO_PIN_TYPE_STD_WPU
);
1567 IRMP_PORT
&= ~(1<<IRMP_BIT
); // deactivate pullup
1568 IRMP_DDR
&= ~(1<<IRMP_BIT
); // set pin to input
1571 #if IRMP_LOGGING == 1
1576 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1578 * @details gets decoded IRMP data
1579 * @param pointer in order to store IRMP data
1580 * @return TRUE: successful, FALSE: failed
1581 *---------------------------------------------------------------------------------------------------------------------------------------------------
1584 irmp_get_data (IRMP_DATA
* irmp_data_p
)
1586 uint8_t rtc
= FALSE
;
1588 if (irmp_ir_detected
)
1590 switch (irmp_protocol
)
1592 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1593 case IRMP_SAMSUNG_PROTOCOL
:
1594 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1596 irmp_command
&= 0xff;
1597 irmp_command
|= irmp_id
<< 8;
1602 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
1603 case IRMP_NEC_PROTOCOL
:
1604 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1606 irmp_command
&= 0xff;
1609 else if (irmp_address
== 0x87EE)
1611 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
1612 irmp_protocol
= IRMP_APPLE_PROTOCOL
;
1613 irmp_address
= (irmp_command
& 0xFF00) >> 8;
1614 irmp_command
&= 0x00FF;
1619 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
1620 case IRMP_BOSE_PROTOCOL
:
1621 if ((irmp_command
>> 8) == (~irmp_command
& 0x00FF))
1623 irmp_command
&= 0xff;
1628 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
1629 case IRMP_SIEMENS_PROTOCOL
:
1630 case IRMP_RUWIDO_PROTOCOL
:
1631 if (((irmp_command
>> 1) & 0x0001) == (~irmp_command
& 0x0001))
1638 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
1639 case IRMP_KATHREIN_PROTOCOL
:
1640 if (irmp_command
!= 0x0000)
1646 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1647 case IRMP_RC5_PROTOCOL
:
1648 irmp_address
&= ~0x20; // clear toggle bit
1652 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
1653 case IRMP_IR60_PROTOCOL
:
1654 if (irmp_command
!= 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
1660 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
1664 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
1665 case IRMP_RCCAR_PROTOCOL
:
1666 // frame in irmp_data:
1667 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
1668 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
1669 irmp_address
= (irmp_command
& 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
1670 irmp_command
= ((irmp_command
& 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
1671 ((irmp_command
& 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
1672 ((irmp_command
& 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
1673 rtc
= TRUE
; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
1677 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
1678 case IRMP_NETBOX_PROTOCOL
:
1679 if (irmp_command
& 0x1000) // last bit set?
1681 if ((irmp_command
& 0x1f) == 0x15) // key pressed: 101 01 (LSB)
1684 irmp_command
&= 0x7F;
1687 else if ((irmp_command
& 0x1f) == 0x10) // key released: 000 01 (LSB)
1690 irmp_command
|= 0x80;
1695 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
1700 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
1704 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
1705 case IRMP_LEGO_PROTOCOL
:
1707 uint8_t crc
= 0x0F ^ ((irmp_command
& 0xF000) >> 12) ^ ((irmp_command
& 0x0F00) >> 8) ^ ((irmp_command
& 0x00F0) >> 4);
1709 if ((irmp_command
& 0x000F) == crc
)
1716 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
1717 // rtc = TRUE; // don't accept codes with CRC errors
1731 irmp_data_p
->protocol
= irmp_protocol
;
1732 irmp_data_p
->address
= irmp_address
;
1733 irmp_data_p
->command
= irmp_command
;
1734 irmp_data_p
->flags
= irmp_flags
;
1740 irmp_ir_detected
= FALSE
;
1747 // irmp_is_busy (void)
1749 // return irmp_busy_flag;
1752 #if IRMP_USE_CALLBACK == 1
1754 irmp_set_callback_ptr (void (*cb
)(uint8_t))
1756 irmp_callback_ptr
= cb
;
1758 #endif // IRMP_USE_CALLBACK == 1
1760 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
1761 static uint16_t irmp_tmp_address
; // ir address
1762 static uint16_t irmp_tmp_command
; // ir command
1764 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
1765 static uint16_t irmp_tmp_address2
; // ir address
1766 static uint16_t irmp_tmp_command2
; // ir command
1769 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1770 static uint16_t irmp_tmp_id
; // ir id (only SAMSUNG)
1772 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1773 static uint8_t xor_check
[6]; // check kaseikyo "parity" bits
1774 static uint8_t genre2
; // save genre2 bits here, later copied to MSB in flags
1777 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1778 static uint8_t parity
; // number of '1' of the first 14 bits, check if even.
1781 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1783 * @details store bit in temp address or temp command
1784 * @param value to store: 0 or 1
1785 *---------------------------------------------------------------------------------------------------------------------------------------------------
1787 // verhindert, dass irmp_store_bit() inline compiliert wird:
1788 // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));
1791 irmp_store_bit (uint8_t value
)
1793 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
1794 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
1803 else if (irmp_bit
== 14)
1805 if (value
) // value == 1: even parity
1809 parity
= PARITY_CHECK_FAILED
;
1813 parity
= PARITY_CHECK_OK
;
1818 if (parity
& 0x01) // value == 0: odd parity
1820 parity
= PARITY_CHECK_OK
;
1824 parity
= PARITY_CHECK_FAILED
;
1831 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
1832 if (irmp_bit
== 0 && irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
)
1839 if (irmp_bit
>= irmp_param
.address_offset
&& irmp_bit
< irmp_param
.address_end
)
1841 if (irmp_param
.lsb_first
)
1843 irmp_tmp_address
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.address_offset
)); // CV wants cast
1847 irmp_tmp_address
<<= 1;
1848 irmp_tmp_address
|= value
;
1851 else if (irmp_bit
>= irmp_param
.command_offset
&& irmp_bit
< irmp_param
.command_end
)
1853 if (irmp_param
.lsb_first
)
1855 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- irmp_param
.command_offset
)); // CV wants cast
1859 irmp_tmp_command
<<= 1;
1860 irmp_tmp_command
|= value
;
1864 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
1865 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
>= 13 && irmp_bit
< 26)
1867 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit
- 13)); // CV wants cast
1872 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
1873 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
>= SAMSUNG_ID_OFFSET
&& irmp_bit
< SAMSUNG_ID_OFFSET
+ SAMSUNG_ID_LEN
)
1875 irmp_tmp_id
|= (((uint16_t) (value
)) << (irmp_bit
- SAMSUNG_ID_OFFSET
)); // store with LSB first
1880 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
1881 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
1883 if (irmp_bit
>= 20 && irmp_bit
< 24)
1885 irmp_tmp_command
|= (((uint16_t) (value
)) << (irmp_bit
- 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
1887 else if (irmp_bit
>= 24 && irmp_bit
< 28)
1889 genre2
|= (((uint8_t) (value
)) << (irmp_bit
- 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
1892 if (irmp_bit
< KASEIKYO_COMPLETE_DATA_LEN
)
1896 xor_check
[irmp_bit
/ 8] |= 1 << (irmp_bit
% 8);
1900 xor_check
[irmp_bit
/ 8] &= ~(1 << (irmp_bit
% 8));
1913 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1915 * @details store bit in temp address or temp command
1916 * @param value to store: 0 or 1
1917 *---------------------------------------------------------------------------------------------------------------------------------------------------
1919 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1921 irmp_store_bit2 (uint8_t value
)
1925 if (irmp_param
.protocol
)
1927 irmp_bit2
= irmp_bit
- 2;
1931 irmp_bit2
= irmp_bit
- 1;
1934 if (irmp_bit2
>= irmp_param2
.address_offset
&& irmp_bit2
< irmp_param2
.address_end
)
1936 irmp_tmp_address2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.address_offset
)); // CV wants cast
1938 else if (irmp_bit2
>= irmp_param2
.command_offset
&& irmp_bit2
< irmp_param2
.command_end
)
1940 irmp_tmp_command2
|= (((uint16_t) (value
)) << (irmp_bit2
- irmp_param2
.command_offset
)); // CV wants cast
1943 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
1945 /*---------------------------------------------------------------------------------------------------------------------------------------------------
1947 * @details ISR routine, called 10000 times per second
1948 *---------------------------------------------------------------------------------------------------------------------------------------------------
1953 static uint8_t irmp_start_bit_detected
; // flag: start bit detected
1954 static uint8_t wait_for_space
; // flag: wait for data bit space
1955 static uint8_t wait_for_start_space
; // flag: wait for start bit space
1956 static uint8_t irmp_pulse_time
; // count bit time for pulse
1957 static PAUSE_LEN irmp_pause_time
; // count bit time for pause
1958 static uint16_t last_irmp_address
= 0xFFFF; // save last irmp address to recognize key repetition
1959 static uint16_t last_irmp_command
= 0xFFFF; // save last irmp command to recognize key repetition
1960 static uint16_t key_repetition_len
; // SIRCS repeats frame 2-5 times with 45 ms pause
1961 static uint8_t repetition_frame_number
;
1962 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
1963 static uint16_t last_irmp_denon_command
; // save last irmp command to recognize DENON frame repetition
1964 static uint16_t denon_repetition_len
= 0xFFFF; // denon repetition len of 2nd auto generated frame
1966 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
1967 static uint8_t rc5_cmd_bit6
; // bit 6 of RC5 command is the inverted 2nd start bit
1969 #if IRMP_SUPPORT_MANCHESTER == 1
1970 static PAUSE_LEN last_pause
; // last pause value
1972 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
1973 static uint8_t last_value
; // last bit value
1975 uint8_t irmp_input
; // input value
1981 irmp_input
= input(IRMP_PIN
);
1983 #if IRMP_USE_CALLBACK == 1
1984 if (irmp_callback_ptr
)
1986 static uint8_t last_inverted_input
;
1988 if (last_inverted_input
!= !irmp_input
)
1990 (*irmp_callback_ptr
) (! irmp_input
);
1991 last_inverted_input
= !irmp_input
;
1994 #endif // IRMP_USE_CALLBACK == 1
1996 irmp_log(irmp_input
); // log ir signal, if IRMP_LOGGING defined
1998 if (! irmp_ir_detected
) // ir code already detected?
2000 if (! irmp_start_bit_detected
) // start bit detected?
2002 if (! irmp_input
) // receiving burst?
2004 // irmp_busy_flag = TRUE;
2006 if (! irmp_pulse_time
)
2008 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
2011 irmp_pulse_time
++; // increment counter
2015 if (irmp_pulse_time
) // it's dark....
2016 { // set flags for counting the time of darkness...
2017 irmp_start_bit_detected
= 1;
2018 wait_for_start_space
= 1;
2020 irmp_tmp_command
= 0;
2021 irmp_tmp_address
= 0;
2022 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2026 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
2027 irmp_tmp_command2
= 0;
2028 irmp_tmp_address2
= 0;
2032 irmp_pause_time
= 1; // 1st pause: set to 1, not to 0!
2033 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2034 rc5_cmd_bit6
= 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
2039 if (key_repetition_len
< 0xFFFF) // avoid overflow of counter
2041 key_repetition_len
++;
2043 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2044 if (denon_repetition_len
< 0xFFFF) // avoid overflow of counter
2046 denon_repetition_len
++;
2048 if (denon_repetition_len
>= DENON_AUTO_REPETITION_PAUSE_LEN
&& last_irmp_denon_command
!= 0)
2050 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
2051 (double) (time_counter
* 1000) / F_INTERRUPTS
);
2052 last_irmp_denon_command
= 0;
2053 denon_repetition_len
= 0xFFFF;
2056 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2063 if (wait_for_start_space
) // we have received start bit...
2064 { // ...and are counting the time of darkness
2065 if (irmp_input
) // still dark?
2067 irmp_pause_time
++; // increment counter
2069 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2070 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
) ||
2071 irmp_pause_time
> IRMP_TIMEOUT_NIKON_LEN
)
2073 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2076 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2077 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
2082 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2084 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
);
2085 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2087 // irmp_busy_flag = FALSE;
2088 irmp_start_bit_detected
= 0; // reset flags, let's wait for another start bit
2089 irmp_pulse_time
= 0;
2090 irmp_pause_time
= 0;
2094 { // receiving first data pulse!
2095 IRMP_PARAMETER
* irmp_param_p
= (IRMP_PARAMETER
*) 0;
2097 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2098 irmp_param2
.protocol
= 0;
2101 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_pulse_time
, irmp_pause_time
);
2103 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2104 if (irmp_pulse_time
>= SIRCS_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIRCS_START_BIT_PULSE_LEN_MAX
&&
2105 irmp_pause_time
>= SIRCS_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIRCS_START_BIT_PAUSE_LEN_MAX
)
2107 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2108 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
,
2109 SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
);
2110 irmp_param_p
= (IRMP_PARAMETER
*) (IRMP_PARAMETER
*) &sircs_param
;
2113 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2115 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2116 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2117 irmp_pulse_time
>= JVC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= JVC_START_BIT_PULSE_LEN_MAX
&&
2118 irmp_pause_time
>= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2120 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2121 JVC_START_BIT_PULSE_LEN_MIN
, JVC_START_BIT_PULSE_LEN_MAX
,
2122 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN
, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2123 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2126 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2128 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2129 if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2130 irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
2132 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2133 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2134 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2135 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2136 irmp_param_p
= (IRMP_PARAMETER
*) &nec42_param
;
2138 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2139 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2140 NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
);
2141 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2145 else if (irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2146 irmp_pause_time
>= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
)
2148 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2149 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // last protocol was JVC, awaiting repeat frame
2150 { // some jvc remote controls use nec repetition frame for jvc repetition frame
2151 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2152 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2153 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2154 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2157 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2159 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2160 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2161 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN
, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX
);
2163 irmp_param_p
= (IRMP_PARAMETER
*) &nec_rep_param
;
2168 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2169 if (irmp_protocol
== IRMP_JVC_PROTOCOL
&& // last protocol was JVC, awaiting repeat frame
2170 irmp_pulse_time
>= NEC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NEC_START_BIT_PULSE_LEN_MAX
&&
2171 irmp_pause_time
>= NEC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_0_PAUSE_LEN_MAX
)
2172 { // it's JVC repetition type 3
2173 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2174 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
,
2175 NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
);
2176 irmp_param_p
= (IRMP_PARAMETER
*) &nec_param
;
2179 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2181 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2183 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2184 if (irmp_pulse_time
>= TELEFUNKEN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= TELEFUNKEN_START_BIT_PULSE_LEN_MAX
&&
2185 irmp_pause_time
>= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
)
2187 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2188 TELEFUNKEN_START_BIT_PULSE_LEN_MIN
, TELEFUNKEN_START_BIT_PULSE_LEN_MAX
,
2189 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN
, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX
);
2190 irmp_param_p
= (IRMP_PARAMETER
*) &telefunken_param
;
2193 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
2195 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2196 if (irmp_pulse_time
>= ROOMBA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_START_BIT_PULSE_LEN_MAX
&&
2197 irmp_pause_time
>= ROOMBA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ROOMBA_START_BIT_PAUSE_LEN_MAX
)
2199 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2200 ROOMBA_START_BIT_PULSE_LEN_MIN
, ROOMBA_START_BIT_PULSE_LEN_MAX
,
2201 ROOMBA_START_BIT_PAUSE_LEN_MIN
, ROOMBA_START_BIT_PAUSE_LEN_MAX
);
2202 irmp_param_p
= (IRMP_PARAMETER
*) &roomba_param
;
2205 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2207 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
2208 if (irmp_pulse_time
>= NIKON_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NIKON_START_BIT_PULSE_LEN_MAX
&&
2209 irmp_pause_time
>= NIKON_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NIKON_START_BIT_PAUSE_LEN_MAX
)
2211 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2212 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
,
2213 NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
);
2214 irmp_param_p
= (IRMP_PARAMETER
*) &nikon_param
;
2217 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
2219 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2220 if (irmp_pulse_time
>= SAMSUNG_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_START_BIT_PULSE_LEN_MAX
&&
2221 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
2223 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2224 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
,
2225 SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
);
2226 irmp_param_p
= (IRMP_PARAMETER
*) &samsung_param
;
2229 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
2231 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2232 if (irmp_pulse_time
>= MATSUSHITA_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= MATSUSHITA_START_BIT_PULSE_LEN_MAX
&&
2233 irmp_pause_time
>= MATSUSHITA_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= MATSUSHITA_START_BIT_PAUSE_LEN_MAX
)
2234 { // it's MATSUSHITA
2235 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2236 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
,
2237 MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
);
2238 irmp_param_p
= (IRMP_PARAMETER
*) &matsushita_param
;
2241 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
2243 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2244 if (irmp_pulse_time
>= KASEIKYO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KASEIKYO_START_BIT_PULSE_LEN_MAX
&&
2245 irmp_pause_time
>= KASEIKYO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KASEIKYO_START_BIT_PAUSE_LEN_MAX
)
2247 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2248 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
,
2249 KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
);
2250 irmp_param_p
= (IRMP_PARAMETER
*) &kaseikyo_param
;
2253 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
2255 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
2256 if (irmp_pulse_time
>= RECS80_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80_START_BIT_PULSE_LEN_MAX
&&
2257 irmp_pause_time
>= RECS80_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80_START_BIT_PAUSE_LEN_MAX
)
2259 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2260 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
,
2261 RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
);
2262 irmp_param_p
= (IRMP_PARAMETER
*) &recs80_param
;
2265 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
2267 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
2268 if (((irmp_pulse_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= RC5_START_BIT_LEN_MAX
) ||
2269 (irmp_pulse_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
)) &&
2270 ((irmp_pause_time
>= RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= RC5_START_BIT_LEN_MAX
) ||
2271 (irmp_pause_time
>= 2 * RC5_START_BIT_LEN_MIN
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
)))
2273 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2274 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2275 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2277 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
2278 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2279 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2280 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2281 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2282 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2283 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2284 memcpy_P (&irmp_param2
, &fdc_param
, sizeof (IRMP_PARAMETER
));
2287 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2289 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2290 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2291 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2293 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
2294 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2295 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2296 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2297 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2298 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2299 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
);
2300 memcpy_P (&irmp_param2
, &rccar_param
, sizeof (IRMP_PARAMETER
));
2303 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2305 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
2306 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2307 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
,
2308 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
2309 2 * RC5_START_BIT_LEN_MIN
, 2 * RC5_START_BIT_LEN_MAX
);
2312 irmp_param_p
= (IRMP_PARAMETER
*) &rc5_param
;
2313 last_pause
= irmp_pause_time
;
2315 if ((irmp_pulse_time
> RC5_START_BIT_LEN_MAX
&& irmp_pulse_time
<= 2 * RC5_START_BIT_LEN_MAX
) ||
2316 (irmp_pause_time
> RC5_START_BIT_LEN_MAX
&& irmp_pause_time
<= 2 * RC5_START_BIT_LEN_MAX
))
2319 rc5_cmd_bit6
= 1<<6;
2327 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
2329 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2330 if ( (irmp_pulse_time
>= DENON_PULSE_LEN_MIN
&& irmp_pulse_time
<= DENON_PULSE_LEN_MAX
) &&
2331 ((irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
) ||
2332 (irmp_pause_time
>= DENON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_0_PAUSE_LEN_MAX
)))
2334 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2335 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
2336 DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
,
2337 DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
);
2338 irmp_param_p
= (IRMP_PARAMETER
*) &denon_param
;
2341 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2343 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2344 if ( (irmp_pulse_time
>= THOMSON_PULSE_LEN_MIN
&& irmp_pulse_time
<= THOMSON_PULSE_LEN_MAX
) &&
2345 ((irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
) ||
2346 (irmp_pause_time
>= THOMSON_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_0_PAUSE_LEN_MAX
)))
2348 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2349 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
2350 THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
,
2351 THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
);
2352 irmp_param_p
= (IRMP_PARAMETER
*) &thomson_param
;
2355 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2357 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
2358 if (irmp_pulse_time
>= BOSE_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= BOSE_START_BIT_PULSE_LEN_MAX
&&
2359 irmp_pause_time
>= BOSE_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BOSE_START_BIT_PAUSE_LEN_MAX
)
2361 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2362 BOSE_START_BIT_PULSE_LEN_MIN
, BOSE_START_BIT_PULSE_LEN_MAX
,
2363 BOSE_START_BIT_PAUSE_LEN_MIN
, BOSE_START_BIT_PAUSE_LEN_MAX
);
2364 irmp_param_p
= (IRMP_PARAMETER
*) &bose_param
;
2367 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
2369 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2370 if (irmp_pulse_time
>= RC6_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RC6_START_BIT_PULSE_LEN_MAX
&&
2371 irmp_pause_time
>= RC6_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RC6_START_BIT_PAUSE_LEN_MAX
)
2373 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2374 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
,
2375 RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
);
2376 irmp_param_p
= (IRMP_PARAMETER
*) &rc6_param
;
2381 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2383 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2384 if (irmp_pulse_time
>= RECS80EXT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RECS80EXT_START_BIT_PULSE_LEN_MAX
&&
2385 irmp_pause_time
>= RECS80EXT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RECS80EXT_START_BIT_PAUSE_LEN_MAX
)
2387 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2388 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
,
2389 RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
);
2390 irmp_param_p
= (IRMP_PARAMETER
*) &recs80ext_param
;
2393 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
2395 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2396 if (irmp_pulse_time
>= NUBERT_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NUBERT_START_BIT_PULSE_LEN_MAX
&&
2397 irmp_pause_time
>= NUBERT_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NUBERT_START_BIT_PAUSE_LEN_MAX
)
2399 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2400 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
,
2401 NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
);
2402 irmp_param_p
= (IRMP_PARAMETER
*) &nubert_param
;
2405 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
2407 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2408 if (irmp_pulse_time
>= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
&&
2409 irmp_pause_time
>= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
)
2410 { // it's BANG_OLUFSEN
2411 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
2412 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2413 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
2414 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
2415 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2416 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
2417 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
2418 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2419 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
2420 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
2421 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2422 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
2423 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
2424 irmp_param_p
= (IRMP_PARAMETER
*) &bang_olufsen_param
;
2428 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2430 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2431 if (irmp_pulse_time
>= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
&& irmp_pulse_time
<= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
&&
2432 irmp_pause_time
>= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
&& irmp_pause_time
<= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
)
2434 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2435 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
2436 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
);
2437 irmp_param_p
= (IRMP_PARAMETER
*) &grundig_param
;
2438 last_pause
= irmp_pause_time
;
2442 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2444 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2445 if (((irmp_pulse_time
>= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
) ||
2446 (irmp_pulse_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
)) &&
2447 ((irmp_pause_time
>= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
) ||
2448 (irmp_pause_time
>= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
)))
2449 { // it's RUWIDO or SIEMENS
2450 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
2451 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2452 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
2453 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
2454 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
);
2455 irmp_param_p
= (IRMP_PARAMETER
*) &ruwido_param
;
2456 last_pause
= irmp_pause_time
;
2460 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2462 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
2463 if (irmp_pulse_time
>= FDC_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_START_BIT_PULSE_LEN_MAX
&&
2464 irmp_pause_time
>= FDC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_START_BIT_PAUSE_LEN_MAX
)
2466 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2467 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
,
2468 FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
);
2469 irmp_param_p
= (IRMP_PARAMETER
*) &fdc_param
;
2472 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
2474 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2475 if (irmp_pulse_time
>= RCCAR_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_START_BIT_PULSE_LEN_MAX
&&
2476 irmp_pause_time
>= RCCAR_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_START_BIT_PAUSE_LEN_MAX
)
2478 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2479 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
,
2480 RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
);
2481 irmp_param_p
= (IRMP_PARAMETER
*) &rccar_param
;
2484 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
2486 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2487 if (irmp_pulse_time
>= KATHREIN_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_START_BIT_PULSE_LEN_MAX
&&
2488 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)
2490 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2491 KATHREIN_START_BIT_PULSE_LEN_MIN
, KATHREIN_START_BIT_PULSE_LEN_MAX
,
2492 KATHREIN_START_BIT_PAUSE_LEN_MIN
, KATHREIN_START_BIT_PAUSE_LEN_MAX
);
2493 irmp_param_p
= (IRMP_PARAMETER
*) &kathrein_param
;
2496 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
2498 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2499 if (irmp_pulse_time
>= NETBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= NETBOX_START_BIT_PULSE_LEN_MAX
&&
2500 irmp_pause_time
>= NETBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NETBOX_START_BIT_PAUSE_LEN_MAX
)
2502 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2503 NETBOX_START_BIT_PULSE_LEN_MIN
, NETBOX_START_BIT_PULSE_LEN_MAX
,
2504 NETBOX_START_BIT_PAUSE_LEN_MIN
, NETBOX_START_BIT_PAUSE_LEN_MAX
);
2505 irmp_param_p
= (IRMP_PARAMETER
*) &netbox_param
;
2508 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
2510 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
2511 if (irmp_pulse_time
>= LEGO_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= LEGO_START_BIT_PULSE_LEN_MAX
&&
2512 irmp_pause_time
>= LEGO_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= LEGO_START_BIT_PAUSE_LEN_MAX
)
2514 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2515 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
,
2516 LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
);
2517 irmp_param_p
= (IRMP_PARAMETER
*) &lego_param
;
2520 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
2522 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2523 if (irmp_pulse_time
>= A1TVBOX_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= A1TVBOX_START_BIT_PULSE_LEN_MAX
&&
2524 irmp_pause_time
>= A1TVBOX_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= A1TVBOX_START_BIT_PAUSE_LEN_MAX
)
2526 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2527 A1TVBOX_START_BIT_PULSE_LEN_MIN
, A1TVBOX_START_BIT_PULSE_LEN_MAX
,
2528 A1TVBOX_START_BIT_PAUSE_LEN_MIN
, A1TVBOX_START_BIT_PAUSE_LEN_MAX
);
2529 irmp_param_p
= (IRMP_PARAMETER
*) &a1tvbox_param
;
2534 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2536 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
2537 if (irmp_pulse_time
>= ORTEK_START_BIT_PULSE_LEN_MIN
&& irmp_pulse_time
<= ORTEK_START_BIT_PULSE_LEN_MAX
&&
2538 irmp_pause_time
>= ORTEK_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= ORTEK_START_BIT_PAUSE_LEN_MAX
)
2539 { // it's ORTEK (Hama)
2540 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
2541 ORTEK_START_BIT_PULSE_LEN_MIN
, ORTEK_START_BIT_PULSE_LEN_MAX
,
2542 ORTEK_START_BIT_PAUSE_LEN_MIN
, ORTEK_START_BIT_PAUSE_LEN_MAX
);
2543 irmp_param_p
= (IRMP_PARAMETER
*) &ortek_param
;
2549 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
2552 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
2553 // irmp_busy_flag = FALSE;
2554 irmp_start_bit_detected
= 0; // wait for another start bit...
2557 if (irmp_start_bit_detected
)
2559 memcpy_P (&irmp_param
, irmp_param_p
, sizeof (IRMP_PARAMETER
));
2562 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2564 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
);
2565 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
);
2569 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_1_len_min
, irmp_param
.pulse_1_len_max
,
2570 2 * irmp_param
.pulse_1_len_min
, 2 * irmp_param
.pulse_1_len_max
);
2571 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_1_len_min
, irmp_param
.pause_1_len_max
,
2572 2 * irmp_param
.pause_1_len_min
, 2 * irmp_param
.pause_1_len_max
);
2575 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2576 if (irmp_param2
.protocol
)
2578 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2
.pulse_0_len_min
, irmp_param2
.pulse_0_len_max
);
2579 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2
.pause_0_len_min
, irmp_param2
.pause_0_len_max
);
2580 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2
.pulse_1_len_min
, irmp_param2
.pulse_1_len_max
);
2581 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2
.pause_1_len_min
, irmp_param2
.pause_1_len_max
);
2586 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2587 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
)
2589 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN
, RC6_TOGGLE_BIT_LEN_MAX
);
2593 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2595 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2596 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
);
2600 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
,
2601 2 * irmp_param
.pulse_0_len_min
, 2 * irmp_param
.pulse_0_len_max
);
2602 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param
.pause_0_len_min
, irmp_param
.pause_0_len_max
,
2603 2 * irmp_param
.pause_0_len_min
, 2 * irmp_param
.pause_0_len_max
);
2606 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
2607 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
2609 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2610 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN
, BANG_OLUFSEN_R_PAUSE_LEN_MAX
);
2614 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param
.command_offset
);
2615 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param
.command_end
- irmp_param
.command_offset
);
2616 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param
.complete_len
);
2617 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param
.stop_bit
);
2623 #if IRMP_SUPPORT_MANCHESTER == 1
2624 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2625 irmp_param
.protocol
!= IRMP_RUWIDO_PROTOCOL
&& // Manchester, but not RUWIDO
2626 irmp_param
.protocol
!= IRMP_RC6_PROTOCOL
) // Manchester, but not RC6
2628 if (irmp_pause_time
> irmp_param
.pulse_1_len_max
&& irmp_pause_time
<= 2 * irmp_param
.pulse_1_len_max
)
2630 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2631 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2633 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1);
2635 else if (! last_value
) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
2637 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2639 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2641 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0);
2645 #endif // IRMP_SUPPORT_MANCHESTER == 1
2647 #if IRMP_SUPPORT_SERIAL == 1
2648 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
2653 #endif // IRMP_SUPPORT_SERIAL == 1
2656 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
2657 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
2659 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2661 if (irmp_pause_time
>= DENON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= DENON_1_PAUSE_LEN_MAX
)
2662 { // pause timings correct for "1"?
2663 ANALYZE_PUTCHAR ('1'); // yes, store 1
2667 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
2668 { // pause timings correct for "0"?
2669 ANALYZE_PUTCHAR ('0'); // yes, store 0
2675 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
2676 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2677 if (irmp_param
.protocol
== IRMP_THOMSON_PROTOCOL
)
2679 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2681 if (irmp_pause_time
>= THOMSON_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= THOMSON_1_PAUSE_LEN_MAX
)
2682 { // pause timings correct for "1"?
2683 ANALYZE_PUTCHAR ('1'); // yes, store 1
2687 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
2688 { // pause timings correct for "0"?
2689 ANALYZE_PUTCHAR ('0'); // yes, store 0
2695 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
2697 ; // else do nothing
2700 irmp_pulse_time
= 1; // set counter to 1, not 0
2701 irmp_pause_time
= 0;
2702 wait_for_start_space
= 0;
2705 else if (wait_for_space
) // the data section....
2706 { // counting the time of darkness....
2707 uint8_t got_light
= FALSE
;
2709 if (irmp_input
) // still dark?
2711 if (irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 1)
2714 #if IRMP_SUPPORT_MANCHESTER == 1
2715 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) ||
2717 #if IRMP_SUPPORT_SERIAL == 1
2718 (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) ||
2720 (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
))
2723 if (! (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
))
2725 ANALYZE_PRINTF ("stop bit detected\n");
2728 irmp_param
.stop_bit
= 0;
2732 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",
2733 irmp_bit
, irmp_pulse_time
, irmp_param
.pulse_0_len_min
, irmp_param
.pulse_0_len_max
);
2735 // irmp_busy_flag = FALSE;
2736 irmp_start_bit_detected
= 0; // wait for another start bit...
2737 irmp_pulse_time
= 0;
2738 irmp_pause_time
= 0;
2743 irmp_pause_time
++; // increment counter
2745 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
2746 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& // Sony has a variable number of bits:
2747 irmp_pause_time
> SIRCS_PAUSE_LEN_MAX
&& // minimum is 12
2748 irmp_bit
>= 12 - 1) // pause too long?
2749 { // yes, break and close this frame
2750 irmp_param
.complete_len
= irmp_bit
+ 1; // set new complete length
2751 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2752 irmp_tmp_address
|= (irmp_bit
- SIRCS_MINIMUM_DATA_LEN
+ 1) << 8; // new: store number of additional bits in upper byte of address!
2753 irmp_param
.command_end
= irmp_param
.command_offset
+ irmp_bit
+ 1; // correct command length
2754 irmp_pause_time
= SIRCS_PAUSE_LEN_MAX
- 1; // correct pause length
2758 #if IRMP_SUPPORT_SERIAL == 1
2759 // NETBOX generates no stop bit, here is the timeout condition:
2760 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
) && irmp_param
.protocol
== IRMP_NETBOX_PROTOCOL
&&
2761 irmp_pause_time
>= NETBOX_PULSE_LEN
* (NETBOX_COMPLETE_DATA_LEN
- irmp_bit
))
2763 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2767 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
2768 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& !irmp_param
.stop_bit
)
2770 if (irmp_pause_time
> IR60_TIMEOUT_LEN
&& (irmp_bit
== 5 || irmp_bit
== 6))
2772 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
2773 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2774 irmp_param
.stop_bit
= TRUE
; // set flag
2776 irmp_param
.protocol
= IRMP_IR60_PROTOCOL
; // change protocol
2777 irmp_param
.complete_len
= IR60_COMPLETE_DATA_LEN
; // correct complete len
2778 irmp_param
.address_offset
= IR60_ADDRESS_OFFSET
;
2779 irmp_param
.address_end
= IR60_ADDRESS_OFFSET
+ IR60_ADDRESS_LEN
;
2780 irmp_param
.command_offset
= IR60_COMMAND_OFFSET
;
2781 irmp_param
.command_end
= IR60_COMMAND_OFFSET
+ IR60_COMMAND_LEN
;
2783 irmp_tmp_command
<<= 1;
2784 irmp_tmp_command
|= first_bit
;
2786 else if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
- 2)
2787 { // special manchester decoder
2788 irmp_param
.complete_len
= GRUNDIG_COMPLETE_DATA_LEN
; // correct complete len
2789 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2790 irmp_param
.stop_bit
= TRUE
; // set flag
2792 else if (irmp_bit
>= GRUNDIG_COMPLETE_DATA_LEN
)
2794 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");
2795 irmp_param
.protocol
= IRMP_NOKIA_PROTOCOL
; // change protocol
2796 irmp_param
.address_offset
= NOKIA_ADDRESS_OFFSET
;
2797 irmp_param
.address_end
= NOKIA_ADDRESS_OFFSET
+ NOKIA_ADDRESS_LEN
;
2798 irmp_param
.command_offset
= NOKIA_COMMAND_OFFSET
;
2799 irmp_param
.command_end
= NOKIA_COMMAND_OFFSET
+ NOKIA_COMMAND_LEN
;
2801 if (irmp_tmp_command
& 0x300)
2803 irmp_tmp_address
= (irmp_tmp_command
>> 8);
2804 irmp_tmp_command
&= 0xFF;
2810 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
2811 if (irmp_param
.protocol
== IRMP_RUWIDO_PROTOCOL
&& !irmp_param
.stop_bit
)
2813 if (irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
- 2)
2814 { // special manchester decoder
2815 irmp_param
.complete_len
= RUWIDO_COMPLETE_DATA_LEN
; // correct complete len
2816 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2817 irmp_param
.stop_bit
= TRUE
; // set flag
2819 else if (irmp_bit
>= RUWIDO_COMPLETE_DATA_LEN
)
2821 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
2822 irmp_param
.protocol
= IRMP_SIEMENS_PROTOCOL
; // change protocol
2823 irmp_param
.address_offset
= SIEMENS_ADDRESS_OFFSET
;
2824 irmp_param
.address_end
= SIEMENS_ADDRESS_OFFSET
+ SIEMENS_ADDRESS_LEN
;
2825 irmp_param
.command_offset
= SIEMENS_COMMAND_OFFSET
;
2826 irmp_param
.command_end
= SIEMENS_COMMAND_OFFSET
+ SIEMENS_COMMAND_LEN
;
2829 // RUWIDO: AAAAAAAAACCCCCCCp
2830 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
2831 irmp_tmp_address
<<= 2;
2832 irmp_tmp_address
|= (irmp_tmp_command
>> 6);
2833 irmp_tmp_command
&= 0x003F;
2834 irmp_tmp_command
<<= 4;
2835 irmp_tmp_command
|= last_value
;
2840 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
2841 if (irmp_param
.protocol
== IRMP_ROOMBA_PROTOCOL
&& // Roomba has no stop bit
2842 irmp_bit
>= ROOMBA_COMPLETE_DATA_LEN
- 1) // it's the last datab bit...
2843 { // break and close this frame
2844 if (irmp_pulse_time
>= ROOMBA_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_1_PULSE_LEN_MAX
)
2846 irmp_pause_time
= ROOMBA_1_PAUSE_LEN
;
2848 else if (irmp_pulse_time
>= ROOMBA_0_PULSE_LEN_MIN
&& irmp_pulse_time
<= ROOMBA_0_PULSE_LEN_MAX
)
2850 irmp_pause_time
= ROOMBA_0_PAUSE_LEN
;
2853 got_light
= TRUE
; // this is a lie, but helps (generates stop bit)
2857 #if IRMP_SUPPORT_MANCHESTER == 1
2858 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
) &&
2859 irmp_pause_time
>= 2 * irmp_param
.pause_1_len_max
&& irmp_bit
>= irmp_param
.complete_len
- 2 && !irmp_param
.stop_bit
)
2860 { // special manchester decoder
2861 got_light
= TRUE
; // this is a lie, but generates a stop bit ;-)
2862 irmp_param
.stop_bit
= TRUE
; // set flag
2865 #endif // IRMP_SUPPORT_MANCHESTER == 1
2866 if (irmp_pause_time
> IRMP_TIMEOUT_LEN
) // timeout?
2868 if (irmp_bit
== irmp_param
.complete_len
- 1 && irmp_param
.stop_bit
== 0)
2872 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2873 else if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2875 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2876 irmp_param
.stop_bit
= TRUE
; // set flag
2877 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2878 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2879 irmp_tmp_command
= (irmp_tmp_address
>> 4); // set command: upper 12 bits are command bits
2880 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2881 irmp_start_bit_detected
= 1; // tricky: don't wait for another start bit...
2883 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2885 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
2886 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
2887 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& irmp_bit
== 32) // it was a NEC stop bit
2889 ANALYZE_PRINTF ("Switching to NEC protocol\n");
2890 irmp_param
.stop_bit
= TRUE
; // set flag
2891 irmp_param
.protocol
= IRMP_NEC_PROTOCOL
; // switch protocol
2892 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2894 // 0123456789ABC0123456789ABC0123456701234567
2895 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2896 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
2897 irmp_tmp_address
|= (irmp_tmp_address2
& 0x0007) << 13; // fm 2012-02-13: 12 -> 13
2898 irmp_tmp_command
= (irmp_tmp_address2
>> 3) | (irmp_tmp_command
<< 10);
2900 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
2901 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
2902 else if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&& (irmp_bit
== 16 || irmp_bit
== 17)) // it was a JVC stop bit
2904 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit
);
2905 irmp_param
.stop_bit
= TRUE
; // set flag
2906 irmp_param
.protocol
= IRMP_JVC_PROTOCOL
; // switch protocol
2907 irmp_param
.complete_len
= irmp_bit
; // patch length: 16 or 17
2909 // 0123456789ABC0123456789ABC0123456701234567
2910 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
2911 // JVC: AAAACCCCCCCCCCCC
2912 irmp_tmp_command
= (irmp_tmp_address
>> 4) | (irmp_tmp_address2
<< 9); // set command: upper 12 bits are command bits
2913 irmp_tmp_address
= irmp_tmp_address
& 0x000F; // lower 4 bits are address bits
2915 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
2916 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
2919 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time
, irmp_bit
);
2920 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
2922 // irmp_busy_flag = FALSE;
2923 irmp_start_bit_detected
= 0; // wait for another start bit...
2924 irmp_pulse_time
= 0;
2925 irmp_pause_time
= 0;
2937 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
2939 #if IRMP_SUPPORT_MANCHESTER == 1
2940 if ((irmp_param
.flags
& IRMP_PARAM_FLAG_IS_MANCHESTER
)) // Manchester
2943 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
/* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
2944 #else // better, but some IR-RCs use asymmetric timings :-/
2945 if (irmp_pulse_time
> irmp_param
.pulse_1_len_max
&& irmp_pulse_time
<= 2 * irmp_param
.pulse_1_len_max
&&
2946 irmp_pause_time
<= 2 * irmp_param
.pause_1_len_max
)
2949 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2950 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2952 ANALYZE_PUTCHAR ('T');
2953 if (irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode 6A
2966 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2968 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '0' : '1');
2969 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 0 : 1 );
2971 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
2972 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 4 && irmp_pulse_time
> RC6_TOGGLE_BIT_LEN_MIN
) // RC6 toggle bit
2974 ANALYZE_PUTCHAR ('T');
2977 if (irmp_pause_time
> 2 * irmp_param
.pause_1_len_max
)
2988 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
2990 ANALYZE_PUTCHAR ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? '1' : '0');
2991 irmp_store_bit ((irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0 );
2992 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
2993 if (! irmp_param2
.protocol
)
2998 last_value
= (irmp_param
.flags
& IRMP_PARAM_FLAG_1ST_PULSE_IS_1
) ? 1 : 0;
3002 else if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
3003 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
3005 uint8_t manchester_value
;
3007 if (last_pause
> irmp_param
.pause_1_len_max
&& last_pause
<= 2 * irmp_param
.pause_1_len_max
)
3009 manchester_value
= last_value
? 0 : 1;
3010 last_value
= manchester_value
;
3014 manchester_value
= last_value
;
3017 ANALYZE_PUTCHAR (manchester_value
+ '0');
3019 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
3020 if (! irmp_param2
.protocol
)
3026 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3027 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_bit
== 1 && manchester_value
== 1) // RC6 mode != 0 ???
3029 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
3030 irmp_param
.complete_len
= RC6_COMPLETE_DATA_LEN_LONG
;
3031 irmp_param
.address_offset
= 5;
3032 irmp_param
.address_end
= irmp_param
.address_offset
+ 15;
3033 irmp_param
.command_offset
= irmp_param
.address_end
+ 1; // skip 1 system bit, changes like a toggle bit
3034 irmp_param
.command_end
= irmp_param
.command_offset
+ 16 - 1;
3035 irmp_tmp_address
= 0;
3037 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3039 irmp_store_bit (manchester_value
);
3043 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3044 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&&
3045 irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
&&
3046 ((irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
) ||
3047 (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)))
3049 ANALYZE_PUTCHAR ('?');
3050 irmp_param
.protocol
= 0; // switch to FDC, see below
3053 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3054 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3055 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&&
3056 irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
&&
3057 ((irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
) ||
3058 (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)))
3060 ANALYZE_PUTCHAR ('?');
3061 irmp_param
.protocol
= 0; // switch to RCCAR, see below
3064 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3066 ANALYZE_PUTCHAR ('?');
3068 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3069 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3070 // irmp_busy_flag = FALSE;
3071 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3072 irmp_pause_time
= 0;
3076 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
3077 if (irmp_param2
.protocol
== IRMP_FDC_PROTOCOL
&& irmp_pulse_time
>= FDC_PULSE_LEN_MIN
&& irmp_pulse_time
<= FDC_PULSE_LEN_MAX
)
3079 if (irmp_pause_time
>= FDC_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_1_PAUSE_LEN_MAX
)
3081 ANALYZE_PRINTF (" 1 (FDC)\n");
3082 irmp_store_bit2 (1);
3084 else if (irmp_pause_time
>= FDC_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= FDC_0_PAUSE_LEN_MAX
)
3086 ANALYZE_PRINTF (" 0 (FDC)\n");
3087 irmp_store_bit2 (0);
3090 if (! irmp_param
.protocol
)
3092 ANALYZE_PRINTF ("Switching to FDC protocol\n");
3093 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3094 irmp_param2
.protocol
= 0;
3095 irmp_tmp_address
= irmp_tmp_address2
;
3096 irmp_tmp_command
= irmp_tmp_command2
;
3099 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
3100 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3101 if (irmp_param2
.protocol
== IRMP_RCCAR_PROTOCOL
&& irmp_pulse_time
>= RCCAR_PULSE_LEN_MIN
&& irmp_pulse_time
<= RCCAR_PULSE_LEN_MAX
)
3103 if (irmp_pause_time
>= RCCAR_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_1_PAUSE_LEN_MAX
)
3105 ANALYZE_PRINTF (" 1 (RCCAR)\n");
3106 irmp_store_bit2 (1);
3108 else if (irmp_pause_time
>= RCCAR_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= RCCAR_0_PAUSE_LEN_MAX
)
3110 ANALYZE_PRINTF (" 0 (RCCAR)\n");
3111 irmp_store_bit2 (0);
3114 if (! irmp_param
.protocol
)
3116 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
3117 memcpy (&irmp_param
, &irmp_param2
, sizeof (IRMP_PARAMETER
));
3118 irmp_param2
.protocol
= 0;
3119 irmp_tmp_address
= irmp_tmp_address2
;
3120 irmp_tmp_command
= irmp_tmp_command2
;
3123 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
3125 last_pause
= irmp_pause_time
;
3129 #endif // IRMP_SUPPORT_MANCHESTER == 1
3131 #if IRMP_SUPPORT_SERIAL == 1
3132 if (irmp_param
.flags
& IRMP_PARAM_FLAG_IS_SERIAL
)
3134 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pulse_time
> irmp_param
.pulse_1_len_max
)
3136 ANALYZE_PUTCHAR ('1');
3139 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
)
3141 irmp_pulse_time
-= irmp_param
.pulse_1_len_min
;
3145 irmp_pulse_time
= 0;
3149 while (irmp_bit
< irmp_param
.complete_len
&& irmp_pause_time
> irmp_param
.pause_1_len_max
)
3151 ANALYZE_PUTCHAR ('0');
3154 if (irmp_pause_time
>= irmp_param
.pause_1_len_min
)
3156 irmp_pause_time
-= irmp_param
.pause_1_len_min
;
3160 irmp_pause_time
= 0;
3167 #endif // IRMP_SUPPORT_SERIAL == 1
3169 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3170 if (irmp_param
.protocol
== IRMP_SAMSUNG_PROTOCOL
&& irmp_bit
== 16) // Samsung: 16th bit
3172 if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
&&
3173 irmp_pause_time
>= SAMSUNG_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_START_BIT_PAUSE_LEN_MAX
)
3175 ANALYZE_PRINTF ("SYNC\n");
3180 else if (irmp_pulse_time
>= SAMSUNG_PULSE_LEN_MIN
&& irmp_pulse_time
<= SAMSUNG_PULSE_LEN_MAX
)
3182 irmp_param
.protocol
= IRMP_SAMSUNG32_PROTOCOL
;
3183 irmp_param
.command_offset
= SAMSUNG32_COMMAND_OFFSET
;
3184 irmp_param
.command_end
= SAMSUNG32_COMMAND_OFFSET
+ SAMSUNG32_COMMAND_LEN
;
3185 irmp_param
.complete_len
= SAMSUNG32_COMPLETE_DATA_LEN
;
3187 if (irmp_pause_time
>= SAMSUNG_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= SAMSUNG_1_PAUSE_LEN_MAX
)
3189 ANALYZE_PUTCHAR ('1');
3196 ANALYZE_PUTCHAR ('0');
3202 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
3205 { // timing incorrect!
3206 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3207 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3208 // irmp_busy_flag = FALSE;
3209 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3210 irmp_pause_time
= 0;
3214 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
3216 #if IRMP_SUPPORT_NEC16_PROTOCOL
3217 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
3218 if (irmp_param
.protocol
== IRMP_NEC42_PROTOCOL
&&
3219 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
3220 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&&
3221 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
3222 irmp_bit
== 8 && irmp_pause_time
>= NEC_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= NEC_START_BIT_PAUSE_LEN_MAX
)
3224 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
3225 irmp_param
.protocol
= IRMP_NEC16_PROTOCOL
;
3226 irmp_param
.address_offset
= NEC16_ADDRESS_OFFSET
;
3227 irmp_param
.address_end
= NEC16_ADDRESS_OFFSET
+ NEC16_ADDRESS_LEN
;
3228 irmp_param
.command_offset
= NEC16_COMMAND_OFFSET
;
3229 irmp_param
.command_end
= NEC16_COMMAND_OFFSET
+ NEC16_COMMAND_LEN
;
3230 irmp_param
.complete_len
= NEC16_COMPLETE_DATA_LEN
;
3234 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
3236 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
3237 if (irmp_param
.protocol
== IRMP_BANG_OLUFSEN_PROTOCOL
)
3239 if (irmp_pulse_time
>= BANG_OLUFSEN_PULSE_LEN_MIN
&& irmp_pulse_time
<= BANG_OLUFSEN_PULSE_LEN_MAX
)
3241 if (irmp_bit
== 1) // Bang & Olufsen: 3rd bit
3243 if (irmp_pause_time
>= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
)
3245 ANALYZE_PRINTF ("3rd start bit\n");
3250 { // timing incorrect!
3251 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
);
3252 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3253 // irmp_busy_flag = FALSE;
3254 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3255 irmp_pause_time
= 0;
3258 else if (irmp_bit
== 19) // Bang & Olufsen: trailer bit
3260 if (irmp_pause_time
>= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX
)
3262 ANALYZE_PRINTF ("trailer bit\n");
3267 { // timing incorrect!
3268 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
);
3269 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3270 // irmp_busy_flag = FALSE;
3271 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3272 irmp_pause_time
= 0;
3277 if (irmp_pause_time
>= BANG_OLUFSEN_1_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_1_PAUSE_LEN_MAX
)
3278 { // pulse & pause timings correct for "1"?
3279 ANALYZE_PUTCHAR ('1');
3285 else if (irmp_pause_time
>= BANG_OLUFSEN_0_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_0_PAUSE_LEN_MAX
)
3286 { // pulse & pause timings correct for "0"?
3287 ANALYZE_PUTCHAR ('0');
3293 else if (irmp_pause_time
>= BANG_OLUFSEN_R_PAUSE_LEN_MIN
&& irmp_pause_time
<= BANG_OLUFSEN_R_PAUSE_LEN_MAX
)
3295 ANALYZE_PUTCHAR (last_value
+ '0');
3297 irmp_store_bit (last_value
);
3301 { // timing incorrect!
3302 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
);
3303 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3304 // irmp_busy_flag = FALSE;
3305 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3306 irmp_pause_time
= 0;
3311 { // timing incorrect!
3312 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
);
3313 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3314 // irmp_busy_flag = FALSE;
3315 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3316 irmp_pause_time
= 0;
3320 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
3322 if (irmp_pulse_time
>= irmp_param
.pulse_1_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_1_len_max
&&
3323 irmp_pause_time
>= irmp_param
.pause_1_len_min
&& irmp_pause_time
<= irmp_param
.pause_1_len_max
)
3324 { // pulse & pause timings correct for "1"?
3325 ANALYZE_PUTCHAR ('1');
3330 else if (irmp_pulse_time
>= irmp_param
.pulse_0_len_min
&& irmp_pulse_time
<= irmp_param
.pulse_0_len_max
&&
3331 irmp_pause_time
>= irmp_param
.pause_0_len_min
&& irmp_pause_time
<= irmp_param
.pause_0_len_max
)
3332 { // pulse & pause timings correct for "0"?
3333 ANALYZE_PUTCHAR ('0');
3339 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
3341 if (irmp_param
.protocol
== IRMP_KATHREIN_PROTOCOL
&&
3342 irmp_pulse_time
>= KATHREIN_1_PULSE_LEN_MIN
&& irmp_pulse_time
<= KATHREIN_1_PULSE_LEN_MAX
&&
3343 (((irmp_bit
== 8 || irmp_bit
== 6) &&
3344 irmp_pause_time
>= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX
) ||
3346 irmp_pause_time
>= KATHREIN_START_BIT_PAUSE_LEN_MIN
&& irmp_pause_time
<= KATHREIN_START_BIT_PAUSE_LEN_MAX
)))
3352 ANALYZE_PUTCHAR ('S');
3354 irmp_tmp_command
<<= 1;
3358 ANALYZE_PUTCHAR ('S');
3365 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
3366 { // timing incorrect!
3367 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit
, irmp_pulse_time
, irmp_pause_time
);
3368 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3369 // irmp_busy_flag = FALSE;
3370 irmp_start_bit_detected
= 0; // reset flags and wait for next start bit
3371 irmp_pause_time
= 0;
3374 irmp_pulse_time
= 1; // set counter to 1, not 0
3378 { // counting the pulse length ...
3379 if (! irmp_input
) // still light?
3381 irmp_pulse_time
++; // increment counter
3385 wait_for_space
= 1; // let's count the time (see above)
3386 irmp_pause_time
= 1; // set pause counter to 1, not 0
3390 if (irmp_start_bit_detected
&& irmp_bit
== irmp_param
.complete_len
&& irmp_param
.stop_bit
== 0) // enough bits received?
3392 if (last_irmp_command
== irmp_tmp_command
&& key_repetition_len
< AUTO_FRAME_REPETITION_LEN
)
3394 repetition_frame_number
++;
3398 repetition_frame_number
= 0;
3401 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
3402 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
3403 if (irmp_param
.protocol
== IRMP_SIRCS_PROTOCOL
&& (repetition_frame_number
== 1 || repetition_frame_number
== 2))
3405 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3406 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3407 key_repetition_len
= 0;
3412 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3413 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3414 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
&& repetition_frame_number
== 1)
3416 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3417 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3418 key_repetition_len
= 0;
3423 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3424 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
3425 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
&& repetition_frame_number
== 1)
3427 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3428 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3429 key_repetition_len
= 0;
3434 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3435 // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3436 if (irmp_param
.protocol
== IRMP_SAMSUNG32_PROTOCOL
&& (repetition_frame_number
& 0x01))
3438 ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3439 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3440 key_repetition_len
= 0;
3445 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
3446 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
3447 if (irmp_param
.protocol
== IRMP_NUBERT_PROTOCOL
&& (repetition_frame_number
& 0x01))
3449 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
3450 repetition_frame_number
+ 1, key_repetition_len
, AUTO_FRAME_REPETITION_LEN
);
3451 key_repetition_len
= 0;
3457 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter
* 1000) / F_INTERRUPTS
, irmp_bit
);
3458 irmp_ir_detected
= TRUE
;
3460 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
3461 if (irmp_param
.protocol
== IRMP_DENON_PROTOCOL
)
3462 { // check for repetition frame
3463 if ((~irmp_tmp_command
& 0x3FF) == last_irmp_denon_command
) // command bits must be inverted
3465 irmp_tmp_command
= last_irmp_denon_command
; // use command received before!
3466 last_irmp_denon_command
= 0;
3468 irmp_protocol
= irmp_param
.protocol
; // store protocol
3469 irmp_address
= irmp_tmp_address
; // store address
3470 irmp_command
= irmp_tmp_command
; // store command
3474 if ((irmp_tmp_command
& 0x01) == 0x00)
3476 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3477 last_irmp_denon_command
= irmp_tmp_command
;
3478 denon_repetition_len
= 0;
3479 irmp_ir_detected
= FALSE
;
3483 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter
* 1000) / F_INTERRUPTS
);
3484 last_irmp_denon_command
= 0;
3485 irmp_ir_detected
= FALSE
;
3490 #endif // IRMP_SUPPORT_DENON_PROTOCOL
3492 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
3493 if (irmp_param
.protocol
== IRMP_GRUNDIG_PROTOCOL
&& irmp_tmp_command
== 0x01ff)
3494 { // Grundig start frame?
3495 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
3496 irmp_ir_detected
= FALSE
;
3499 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
3501 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
3502 if (irmp_param
.protocol
== IRMP_NOKIA_PROTOCOL
&& irmp_tmp_address
== 0x00ff && irmp_tmp_command
== 0x00fe)
3503 { // Nokia start frame?
3504 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
3505 irmp_ir_detected
= FALSE
;
3508 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
3510 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3511 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
&& irmp_bit
== 0) // repetition frame
3513 if (key_repetition_len
< NEC_FRAME_REPEAT_PAUSE_LEN_MAX
)
3515 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len
);
3516 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
3517 irmp_tmp_address
= last_irmp_address
; // address is last address
3518 irmp_tmp_command
= last_irmp_command
; // command is last command
3519 irmp_flags
|= IRMP_FLAG_REPETITION
;
3520 key_repetition_len
= 0;
3524 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
3525 key_repetition_len
, NEC_FRAME_REPEAT_PAUSE_LEN_MAX
);
3526 irmp_ir_detected
= FALSE
;
3529 #endif // IRMP_SUPPORT_NEC_PROTOCOL
3531 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3532 if (irmp_param
.protocol
== IRMP_KASEIKYO_PROTOCOL
)
3535 // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
3536 // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
3538 xor_value
= (xor_check
[0] & 0x0F) ^ ((xor_check
[0] & 0xF0) >> 4) ^ (xor_check
[1] & 0x0F) ^ ((xor_check
[1] & 0xF0) >> 4);
3540 if (xor_value
!= (xor_check
[2] & 0x0F))
3542 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value
, xor_check
[2] & 0x0F);
3543 irmp_ir_detected
= FALSE
;
3546 xor_value
= xor_check
[2] ^ xor_check
[3] ^ xor_check
[4];
3548 if (xor_value
!= xor_check
[5])
3550 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value
, xor_check
[5]);
3551 irmp_ir_detected
= FALSE
;
3554 irmp_flags
|= genre2
; // write the genre2 bits into MSB of the flag byte
3556 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
3558 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3559 if (irmp_param
.protocol
== IRMP_ORTEK_PROTOCOL
)
3561 if (parity
== PARITY_CHECK_FAILED
)
3563 ANALYZE_PRINTF ("error 6: parity check failed\n");
3564 irmp_ir_detected
= FALSE
;
3567 if ((irmp_tmp_address
& 0x03) == 0x02)
3569 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
3570 irmp_ir_detected
= FALSE
;
3572 irmp_tmp_address
>>= 2;
3574 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
3576 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
3577 if (irmp_param
.protocol
== IRMP_RC6_PROTOCOL
&& irmp_param
.complete_len
== RC6_COMPLETE_DATA_LEN_LONG
) // RC6 mode = 6?
3579 irmp_protocol
= IRMP_RC6A_PROTOCOL
;
3582 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
3584 irmp_protocol
= irmp_param
.protocol
;
3587 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
3588 if (irmp_param
.protocol
== IRMP_FDC_PROTOCOL
)
3590 if (irmp_tmp_command
& 0x000F) // released key?
3592 irmp_tmp_command
= (irmp_tmp_command
>> 4) | 0x80; // yes, set bit 7
3596 irmp_tmp_command
>>= 4; // no, it's a pressed key
3598 irmp_tmp_command
|= (irmp_tmp_address
<< 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
3599 irmp_tmp_address
&= 0x003F;
3603 irmp_address
= irmp_tmp_address
; // store address
3604 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
3605 if (irmp_param
.protocol
== IRMP_NEC_PROTOCOL
)
3607 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3611 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
3612 if (irmp_param
.protocol
== IRMP_RC5_PROTOCOL
)
3614 irmp_tmp_command
|= rc5_cmd_bit6
; // store bit 6
3617 irmp_command
= irmp_tmp_command
; // store command
3619 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
3620 irmp_id
= irmp_tmp_id
;
3625 if (irmp_ir_detected
)
3627 if (last_irmp_command
== irmp_tmp_command
&&
3628 last_irmp_address
== irmp_tmp_address
&&
3629 key_repetition_len
< IRMP_KEY_REPETITION_LEN
)
3631 irmp_flags
|= IRMP_FLAG_REPETITION
;
3634 last_irmp_address
= irmp_tmp_address
; // store as last address, too
3635 last_irmp_command
= irmp_tmp_command
; // store as last command, too
3637 key_repetition_len
= 0;
3641 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
3644 // irmp_busy_flag = FALSE;
3645 irmp_start_bit_detected
= 0; // and wait for next start bit
3646 irmp_tmp_command
= 0;
3647 irmp_pulse_time
= 0;
3648 irmp_pause_time
= 0;
3650 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
3651 if (irmp_protocol
== IRMP_JVC_PROTOCOL
) // the stop bit of JVC frame is also start bit of next frame
3652 { // set pulse time here!
3653 irmp_pulse_time
= ((uint8_t)(F_INTERRUPTS
* JVC_START_BIT_PULSE_TIME
));
3655 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
3660 #if defined(STELLARIS_ARM_CORTEX_M4)
3661 // Clear the timer interrupt
3662 TimerIntClear(TIMER1_BASE
, TIMER_TIMA_TIMEOUT
);
3665 return (irmp_ir_detected
);
3670 /*---------------------------------------------------------------------------------------------------------------------------------------------------
3671 * main functions - for Unix/Linux + Windows only!
3675 * Compile it under linux with:
3678 * usage: ./irmp [-v|-s|-a|-l|-p] < file
3684 * -l list pulse/pauses
3686 *---------------------------------------------------------------------------------------------------------------------------------------------------
3690 print_timings (void)
3692 printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN
, sizeof (PAUSE_LEN
));
3693 printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN
);
3695 printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");
3696 printf ("====================================================================================\n");
3697 printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3698 SIRCS_START_BIT_PULSE_LEN_MIN
, SIRCS_START_BIT_PULSE_LEN_MAX
, SIRCS_START_BIT_PAUSE_LEN_MIN
, SIRCS_START_BIT_PAUSE_LEN_MAX
,
3699 SIRCS_0_PULSE_LEN_MIN
, SIRCS_0_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
,
3700 SIRCS_1_PULSE_LEN_MIN
, SIRCS_1_PULSE_LEN_MAX
, SIRCS_PAUSE_LEN_MIN
, SIRCS_PAUSE_LEN_MAX
);
3702 printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3703 NEC_START_BIT_PULSE_LEN_MIN
, NEC_START_BIT_PULSE_LEN_MAX
, NEC_START_BIT_PAUSE_LEN_MIN
, NEC_START_BIT_PAUSE_LEN_MAX
,
3704 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3705 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3707 printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3708 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
,
3709 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_0_PAUSE_LEN_MIN
, NEC_0_PAUSE_LEN_MAX
,
3710 NEC_PULSE_LEN_MIN
, NEC_PULSE_LEN_MAX
, NEC_1_PAUSE_LEN_MIN
, NEC_1_PAUSE_LEN_MAX
);
3712 printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3713 SAMSUNG_START_BIT_PULSE_LEN_MIN
, SAMSUNG_START_BIT_PULSE_LEN_MAX
, SAMSUNG_START_BIT_PAUSE_LEN_MIN
, SAMSUNG_START_BIT_PAUSE_LEN_MAX
,
3714 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_0_PAUSE_LEN_MIN
, SAMSUNG_0_PAUSE_LEN_MAX
,
3715 SAMSUNG_PULSE_LEN_MIN
, SAMSUNG_PULSE_LEN_MAX
, SAMSUNG_1_PAUSE_LEN_MIN
, SAMSUNG_1_PAUSE_LEN_MAX
);
3717 printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3718 MATSUSHITA_START_BIT_PULSE_LEN_MIN
, MATSUSHITA_START_BIT_PULSE_LEN_MAX
, MATSUSHITA_START_BIT_PAUSE_LEN_MIN
, MATSUSHITA_START_BIT_PAUSE_LEN_MAX
,
3719 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_0_PAUSE_LEN_MIN
, MATSUSHITA_0_PAUSE_LEN_MAX
,
3720 MATSUSHITA_PULSE_LEN_MIN
, MATSUSHITA_PULSE_LEN_MAX
, MATSUSHITA_1_PAUSE_LEN_MIN
, MATSUSHITA_1_PAUSE_LEN_MAX
);
3722 printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3723 KASEIKYO_START_BIT_PULSE_LEN_MIN
, KASEIKYO_START_BIT_PULSE_LEN_MAX
, KASEIKYO_START_BIT_PAUSE_LEN_MIN
, KASEIKYO_START_BIT_PAUSE_LEN_MAX
,
3724 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_0_PAUSE_LEN_MIN
, KASEIKYO_0_PAUSE_LEN_MAX
,
3725 KASEIKYO_PULSE_LEN_MIN
, KASEIKYO_PULSE_LEN_MAX
, KASEIKYO_1_PAUSE_LEN_MIN
, KASEIKYO_1_PAUSE_LEN_MAX
);
3727 printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3728 RECS80_START_BIT_PULSE_LEN_MIN
, RECS80_START_BIT_PULSE_LEN_MAX
, RECS80_START_BIT_PAUSE_LEN_MIN
, RECS80_START_BIT_PAUSE_LEN_MAX
,
3729 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_0_PAUSE_LEN_MIN
, RECS80_0_PAUSE_LEN_MAX
,
3730 RECS80_PULSE_LEN_MIN
, RECS80_PULSE_LEN_MAX
, RECS80_1_PAUSE_LEN_MIN
, RECS80_1_PAUSE_LEN_MAX
);
3732 printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",
3733 RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
, RC5_START_BIT_LEN_MIN
, RC5_START_BIT_LEN_MAX
,
3734 RC5_BIT_LEN_MIN
, RC5_BIT_LEN_MAX
);
3736 printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3737 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
,
3738 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_0_PAUSE_LEN_MIN
, DENON_0_PAUSE_LEN_MAX
,
3739 DENON_PULSE_LEN_MIN
, DENON_PULSE_LEN_MAX
, DENON_1_PAUSE_LEN_MIN
, DENON_1_PAUSE_LEN_MAX
);
3741 printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3742 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
,
3743 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_0_PAUSE_LEN_MIN
, THOMSON_0_PAUSE_LEN_MAX
,
3744 THOMSON_PULSE_LEN_MIN
, THOMSON_PULSE_LEN_MAX
, THOMSON_1_PAUSE_LEN_MIN
, THOMSON_1_PAUSE_LEN_MAX
);
3746 printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3747 RC6_START_BIT_PULSE_LEN_MIN
, RC6_START_BIT_PULSE_LEN_MAX
, RC6_START_BIT_PAUSE_LEN_MIN
, RC6_START_BIT_PAUSE_LEN_MAX
,
3748 RC6_BIT_PULSE_LEN_MIN
, RC6_BIT_PULSE_LEN_MAX
, RC6_BIT_PAUSE_LEN_MIN
, RC6_BIT_PAUSE_LEN_MAX
);
3750 printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3751 RECS80EXT_START_BIT_PULSE_LEN_MIN
, RECS80EXT_START_BIT_PULSE_LEN_MAX
, RECS80EXT_START_BIT_PAUSE_LEN_MIN
, RECS80EXT_START_BIT_PAUSE_LEN_MAX
,
3752 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_0_PAUSE_LEN_MIN
, RECS80EXT_0_PAUSE_LEN_MAX
,
3753 RECS80EXT_PULSE_LEN_MIN
, RECS80EXT_PULSE_LEN_MAX
, RECS80EXT_1_PAUSE_LEN_MIN
, RECS80EXT_1_PAUSE_LEN_MAX
);
3755 printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3756 NUBERT_START_BIT_PULSE_LEN_MIN
, NUBERT_START_BIT_PULSE_LEN_MAX
, NUBERT_START_BIT_PAUSE_LEN_MIN
, NUBERT_START_BIT_PAUSE_LEN_MAX
,
3757 NUBERT_0_PULSE_LEN_MIN
, NUBERT_0_PULSE_LEN_MAX
, NUBERT_0_PAUSE_LEN_MIN
, NUBERT_0_PAUSE_LEN_MAX
,
3758 NUBERT_1_PULSE_LEN_MIN
, NUBERT_1_PULSE_LEN_MAX
, NUBERT_1_PAUSE_LEN_MIN
, NUBERT_1_PAUSE_LEN_MAX
);
3760 printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",
3761 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX
,
3762 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX
);
3764 printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",
3765 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX
,
3766 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX
);
3768 printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",
3769 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX
,
3770 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX
);
3772 printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",
3773 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX
,
3774 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN
, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX
);
3776 printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3777 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_0_PAUSE_LEN_MIN
, BANG_OLUFSEN_0_PAUSE_LEN_MAX
,
3778 BANG_OLUFSEN_PULSE_LEN_MIN
, BANG_OLUFSEN_PULSE_LEN_MAX
, BANG_OLUFSEN_1_PAUSE_LEN_MIN
, BANG_OLUFSEN_1_PAUSE_LEN_MAX
);
3780 printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",
3781 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX
,
3782 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN
, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX
,
3783 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN
, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX
);
3785 printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3786 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX
,
3787 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX
,
3788 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3789 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
,
3790 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX
,
3791 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN
, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX
);
3793 printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3794 FDC_START_BIT_PULSE_LEN_MIN
, FDC_START_BIT_PULSE_LEN_MAX
, FDC_START_BIT_PAUSE_LEN_MIN
, FDC_START_BIT_PAUSE_LEN_MAX
,
3795 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_0_PAUSE_LEN_MIN
, FDC_0_PAUSE_LEN_MAX
,
3796 FDC_PULSE_LEN_MIN
, FDC_PULSE_LEN_MAX
, FDC_1_PAUSE_LEN_MIN
, FDC_1_PAUSE_LEN_MAX
);
3798 printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3799 RCCAR_START_BIT_PULSE_LEN_MIN
, RCCAR_START_BIT_PULSE_LEN_MAX
, RCCAR_START_BIT_PAUSE_LEN_MIN
, RCCAR_START_BIT_PAUSE_LEN_MAX
,
3800 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_0_PAUSE_LEN_MIN
, RCCAR_0_PAUSE_LEN_MAX
,
3801 RCCAR_PULSE_LEN_MIN
, RCCAR_PULSE_LEN_MAX
, RCCAR_1_PAUSE_LEN_MIN
, RCCAR_1_PAUSE_LEN_MAX
);
3803 printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3804 NIKON_START_BIT_PULSE_LEN_MIN
, NIKON_START_BIT_PULSE_LEN_MAX
, NIKON_START_BIT_PAUSE_LEN_MIN
, NIKON_START_BIT_PAUSE_LEN_MAX
,
3805 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_0_PAUSE_LEN_MIN
, NIKON_0_PAUSE_LEN_MAX
,
3806 NIKON_PULSE_LEN_MIN
, NIKON_PULSE_LEN_MAX
, NIKON_1_PAUSE_LEN_MIN
, NIKON_1_PAUSE_LEN_MAX
);
3808 printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",
3809 LEGO_START_BIT_PULSE_LEN_MIN
, LEGO_START_BIT_PULSE_LEN_MAX
, LEGO_START_BIT_PAUSE_LEN_MIN
, LEGO_START_BIT_PAUSE_LEN_MAX
,
3810 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_0_PAUSE_LEN_MIN
, LEGO_0_PAUSE_LEN_MAX
,
3811 LEGO_PULSE_LEN_MIN
, LEGO_PULSE_LEN_MAX
, LEGO_1_PAUSE_LEN_MIN
, LEGO_1_PAUSE_LEN_MAX
);
3816 print_spectrum (char * text
, int * buf
, int is_pulse
)
3829 puts ("-------------------------------------------------------------------------------");
3830 printf ("%s:\n", text
);
3832 for (i
= 0; i
< 256; i
++)
3834 if (buf
[i
] > max_value
)
3840 for (i
= 1; i
< 100; i
++)
3845 value
= (buf
[i
] * 60) / max_value
;
3847 for (j
= 0; j
< value
; j
++)
3851 printf (" %d\n", buf
[i
]);
3862 average
= (float) sum
/ (float) counter
;
3873 printf ("avg: %4.1f=%6.1f us, ", average
, (1000000. * average
) / (float) F_INTERRUPTS
);
3874 printf ("min: %2d=%6.1f us, ", min
, (1000000. * min
) / (float) F_INTERRUPTS
);
3875 printf ("max: %2d=%6.1f us, ", max
, (1000000. * max
) / (float) F_INTERRUPTS
);
3877 tolerance
= (max
- average
);
3879 if (average
- min
> tolerance
)
3881 tolerance
= average
- min
;
3884 tolerance
= tolerance
* 100 / average
;
3885 printf ("tol: %4.1f%%\n", tolerance
);
3895 #define STATE_LEFT_SHIFT 0x01
3896 #define STATE_RIGHT_SHIFT 0x02
3897 #define STATE_LEFT_CTRL 0x04
3898 #define STATE_LEFT_ALT 0x08
3899 #define STATE_RIGHT_ALT 0x10
3901 #define KEY_ESCAPE 0x1B // keycode = 0x006e
3902 #define KEY_MENUE 0x80 // keycode = 0x0070
3903 #define KEY_BACK 0x81 // keycode = 0x0071
3904 #define KEY_FORWARD 0x82 // keycode = 0x0072
3905 #define KEY_ADDRESS 0x83 // keycode = 0x0073
3906 #define KEY_WINDOW 0x84 // keycode = 0x0074
3907 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
3908 #define KEY_STOP 0x86 // keycode = 0x0076
3909 #define KEY_MAIL 0x87 // keycode = 0x0077
3910 #define KEY_FAVORITES 0x88 // keycode = 0x0078
3911 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
3912 #define KEY_SETUP 0x8A // keycode = 0x007a
3913 #define KEY_FONT 0x8B // keycode = 0x007b
3914 #define KEY_PRINT 0x8C // keycode = 0x007c
3915 #define KEY_ON_OFF 0x8E // keycode = 0x007c
3917 #define KEY_INSERT 0x90 // keycode = 0x004b
3918 #define KEY_DELETE 0x91 // keycode = 0x004c
3919 #define KEY_LEFT 0x92 // keycode = 0x004f
3920 #define KEY_HOME 0x93 // keycode = 0x0050
3921 #define KEY_END 0x94 // keycode = 0x0051
3922 #define KEY_UP 0x95 // keycode = 0x0053
3923 #define KEY_DOWN 0x96 // keycode = 0x0054
3924 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
3925 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
3926 #define KEY_RIGHT 0x99 // keycode = 0x0059
3927 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
3928 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
3931 get_fdc_key (uint16_t cmd
)
3933 static uint8_t key_table
[128] =
3935 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3936 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',
3937 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',
3938 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',
3939 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
3941 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
3942 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',
3943 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',
3944 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
3946 static uint8_t state
;
3952 case 0x002C: state
|= STATE_LEFT_SHIFT
; break; // pressed left shift
3953 case 0x00AC: state
&= ~STATE_LEFT_SHIFT
; break; // released left shift
3954 case 0x0039: state
|= STATE_RIGHT_SHIFT
; break; // pressed right shift
3955 case 0x00B9: state
&= ~STATE_RIGHT_SHIFT
; break; // released right shift
3956 case 0x003A: state
|= STATE_LEFT_CTRL
; break; // pressed left ctrl
3957 case 0x00BA: state
&= ~STATE_LEFT_CTRL
; break; // released left ctrl
3958 case 0x003C: state
|= STATE_LEFT_ALT
; break; // pressed left alt
3959 case 0x00BC: state
&= ~STATE_LEFT_ALT
; break; // released left alt
3960 case 0x003E: state
|= STATE_RIGHT_ALT
; break; // pressed left alt
3961 case 0x00BE: state
&= ~STATE_RIGHT_ALT
; break; // released left alt
3963 case 0x006e: key
= KEY_ESCAPE
; break;
3964 case 0x004b: key
= KEY_INSERT
; break;
3965 case 0x004c: key
= KEY_DELETE
; break;
3966 case 0x004f: key
= KEY_LEFT
; break;
3967 case 0x0050: key
= KEY_HOME
; break;
3968 case 0x0051: key
= KEY_END
; break;
3969 case 0x0053: key
= KEY_UP
; break;
3970 case 0x0054: key
= KEY_DOWN
; break;
3971 case 0x0055: key
= KEY_PAGE_UP
; break;
3972 case 0x0056: key
= KEY_PAGE_DOWN
; break;
3973 case 0x0059: key
= KEY_RIGHT
; break;
3974 case 0x0400: key
= KEY_MOUSE_1
; break;
3975 case 0x0800: key
= KEY_MOUSE_2
; break;
3979 if (!(cmd
& 0x80)) // pressed key
3981 if (cmd
>= 0x70 && cmd
<= 0x7F) // function keys
3983 key
= cmd
+ 0x10; // 7x -> 8x
3985 else if (cmd
< 64) // key listed in key_table
3987 if (state
& (STATE_LEFT_ALT
| STATE_RIGHT_ALT
))
3991 case 0x0003: key
= '²'; break;
3992 case 0x0008: key
= '{'; break;
3993 case 0x0009: key
= '['; break;
3994 case 0x000A: key
= ']'; break;
3995 case 0x000B: key
= '}'; break;
3996 case 0x000C: key
= '\\'; break;
3997 case 0x001C: key
= '~'; break;
3998 case 0x002D: key
= '|'; break;
3999 case 0x0034: key
= 0xB5; break; // Mu
4002 else if (state
& (STATE_LEFT_CTRL
))
4004 if (key_table
[cmd
] >= 'a' && key_table
[cmd
] <= 'z')
4006 key
= key_table
[cmd
] - 'a' + 1;
4010 key
= key_table
[cmd
];
4015 int idx
= cmd
+ ((state
& (STATE_LEFT_SHIFT
| STATE_RIGHT_SHIFT
)) ? 64 : 0);
4019 key
= key_table
[idx
];
4031 static int analyze
= FALSE
;
4032 static int list
= FALSE
;
4033 static IRMP_DATA irmp_data
;
4034 static int expected_protocol
;
4035 static int expected_address
;
4036 static int expected_command
;
4037 static int do_check_expected_values
;
4042 if (! analyze
&& ! list
)
4046 if (irmp_get_data (&irmp_data
))
4050 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
4054 printf ("%8.3fms ", (double) (time_counter
* 1000) / F_INTERRUPTS
);
4057 if (irmp_data
.protocol
== IRMP_FDC_PROTOCOL
&& (key
= get_fdc_key (irmp_data
.command
)) != 0)
4059 if ((key
>= 0x20 && key
< 0x7F) || key
>= 0xA0)
4061 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
4062 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, key
);
4064 else if (key
== '\r' || key
== '\t' || key
== KEY_ESCAPE
|| (key
>= 0x80 && key
<= 0x9F)) // function keys
4066 char * p
= (char *) NULL
;
4070 case '\t' : p
= "TAB"; break;
4071 case '\r' : p
= "CR"; break;
4072 case KEY_ESCAPE
: p
= "ESCAPE"; break;
4073 case KEY_MENUE
: p
= "MENUE"; break;
4074 case KEY_BACK
: p
= "BACK"; break;
4075 case KEY_FORWARD
: p
= "FORWARD"; break;
4076 case KEY_ADDRESS
: p
= "ADDRESS"; break;
4077 case KEY_WINDOW
: p
= "WINDOW"; break;
4078 case KEY_1ST_PAGE
: p
= "1ST_PAGE"; break;
4079 case KEY_STOP
: p
= "STOP"; break;
4080 case KEY_MAIL
: p
= "MAIL"; break;
4081 case KEY_FAVORITES
: p
= "FAVORITES"; break;
4082 case KEY_NEW_PAGE
: p
= "NEW_PAGE"; break;
4083 case KEY_SETUP
: p
= "SETUP"; break;
4084 case KEY_FONT
: p
= "FONT"; break;
4085 case KEY_PRINT
: p
= "PRINT"; break;
4086 case KEY_ON_OFF
: p
= "ON_OFF"; break;
4088 case KEY_INSERT
: p
= "INSERT"; break;
4089 case KEY_DELETE
: p
= "DELETE"; break;
4090 case KEY_LEFT
: p
= "LEFT"; break;
4091 case KEY_HOME
: p
= "HOME"; break;
4092 case KEY_END
: p
= "END"; break;
4093 case KEY_UP
: p
= "UP"; break;
4094 case KEY_DOWN
: p
= "DOWN"; break;
4095 case KEY_PAGE_UP
: p
= "PAGE_UP"; break;
4096 case KEY_PAGE_DOWN
: p
= "PAGE_DOWN"; break;
4097 case KEY_RIGHT
: p
= "RIGHT"; break;
4098 case KEY_MOUSE_1
: p
= "KEY_MOUSE_1"; break;
4099 case KEY_MOUSE_2
: p
= "KEY_MOUSE_2"; break;
4100 default : p
= "<UNKNWON>"; break;
4103 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
4104 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
, p
);
4108 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
4109 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
, key
);
4114 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
4115 irmp_data
.protocol
, irmp_protocol_names
[irmp_data
.protocol
], irmp_data
.address
, irmp_data
.command
, irmp_data
.flags
);
4118 if (do_check_expected_values
)
4120 if (irmp_data
.protocol
!= expected_protocol
||
4121 irmp_data
.address
!= expected_address
||
4122 irmp_data
.command
!= expected_command
)
4124 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
4125 expected_protocol
, irmp_protocol_names
[expected_protocol
], expected_address
, expected_command
);
4129 printf (" checked!\n");
4131 do_check_expected_values
= FALSE
; // only check 1st frame in a line!
4142 main (int argc
, char ** argv
)
4150 int start_pulses
[256];
4151 int start_pauses
[256];
4155 int first_pulse
= TRUE
;
4156 int first_pause
= TRUE
;
4160 if (! strcmp (argv
[1], "-v"))
4164 else if (! strcmp (argv
[1], "-l"))
4168 else if (! strcmp (argv
[1], "-a"))
4172 else if (! strcmp (argv
[1], "-s"))
4176 else if (! strcmp (argv
[1], "-p"))
4183 for (i
= 0; i
< 256; i
++)
4185 start_pulses
[i
] = 0;
4186 start_pauses
[i
] = 0;
4193 while ((ch
= getchar ()) != EOF
)
4195 if (ch
== '_' || ch
== '0')
4203 printf ("pause: %d\n", pause
);
4212 start_pauses
[pause
]++;
4214 first_pause
= FALSE
;
4230 else if (ch
== 0xaf || ch
== '-' || ch
== '1')
4236 printf ("pulse: %d ", pulse
);
4245 start_pulses
[pulse
]++;
4247 first_pulse
= FALSE
;
4263 else if (ch
== '\n')
4268 if (list
&& pause
> 0)
4270 printf ("pause: %d\n", pause
);
4276 for (i
= 0; i
< (int) ((10000.0 * F_INTERRUPTS
) / 10000); i
++) // newline: long pause of 10000 msec
4290 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4301 puts ("-------------------------------------------------------------------");
4305 while ((ch
= getchar()) != '\n' && ch
!= EOF
)
4307 if (ch
!= '\r') // ignore CR in DOS/Windows files
4309 if (ch
== '[' && idx
== -1)
4317 do_check_expected_values
= FALSE
;
4321 expected_protocol
= atoi (buf
);
4323 if (expected_protocol
> 0)
4332 if (sscanf (p
, "%x", &expected_address
) == 1)
4334 do_check_expected_values
= TRUE
;
4341 if (do_check_expected_values
)
4343 do_check_expected_values
= FALSE
;
4351 if (sscanf (p
, "%x", &expected_command
) == 1)
4353 do_check_expected_values
= TRUE
;
4360 if (do_check_expected_values
)
4362 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
4367 else if (idx
< 1024 - 2)
4387 print_spectrum ("START PULSES", start_pulses
, TRUE
);
4388 print_spectrum ("START PAUSES", start_pauses
, FALSE
);
4389 print_spectrum ("PULSES", pulses
, TRUE
);
4390 print_spectrum ("PAUSES", pauses
, FALSE
);
4391 puts ("-------------------------------------------------------------------------------");