]>
Commit | Line | Data |
---|---|---|
4225a882 | 1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
2 | * irmp.c - infrared multi-protocol decoder, supports several remote control protocols\r | |
3 | *\r | |
08f2dd9d | 4 | * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de\r |
4225a882 | 5 | *\r |
f874da09 | 6 | * $Id: irmp.c,v 1.129 2012/10/26 08:09:37 fm Exp $\r |
cb8474cc | 7 | *\r |
4225a882 | 8 | * ATMEGA88 @ 8 MHz\r |
9 | *\r | |
7644ac04 | 10 | * Supported mikrocontrollers:\r |
11 | *\r | |
21a4e0ee | 12 | * ATtiny87, ATtiny167\r |
476267f4 | 13 | * ATtiny45, ATtiny85\r |
14 | * ATtiny84\r | |
7644ac04 | 15 | * ATmega8, ATmega16, ATmega32\r |
16 | * ATmega162\r | |
17 | * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284\r | |
18 | * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P\r | |
19 | *\r | |
4225a882 | 20 | * This program is free software; you can redistribute it and/or modify\r |
21 | * it under the terms of the GNU General Public License as published by\r | |
22 | * the Free Software Foundation; either version 2 of the License, or\r | |
23 | * (at your option) any later version.\r | |
24 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
25 | */\r | |
26 | \r | |
f5ca0147 | 27 | #include "irmp.h"\r |
4225a882 | 28 | \r |
89e8cafb | 29 | #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1\r |
08f2dd9d | 30 | # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1\r |
d155e9ab | 31 | #else\r |
08f2dd9d | 32 | # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0\r |
d155e9ab | 33 | #endif\r |
34 | \r | |
12948cf3 | 35 | #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r |
08f2dd9d | 36 | # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1\r |
12948cf3 | 37 | #else\r |
08f2dd9d | 38 | # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0\r |
12948cf3 | 39 | #endif\r |
40 | \r | |
deba2a0a | 41 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \\r |
42 | IRMP_SUPPORT_RC6_PROTOCOL == 1 || \\r | |
43 | IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \\r | |
44 | IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \\r | |
89e8cafb | 45 | IRMP_SUPPORT_IR60_PROTOCOL\r |
08f2dd9d | 46 | # define IRMP_SUPPORT_MANCHESTER 1\r |
77f488bb | 47 | #else\r |
08f2dd9d | 48 | # define IRMP_SUPPORT_MANCHESTER 0\r |
77f488bb | 49 | #endif\r |
50 | \r | |
93570cd9 | 51 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
08f2dd9d | 52 | # define IRMP_SUPPORT_SERIAL 1\r |
deba2a0a | 53 | #else\r |
08f2dd9d | 54 | # define IRMP_SUPPORT_SERIAL 0\r |
deba2a0a | 55 | #endif\r |
56 | \r | |
6db2522c | 57 | #define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec\r |
4225a882 | 58 | \r |
fef942f6 | 59 | #define MIN_TOLERANCE_00 1.0 // -0%\r |
60 | #define MAX_TOLERANCE_00 1.0 // +0%\r | |
61 | \r | |
62 | #define MIN_TOLERANCE_05 0.95 // -5%\r | |
63 | #define MAX_TOLERANCE_05 1.05 // +5%\r | |
64 | \r | |
4225a882 | 65 | #define MIN_TOLERANCE_10 0.9 // -10%\r |
66 | #define MAX_TOLERANCE_10 1.1 // +10%\r | |
67 | \r | |
fef942f6 | 68 | #define MIN_TOLERANCE_15 0.85 // -15%\r |
69 | #define MAX_TOLERANCE_15 1.15 // +15%\r | |
70 | \r | |
4225a882 | 71 | #define MIN_TOLERANCE_20 0.8 // -20%\r |
72 | #define MAX_TOLERANCE_20 1.2 // +20%\r | |
73 | \r | |
74 | #define MIN_TOLERANCE_30 0.7 // -30%\r | |
75 | #define MAX_TOLERANCE_30 1.3 // +30%\r | |
76 | \r | |
77 | #define MIN_TOLERANCE_40 0.6 // -40%\r | |
78 | #define MAX_TOLERANCE_40 1.4 // +40%\r | |
79 | \r | |
80 | #define MIN_TOLERANCE_50 0.5 // -50%\r | |
81 | #define MAX_TOLERANCE_50 1.5 // +50%\r | |
82 | \r | |
83 | #define MIN_TOLERANCE_60 0.4 // -60%\r | |
84 | #define MAX_TOLERANCE_60 1.6 // +60%\r | |
85 | \r | |
9405f84a | 86 | #define MIN_TOLERANCE_70 0.3 // -70%\r |
87 | #define MAX_TOLERANCE_70 1.7 // +70%\r | |
88 | \r | |
fef942f6 | 89 | #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
90 | #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
91 | #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
deba2a0a | 92 | #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:\r |
08f2dd9d | 93 | # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r |
deba2a0a | 94 | #else // only 5% + 1 to avoid conflict with RC6:\r |
08f2dd9d | 95 | # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r |
deba2a0a | 96 | #endif\r |
fef942f6 | 97 | #define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
98 | #define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
99 | #define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
100 | #define SIRCS_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
101 | #define SIRCS_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
102 | #define SIRCS_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
103 | \r | |
93ba2e01 | 104 | #define NEC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r |
105 | #define NEC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
106 | #define NEC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
107 | #define NEC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
108 | #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
109 | #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
110 | #define NEC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
111 | #define NEC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
112 | #define NEC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
113 | #define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
114 | #define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
115 | #define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
6db2522c | 116 | // autodetect nec repetition frame within 50 msec:\r |
117 | // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms\r | |
118 | #if 0\r | |
119 | #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
120 | #else\r | |
121 | #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)\r | |
122 | #endif\r | |
fef942f6 | 123 | \r |
124 | #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
125 | #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
126 | #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
127 | #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
5b437ff6 | 128 | #define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r |
129 | #define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
130 | #define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
131 | #define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
132 | #define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
133 | #define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
fef942f6 | 134 | \r |
135 | #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
136 | #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
137 | #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
138 | #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
139 | #define MATSUSHITA_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
140 | #define MATSUSHITA_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
141 | #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
142 | #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
143 | #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
144 | #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
145 | \r | |
146 | #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
147 | #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
148 | #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
149 | #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
150 | #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r | |
770a1a9d | 151 | #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r |
152 | #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
153 | #define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
fef942f6 | 154 | #define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r |
155 | #define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r | |
156 | \r | |
157 | #define RECS80_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r | |
158 | #define RECS80_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
159 | #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
160 | #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
161 | #define RECS80_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
162 | #define RECS80_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
163 | #define RECS80_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
164 | #define RECS80_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
165 | #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
166 | #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
167 | \r | |
3a7e26e1 | 168 | \r |
169 | #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:\r | |
170 | #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r | |
171 | #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r | |
172 | #else\r | |
02dbaeff | 173 | #define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
174 | #define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
3a7e26e1 | 175 | #endif\r |
31c1f035 | 176 | \r |
02dbaeff | 177 | #define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
178 | #define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
fef942f6 | 179 | \r |
b5ea7869 | 180 | #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
08f2dd9d | 181 | #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r |
b5ea7869 | 182 | #define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
183 | #define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
08f2dd9d | 184 | // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON\r |
185 | #define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
b5ea7869 | 186 | #define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r |
08f2dd9d | 187 | #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r |
fef942f6 | 188 | \r |
beda975f | 189 | #define THOMSON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
190 | #define THOMSON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
191 | #define THOMSON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
192 | #define THOMSON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
193 | #define THOMSON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
194 | #define THOMSON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
195 | \r | |
fef942f6 | 196 | #define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
197 | #define RC6_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
198 | #define RC6_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
199 | #define RC6_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
200 | #define RC6_TOGGLE_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
201 | #define RC6_TOGGLE_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
c7a47e89 | 202 | #define RC6_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
31c1f035 | 203 | #define RC6_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800\r |
204 | #define RC6_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
205 | #define RC6_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600\r | |
1aee56bc | 206 | \r |
fef942f6 | 207 | #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r |
208 | #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)\r | |
209 | #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r | |
210 | #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r | |
211 | #define RECS80EXT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
212 | #define RECS80EXT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
213 | #define RECS80EXT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
214 | #define RECS80EXT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
215 | #define RECS80EXT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
216 | #define RECS80EXT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
217 | \r | |
218 | #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
219 | #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
220 | #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
221 | #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
222 | #define NUBERT_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
223 | #define NUBERT_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
224 | #define NUBERT_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
225 | #define NUBERT_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
226 | #define NUBERT_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
227 | #define NUBERT_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
228 | #define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
229 | #define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
230 | \r | |
b5ea7869 | 231 | #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
232 | #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
233 | #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
234 | #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
235 | #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
236 | #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
237 | #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
238 | #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
239 | #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
240 | #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
241 | #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
2eab5ec9 | 242 | #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\r |
b5ea7869 | 243 | #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
244 | #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
245 | #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
246 | #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
247 | #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
248 | #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
249 | #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
250 | #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
251 | #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
252 | #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
253 | #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
254 | #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
255 | #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
256 | #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
504d9df9 | 257 | \r |
89e8cafb | 258 | #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))\r |
f60c4644 | 259 | #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
260 | #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
261 | #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
262 | #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
89e8cafb | 263 | #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)\r |
264 | #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
265 | \r | |
266 | #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)\r | |
267 | #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)\r | |
268 | #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)\r | |
269 | #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)\r | |
89e8cafb | 270 | #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
271 | #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
272 | #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
273 | #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
592411d1 | 274 | \r |
a42d1ee6 | 275 | #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\r |
276 | #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))\r | |
277 | #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r | |
278 | #define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r | |
6f750020 | 279 | #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
280 | #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r | |
281 | #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
282 | #define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
283 | #if 0\r | |
284 | #define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255\r | |
285 | #else\r | |
286 | #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1\r | |
287 | #endif\r | |
288 | #define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
b5ea7869 | 289 | \r |
9e16d699 | 290 | #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
291 | #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
292 | #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
293 | #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
48664931 | 294 | #define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r |
295 | #define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
296 | #define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
297 | #define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
298 | #define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
299 | #define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
9e16d699 | 300 | \r |
770a1a9d | 301 | #define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
302 | #define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
303 | #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!\r | |
9405f84a | 304 | #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!\r |
770a1a9d | 305 | #define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
306 | #define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
307 | #define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
308 | #define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
309 | #define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
310 | #define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
311 | // autodetect JVC repetition frame within 50 msec:\r | |
312 | #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
313 | \r | |
9405f84a | 314 | #define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r |
315 | #define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
316 | #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
317 | #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
318 | #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
319 | #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
320 | #define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
321 | #define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
322 | #define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
323 | #define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
324 | #define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r | |
325 | #define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r | |
326 | #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r | |
327 | \r | |
111d6191 | 328 | #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
329 | #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
330 | #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
331 | #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
332 | #define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
333 | #define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
334 | #define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
335 | #define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
336 | #define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
337 | #define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
338 | #define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
339 | #define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
340 | #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
341 | #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
342 | \r | |
deba2a0a | 343 | #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r |
344 | #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
345 | #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r | |
346 | #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r | |
347 | #define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))\r | |
348 | #define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))\r | |
349 | #define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))\r | |
350 | #define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))\r | |
351 | \r | |
f50e01e7 | 352 | #define LEGO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r |
353 | #define LEGO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
354 | #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
355 | #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
356 | #define LEGO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
357 | #define LEGO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
358 | #define LEGO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
359 | #define LEGO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
360 | #define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r | |
361 | #define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r | |
362 | \r | |
3a7e26e1 | 363 | #define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r |
364 | #define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
365 | #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
366 | #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
367 | #define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
368 | #define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
369 | #define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
370 | #define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
371 | #define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r | |
372 | #define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r | |
373 | #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)\r | |
374 | \r | |
d155e9ab | 375 | #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!\r |
4225a882 | 376 | \r |
48664931 | 377 | #ifdef ANALYZE\r |
08f2dd9d | 378 | # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }\r |
379 | # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }\r | |
380 | # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }\r | |
381 | # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }\r | |
7644ac04 | 382 | static int silent;\r |
383 | static int time_counter;\r | |
384 | static int verbose;\r | |
4225a882 | 385 | #else\r |
08f2dd9d | 386 | # define ANALYZE_PUTCHAR(a)\r |
387 | # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)\r | |
388 | # define ANALYZE_PRINTF(...)\r | |
389 | # define ANALYZE_NEWLINE()\r | |
4225a882 | 390 | #endif\r |
391 | \r | |
7644ac04 | 392 | #if IRMP_USE_CALLBACK == 1\r |
393 | static void (*irmp_callback_ptr) (uint8_t);\r | |
394 | #endif // IRMP_USE_CALLBACK == 1\r | |
395 | \r | |
1f54e86c | 396 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
397 | * Protocol names\r | |
398 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
399 | */\r | |
400 | #if IRMP_PROTOCOL_NAMES == 1\r | |
401 | char *\r | |
402 | irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =\r | |
403 | {\r | |
404 | "UNKNOWN",\r | |
405 | "SIRCS",\r | |
406 | "NEC",\r | |
407 | "SAMSUNG",\r | |
408 | "MATSUSH",\r | |
409 | "KASEIKYO",\r | |
410 | "RECS80",\r | |
411 | "RC5",\r | |
412 | "DENON",\r | |
413 | "RC6",\r | |
414 | "SAMSG32",\r | |
415 | "APPLE",\r | |
416 | "RECS80EX",\r | |
417 | "NUBERT",\r | |
418 | "BANG OLU",\r | |
419 | "GRUNDIG",\r | |
420 | "NOKIA",\r | |
421 | "SIEMENS",\r | |
422 | "FDC",\r | |
423 | "RCCAR",\r | |
424 | "JVC",\r | |
425 | "RC6A",\r | |
426 | "NIKON",\r | |
427 | "RUWIDO",\r | |
428 | "IR60",\r | |
429 | "KATHREIN",\r | |
430 | "NETBOX",\r | |
431 | "NEC16",\r | |
432 | "NEC42",\r | |
433 | "LEGO",\r | |
3a7e26e1 | 434 | "THOMSON",\r |
435 | "BOSE"\r | |
1f54e86c | 436 | };\r |
437 | #endif\r | |
438 | \r | |
439 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
440 | * Logging\r | |
441 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
442 | */\r | |
6c3c57e6 | 443 | #if IRMP_LOGGING == 1 // logging via UART\r |
444 | \r | |
445 | #if IRMP_EXT_LOGGING == 1 // use external logging\r | |
446 | #include "irmpextlog.h"\r | |
447 | #else // normal UART log (IRMP_EXT_LOGGING == 0)\r | |
879b06c2 | 448 | #define BAUD 9600L\r |
449 | #include <util/setbaud.h>\r | |
450 | \r | |
451 | #ifdef UBRR0H\r | |
452 | \r | |
453 | #define UART0_UBRRH UBRR0H\r | |
454 | #define UART0_UBRRL UBRR0L\r | |
455 | #define UART0_UCSRA UCSR0A\r | |
456 | #define UART0_UCSRB UCSR0B\r | |
457 | #define UART0_UCSRC UCSR0C\r | |
458 | #define UART0_UDRE_BIT_VALUE (1<<UDRE0)\r | |
459 | #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)\r | |
460 | #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)\r | |
461 | #ifdef URSEL0\r | |
462 | #define UART0_URSEL_BIT_VALUE (1<<URSEL0)\r | |
463 | #else\r | |
464 | #define UART0_URSEL_BIT_VALUE (0)\r | |
465 | #endif\r | |
466 | #define UART0_TXEN_BIT_VALUE (1<<TXEN0)\r | |
e92413eb | 467 | #define UART0_UDR UDR0\r |
c7a47e89 | 468 | #define UART0_U2X U2X0\r |
cea96148 | 469 | \r |
879b06c2 | 470 | #else\r |
4225a882 | 471 | \r |
879b06c2 | 472 | #define UART0_UBRRH UBRRH\r |
473 | #define UART0_UBRRL UBRRL\r | |
474 | #define UART0_UCSRA UCSRA\r | |
475 | #define UART0_UCSRB UCSRB\r | |
476 | #define UART0_UCSRC UCSRC\r | |
477 | #define UART0_UDRE_BIT_VALUE (1<<UDRE)\r | |
478 | #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)\r | |
479 | #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)\r | |
480 | #ifdef URSEL\r | |
481 | #define UART0_URSEL_BIT_VALUE (1<<URSEL)\r | |
482 | #else\r | |
483 | #define UART0_URSEL_BIT_VALUE (0)\r | |
484 | #endif\r | |
485 | #define UART0_TXEN_BIT_VALUE (1<<TXEN)\r | |
e92413eb | 486 | #define UART0_UDR UDR\r |
c7a47e89 | 487 | #define UART0_U2X U2X\r |
4225a882 | 488 | \r |
6c3c57e6 | 489 | #endif //UBRR0H\r |
490 | #endif //IRMP_EXT_LOGGING\r | |
4225a882 | 491 | \r |
4225a882 | 492 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
493 | * Initialize UART\r | |
494 | * @details Initializes UART\r | |
495 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
496 | */\r | |
497 | void\r | |
498 | irmp_uart_init (void)\r | |
499 | {\r | |
6c3c57e6 | 500 | #if (IRMP_EXT_LOGGING == 0) // use UART\r |
879b06c2 | 501 | UART0_UBRRH = UBRRH_VALUE; // set baud rate\r |
502 | UART0_UBRRL = UBRRL_VALUE;\r | |
503 | \r | |
504 | #if USE_2X\r | |
c7a47e89 | 505 | UART0_UCSRA |= (1<<UART0_U2X);\r |
879b06c2 | 506 | #else\r |
c7a47e89 | 507 | UART0_UCSRA &= ~(1<<UART0_U2X);\r |
879b06c2 | 508 | #endif\r |
509 | \r | |
510 | UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;\r | |
511 | UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX\r | |
6c3c57e6 | 512 | #else // other log method\r |
cea96148 | 513 | initextlog(); \r |
6c3c57e6 | 514 | #endif //IRMP_EXT_LOGGING\r |
4225a882 | 515 | }\r |
516 | \r | |
517 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
518 | * Send character\r | |
519 | * @details Sends character\r | |
520 | * @param ch character to be transmitted\r | |
521 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
522 | */\r | |
523 | void\r | |
524 | irmp_uart_putc (unsigned char ch)\r | |
525 | {\r | |
6c3c57e6 | 526 | #if (IRMP_EXT_LOGGING == 0)\r |
879b06c2 | 527 | while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))\r |
4225a882 | 528 | {\r |
529 | ;\r | |
530 | }\r | |
531 | \r | |
879b06c2 | 532 | UART0_UDR = ch;\r |
6c3c57e6 | 533 | #else\r |
534 | sendextlog(ch); //Use external log\r | |
535 | #endif\r | |
4225a882 | 536 | }\r |
537 | \r | |
538 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
539 | * Log IR signal\r | |
540 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
541 | */\r | |
d155e9ab | 542 | \r |
543 | #define STARTCYCLES 2 // min count of zeros before start of logging\r | |
544 | #define ENDBITS 1000 // number of sequenced highbits to detect end\r | |
545 | #define DATALEN 700 // log buffer size\r | |
4225a882 | 546 | \r |
547 | static void\r | |
d155e9ab | 548 | irmp_log (uint8_t val)\r |
4225a882 | 549 | {\r |
d155e9ab | 550 | static uint8_t buf[DATALEN]; // logging buffer\r |
551 | static uint16_t buf_idx; // number of written bits\r | |
552 | static uint8_t startcycles; // current number of start-zeros\r | |
553 | static uint16_t cnt; // counts sequenced highbits - to detect end\r | |
4225a882 | 554 | \r |
d155e9ab | 555 | if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging\r |
4225a882 | 556 | {\r |
d155e9ab | 557 | startcycles++;\r |
4225a882 | 558 | }\r |
559 | else\r | |
560 | {\r | |
d155e9ab | 561 | startcycles = 0;\r |
4225a882 | 562 | \r |
d155e9ab | 563 | if (! val || (val && buf_idx != 0)) // start or continue logging on "0", "1" cannot init logging\r |
4225a882 | 564 | {\r |
d155e9ab | 565 | if (buf_idx < DATALEN * 8) // index in range?\r |
566 | { // yes\r | |
567 | if (val)\r | |
568 | {\r | |
569 | buf[(buf_idx / 8)] |= (1<<(buf_idx % 8)); // set bit\r | |
570 | }\r | |
571 | else\r | |
572 | {\r | |
573 | buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8)); // reset bit\r | |
574 | }\r | |
4225a882 | 575 | \r |
d155e9ab | 576 | buf_idx++;\r |
577 | }\r | |
4225a882 | 578 | \r |
579 | if (val)\r | |
46dd89b7 | 580 | { // if high received then look at log-stop condition\r |
d155e9ab | 581 | cnt++;\r |
4225a882 | 582 | \r |
d155e9ab | 583 | if (cnt > ENDBITS)\r |
584 | { // if stop condition is true, output on uart\r | |
4225a882 | 585 | uint16_t i;\r |
586 | \r | |
d155e9ab | 587 | for (i = 0; i < STARTCYCLES; i++)\r |
4225a882 | 588 | {\r |
46dd89b7 | 589 | irmp_uart_putc ('0'); // the ignored starting zeros\r |
4225a882 | 590 | }\r |
591 | \r | |
d155e9ab | 592 | for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++) // transform bitset into uart chars\r |
4225a882 | 593 | {\r |
d155e9ab | 594 | uint8_t d = buf[i];\r |
4225a882 | 595 | uint8_t j;\r |
596 | \r | |
d155e9ab | 597 | for (j = 0; j < 8; j++)\r |
4225a882 | 598 | {\r |
599 | irmp_uart_putc ((d & 1) + '0');\r | |
600 | d >>= 1;\r | |
601 | }\r | |
602 | }\r | |
603 | \r | |
604 | irmp_uart_putc ('\n');\r | |
d155e9ab | 605 | buf_idx = 0;\r |
4225a882 | 606 | }\r |
607 | }\r | |
608 | else\r | |
609 | {\r | |
d155e9ab | 610 | cnt = 0;\r |
4225a882 | 611 | }\r |
612 | }\r | |
613 | }\r | |
614 | }\r | |
615 | \r | |
616 | #else\r | |
d155e9ab | 617 | #define irmp_log(val)\r |
6c3c57e6 | 618 | #endif //IRMP_LOGGING\r |
4225a882 | 619 | \r |
620 | typedef struct\r | |
621 | {\r | |
622 | uint8_t protocol; // ir protocol\r | |
623 | uint8_t pulse_1_len_min; // minimum length of pulse with bit value 1\r | |
624 | uint8_t pulse_1_len_max; // maximum length of pulse with bit value 1\r | |
625 | uint8_t pause_1_len_min; // minimum length of pause with bit value 1\r | |
626 | uint8_t pause_1_len_max; // maximum length of pause with bit value 1\r | |
627 | uint8_t pulse_0_len_min; // minimum length of pulse with bit value 0\r | |
628 | uint8_t pulse_0_len_max; // maximum length of pulse with bit value 0\r | |
629 | uint8_t pause_0_len_min; // minimum length of pause with bit value 0\r | |
630 | uint8_t pause_0_len_max; // maximum length of pause with bit value 0\r | |
631 | uint8_t address_offset; // address offset\r | |
632 | uint8_t address_end; // end of address\r | |
633 | uint8_t command_offset; // command offset\r | |
634 | uint8_t command_end; // end of command\r | |
635 | uint8_t complete_len; // complete length of frame\r | |
636 | uint8_t stop_bit; // flag: frame has stop bit\r | |
637 | uint8_t lsb_first; // flag: LSB first\r | |
77f488bb | 638 | uint8_t flags; // some flags\r |
4225a882 | 639 | } IRMP_PARAMETER;\r |
640 | \r | |
641 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
642 | \r | |
63b94f48 | 643 | static const PROGMEM IRMP_PARAMETER sircs_param =\r |
4225a882 | 644 | {\r |
d155e9ab | 645 | IRMP_SIRCS_PROTOCOL, // protocol: ir protocol\r |
646 | SIRCS_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
647 | SIRCS_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
648 | SIRCS_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
649 | SIRCS_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
650 | SIRCS_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
651 | SIRCS_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
652 | SIRCS_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
653 | SIRCS_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
654 | SIRCS_ADDRESS_OFFSET, // address_offset: address offset\r | |
655 | SIRCS_ADDRESS_OFFSET + SIRCS_ADDRESS_LEN, // address_end: end of address\r | |
656 | SIRCS_COMMAND_OFFSET, // command_offset: command offset\r | |
657 | SIRCS_COMMAND_OFFSET + SIRCS_COMMAND_LEN, // command_end: end of command\r | |
658 | SIRCS_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
659 | SIRCS_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 660 | SIRCS_LSB, // lsb_first: flag: LSB first\r |
661 | SIRCS_FLAGS // flags: some flags\r | |
4225a882 | 662 | };\r |
663 | \r | |
664 | #endif\r | |
665 | \r | |
666 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
667 | \r | |
63b94f48 | 668 | static const PROGMEM IRMP_PARAMETER nec_param =\r |
4225a882 | 669 | {\r |
d155e9ab | 670 | IRMP_NEC_PROTOCOL, // protocol: ir protocol\r |
671 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
672 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
673 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
674 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
675 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
676 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
677 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
678 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
679 | NEC_ADDRESS_OFFSET, // address_offset: address offset\r | |
680 | NEC_ADDRESS_OFFSET + NEC_ADDRESS_LEN, // address_end: end of address\r | |
681 | NEC_COMMAND_OFFSET, // command_offset: command offset\r | |
682 | NEC_COMMAND_OFFSET + NEC_COMMAND_LEN, // command_end: end of command\r | |
683 | NEC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
684 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 685 | NEC_LSB, // lsb_first: flag: LSB first\r |
686 | NEC_FLAGS // flags: some flags\r | |
4225a882 | 687 | };\r |
688 | \r | |
63b94f48 | 689 | static const PROGMEM IRMP_PARAMETER nec_rep_param =\r |
46dd89b7 | 690 | {\r |
d155e9ab | 691 | IRMP_NEC_PROTOCOL, // protocol: ir protocol\r |
692 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
693 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
694 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
695 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
696 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
697 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
698 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
699 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
700 | 0, // address_offset: address offset\r | |
701 | 0, // address_end: end of address\r | |
702 | 0, // command_offset: command offset\r | |
703 | 0, // command_end: end of command\r | |
704 | 0, // complete_len: complete length of frame\r | |
705 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 706 | NEC_LSB, // lsb_first: flag: LSB first\r |
707 | NEC_FLAGS // flags: some flags\r | |
46dd89b7 | 708 | };\r |
709 | \r | |
4225a882 | 710 | #endif\r |
711 | \r | |
35213800 | 712 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
fc80d688 | 713 | \r |
63b94f48 | 714 | static const PROGMEM IRMP_PARAMETER nec42_param =\r |
fc80d688 | 715 | {\r |
35213800 | 716 | IRMP_NEC42_PROTOCOL, // protocol: ir protocol\r |
fc80d688 | 717 | NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r |
718 | NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
719 | NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
720 | NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
721 | NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
722 | NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
723 | NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
724 | NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
35213800 | 725 | NEC42_ADDRESS_OFFSET, // address_offset: address offset\r |
7644ac04 | 726 | NEC42_ADDRESS_OFFSET + NEC42_ADDRESS_LEN, // address_end: end of address\r |
35213800 | 727 | NEC42_COMMAND_OFFSET, // command_offset: command offset\r |
7644ac04 | 728 | NEC42_COMMAND_OFFSET + NEC42_COMMAND_LEN, // command_end: end of command\r |
35213800 | 729 | NEC42_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r |
730 | NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
731 | NEC_LSB, // lsb_first: flag: LSB first\r | |
732 | NEC_FLAGS // flags: some flags\r | |
fc80d688 | 733 | };\r |
734 | \r | |
735 | #endif\r | |
736 | \r | |
4225a882 | 737 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
738 | \r | |
63b94f48 | 739 | static const PROGMEM IRMP_PARAMETER samsung_param =\r |
4225a882 | 740 | {\r |
d155e9ab | 741 | IRMP_SAMSUNG_PROTOCOL, // protocol: ir protocol\r |
742 | SAMSUNG_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
743 | SAMSUNG_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
744 | SAMSUNG_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
745 | SAMSUNG_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
746 | SAMSUNG_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
747 | SAMSUNG_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
748 | SAMSUNG_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
749 | SAMSUNG_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
750 | SAMSUNG_ADDRESS_OFFSET, // address_offset: address offset\r | |
751 | SAMSUNG_ADDRESS_OFFSET + SAMSUNG_ADDRESS_LEN, // address_end: end of address\r | |
752 | SAMSUNG_COMMAND_OFFSET, // command_offset: command offset\r | |
753 | SAMSUNG_COMMAND_OFFSET + SAMSUNG_COMMAND_LEN, // command_end: end of command\r | |
754 | SAMSUNG_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
755 | SAMSUNG_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 756 | SAMSUNG_LSB, // lsb_first: flag: LSB first\r |
757 | SAMSUNG_FLAGS // flags: some flags\r | |
4225a882 | 758 | };\r |
759 | \r | |
760 | #endif\r | |
761 | \r | |
762 | #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
763 | \r | |
63b94f48 | 764 | static const PROGMEM IRMP_PARAMETER matsushita_param =\r |
4225a882 | 765 | {\r |
d155e9ab | 766 | IRMP_MATSUSHITA_PROTOCOL, // protocol: ir protocol\r |
767 | MATSUSHITA_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
768 | MATSUSHITA_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
769 | MATSUSHITA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
770 | MATSUSHITA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
771 | MATSUSHITA_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
772 | MATSUSHITA_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
773 | MATSUSHITA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
774 | MATSUSHITA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
775 | MATSUSHITA_ADDRESS_OFFSET, // address_offset: address offset\r | |
776 | MATSUSHITA_ADDRESS_OFFSET + MATSUSHITA_ADDRESS_LEN, // address_end: end of address\r | |
777 | MATSUSHITA_COMMAND_OFFSET, // command_offset: command offset\r | |
778 | MATSUSHITA_COMMAND_OFFSET + MATSUSHITA_COMMAND_LEN, // command_end: end of command\r | |
779 | MATSUSHITA_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
780 | MATSUSHITA_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 781 | MATSUSHITA_LSB, // lsb_first: flag: LSB first\r |
782 | MATSUSHITA_FLAGS // flags: some flags\r | |
4225a882 | 783 | };\r |
784 | \r | |
785 | #endif\r | |
786 | \r | |
787 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
788 | \r | |
63b94f48 | 789 | static const PROGMEM IRMP_PARAMETER kaseikyo_param =\r |
4225a882 | 790 | {\r |
d155e9ab | 791 | IRMP_KASEIKYO_PROTOCOL, // protocol: ir protocol\r |
792 | KASEIKYO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
793 | KASEIKYO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
794 | KASEIKYO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
795 | KASEIKYO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
796 | KASEIKYO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
797 | KASEIKYO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
798 | KASEIKYO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
799 | KASEIKYO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
800 | KASEIKYO_ADDRESS_OFFSET, // address_offset: address offset\r | |
801 | KASEIKYO_ADDRESS_OFFSET + KASEIKYO_ADDRESS_LEN, // address_end: end of address\r | |
802 | KASEIKYO_COMMAND_OFFSET, // command_offset: command offset\r | |
803 | KASEIKYO_COMMAND_OFFSET + KASEIKYO_COMMAND_LEN, // command_end: end of command\r | |
804 | KASEIKYO_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
805 | KASEIKYO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 806 | KASEIKYO_LSB, // lsb_first: flag: LSB first\r |
807 | KASEIKYO_FLAGS // flags: some flags\r | |
4225a882 | 808 | };\r |
809 | \r | |
810 | #endif\r | |
811 | \r | |
812 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
813 | \r | |
63b94f48 | 814 | static const PROGMEM IRMP_PARAMETER recs80_param =\r |
4225a882 | 815 | {\r |
d155e9ab | 816 | IRMP_RECS80_PROTOCOL, // protocol: ir protocol\r |
817 | RECS80_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
818 | RECS80_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
819 | RECS80_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
820 | RECS80_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
821 | RECS80_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
822 | RECS80_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
823 | RECS80_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
824 | RECS80_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
825 | RECS80_ADDRESS_OFFSET, // address_offset: address offset\r | |
826 | RECS80_ADDRESS_OFFSET + RECS80_ADDRESS_LEN, // address_end: end of address\r | |
827 | RECS80_COMMAND_OFFSET, // command_offset: command offset\r | |
828 | RECS80_COMMAND_OFFSET + RECS80_COMMAND_LEN, // command_end: end of command\r | |
829 | RECS80_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
830 | RECS80_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 831 | RECS80_LSB, // lsb_first: flag: LSB first\r |
832 | RECS80_FLAGS // flags: some flags\r | |
4225a882 | 833 | };\r |
834 | \r | |
835 | #endif\r | |
836 | \r | |
837 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
838 | \r | |
63b94f48 | 839 | static const PROGMEM IRMP_PARAMETER rc5_param =\r |
4225a882 | 840 | {\r |
d155e9ab | 841 | IRMP_RC5_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 842 | RC5_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r |
843 | RC5_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
844 | RC5_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
845 | RC5_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 846 | 0, // pulse_0_len_min: here: not used\r |
847 | 0, // pulse_0_len_max: here: not used\r | |
848 | 0, // pause_0_len_min: here: not used\r | |
849 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 850 | RC5_ADDRESS_OFFSET, // address_offset: address offset\r |
851 | RC5_ADDRESS_OFFSET + RC5_ADDRESS_LEN, // address_end: end of address\r | |
852 | RC5_COMMAND_OFFSET, // command_offset: command offset\r | |
853 | RC5_COMMAND_OFFSET + RC5_COMMAND_LEN, // command_end: end of command\r | |
854 | RC5_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
855 | RC5_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 856 | RC5_LSB, // lsb_first: flag: LSB first\r |
857 | RC5_FLAGS // flags: some flags\r | |
4225a882 | 858 | };\r |
859 | \r | |
860 | #endif\r | |
861 | \r | |
862 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
863 | \r | |
63b94f48 | 864 | static const PROGMEM IRMP_PARAMETER denon_param =\r |
4225a882 | 865 | {\r |
d155e9ab | 866 | IRMP_DENON_PROTOCOL, // protocol: ir protocol\r |
867 | DENON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
868 | DENON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
869 | DENON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
870 | DENON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
871 | DENON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
872 | DENON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
873 | DENON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
874 | DENON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
875 | DENON_ADDRESS_OFFSET, // address_offset: address offset\r | |
876 | DENON_ADDRESS_OFFSET + DENON_ADDRESS_LEN, // address_end: end of address\r | |
877 | DENON_COMMAND_OFFSET, // command_offset: command offset\r | |
878 | DENON_COMMAND_OFFSET + DENON_COMMAND_LEN, // command_end: end of command\r | |
879 | DENON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
880 | DENON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 881 | DENON_LSB, // lsb_first: flag: LSB first\r |
882 | DENON_FLAGS // flags: some flags\r | |
4225a882 | 883 | };\r |
884 | \r | |
885 | #endif\r | |
886 | \r | |
887 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
888 | \r | |
63b94f48 | 889 | static const PROGMEM IRMP_PARAMETER rc6_param =\r |
4225a882 | 890 | {\r |
d155e9ab | 891 | IRMP_RC6_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 892 | \r |
893 | RC6_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r | |
894 | RC6_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
895 | RC6_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
896 | RC6_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 897 | 0, // pulse_0_len_min: here: not used\r |
898 | 0, // pulse_0_len_max: here: not used\r | |
899 | 0, // pause_0_len_min: here: not used\r | |
900 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 901 | RC6_ADDRESS_OFFSET, // address_offset: address offset\r |
902 | RC6_ADDRESS_OFFSET + RC6_ADDRESS_LEN, // address_end: end of address\r | |
903 | RC6_COMMAND_OFFSET, // command_offset: command offset\r | |
904 | RC6_COMMAND_OFFSET + RC6_COMMAND_LEN, // command_end: end of command\r | |
905 | RC6_COMPLETE_DATA_LEN_SHORT, // complete_len: complete length of frame\r | |
906 | RC6_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 907 | RC6_LSB, // lsb_first: flag: LSB first\r |
908 | RC6_FLAGS // flags: some flags\r | |
4225a882 | 909 | };\r |
910 | \r | |
911 | #endif\r | |
912 | \r | |
913 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
914 | \r | |
63b94f48 | 915 | static const PROGMEM IRMP_PARAMETER recs80ext_param =\r |
4225a882 | 916 | {\r |
d155e9ab | 917 | IRMP_RECS80EXT_PROTOCOL, // protocol: ir protocol\r |
918 | RECS80EXT_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
919 | RECS80EXT_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
920 | RECS80EXT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
921 | RECS80EXT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
922 | RECS80EXT_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
923 | RECS80EXT_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
924 | RECS80EXT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
925 | RECS80EXT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
926 | RECS80EXT_ADDRESS_OFFSET, // address_offset: address offset\r | |
927 | RECS80EXT_ADDRESS_OFFSET + RECS80EXT_ADDRESS_LEN, // address_end: end of address\r | |
928 | RECS80EXT_COMMAND_OFFSET, // command_offset: command offset\r | |
929 | RECS80EXT_COMMAND_OFFSET + RECS80EXT_COMMAND_LEN, // command_end: end of command\r | |
930 | RECS80EXT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
931 | RECS80EXT_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 932 | RECS80EXT_LSB, // lsb_first: flag: LSB first\r |
933 | RECS80EXT_FLAGS // flags: some flags\r | |
4225a882 | 934 | };\r |
935 | \r | |
936 | #endif\r | |
937 | \r | |
504d9df9 | 938 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r |
4225a882 | 939 | \r |
63b94f48 | 940 | static const PROGMEM IRMP_PARAMETER nubert_param =\r |
4225a882 | 941 | {\r |
d155e9ab | 942 | IRMP_NUBERT_PROTOCOL, // protocol: ir protocol\r |
943 | NUBERT_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
944 | NUBERT_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
945 | NUBERT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
946 | NUBERT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
947 | NUBERT_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
948 | NUBERT_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
949 | NUBERT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
950 | NUBERT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
951 | NUBERT_ADDRESS_OFFSET, // address_offset: address offset\r | |
952 | NUBERT_ADDRESS_OFFSET + NUBERT_ADDRESS_LEN, // address_end: end of address\r | |
953 | NUBERT_COMMAND_OFFSET, // command_offset: command offset\r | |
954 | NUBERT_COMMAND_OFFSET + NUBERT_COMMAND_LEN, // command_end: end of command\r | |
955 | NUBERT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
956 | NUBERT_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 957 | NUBERT_LSB, // lsb_first: flag: LSB first\r |
958 | NUBERT_FLAGS // flags: some flags\r | |
4225a882 | 959 | };\r |
960 | \r | |
961 | #endif\r | |
962 | \r | |
504d9df9 | 963 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
964 | \r | |
63b94f48 | 965 | static const PROGMEM IRMP_PARAMETER bang_olufsen_param =\r |
504d9df9 | 966 | {\r |
d155e9ab | 967 | IRMP_BANG_OLUFSEN_PROTOCOL, // protocol: ir protocol\r |
968 | BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
969 | BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
970 | BANG_OLUFSEN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
971 | BANG_OLUFSEN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
972 | BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
973 | BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
974 | BANG_OLUFSEN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
975 | BANG_OLUFSEN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
976 | BANG_OLUFSEN_ADDRESS_OFFSET, // address_offset: address offset\r | |
977 | BANG_OLUFSEN_ADDRESS_OFFSET + BANG_OLUFSEN_ADDRESS_LEN, // address_end: end of address\r | |
978 | BANG_OLUFSEN_COMMAND_OFFSET, // command_offset: command offset\r | |
979 | BANG_OLUFSEN_COMMAND_OFFSET + BANG_OLUFSEN_COMMAND_LEN, // command_end: end of command\r | |
980 | BANG_OLUFSEN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
981 | BANG_OLUFSEN_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
77f488bb | 982 | BANG_OLUFSEN_LSB, // lsb_first: flag: LSB first\r |
983 | BANG_OLUFSEN_FLAGS // flags: some flags\r | |
504d9df9 | 984 | };\r |
985 | \r | |
986 | #endif\r | |
987 | \r | |
89e8cafb | 988 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
989 | \r | |
990 | static uint8_t first_bit;\r | |
592411d1 | 991 | \r |
63b94f48 | 992 | static const PROGMEM IRMP_PARAMETER grundig_param =\r |
592411d1 | 993 | {\r |
d155e9ab | 994 | IRMP_GRUNDIG_PROTOCOL, // protocol: ir protocol\r |
1aee56bc | 995 | \r |
89e8cafb | 996 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r |
997 | GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
998 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
999 | GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1000 | 0, // pulse_0_len_min: here: not used\r |
1001 | 0, // pulse_0_len_max: here: not used\r | |
1002 | 0, // pause_0_len_min: here: not used\r | |
1003 | 0, // pause_0_len_max: here: not used\r | |
d155e9ab | 1004 | GRUNDIG_ADDRESS_OFFSET, // address_offset: address offset\r |
1005 | GRUNDIG_ADDRESS_OFFSET + GRUNDIG_ADDRESS_LEN, // address_end: end of address\r | |
1006 | GRUNDIG_COMMAND_OFFSET, // command_offset: command offset\r | |
1007 | GRUNDIG_COMMAND_OFFSET + GRUNDIG_COMMAND_LEN + 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)\r | |
1008 | NOKIA_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!\r | |
89e8cafb | 1009 | GRUNDIG_NOKIA_IR60_STOP_BIT, // stop_bit: flag: frame has stop bit\r |
1010 | GRUNDIG_NOKIA_IR60_LSB, // lsb_first: flag: LSB first\r | |
1011 | GRUNDIG_NOKIA_IR60_FLAGS // flags: some flags\r | |
592411d1 | 1012 | };\r |
1013 | \r | |
1014 | #endif\r | |
1015 | \r | |
12948cf3 | 1016 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
a7054daf | 1017 | \r |
63b94f48 | 1018 | static const PROGMEM IRMP_PARAMETER ruwido_param =\r |
a7054daf | 1019 | {\r |
12948cf3 | 1020 | IRMP_RUWIDO_PROTOCOL, // protocol: ir protocol\r |
1021 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r | |
1022 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r | |
1023 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r | |
1024 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r | |
31c1f035 | 1025 | 0, // pulse_0_len_min: here: not used\r |
1026 | 0, // pulse_0_len_max: here: not used\r | |
1027 | 0, // pause_0_len_min: here: not used\r | |
1028 | 0, // pause_0_len_max: here: not used\r | |
12948cf3 | 1029 | RUWIDO_ADDRESS_OFFSET, // address_offset: address offset\r |
1030 | RUWIDO_ADDRESS_OFFSET + RUWIDO_ADDRESS_LEN, // address_end: end of address\r | |
1031 | RUWIDO_COMMAND_OFFSET, // command_offset: command offset\r | |
1032 | RUWIDO_COMMAND_OFFSET + RUWIDO_COMMAND_LEN, // command_end: end of command\r | |
1033 | SIEMENS_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!\r | |
1034 | SIEMENS_OR_RUWIDO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1035 | SIEMENS_OR_RUWIDO_LSB, // lsb_first: flag: LSB first\r | |
1036 | SIEMENS_OR_RUWIDO_FLAGS // flags: some flags\r | |
a7054daf | 1037 | };\r |
1038 | \r | |
1039 | #endif\r | |
1040 | \r | |
48664931 | 1041 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
b5ea7869 | 1042 | \r |
63b94f48 | 1043 | static const PROGMEM IRMP_PARAMETER fdc_param =\r |
b5ea7869 | 1044 | {\r |
48664931 | 1045 | IRMP_FDC_PROTOCOL, // protocol: ir protocol\r |
1046 | FDC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1047 | FDC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1048 | FDC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1049 | FDC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1050 | FDC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1051 | FDC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1052 | FDC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1053 | FDC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1054 | FDC_ADDRESS_OFFSET, // address_offset: address offset\r | |
1055 | FDC_ADDRESS_OFFSET + FDC_ADDRESS_LEN, // address_end: end of address\r | |
1056 | FDC_COMMAND_OFFSET, // command_offset: command offset\r | |
1057 | FDC_COMMAND_OFFSET + FDC_COMMAND_LEN, // command_end: end of command\r | |
1058 | FDC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1059 | FDC_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1060 | FDC_LSB, // lsb_first: flag: LSB first\r | |
1061 | FDC_FLAGS // flags: some flags\r | |
b5ea7869 | 1062 | };\r |
1063 | \r | |
1064 | #endif\r | |
1065 | \r | |
9e16d699 | 1066 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
1067 | \r | |
63b94f48 | 1068 | static const PROGMEM IRMP_PARAMETER rccar_param =\r |
9e16d699 | 1069 | {\r |
1070 | IRMP_RCCAR_PROTOCOL, // protocol: ir protocol\r | |
1071 | RCCAR_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1072 | RCCAR_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1073 | RCCAR_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1074 | RCCAR_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1075 | RCCAR_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1076 | RCCAR_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1077 | RCCAR_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1078 | RCCAR_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1079 | RCCAR_ADDRESS_OFFSET, // address_offset: address offset\r | |
1080 | RCCAR_ADDRESS_OFFSET + RCCAR_ADDRESS_LEN, // address_end: end of address\r | |
1081 | RCCAR_COMMAND_OFFSET, // command_offset: command offset\r | |
1082 | RCCAR_COMMAND_OFFSET + RCCAR_COMMAND_LEN, // command_end: end of command\r | |
1083 | RCCAR_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1084 | RCCAR_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1085 | RCCAR_LSB, // lsb_first: flag: LSB first\r | |
1086 | RCCAR_FLAGS // flags: some flags\r | |
1087 | };\r | |
1088 | \r | |
1089 | #endif\r | |
1090 | \r | |
9405f84a | 1091 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
1092 | \r | |
63b94f48 | 1093 | static const PROGMEM IRMP_PARAMETER nikon_param =\r |
9405f84a | 1094 | {\r |
1095 | IRMP_NIKON_PROTOCOL, // protocol: ir protocol\r | |
1096 | NIKON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1097 | NIKON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1098 | NIKON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1099 | NIKON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1100 | NIKON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1101 | NIKON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1102 | NIKON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1103 | NIKON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1104 | NIKON_ADDRESS_OFFSET, // address_offset: address offset\r | |
1105 | NIKON_ADDRESS_OFFSET + NIKON_ADDRESS_LEN, // address_end: end of address\r | |
1106 | NIKON_COMMAND_OFFSET, // command_offset: command offset\r | |
1107 | NIKON_COMMAND_OFFSET + NIKON_COMMAND_LEN, // command_end: end of command\r | |
1108 | NIKON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1109 | NIKON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1110 | NIKON_LSB, // lsb_first: flag: LSB first\r | |
1111 | NIKON_FLAGS // flags: some flags\r | |
1112 | };\r | |
1113 | \r | |
1114 | #endif\r | |
1115 | \r | |
111d6191 | 1116 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
1117 | \r | |
63b94f48 | 1118 | static const PROGMEM IRMP_PARAMETER kathrein_param =\r |
111d6191 | 1119 | {\r |
1120 | IRMP_KATHREIN_PROTOCOL, // protocol: ir protocol\r | |
1121 | KATHREIN_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1122 | KATHREIN_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1123 | KATHREIN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1124 | KATHREIN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1125 | KATHREIN_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1126 | KATHREIN_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1127 | KATHREIN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1128 | KATHREIN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1129 | KATHREIN_ADDRESS_OFFSET, // address_offset: address offset\r | |
1130 | KATHREIN_ADDRESS_OFFSET + KATHREIN_ADDRESS_LEN, // address_end: end of address\r | |
1131 | KATHREIN_COMMAND_OFFSET, // command_offset: command offset\r | |
1132 | KATHREIN_COMMAND_OFFSET + KATHREIN_COMMAND_LEN, // command_end: end of command\r | |
1133 | KATHREIN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1134 | KATHREIN_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1135 | KATHREIN_LSB, // lsb_first: flag: LSB first\r | |
1136 | KATHREIN_FLAGS // flags: some flags\r | |
1137 | };\r | |
1138 | \r | |
1139 | #endif\r | |
1140 | \r | |
deba2a0a | 1141 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
1142 | \r | |
63b94f48 | 1143 | static const PROGMEM IRMP_PARAMETER netbox_param =\r |
deba2a0a | 1144 | {\r |
1145 | IRMP_NETBOX_PROTOCOL, // protocol: ir protocol\r | |
a42d1ee6 | 1146 | NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value\r |
1147 | NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value\r | |
1148 | NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value\r | |
1149 | NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value\r | |
1150 | NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value\r | |
1151 | NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value\r | |
1152 | NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value\r | |
1153 | NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value\r | |
deba2a0a | 1154 | NETBOX_ADDRESS_OFFSET, // address_offset: address offset\r |
1155 | NETBOX_ADDRESS_OFFSET + NETBOX_ADDRESS_LEN, // address_end: end of address\r | |
1156 | NETBOX_COMMAND_OFFSET, // command_offset: command offset\r | |
1157 | NETBOX_COMMAND_OFFSET + NETBOX_COMMAND_LEN, // command_end: end of command\r | |
1158 | NETBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1159 | NETBOX_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1160 | NETBOX_LSB, // lsb_first: flag: LSB first\r | |
1161 | NETBOX_FLAGS // flags: some flags\r | |
1162 | };\r | |
1163 | \r | |
1164 | #endif\r | |
1165 | \r | |
f50e01e7 | 1166 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
1167 | \r | |
63b94f48 | 1168 | static const PROGMEM IRMP_PARAMETER lego_param =\r |
f50e01e7 | 1169 | {\r |
1170 | IRMP_LEGO_PROTOCOL, // protocol: ir protocol\r | |
1171 | LEGO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1172 | LEGO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1173 | LEGO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1174 | LEGO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1175 | LEGO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1176 | LEGO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1177 | LEGO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1178 | LEGO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1179 | LEGO_ADDRESS_OFFSET, // address_offset: address offset\r | |
1180 | LEGO_ADDRESS_OFFSET + LEGO_ADDRESS_LEN, // address_end: end of address\r | |
1181 | LEGO_COMMAND_OFFSET, // command_offset: command offset\r | |
1182 | LEGO_COMMAND_OFFSET + LEGO_COMMAND_LEN, // command_end: end of command\r | |
1183 | LEGO_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1184 | LEGO_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1185 | LEGO_LSB, // lsb_first: flag: LSB first\r | |
1186 | LEGO_FLAGS // flags: some flags\r | |
1187 | };\r | |
1188 | \r | |
1189 | #endif\r | |
1190 | \r | |
beda975f | 1191 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
1192 | \r | |
63b94f48 | 1193 | static const PROGMEM IRMP_PARAMETER thomson_param =\r |
beda975f | 1194 | {\r |
1195 | IRMP_THOMSON_PROTOCOL, // protocol: ir protocol\r | |
1196 | THOMSON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1197 | THOMSON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1198 | THOMSON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1199 | THOMSON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1200 | THOMSON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1201 | THOMSON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1202 | THOMSON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1203 | THOMSON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1204 | THOMSON_ADDRESS_OFFSET, // address_offset: address offset\r | |
1205 | THOMSON_ADDRESS_OFFSET + THOMSON_ADDRESS_LEN, // address_end: end of address\r | |
1206 | THOMSON_COMMAND_OFFSET, // command_offset: command offset\r | |
1207 | THOMSON_COMMAND_OFFSET + THOMSON_COMMAND_LEN, // command_end: end of command\r | |
1208 | THOMSON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1209 | THOMSON_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1210 | THOMSON_LSB, // lsb_first: flag: LSB first\r | |
1211 | THOMSON_FLAGS // flags: some flags\r | |
1212 | };\r | |
1213 | \r | |
1214 | #endif\r | |
1215 | \r | |
3a7e26e1 | 1216 | #if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r |
1217 | \r | |
1218 | static const PROGMEM IRMP_PARAMETER bose_param =\r | |
1219 | {\r | |
1220 | IRMP_BOSE_PROTOCOL, // protocol: ir protocol\r | |
1221 | BOSE_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r | |
1222 | BOSE_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r | |
1223 | BOSE_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r | |
1224 | BOSE_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r | |
1225 | BOSE_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r | |
1226 | BOSE_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r | |
1227 | BOSE_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r | |
1228 | BOSE_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r | |
1229 | BOSE_ADDRESS_OFFSET, // address_offset: address offset\r | |
1230 | BOSE_ADDRESS_OFFSET + BOSE_ADDRESS_LEN, // address_end: end of address\r | |
1231 | BOSE_COMMAND_OFFSET, // command_offset: command offset\r | |
1232 | BOSE_COMMAND_OFFSET + BOSE_COMMAND_LEN, // command_end: end of command\r | |
1233 | BOSE_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r | |
1234 | BOSE_STOP_BIT, // stop_bit: flag: frame has stop bit\r | |
1235 | BOSE_LSB, // lsb_first: flag: LSB first\r | |
1236 | BOSE_FLAGS // flags: some flags\r | |
1237 | };\r | |
1238 | \r | |
1239 | #endif\r | |
1240 | \r | |
d155e9ab | 1241 | static uint8_t irmp_bit; // current bit position\r |
4225a882 | 1242 | static IRMP_PARAMETER irmp_param;\r |
1243 | \r | |
6f750020 | 1244 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
1245 | static IRMP_PARAMETER irmp_param2;\r | |
1246 | #endif\r | |
1247 | \r | |
4225a882 | 1248 | static volatile uint8_t irmp_ir_detected;\r |
1249 | static volatile uint8_t irmp_protocol;\r | |
1250 | static volatile uint16_t irmp_address;\r | |
1251 | static volatile uint16_t irmp_command;\r | |
d155e9ab | 1252 | static volatile uint16_t irmp_id; // only used for SAMSUNG protocol\r |
4225a882 | 1253 | static volatile uint8_t irmp_flags;\r |
08f2dd9d | 1254 | // static volatile uint8_t irmp_busy_flag;\r |
4225a882 | 1255 | \r |
48664931 | 1256 | #ifdef ANALYZE\r |
08f2dd9d | 1257 | #define input(x) (x)\r |
4225a882 | 1258 | static uint8_t IRMP_PIN;\r |
1259 | #endif\r | |
1260 | \r | |
1261 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1262 | * Initialize IRMP decoder\r | |
1263 | * @details Configures IRMP input pin\r | |
1264 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1265 | */\r | |
48664931 | 1266 | #ifndef ANALYZE\r |
4225a882 | 1267 | void\r |
1268 | irmp_init (void)\r | |
1269 | {\r | |
08f2dd9d | 1270 | #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing\r |
1271 | #elif defined (ARM_STM32) // STM32\r | |
1272 | GPIO_InitTypeDef GPIO_InitStructure;\r | |
1273 | \r | |
1274 | /* GPIOx clock enable */\r | |
1275 | #if defined (ARM_STM32L1XX)\r | |
1276 | RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r | |
1277 | #elif defined (ARM_STM32F10X)\r | |
1278 | RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r | |
1279 | #elif defined (ARM_STM32F4XX)\r | |
1280 | RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r | |
1281 | #endif\r | |
1282 | \r | |
1283 | /* GPIO Configuration */\r | |
1284 | GPIO_InitStructure.GPIO_Pin = IRMP_BIT;\r | |
1285 | #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)\r | |
37b29f94 | 1286 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;\r |
08f2dd9d | 1287 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r |
1288 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r | |
1289 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r | |
1290 | #elif defined (ARM_STM32F10X)\r | |
1291 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r | |
37b29f94 | 1292 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r |
08f2dd9d | 1293 | #endif\r |
1294 | GPIO_Init(IRMP_PORT, &GPIO_InitStructure);\r | |
08f2dd9d | 1295 | #else // AVR\r |
d155e9ab | 1296 | IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r |
1297 | IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r | |
93ba2e01 | 1298 | #endif\r |
4225a882 | 1299 | \r |
1300 | #if IRMP_LOGGING == 1\r | |
1301 | irmp_uart_init ();\r | |
1302 | #endif\r | |
1303 | }\r | |
1304 | #endif\r | |
1305 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1306 | * Get IRMP data\r | |
1307 | * @details gets decoded IRMP data\r | |
1308 | * @param pointer in order to store IRMP data\r | |
1309 | * @return TRUE: successful, FALSE: failed\r | |
1310 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1311 | */\r | |
1312 | uint8_t\r | |
1313 | irmp_get_data (IRMP_DATA * irmp_data_p)\r | |
1314 | {\r | |
1315 | uint8_t rtc = FALSE;\r | |
1316 | \r | |
1317 | if (irmp_ir_detected)\r | |
1318 | {\r | |
1319 | switch (irmp_protocol)\r | |
1320 | {\r | |
1321 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
1322 | case IRMP_SAMSUNG_PROTOCOL:\r | |
1323 | if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r | |
1324 | {\r | |
1325 | irmp_command &= 0xff;\r | |
1326 | irmp_command |= irmp_id << 8;\r | |
1327 | rtc = TRUE;\r | |
1328 | }\r | |
1329 | break;\r | |
1330 | #endif\r | |
1331 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
1332 | case IRMP_NEC_PROTOCOL:\r | |
1333 | if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r | |
1334 | {\r | |
1335 | irmp_command &= 0xff;\r | |
1336 | rtc = TRUE;\r | |
1337 | }\r | |
770a1a9d | 1338 | else if (irmp_address == 0x87EE)\r |
4225a882 | 1339 | {\r |
48664931 | 1340 | ANALYZE_PRINTF ("Switching to APPLE protocol\n");\r |
4225a882 | 1341 | irmp_protocol = IRMP_APPLE_PROTOCOL;\r |
770a1a9d | 1342 | irmp_address = (irmp_command & 0xFF00) >> 8;\r |
1343 | irmp_command &= 0x00FF;\r | |
4225a882 | 1344 | rtc = TRUE;\r |
1345 | }\r | |
1346 | break;\r | |
48664931 | 1347 | #endif\r |
3a7e26e1 | 1348 | #if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r |
1349 | case IRMP_BOSE_PROTOCOL:\r | |
1350 | if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r | |
1351 | {\r | |
1352 | irmp_command &= 0xff;\r | |
1353 | rtc = TRUE;\r | |
1354 | }\r | |
1355 | break;\r | |
1356 | #endif\r | |
12948cf3 | 1357 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
9405f84a | 1358 | case IRMP_SIEMENS_PROTOCOL:\r |
12948cf3 | 1359 | case IRMP_RUWIDO_PROTOCOL:\r |
9405f84a | 1360 | if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001))\r |
1361 | {\r | |
1362 | irmp_command >>= 1;\r | |
1363 | rtc = TRUE;\r | |
1364 | }\r | |
1365 | break;\r | |
1366 | #endif\r | |
111d6191 | 1367 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
1368 | case IRMP_KATHREIN_PROTOCOL:\r | |
2cfc146d | 1369 | if (irmp_command != 0x0000)\r |
111d6191 | 1370 | {\r |
1371 | rtc = TRUE;\r | |
1372 | }\r | |
1373 | break;\r | |
1374 | #endif\r | |
03780b34 | 1375 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r |
1376 | case IRMP_RC5_PROTOCOL:\r | |
1377 | irmp_address &= ~0x20; // clear toggle bit\r | |
1378 | rtc = TRUE;\r | |
1379 | break;\r | |
1380 | #endif\r | |
89e8cafb | 1381 | #if IRMP_SUPPORT_IR60_PROTOCOL == 1\r |
1382 | case IRMP_IR60_PROTOCOL:\r | |
1383 | if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame\r | |
1384 | {\r | |
1385 | rtc = TRUE;\r | |
1386 | }\r | |
f60c4644 | 1387 | else\r |
1388 | {\r | |
1389 | ANALYZE_PRINTF("Info IR60: got start instruction frame\n");\r | |
1390 | }\r | |
89e8cafb | 1391 | break;\r |
1392 | #endif\r | |
48664931 | 1393 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
1394 | case IRMP_RCCAR_PROTOCOL:\r | |
1395 | // frame in irmp_data:\r | |
1396 | // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0\r | |
1397 | // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0\r | |
1398 | irmp_address = (irmp_command & 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0\r | |
1399 | irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0\r | |
1400 | ((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0\r | |
1401 | ((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0\r | |
1402 | rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0\r | |
1403 | break;\r | |
4225a882 | 1404 | #endif\r |
beda975f | 1405 | \r |
1406 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key\r | |
deba2a0a | 1407 | case IRMP_NETBOX_PROTOCOL:\r |
1408 | if (irmp_command & 0x1000) // last bit set?\r | |
1409 | {\r | |
1410 | if ((irmp_command & 0x1f) == 0x15) // key pressed: 101 01 (LSB)\r | |
1411 | {\r | |
1412 | irmp_command >>= 5;\r | |
1413 | irmp_command &= 0x7F;\r | |
1414 | rtc = TRUE;\r | |
1415 | }\r | |
1416 | else if ((irmp_command & 0x1f) == 0x10) // key released: 000 01 (LSB)\r | |
1417 | {\r | |
1418 | irmp_command >>= 5;\r | |
1419 | irmp_command |= 0x80;\r | |
1420 | rtc = TRUE;\r | |
1421 | }\r | |
1422 | else\r | |
1423 | {\r | |
1424 | ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");\r | |
1425 | }\r | |
1426 | }\r | |
1427 | else\r | |
1428 | {\r | |
1429 | ANALYZE_PRINTF("error NETBOX: last bit not set\n");\r | |
1430 | }\r | |
1431 | break;\r | |
1432 | #endif\r | |
f50e01e7 | 1433 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
1434 | case IRMP_LEGO_PROTOCOL:\r | |
1435 | {\r | |
1436 | uint8_t crc = 0x0F ^ ((irmp_command & 0xF000) >> 12) ^ ((irmp_command & 0x0F00) >> 8) ^ ((irmp_command & 0x00F0) >> 4);\r | |
1437 | \r | |
1438 | if ((irmp_command & 0x000F) == crc)\r | |
1439 | {\r | |
1440 | irmp_command >>= 4;\r | |
1441 | rtc = TRUE;\r | |
1442 | }\r | |
1443 | else\r | |
1444 | {\r | |
1445 | ANALYZE_PRINTF ("CRC error in LEGO protocol\n");\r | |
f874da09 | 1446 | // rtc = TRUE; // don't accept codes with CRC errors\r |
f50e01e7 | 1447 | }\r |
1448 | break;\r | |
1449 | }\r | |
1450 | #endif\r | |
4225a882 | 1451 | default:\r |
08f2dd9d | 1452 | {\r |
4225a882 | 1453 | rtc = TRUE;\r |
08f2dd9d | 1454 | break;\r |
1455 | }\r | |
4225a882 | 1456 | }\r |
1457 | \r | |
1458 | if (rtc)\r | |
1459 | {\r | |
1460 | irmp_data_p->protocol = irmp_protocol;\r | |
1461 | irmp_data_p->address = irmp_address;\r | |
1462 | irmp_data_p->command = irmp_command;\r | |
1463 | irmp_data_p->flags = irmp_flags;\r | |
1464 | irmp_command = 0;\r | |
1465 | irmp_address = 0;\r | |
1466 | irmp_flags = 0;\r | |
1467 | }\r | |
1468 | \r | |
1469 | irmp_ir_detected = FALSE;\r | |
1470 | }\r | |
1471 | \r | |
1472 | return rtc;\r | |
1473 | }\r | |
1474 | \r | |
1f54e86c | 1475 | // uint8_t\r |
1476 | // irmp_is_busy (void)\r | |
1477 | // {\r | |
1478 | // return irmp_busy_flag;\r | |
1479 | // }\r | |
1480 | \r | |
7644ac04 | 1481 | #if IRMP_USE_CALLBACK == 1\r |
1482 | void\r | |
1483 | irmp_set_callback_ptr (void (*cb)(uint8_t))\r | |
1484 | {\r | |
1485 | irmp_callback_ptr = cb;\r | |
1486 | }\r | |
1487 | #endif // IRMP_USE_CALLBACK == 1\r | |
1488 | \r | |
4225a882 | 1489 | // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()\r |
770a1a9d | 1490 | static uint16_t irmp_tmp_address; // ir address\r |
1491 | static uint16_t irmp_tmp_command; // ir command\r | |
6f750020 | 1492 | \r |
35213800 | 1493 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
770a1a9d | 1494 | static uint16_t irmp_tmp_address2; // ir address\r |
1495 | static uint16_t irmp_tmp_command2; // ir command\r | |
6f750020 | 1496 | #endif\r |
1497 | \r | |
4225a882 | 1498 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
770a1a9d | 1499 | static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)\r |
1500 | #endif\r | |
1501 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
1502 | static uint8_t xor_check[6]; // check kaseikyo "parity" bits\r | |
0f700c8e | 1503 | static uint8_t genre2; // save genre2 bits here, later copied to MSB in flags\r |
4225a882 | 1504 | #endif\r |
1505 | \r | |
4225a882 | 1506 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1507 | * store bit\r | |
1508 | * @details store bit in temp address or temp command\r | |
1509 | * @param value to store: 0 or 1\r | |
1510 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1511 | */\r | |
d823e852 | 1512 | // verhindert, dass irmp_store_bit() inline compiliert wird:\r |
1513 | // static void irmp_store_bit (uint8_t) __attribute__ ((noinline));\r | |
1514 | \r | |
4225a882 | 1515 | static void\r |
1516 | irmp_store_bit (uint8_t value)\r | |
1517 | {\r | |
89e8cafb | 1518 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
1519 | if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)\r | |
1520 | {\r | |
1521 | first_bit = value;\r | |
1522 | }\r | |
1523 | else\r | |
1524 | #endif\r | |
770a1a9d | 1525 | \r |
4225a882 | 1526 | if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)\r |
1527 | {\r | |
1528 | if (irmp_param.lsb_first)\r | |
1529 | {\r | |
1530 | irmp_tmp_address |= (((uint16_t) (value)) << (irmp_bit - irmp_param.address_offset)); // CV wants cast\r | |
1531 | }\r | |
1532 | else\r | |
1533 | {\r | |
1534 | irmp_tmp_address <<= 1;\r | |
1535 | irmp_tmp_address |= value;\r | |
1536 | }\r | |
1537 | }\r | |
1538 | else if (irmp_bit >= irmp_param.command_offset && irmp_bit < irmp_param.command_end)\r | |
1539 | {\r | |
1540 | if (irmp_param.lsb_first)\r | |
1541 | {\r | |
1542 | irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast\r | |
1543 | }\r | |
1544 | else\r | |
1545 | {\r | |
1546 | irmp_tmp_command <<= 1;\r | |
1547 | irmp_tmp_command |= value;\r | |
1548 | }\r | |
1549 | }\r | |
770a1a9d | 1550 | \r |
35213800 | 1551 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
f60c4644 | 1552 | if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)\r |
35213800 | 1553 | {\r |
1554 | irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit - 13)); // CV wants cast\r | |
1555 | }\r | |
f60c4644 | 1556 | else\r |
35213800 | 1557 | #endif\r |
1558 | \r | |
4225a882 | 1559 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
f60c4644 | 1560 | if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)\r |
4225a882 | 1561 | {\r |
1562 | irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first\r | |
1563 | }\r | |
f60c4644 | 1564 | else\r |
4225a882 | 1565 | #endif\r |
770a1a9d | 1566 | \r |
1567 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
f60c4644 | 1568 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r |
770a1a9d | 1569 | {\r |
0f700c8e | 1570 | if (irmp_bit >= 20 && irmp_bit < 24)\r |
770a1a9d | 1571 | {\r |
0f700c8e | 1572 | irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8)); // store 4 system bits (genre 1) in upper nibble with LSB first\r |
770a1a9d | 1573 | }\r |
cea96148 | 1574 | else if (irmp_bit >= 24 && irmp_bit < 28)\r |
770a1a9d | 1575 | {\r |
0f700c8e | 1576 | genre2 |= (((uint8_t) (value)) << (irmp_bit - 20)); // store 4 system bits (genre 2) in upper nibble with LSB first\r |
770a1a9d | 1577 | }\r |
770a1a9d | 1578 | \r |
0f700c8e | 1579 | if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)\r |
1580 | {\r | |
1581 | if (value)\r | |
1582 | {\r | |
1583 | xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);\r | |
1584 | }\r | |
1585 | else\r | |
1586 | {\r | |
1587 | xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));\r | |
1588 | }\r | |
1589 | }\r | |
1590 | }\r | |
26b6c304 | 1591 | else\r |
770a1a9d | 1592 | #endif\r |
26b6c304 | 1593 | {\r |
1594 | ;\r | |
1595 | }\r | |
770a1a9d | 1596 | \r |
4225a882 | 1597 | irmp_bit++;\r |
1598 | }\r | |
1599 | \r | |
6f750020 | 1600 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1601 | * store bit\r | |
1602 | * @details store bit in temp address or temp command\r | |
1603 | * @param value to store: 0 or 1\r | |
1604 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1605 | */\r | |
1606 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r | |
1607 | static void\r | |
1608 | irmp_store_bit2 (uint8_t value)\r | |
1609 | {\r | |
1610 | uint8_t irmp_bit2;\r | |
1611 | \r | |
1612 | if (irmp_param.protocol)\r | |
1613 | {\r | |
1614 | irmp_bit2 = irmp_bit - 2;\r | |
1615 | }\r | |
1616 | else\r | |
1617 | {\r | |
1618 | irmp_bit2 = irmp_bit - 1;\r | |
1619 | }\r | |
1620 | \r | |
1621 | if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)\r | |
1622 | {\r | |
1623 | irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset)); // CV wants cast\r | |
1624 | }\r | |
1625 | else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)\r | |
1626 | {\r | |
1627 | irmp_tmp_command2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset)); // CV wants cast\r | |
1628 | }\r | |
1629 | }\r | |
1630 | #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r | |
1631 | \r | |
4225a882 | 1632 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
1633 | * ISR routine\r | |
1634 | * @details ISR routine, called 10000 times per second\r | |
1635 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
1636 | */\r | |
879b06c2 | 1637 | uint8_t\r |
4225a882 | 1638 | irmp_ISR (void)\r |
1639 | {\r | |
48664931 | 1640 | static uint8_t irmp_start_bit_detected; // flag: start bit detected\r |
1641 | static uint8_t wait_for_space; // flag: wait for data bit space\r | |
1642 | static uint8_t wait_for_start_space; // flag: wait for start bit space\r | |
1643 | static uint8_t irmp_pulse_time; // count bit time for pulse\r | |
1644 | static PAUSE_LEN irmp_pause_time; // count bit time for pause\r | |
1645 | static uint16_t last_irmp_address = 0xFFFF; // save last irmp address to recognize key repetition\r | |
1646 | static uint16_t last_irmp_command = 0xFFFF; // save last irmp command to recognize key repetition\r | |
c7a47e89 | 1647 | static uint16_t repetition_len; // SIRCS repeats frame 2-5 times with 45 ms pause\r |
48664931 | 1648 | static uint8_t repetition_frame_number;\r |
4225a882 | 1649 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
48664931 | 1650 | static uint16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition\r |
4225a882 | 1651 | #endif\r |
1652 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
48664931 | 1653 | static uint8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit\r |
4225a882 | 1654 | #endif\r |
77f488bb | 1655 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
48664931 | 1656 | static PAUSE_LEN last_pause; // last pause value\r |
504d9df9 | 1657 | #endif\r |
77f488bb | 1658 | #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
48664931 | 1659 | static uint8_t last_value; // last bit value\r |
4225a882 | 1660 | #endif\r |
48664931 | 1661 | uint8_t irmp_input; // input value\r |
4225a882 | 1662 | \r |
48664931 | 1663 | #ifdef ANALYZE\r |
592411d1 | 1664 | time_counter++;\r |
1665 | #endif\r | |
1666 | \r | |
4225a882 | 1667 | irmp_input = input(IRMP_PIN);\r |
1668 | \r | |
7644ac04 | 1669 | #if IRMP_USE_CALLBACK == 1\r |
1670 | if (irmp_callback_ptr)\r | |
1671 | {\r | |
1672 | static uint8_t last_inverted_input;\r | |
1673 | \r | |
1674 | if (last_inverted_input != !irmp_input)\r | |
1675 | {\r | |
1676 | (*irmp_callback_ptr) (! irmp_input);\r | |
1677 | last_inverted_input = !irmp_input;\r | |
1678 | }\r | |
1679 | }\r | |
1680 | #endif // IRMP_USE_CALLBACK == 1\r | |
1681 | \r | |
d155e9ab | 1682 | irmp_log(irmp_input); // log ir signal, if IRMP_LOGGING defined\r |
4225a882 | 1683 | \r |
1684 | if (! irmp_ir_detected) // ir code already detected?\r | |
1685 | { // no...\r | |
1686 | if (! irmp_start_bit_detected) // start bit detected?\r | |
1687 | { // no...\r | |
d155e9ab | 1688 | if (! irmp_input) // receiving burst?\r |
4225a882 | 1689 | { // yes...\r |
1f54e86c | 1690 | // irmp_busy_flag = TRUE;\r |
48664931 | 1691 | #ifdef ANALYZE\r |
d155e9ab | 1692 | if (! irmp_pulse_time)\r |
1693 | {\r | |
0f700c8e | 1694 | ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r |
d155e9ab | 1695 | }\r |
1696 | #endif\r | |
4225a882 | 1697 | irmp_pulse_time++; // increment counter\r |
1698 | }\r | |
1699 | else\r | |
1700 | { // no...\r | |
1701 | if (irmp_pulse_time) // it's dark....\r | |
1702 | { // set flags for counting the time of darkness...\r | |
1703 | irmp_start_bit_detected = 1;\r | |
1704 | wait_for_start_space = 1;\r | |
1705 | wait_for_space = 0;\r | |
1706 | irmp_tmp_command = 0;\r | |
1707 | irmp_tmp_address = 0;\r | |
0f700c8e | 1708 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r |
1709 | genre2 = 0;\r | |
1710 | #endif\r | |
6f750020 | 1711 | \r |
35213800 | 1712 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
6f750020 | 1713 | irmp_tmp_command2 = 0;\r |
1714 | irmp_tmp_address2 = 0;\r | |
1715 | #endif\r | |
1716 | \r | |
4225a882 | 1717 | irmp_bit = 0xff;\r |
1718 | irmp_pause_time = 1; // 1st pause: set to 1, not to 0!\r | |
1719 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
1720 | rc5_cmd_bit6 = 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!\r | |
1721 | #endif\r | |
1722 | }\r | |
1723 | else\r | |
1724 | {\r | |
c7a47e89 | 1725 | if (repetition_len < 0xFFFF) // avoid overflow of counter\r |
6db2522c | 1726 | {\r |
c7a47e89 | 1727 | repetition_len++;\r |
08f2dd9d | 1728 | \r |
1729 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
1730 | if (repetition_len >= DENON_AUTO_REPETITION_PAUSE_LEN && last_irmp_denon_command != 0)\r | |
1731 | {\r | |
1732 | ANALYZE_PRINTF ("%8.3fms error 6: did not receive inverted command repetition\n",\r | |
1733 | (double) (time_counter * 1000) / F_INTERRUPTS);\r | |
1734 | last_irmp_denon_command = 0;\r | |
1735 | }\r | |
1736 | #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
6db2522c | 1737 | }\r |
4225a882 | 1738 | }\r |
1739 | }\r | |
1740 | }\r | |
1741 | else\r | |
1742 | {\r | |
1743 | if (wait_for_start_space) // we have received start bit...\r | |
1744 | { // ...and are counting the time of darkness\r | |
1745 | if (irmp_input) // still dark?\r | |
1746 | { // yes\r | |
1747 | irmp_pause_time++; // increment counter\r | |
1748 | \r | |
9405f84a | 1749 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
1750 | 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) ||\r | |
1751 | irmp_pause_time > IRMP_TIMEOUT_NIKON_LEN)\r | |
1752 | #else\r | |
504d9df9 | 1753 | if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r |
9405f84a | 1754 | #endif\r |
4225a882 | 1755 | { // yes...\r |
c7a47e89 | 1756 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
1757 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // don't show eror if JVC protocol, irmp_pulse_time has been set below!\r | |
1758 | {\r | |
1759 | ;\r | |
1760 | }\r | |
1761 | else\r | |
1762 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
1763 | {\r | |
0f700c8e | 1764 | 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);\r |
c7a47e89 | 1765 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
1766 | }\r | |
1f54e86c | 1767 | // irmp_busy_flag = FALSE;\r |
4225a882 | 1768 | irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit\r |
1769 | irmp_pulse_time = 0;\r | |
1770 | irmp_pause_time = 0;\r | |
1771 | }\r | |
1772 | }\r | |
1773 | else\r | |
1774 | { // receiving first data pulse!\r | |
46dd89b7 | 1775 | IRMP_PARAMETER * irmp_param_p = (IRMP_PARAMETER *) 0;\r |
1776 | \r | |
6f750020 | 1777 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
1778 | irmp_param2.protocol = 0;\r | |
1779 | #endif\r | |
1780 | \r | |
0f700c8e | 1781 | ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 1782 | \r |
1783 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
1784 | if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&\r | |
1785 | irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 1786 | { // it's SIRCS\r |
48664931 | 1787 | ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 1788 | SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX,\r |
1789 | SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1790 | irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param;\r |
4225a882 | 1791 | }\r |
1792 | else\r | |
1793 | #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
1794 | \r | |
770a1a9d | 1795 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
1796 | if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame\r | |
1797 | irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&\r | |
1798 | irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r | |
1799 | {\r | |
93ba2e01 | 1800 | ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
770a1a9d | 1801 | JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,\r |
1802 | JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
35213800 | 1803 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r |
770a1a9d | 1804 | }\r |
1805 | else\r | |
1806 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
1807 | \r | |
4225a882 | 1808 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
1809 | if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
46dd89b7 | 1810 | irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r |
1811 | {\r | |
35213800 | 1812 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
1813 | ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1814 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
1815 | NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r | |
1816 | irmp_param_p = (IRMP_PARAMETER *) &nec42_param;\r | |
1817 | #else\r | |
48664931 | 1818 | ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
46dd89b7 | 1819 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r |
1820 | NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r | |
1821 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
35213800 | 1822 | #endif\r |
1823 | \r | |
46dd89b7 | 1824 | }\r |
1825 | else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
1826 | irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r | |
1827 | { // it's NEC\r | |
93ba2e01 | 1828 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
1829 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // last protocol was JVC, awaiting repeat frame\r | |
1830 | { // some jvc remote controls use nec repetition frame for jvc repetition frame\r | |
1831 | ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1832 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
1833 | NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
1834 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
1835 | }\r | |
1836 | else\r | |
1837 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
1838 | {\r | |
1839 | ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1840 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
1841 | NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1842 | \r |
93ba2e01 | 1843 | irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;\r |
1844 | }\r | |
1845 | }\r | |
1846 | else\r | |
1847 | \r | |
1848 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
1849 | if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame\r | |
1850 | irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r | |
1851 | irmp_pause_time >= NEC_0_PAUSE_LEN_MIN && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX)\r | |
1852 | { // it's JVC repetition type 3\r | |
1853 | ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1854 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r | |
1855 | NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX);\r | |
1856 | irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r | |
4225a882 | 1857 | }\r |
1858 | else\r | |
93ba2e01 | 1859 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
1860 | \r | |
4225a882 | 1861 | #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
1862 | \r | |
9405f84a | 1863 | #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r |
1864 | if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&\r | |
1865 | irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)\r | |
1866 | {\r | |
1867 | ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1868 | NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,\r | |
1869 | NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);\r | |
1870 | irmp_param_p = (IRMP_PARAMETER *) &nikon_param;\r | |
1871 | }\r | |
1872 | else\r | |
1873 | #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1\r | |
1874 | \r | |
4225a882 | 1875 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
1876 | if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&\r | |
1877 | irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 1878 | { // it's SAMSUNG\r |
48664931 | 1879 | ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 1880 | SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX,\r |
1881 | SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1882 | irmp_param_p = (IRMP_PARAMETER *) &samsung_param;\r |
4225a882 | 1883 | }\r |
1884 | else\r | |
1885 | #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
1886 | \r | |
1887 | #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
1888 | if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&\r | |
1889 | irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 1890 | { // it's MATSUSHITA\r |
48664931 | 1891 | ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 1892 | MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX,\r |
1893 | MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1894 | irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;\r |
4225a882 | 1895 | }\r |
1896 | else\r | |
1897 | #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r | |
1898 | \r | |
1899 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
1900 | if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&\r | |
1901 | irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 1902 | { // it's KASEIKYO\r |
48664931 | 1903 | ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 1904 | KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX,\r |
1905 | KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1906 | irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;\r |
4225a882 | 1907 | }\r |
1908 | else\r | |
1909 | #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
1910 | \r | |
1911 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
1912 | if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&\r | |
1913 | irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 1914 | { // it's RECS80\r |
48664931 | 1915 | ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 1916 | RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX,\r |
1917 | RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1918 | irmp_param_p = (IRMP_PARAMETER *) &recs80_param;\r |
4225a882 | 1919 | }\r |
1920 | else\r | |
1921 | #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1\r | |
1922 | \r | |
1923 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
31c1f035 | 1924 | if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||\r |
1925 | (irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&\r | |
1926 | ((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||\r | |
1927 | (irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))\r | |
46dd89b7 | 1928 | { // it's RC5\r |
6f750020 | 1929 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
1930 | if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r | |
1931 | irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r | |
1932 | {\r | |
1933 | ANALYZE_PRINTF ("protocol = RC5 or FDC\n");\r | |
1934 | ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1935 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r | |
1936 | FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r | |
1937 | ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1938 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
1939 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r | |
1940 | memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));\r | |
1941 | }\r | |
1942 | else\r | |
1943 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
12948cf3 | 1944 | \r |
6f750020 | 1945 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
1946 | if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r | |
1947 | irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r | |
1948 | {\r | |
1949 | ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");\r | |
1950 | ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1951 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r | |
1952 | RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r | |
1953 | ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
1954 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
1955 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r | |
1956 | memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));\r | |
1957 | }\r | |
1958 | else\r | |
1959 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
1960 | {\r | |
1aee56bc | 1961 | ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",\r |
6f750020 | 1962 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r |
31c1f035 | 1963 | 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX,\r |
1aee56bc | 1964 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r |
31c1f035 | 1965 | 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX);\r |
6f750020 | 1966 | }\r |
1967 | \r | |
46dd89b7 | 1968 | irmp_param_p = (IRMP_PARAMETER *) &rc5_param;\r |
504d9df9 | 1969 | last_pause = irmp_pause_time;\r |
4225a882 | 1970 | \r |
31c1f035 | 1971 | if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||\r |
1972 | (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))\r | |
4225a882 | 1973 | {\r |
504d9df9 | 1974 | last_value = 0;\r |
4225a882 | 1975 | rc5_cmd_bit6 = 1<<6;\r |
1976 | }\r | |
1977 | else\r | |
1978 | {\r | |
504d9df9 | 1979 | last_value = 1;\r |
4225a882 | 1980 | }\r |
1981 | }\r | |
1982 | else\r | |
1983 | #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
1984 | \r | |
1985 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
1986 | if ( (irmp_pulse_time >= DENON_PULSE_LEN_MIN && irmp_pulse_time <= DENON_PULSE_LEN_MAX) &&\r | |
1987 | ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||\r | |
1988 | (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))\r | |
1989 | { // it's DENON\r | |
48664931 | 1990 | ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r |
4225a882 | 1991 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r |
1992 | DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,\r | |
1993 | DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r | |
46dd89b7 | 1994 | irmp_param_p = (IRMP_PARAMETER *) &denon_param;\r |
4225a882 | 1995 | }\r |
1996 | else\r | |
1997 | #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
1998 | \r | |
beda975f | 1999 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
2000 | if ( (irmp_pulse_time >= THOMSON_PULSE_LEN_MIN && irmp_pulse_time <= THOMSON_PULSE_LEN_MAX) &&\r | |
2001 | ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||\r | |
2002 | (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)))\r | |
2003 | { // it's THOMSON\r | |
2004 | ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r | |
2005 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,\r | |
2006 | THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX,\r | |
2007 | THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX);\r | |
2008 | irmp_param_p = (IRMP_PARAMETER *) &thomson_param;\r | |
2009 | }\r | |
2010 | else\r | |
2011 | #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r | |
2012 | \r | |
3a7e26e1 | 2013 | #if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r |
2014 | if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&\r | |
2015 | irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)\r | |
2016 | {\r | |
2017 | ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2018 | BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX,\r | |
2019 | BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX);\r | |
2020 | irmp_param_p = (IRMP_PARAMETER *) &bose_param;\r | |
2021 | }\r | |
2022 | else\r | |
2023 | #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1\r | |
2024 | \r | |
4225a882 | 2025 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2026 | if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&\r | |
2027 | irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)\r | |
2028 | { // it's RC6\r | |
48664931 | 2029 | ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2030 | RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX,\r |
2031 | RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2032 | irmp_param_p = (IRMP_PARAMETER *) &rc6_param;\r |
504d9df9 | 2033 | last_pause = 0;\r |
c7a47e89 | 2034 | last_value = 1;\r |
4225a882 | 2035 | }\r |
2036 | else\r | |
2037 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2038 | \r | |
2039 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
2040 | if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&\r | |
2041 | irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2042 | { // it's RECS80EXT\r |
48664931 | 2043 | ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2044 | RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX,\r |
2045 | RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2046 | irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;\r |
4225a882 | 2047 | }\r |
2048 | else\r | |
2049 | #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r | |
2050 | \r | |
2051 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
2052 | if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&\r | |
2053 | irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2054 | { // it's NUBERT\r |
48664931 | 2055 | ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
4225a882 | 2056 | NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX,\r |
2057 | NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2058 | irmp_param_p = (IRMP_PARAMETER *) &nubert_param;\r |
4225a882 | 2059 | }\r |
2060 | else\r | |
2061 | #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
2062 | \r | |
504d9df9 | 2063 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
2064 | if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&\r | |
2065 | irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)\r | |
46dd89b7 | 2066 | { // it's BANG_OLUFSEN\r |
48664931 | 2067 | ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");\r |
2068 | ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
504d9df9 | 2069 | BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r |
2070 | BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r | |
48664931 | 2071 | ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2072 | BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r |
2073 | BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r | |
48664931 | 2074 | ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2075 | BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r |
2076 | BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r | |
48664931 | 2077 | ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
504d9df9 | 2078 | BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r |
2079 | BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r | |
46dd89b7 | 2080 | irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;\r |
504d9df9 | 2081 | last_value = 0;\r |
2082 | }\r | |
2083 | else\r | |
2084 | #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r | |
2085 | \r | |
89e8cafb | 2086 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
2087 | if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&\r | |
2088 | irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)\r | |
592411d1 | 2089 | { // it's GRUNDIG\r |
48664931 | 2090 | ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
89e8cafb | 2091 | GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r |
2092 | GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);\r | |
592411d1 | 2093 | irmp_param_p = (IRMP_PARAMETER *) &grundig_param;\r |
2094 | last_pause = irmp_pause_time;\r | |
2095 | last_value = 1;\r | |
2096 | }\r | |
2097 | else\r | |
89e8cafb | 2098 | #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
592411d1 | 2099 | \r |
12948cf3 | 2100 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2101 | if (((irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||\r | |
31c1f035 | 2102 | (irmp_pulse_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX)) &&\r |
fc80d688 | 2103 | ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) || \r |
31c1f035 | 2104 | (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))\r |
12948cf3 | 2105 | { // it's RUWIDO or SIEMENS\r |
2106 | ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r | |
2107 | SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r | |
31c1f035 | 2108 | 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r |
12948cf3 | 2109 | SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r |
31c1f035 | 2110 | 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX);\r |
12948cf3 | 2111 | irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;\r |
a7054daf | 2112 | last_pause = irmp_pause_time;\r |
2113 | last_value = 1;\r | |
2114 | }\r | |
2115 | else\r | |
12948cf3 | 2116 | #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2117 | \r | |
48664931 | 2118 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
2119 | if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r | |
2120 | irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r | |
eaaf80c3 | 2121 | {\r |
48664931 | 2122 | ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
2123 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r | |
2124 | FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r | |
2125 | irmp_param_p = (IRMP_PARAMETER *) &fdc_param;\r | |
eaaf80c3 | 2126 | }\r |
2127 | else\r | |
48664931 | 2128 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r |
12948cf3 | 2129 | \r |
9e16d699 | 2130 | #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r |
2131 | if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r | |
2132 | irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r | |
2133 | {\r | |
48664931 | 2134 | ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r |
9e16d699 | 2135 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r |
2136 | RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r | |
2137 | irmp_param_p = (IRMP_PARAMETER *) &rccar_param;\r | |
2138 | }\r | |
2139 | else\r | |
2140 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
89e8cafb | 2141 | \r |
111d6191 | 2142 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r |
2143 | if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&\r | |
2144 | irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)\r | |
2145 | { // it's KATHREIN\r | |
2146 | ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2147 | KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX,\r | |
2148 | KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX);\r | |
2149 | irmp_param_p = (IRMP_PARAMETER *) &kathrein_param;\r | |
2150 | }\r | |
2151 | else\r | |
2152 | #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r | |
2153 | \r | |
deba2a0a | 2154 | #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r |
2155 | if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&\r | |
2156 | irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)\r | |
2157 | { // it's NETBOX\r | |
2158 | ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2159 | NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX,\r | |
2160 | NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX);\r | |
2161 | irmp_param_p = (IRMP_PARAMETER *) &netbox_param;\r | |
2162 | }\r | |
2163 | else\r | |
2164 | #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r | |
2165 | \r | |
f50e01e7 | 2166 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
2167 | if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&\r | |
2168 | irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)\r | |
2169 | {\r | |
2170 | ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r | |
2171 | LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX,\r | |
2172 | LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX);\r | |
2173 | irmp_param_p = (IRMP_PARAMETER *) &lego_param;\r | |
2174 | }\r | |
2175 | else\r | |
93ba2e01 | 2176 | #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1\r |
f50e01e7 | 2177 | \r |
4225a882 | 2178 | {\r |
48664931 | 2179 | ANALYZE_PRINTF ("protocol = UNKNOWN\n");\r |
1f54e86c | 2180 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2181 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2182 | }\r | |
2183 | \r | |
2184 | if (irmp_start_bit_detected)\r | |
2185 | {\r | |
46dd89b7 | 2186 | memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));\r |
2187 | \r | |
48664931 | 2188 | #ifdef ANALYZE\r |
77f488bb | 2189 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r |
2190 | {\r | |
48664931 | 2191 | ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r |
2192 | ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\r | |
77f488bb | 2193 | }\r |
2194 | else\r | |
2195 | {\r | |
48664931 | 2196 | ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,\r |
31c1f035 | 2197 | 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);\r |
48664931 | 2198 | ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max,\r |
31c1f035 | 2199 | 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r |
77f488bb | 2200 | }\r |
46dd89b7 | 2201 | \r |
6f750020 | 2202 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
2203 | if (irmp_param2.protocol)\r | |
2204 | {\r | |
2205 | ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);\r | |
2206 | ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);\r | |
2207 | ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);\r | |
2208 | ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);\r | |
2209 | }\r | |
2210 | #endif\r | |
2211 | \r | |
d823e852 | 2212 | \r |
504d9df9 | 2213 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
4225a882 | 2214 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r |
2215 | {\r | |
48664931 | 2216 | ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r |
4225a882 | 2217 | }\r |
504d9df9 | 2218 | #endif\r |
77f488bb | 2219 | \r |
2220 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r | |
2221 | {\r | |
93ba2e01 | 2222 | ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r |
2223 | ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r | |
2224 | }\r | |
2225 | else\r | |
2226 | {\r | |
2227 | ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max,\r | |
2228 | 2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max);\r | |
2229 | ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max,\r | |
2230 | 2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max);\r | |
77f488bb | 2231 | }\r |
46dd89b7 | 2232 | \r |
504d9df9 | 2233 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
2234 | if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r | |
2235 | {\r | |
48664931 | 2236 | ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r |
2237 | ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);\r | |
504d9df9 | 2238 | }\r |
2239 | #endif\r | |
2240 | \r | |
48664931 | 2241 | ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset);\r |
2242 | ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset);\r | |
2243 | ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len);\r | |
2244 | ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param.stop_bit);\r | |
2245 | #endif // ANALYZE\r | |
4225a882 | 2246 | }\r |
2247 | \r | |
2248 | irmp_bit = 0;\r | |
2249 | \r | |
77f488bb | 2250 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
12948cf3 | 2251 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r |
2252 | irmp_param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO\r | |
2253 | irmp_param.protocol != IRMP_RC6_PROTOCOL) // Manchester, but not RC6\r | |
4225a882 | 2254 | {\r |
31c1f035 | 2255 | if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)\r |
4225a882 | 2256 | {\r |
0f700c8e | 2257 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
48664931 | 2258 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r |
2259 | ANALYZE_NEWLINE ();\r | |
77f488bb | 2260 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);\r |
592411d1 | 2261 | }\r |
6f750020 | 2262 | else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r |
592411d1 | 2263 | {\r |
0f700c8e | 2264 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
592411d1 | 2265 | \r |
48664931 | 2266 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r |
2267 | ANALYZE_NEWLINE ();\r | |
77f488bb | 2268 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);\r |
a7054daf | 2269 | }\r |
2270 | }\r | |
2271 | else\r | |
77f488bb | 2272 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
a7054daf | 2273 | \r |
deba2a0a | 2274 | #if IRMP_SUPPORT_SERIAL == 1\r |
2275 | if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r | |
2276 | {\r | |
2277 | ; // do nothing\r | |
2278 | }\r | |
2279 | else\r | |
2280 | #endif // IRMP_SUPPORT_SERIAL == 1\r | |
2281 | \r | |
2282 | \r | |
4225a882 | 2283 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
2284 | if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r | |
2285 | {\r | |
0f700c8e | 2286 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 2287 | \r |
2288 | if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)\r | |
2289 | { // pause timings correct for "1"?\r | |
48664931 | 2290 | ANALYZE_PUTCHAR ('1'); // yes, store 1\r |
2291 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2292 | irmp_store_bit (1);\r |
2293 | }\r | |
2294 | else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)\r | |
2295 | { // pause timings correct for "0"?\r | |
48664931 | 2296 | ANALYZE_PUTCHAR ('0'); // yes, store 0\r |
2297 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2298 | irmp_store_bit (0);\r |
2299 | }\r | |
2300 | }\r | |
881dbf79 | 2301 | else\r |
4225a882 | 2302 | #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r |
beda975f | 2303 | #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r |
2304 | if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL)\r | |
2305 | {\r | |
0f700c8e | 2306 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
beda975f | 2307 | \r |
2308 | if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX)\r | |
2309 | { // pause timings correct for "1"?\r | |
2310 | ANALYZE_PUTCHAR ('1'); // yes, store 1\r | |
2311 | ANALYZE_NEWLINE ();\r | |
2312 | irmp_store_bit (1);\r | |
2313 | }\r | |
2314 | else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)\r | |
2315 | { // pause timings correct for "0"?\r | |
2316 | ANALYZE_PUTCHAR ('0'); // yes, store 0\r | |
2317 | ANALYZE_NEWLINE ();\r | |
2318 | irmp_store_bit (0);\r | |
2319 | }\r | |
2320 | }\r | |
2321 | else\r | |
2322 | #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r | |
881dbf79 | 2323 | {\r |
2324 | ; // else do nothing\r | |
2325 | }\r | |
4225a882 | 2326 | \r |
2327 | irmp_pulse_time = 1; // set counter to 1, not 0\r | |
2328 | irmp_pause_time = 0;\r | |
2329 | wait_for_start_space = 0;\r | |
2330 | }\r | |
2331 | }\r | |
2332 | else if (wait_for_space) // the data section....\r | |
2333 | { // counting the time of darkness....\r | |
2334 | uint8_t got_light = FALSE;\r | |
2335 | \r | |
2336 | if (irmp_input) // still dark?\r | |
2337 | { // yes...\r | |
2338 | if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1)\r | |
2339 | {\r | |
a42d1ee6 | 2340 | if (\r |
2341 | #if IRMP_SUPPORT_MANCHESTER == 1\r | |
2342 | (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||\r | |
2343 | #endif\r | |
2344 | #if IRMP_SUPPORT_SERIAL == 1\r | |
deba2a0a | 2345 | (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||\r |
a42d1ee6 | 2346 | #endif\r |
1aee56bc | 2347 | (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max))\r |
4225a882 | 2348 | {\r |
48664931 | 2349 | #ifdef ANALYZE\r |
77f488bb | 2350 | if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r |
4225a882 | 2351 | {\r |
48664931 | 2352 | ANALYZE_PRINTF ("stop bit detected\n");\r |
4225a882 | 2353 | }\r |
2354 | #endif\r | |
2355 | irmp_param.stop_bit = 0;\r | |
2356 | }\r | |
2357 | else\r | |
2358 | {\r | |
93ba2e01 | 2359 | 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",\r |
2360 | irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r | |
4225a882 | 2361 | \r |
1f54e86c | 2362 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2363 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2364 | irmp_pulse_time = 0;\r | |
2365 | irmp_pause_time = 0;\r | |
2366 | }\r | |
2367 | }\r | |
2368 | else\r | |
2369 | {\r | |
9547ee89 | 2370 | irmp_pause_time++; // increment counter\r |
4225a882 | 2371 | \r |
2372 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
9547ee89 | 2373 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits:\r |
2374 | irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12\r | |
2375 | irmp_bit >= 12 - 1) // pause too long?\r | |
2376 | { // yes, break and close this frame\r | |
2377 | irmp_param.complete_len = irmp_bit + 1; // set new complete length\r | |
2378 | got_light = TRUE; // this is a lie, but helps (generates stop bit)\r | |
2379 | irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8; // new: store number of additional bits in upper byte of address!\r | |
2380 | irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length\r | |
2381 | irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length\r | |
4225a882 | 2382 | }\r |
2383 | else\r | |
2384 | #endif\r | |
deba2a0a | 2385 | #if IRMP_SUPPORT_SERIAL == 1\r |
a42d1ee6 | 2386 | // NETBOX generates no stop bit, here is the timeout condition:\r |
deba2a0a | 2387 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL &&\r |
a42d1ee6 | 2388 | irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit))\r |
deba2a0a | 2389 | {\r |
2390 | got_light = TRUE; // this is a lie, but helps (generates stop bit)\r | |
2391 | }\r | |
2392 | else\r | |
2393 | #endif\r | |
89e8cafb | 2394 | #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r |
77f488bb | 2395 | if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)\r |
d155e9ab | 2396 | {\r |
f60c4644 | 2397 | if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6))\r |
89e8cafb | 2398 | {\r |
2399 | ANALYZE_PRINTF ("Switching to IR60 protocol\n");\r | |
2400 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2401 | irmp_param.stop_bit = TRUE; // set flag\r | |
2402 | \r | |
2403 | irmp_param.protocol = IRMP_IR60_PROTOCOL; // change protocol\r | |
2404 | irmp_param.complete_len = IR60_COMPLETE_DATA_LEN; // correct complete len\r | |
2405 | irmp_param.address_offset = IR60_ADDRESS_OFFSET;\r | |
2406 | irmp_param.address_end = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;\r | |
2407 | irmp_param.command_offset = IR60_COMMAND_OFFSET;\r | |
2408 | irmp_param.command_end = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;\r | |
2409 | \r | |
2410 | irmp_tmp_command <<= 1;\r | |
2411 | irmp_tmp_command |= first_bit;\r | |
2412 | }\r | |
31c1f035 | 2413 | else if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)\r |
77f488bb | 2414 | { // special manchester decoder\r |
2415 | irmp_param.complete_len = GRUNDIG_COMPLETE_DATA_LEN; // correct complete len\r | |
2416 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2417 | irmp_param.stop_bit = TRUE; // set flag\r | |
2418 | }\r | |
2419 | else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r | |
d155e9ab | 2420 | {\r |
48664931 | 2421 | ANALYZE_PRINTF ("Switching to NOKIA protocol\n");\r |
77f488bb | 2422 | irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol\r |
2423 | irmp_param.address_offset = NOKIA_ADDRESS_OFFSET;\r | |
2424 | irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;\r | |
2425 | irmp_param.command_offset = NOKIA_COMMAND_OFFSET;\r | |
2426 | irmp_param.command_end = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;\r | |
2427 | \r | |
2428 | if (irmp_tmp_command & 0x300)\r | |
2429 | {\r | |
2430 | irmp_tmp_address = (irmp_tmp_command >> 8);\r | |
2431 | irmp_tmp_command &= 0xFF;\r | |
2432 | }\r | |
d155e9ab | 2433 | }\r |
2434 | }\r | |
2435 | else\r | |
2436 | #endif\r | |
12948cf3 | 2437 | #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r |
2438 | if (irmp_param.protocol == IRMP_RUWIDO_PROTOCOL && !irmp_param.stop_bit)\r | |
2439 | {\r | |
31c1f035 | 2440 | if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= RUWIDO_COMPLETE_DATA_LEN - 2)\r |
12948cf3 | 2441 | { // special manchester decoder\r |
2442 | irmp_param.complete_len = RUWIDO_COMPLETE_DATA_LEN; // correct complete len\r | |
2443 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r | |
2444 | irmp_param.stop_bit = TRUE; // set flag\r | |
2445 | }\r | |
2446 | else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)\r | |
2447 | {\r | |
2448 | ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");\r | |
2449 | irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol\r | |
2450 | irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET;\r | |
2451 | irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;\r | |
2452 | irmp_param.command_offset = SIEMENS_COMMAND_OFFSET;\r | |
2453 | irmp_param.command_end = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;\r | |
2454 | \r | |
2455 | // 76543210\r | |
2456 | // RUWIDO: AAAAAAAAACCCCCCCp\r | |
2457 | // SIEMENS: AAAAAAAAAAACCCCCCCCCCp\r | |
2458 | irmp_tmp_address <<= 2;\r | |
2459 | irmp_tmp_address |= (irmp_tmp_command >> 6);\r | |
2460 | irmp_tmp_command &= 0x003F;\r | |
2461 | irmp_tmp_command <<= 4;\r | |
2462 | irmp_tmp_command |= last_value;\r | |
2463 | }\r | |
2464 | }\r | |
2465 | else\r | |
2466 | #endif\r | |
77f488bb | 2467 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
2468 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r | |
31c1f035 | 2469 | irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r |
77f488bb | 2470 | { // special manchester decoder\r |
a7054daf | 2471 | got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r |
2472 | irmp_param.stop_bit = TRUE; // set flag\r | |
2473 | }\r | |
2474 | else\r | |
77f488bb | 2475 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
504d9df9 | 2476 | if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r |
4225a882 | 2477 | { // yes...\r |
2478 | if (irmp_bit == irmp_param.complete_len - 1 && irmp_param.stop_bit == 0)\r | |
2479 | {\r | |
2480 | irmp_bit++;\r | |
2481 | }\r | |
770a1a9d | 2482 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r |
2483 | else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit\r | |
2484 | {\r | |
93ba2e01 | 2485 | ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r |
770a1a9d | 2486 | irmp_param.stop_bit = TRUE; // set flag\r |
2487 | irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol\r | |
2488 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2489 | irmp_tmp_command = (irmp_tmp_address >> 4); // set command: upper 12 bits are command bits\r | |
2490 | irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits\r | |
2491 | irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...\r | |
2492 | }\r | |
2493 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
35213800 | 2494 | \r |
2495 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
2496 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
2497 | else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32) // it was a NEC stop bit\r | |
2498 | {\r | |
2499 | ANALYZE_PRINTF ("Switching to NEC protocol\n");\r | |
2500 | irmp_param.stop_bit = TRUE; // set flag\r | |
2501 | irmp_param.protocol = IRMP_NEC_PROTOCOL; // switch protocol\r | |
2502 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2503 | \r | |
2504 | // 0123456789ABC0123456789ABC0123456701234567\r | |
2505 | // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r | |
2506 | // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc\r | |
0f700c8e | 2507 | irmp_tmp_address |= (irmp_tmp_address2 & 0x0007) << 13; // fm 2012-02-13: 12 -> 13\r |
35213800 | 2508 | irmp_tmp_command = (irmp_tmp_address2 >> 3) | (irmp_tmp_command << 10);\r |
2509 | }\r | |
2510 | #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
2511 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
93ba2e01 | 2512 | else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit\r |
35213800 | 2513 | {\r |
93ba2e01 | 2514 | ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r |
35213800 | 2515 | irmp_param.stop_bit = TRUE; // set flag\r |
2516 | irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol\r | |
2517 | irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r | |
2518 | \r | |
2519 | // 0123456789ABC0123456789ABC0123456701234567\r | |
2520 | // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r | |
2521 | // JVC: AAAACCCCCCCCCCCC\r | |
2522 | irmp_tmp_command = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9); // set command: upper 12 bits are command bits\r | |
2523 | irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits\r | |
2524 | }\r | |
2525 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
2526 | #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
4225a882 | 2527 | else\r |
2528 | {\r | |
48664931 | 2529 | ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);\r |
2530 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
4225a882 | 2531 | \r |
1f54e86c | 2532 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2533 | irmp_start_bit_detected = 0; // wait for another start bit...\r |
2534 | irmp_pulse_time = 0;\r | |
2535 | irmp_pause_time = 0;\r | |
2536 | }\r | |
2537 | }\r | |
2538 | }\r | |
2539 | }\r | |
2540 | else\r | |
2541 | { // got light now!\r | |
2542 | got_light = TRUE;\r | |
2543 | }\r | |
2544 | \r | |
2545 | if (got_light)\r | |
2546 | {\r | |
0f700c8e | 2547 | ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
4225a882 | 2548 | \r |
77f488bb | 2549 | #if IRMP_SUPPORT_MANCHESTER == 1\r |
d823e852 | 2550 | if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester\r |
4225a882 | 2551 | {\r |
31c1f035 | 2552 | #if 1\r |
2553 | if (irmp_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)\r | |
2554 | #else // better, but some IR-RCs use asymmetric timings :-/\r | |
2555 | if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max &&\r | |
2556 | irmp_pause_time <= 2 * irmp_param.pause_1_len_max)\r | |
fc80d688 | 2557 | #endif\r |
4225a882 | 2558 | {\r |
c7a47e89 | 2559 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2560 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit\r | |
4225a882 | 2561 | {\r |
c7a47e89 | 2562 | ANALYZE_PUTCHAR ('T');\r |
2563 | if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A\r | |
2564 | {\r | |
2565 | irmp_store_bit (1);\r | |
2566 | last_value = 1;\r | |
2567 | }\r | |
2568 | else // RC6 mode 0\r | |
2569 | {\r | |
2570 | irmp_store_bit (0);\r | |
2571 | last_value = 0;\r | |
2572 | }\r | |
2573 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2574 | }\r |
c7a47e89 | 2575 | else\r |
2576 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2577 | {\r | |
2578 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r | |
2579 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 );\r | |
4225a882 | 2580 | \r |
c7a47e89 | 2581 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
2582 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit\r | |
2583 | {\r | |
2584 | ANALYZE_PUTCHAR ('T');\r | |
2585 | irmp_store_bit (1);\r | |
2586 | \r | |
31c1f035 | 2587 | if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)\r |
c7a47e89 | 2588 | {\r |
2589 | last_value = 0;\r | |
2590 | }\r | |
2591 | else\r | |
2592 | {\r | |
2593 | last_value = 1;\r | |
2594 | }\r | |
2595 | ANALYZE_NEWLINE ();\r | |
2596 | }\r | |
2597 | else\r | |
77f488bb | 2598 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
c7a47e89 | 2599 | {\r |
2600 | ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r | |
2601 | irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 );\r | |
6f750020 | 2602 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
c7a47e89 | 2603 | if (! irmp_param2.protocol)\r |
6f750020 | 2604 | #endif\r |
c7a47e89 | 2605 | {\r |
2606 | ANALYZE_NEWLINE ();\r | |
2607 | }\r | |
2608 | last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r | |
2609 | }\r | |
6f750020 | 2610 | }\r |
592411d1 | 2611 | }\r |
31c1f035 | 2612 | else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max\r |
2613 | /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)\r | |
592411d1 | 2614 | {\r |
77f488bb | 2615 | uint8_t manchester_value;\r |
592411d1 | 2616 | \r |
31c1f035 | 2617 | if (last_pause > irmp_param.pause_1_len_max && last_pause <= 2 * irmp_param.pause_1_len_max)\r |
592411d1 | 2618 | {\r |
77f488bb | 2619 | manchester_value = last_value ? 0 : 1;\r |
2620 | last_value = manchester_value;\r | |
592411d1 | 2621 | }\r |
2622 | else\r | |
2623 | {\r | |
77f488bb | 2624 | manchester_value = last_value;\r |
592411d1 | 2625 | }\r |
2626 | \r | |
48664931 | 2627 | ANALYZE_PUTCHAR (manchester_value + '0');\r |
c7a47e89 | 2628 | \r |
6f750020 | 2629 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r |
2630 | if (! irmp_param2.protocol)\r | |
2631 | #endif\r | |
2632 | {\r | |
2633 | ANALYZE_NEWLINE ();\r | |
2634 | }\r | |
c7a47e89 | 2635 | \r |
2636 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2637 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1) // RC6 mode != 0 ???\r | |
2638 | {\r | |
2639 | ANALYZE_PRINTF ("Switching to RC6A protocol\n");\r | |
2640 | irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;\r | |
2641 | irmp_param.address_offset = 5;\r | |
2642 | irmp_param.address_end = irmp_param.address_offset + 15;\r | |
2643 | irmp_param.command_offset = irmp_param.address_end + 1; // skip 1 system bit, changes like a toggle bit\r | |
2644 | irmp_param.command_end = irmp_param.command_offset + 16 - 1;\r | |
9547ee89 | 2645 | irmp_tmp_address = 0;\r |
c7a47e89 | 2646 | }\r |
2647 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
2648 | \r | |
77f488bb | 2649 | irmp_store_bit (manchester_value);\r |
a7054daf | 2650 | }\r |
6f750020 | 2651 | else\r |
2652 | {\r | |
2653 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2654 | if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&\r | |
2655 | irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&\r | |
2656 | ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||\r | |
2657 | (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))\r | |
2658 | {\r | |
2659 | ANALYZE_PUTCHAR ('?');\r | |
d823e852 | 2660 | irmp_param.protocol = 0; // switch to FDC, see below\r |
6f750020 | 2661 | }\r |
2662 | else\r | |
2663 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2664 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2665 | if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&\r | |
2666 | irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&\r | |
2667 | ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||\r | |
2668 | (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))\r | |
2669 | {\r | |
2670 | ANALYZE_PUTCHAR ('?');\r | |
d823e852 | 2671 | irmp_param.protocol = 0; // switch to RCCAR, see below\r |
6f750020 | 2672 | }\r |
2673 | else\r | |
2674 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2675 | {\r | |
2676 | ANALYZE_PUTCHAR ('?');\r | |
2677 | ANALYZE_NEWLINE ();\r | |
c7a47e89 | 2678 | ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
6f750020 | 2679 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
1f54e86c | 2680 | // irmp_busy_flag = FALSE;\r |
6f750020 | 2681 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
2682 | irmp_pause_time = 0;\r | |
2683 | }\r | |
2684 | }\r | |
2685 | \r | |
2686 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2687 | if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)\r | |
2688 | {\r | |
2689 | if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)\r | |
2690 | {\r | |
2691 | ANALYZE_PRINTF (" 1 (FDC)\n");\r | |
2692 | irmp_store_bit2 (1);\r | |
2693 | }\r | |
2694 | else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)\r | |
2695 | {\r | |
2696 | ANALYZE_PRINTF (" 0 (FDC)\n");\r | |
2697 | irmp_store_bit2 (0);\r | |
2698 | }\r | |
2699 | \r | |
2700 | if (! irmp_param.protocol)\r | |
2701 | {\r | |
2702 | ANALYZE_PRINTF ("Switching to FDC protocol\n");\r | |
2703 | memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r | |
2704 | irmp_param2.protocol = 0;\r | |
2705 | irmp_tmp_address = irmp_tmp_address2;\r | |
2706 | irmp_tmp_command = irmp_tmp_command2;\r | |
2707 | }\r | |
2708 | }\r | |
2709 | #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
2710 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
2711 | if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)\r | |
2712 | {\r | |
2713 | if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)\r | |
2714 | {\r | |
2715 | ANALYZE_PRINTF (" 1 (RCCAR)\n");\r | |
2716 | irmp_store_bit2 (1);\r | |
2717 | }\r | |
2718 | else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)\r | |
2719 | {\r | |
2720 | ANALYZE_PRINTF (" 0 (RCCAR)\n");\r | |
2721 | irmp_store_bit2 (0);\r | |
2722 | }\r | |
2723 | \r | |
2724 | if (! irmp_param.protocol)\r | |
2725 | {\r | |
2726 | ANALYZE_PRINTF ("Switching to RCCAR protocol\n");\r | |
2727 | memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r | |
2728 | irmp_param2.protocol = 0;\r | |
2729 | irmp_tmp_address = irmp_tmp_address2;\r | |
2730 | irmp_tmp_command = irmp_tmp_command2;\r | |
2731 | }\r | |
2732 | }\r | |
2733 | #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r | |
a7054daf | 2734 | \r |
77f488bb | 2735 | last_pause = irmp_pause_time;\r |
2736 | wait_for_space = 0;\r | |
a7054daf | 2737 | }\r |
2738 | else\r | |
77f488bb | 2739 | #endif // IRMP_SUPPORT_MANCHESTER == 1\r |
2740 | \r | |
deba2a0a | 2741 | #if IRMP_SUPPORT_SERIAL == 1\r |
2742 | if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r | |
2743 | {\r | |
2744 | while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)\r | |
2745 | {\r | |
2746 | ANALYZE_PUTCHAR ('1');\r | |
2747 | irmp_store_bit (1);\r | |
2748 | \r | |
2749 | if (irmp_pulse_time >= irmp_param.pulse_1_len_min)\r | |
2750 | {\r | |
2751 | irmp_pulse_time -= irmp_param.pulse_1_len_min;\r | |
2752 | }\r | |
2753 | else\r | |
2754 | {\r | |
2755 | irmp_pulse_time = 0;\r | |
2756 | }\r | |
2757 | }\r | |
2758 | \r | |
2759 | while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)\r | |
2760 | {\r | |
2761 | ANALYZE_PUTCHAR ('0');\r | |
2762 | irmp_store_bit (0);\r | |
2763 | \r | |
2764 | if (irmp_pause_time >= irmp_param.pause_1_len_min)\r | |
2765 | {\r | |
2766 | irmp_pause_time -= irmp_param.pause_1_len_min;\r | |
2767 | }\r | |
2768 | else\r | |
2769 | {\r | |
2770 | irmp_pause_time = 0;\r | |
2771 | }\r | |
2772 | }\r | |
2773 | ANALYZE_NEWLINE ();\r | |
2774 | wait_for_space = 0;\r | |
2775 | }\r | |
2776 | else\r | |
2777 | #endif // IRMP_SUPPORT_SERIAL == 1\r | |
a7054daf | 2778 | \r |
4225a882 | 2779 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
2780 | if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit == 16) // Samsung: 16th bit\r | |
2781 | {\r | |
2782 | if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&\r | |
2783 | irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r | |
2784 | {\r | |
48664931 | 2785 | ANALYZE_PRINTF ("SYNC\n");\r |
4225a882 | 2786 | wait_for_space = 0;\r |
2787 | irmp_tmp_id = 0;\r | |
2788 | irmp_bit++;\r | |
2789 | }\r | |
2790 | else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)\r | |
2791 | {\r | |
5b437ff6 | 2792 | irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;\r |
2793 | irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;\r | |
2794 | irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r | |
2795 | irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;\r | |
2796 | \r | |
4225a882 | 2797 | if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)\r |
2798 | {\r | |
48664931 | 2799 | ANALYZE_PUTCHAR ('1');\r |
2800 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2801 | irmp_store_bit (1);\r |
2802 | wait_for_space = 0;\r | |
2803 | }\r | |
2804 | else\r | |
2805 | {\r | |
48664931 | 2806 | ANALYZE_PUTCHAR ('0');\r |
2807 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2808 | irmp_store_bit (0);\r |
2809 | wait_for_space = 0;\r | |
2810 | }\r | |
2811 | \r | |
48664931 | 2812 | ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");\r |
4225a882 | 2813 | }\r |
2814 | else\r | |
2815 | { // timing incorrect!\r | |
48664931 | 2816 | ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
2817 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2818 | // irmp_busy_flag = FALSE;\r |
504d9df9 | 2819 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
4225a882 | 2820 | irmp_pause_time = 0;\r |
2821 | }\r | |
4225a882 | 2822 | }\r |
2823 | else\r | |
2824 | #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL\r | |
2825 | \r | |
fc80d688 | 2826 | #if IRMP_SUPPORT_NEC16_PROTOCOL\r |
35213800 | 2827 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r |
2828 | if (irmp_param.protocol == IRMP_NEC42_PROTOCOL &&\r | |
2829 | #else // IRMP_SUPPORT_NEC_PROTOCOL instead\r | |
2830 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL &&\r | |
2831 | #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r | |
2832 | irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r | |
fc80d688 | 2833 | {\r |
2834 | ANALYZE_PRINTF ("Switching to NEC16 protocol\n");\r | |
7644ac04 | 2835 | irmp_param.protocol = IRMP_NEC16_PROTOCOL;\r |
35213800 | 2836 | irmp_param.address_offset = NEC16_ADDRESS_OFFSET;\r |
2837 | irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN;\r | |
2838 | irmp_param.command_offset = NEC16_COMMAND_OFFSET;\r | |
2839 | irmp_param.command_end = NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN;\r | |
2840 | irmp_param.complete_len = NEC16_COMPLETE_DATA_LEN;\r | |
fc80d688 | 2841 | wait_for_space = 0;\r |
2842 | }\r | |
2843 | else\r | |
2844 | #endif // IRMP_SUPPORT_NEC16_PROTOCOL\r | |
2845 | \r | |
504d9df9 | 2846 | #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r |
2847 | if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r | |
2848 | {\r | |
2849 | if (irmp_pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)\r | |
2850 | {\r | |
46dd89b7 | 2851 | if (irmp_bit == 1) // Bang & Olufsen: 3rd bit\r |
504d9df9 | 2852 | {\r |
2853 | if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)\r | |
2854 | {\r | |
48664931 | 2855 | ANALYZE_PRINTF ("3rd start bit\n");\r |
504d9df9 | 2856 | wait_for_space = 0;\r |
504d9df9 | 2857 | irmp_bit++;\r |
2858 | }\r | |
2859 | else\r | |
d155e9ab | 2860 | { // timing incorrect!\r |
48664931 | 2861 | 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);\r |
2862 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2863 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 2864 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 2865 | irmp_pause_time = 0;\r |
2866 | }\r | |
504d9df9 | 2867 | }\r |
46dd89b7 | 2868 | else if (irmp_bit == 19) // Bang & Olufsen: trailer bit\r |
504d9df9 | 2869 | {\r |
2870 | if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)\r | |
2871 | {\r | |
48664931 | 2872 | ANALYZE_PRINTF ("trailer bit\n");\r |
504d9df9 | 2873 | wait_for_space = 0;\r |
504d9df9 | 2874 | irmp_bit++;\r |
2875 | }\r | |
2876 | else\r | |
46dd89b7 | 2877 | { // timing incorrect!\r |
48664931 | 2878 | 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);\r |
2879 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2880 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 2881 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 2882 | irmp_pause_time = 0;\r |
2883 | }\r | |
504d9df9 | 2884 | }\r |
2885 | else\r | |
2886 | {\r | |
46dd89b7 | 2887 | if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)\r |
2888 | { // pulse & pause timings correct for "1"?\r | |
48664931 | 2889 | ANALYZE_PUTCHAR ('1');\r |
2890 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 2891 | irmp_store_bit (1);\r |
2892 | last_value = 1;\r | |
2893 | wait_for_space = 0;\r | |
2894 | }\r | |
46dd89b7 | 2895 | else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)\r |
2896 | { // pulse & pause timings correct for "0"?\r | |
48664931 | 2897 | ANALYZE_PUTCHAR ('0');\r |
2898 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 2899 | irmp_store_bit (0);\r |
2900 | last_value = 0;\r | |
2901 | wait_for_space = 0;\r | |
2902 | }\r | |
2903 | else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)\r | |
2904 | {\r | |
48664931 | 2905 | ANALYZE_PUTCHAR (last_value + '0');\r |
2906 | ANALYZE_NEWLINE ();\r | |
504d9df9 | 2907 | irmp_store_bit (last_value);\r |
2908 | wait_for_space = 0;\r | |
2909 | }\r | |
2910 | else\r | |
46dd89b7 | 2911 | { // timing incorrect!\r |
48664931 | 2912 | 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);\r |
2913 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2914 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 2915 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 2916 | irmp_pause_time = 0;\r |
2917 | }\r | |
2918 | }\r | |
2919 | }\r | |
2920 | else\r | |
46dd89b7 | 2921 | { // timing incorrect!\r |
48664931 | 2922 | 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);\r |
2923 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2924 | // irmp_busy_flag = FALSE;\r |
46dd89b7 | 2925 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
504d9df9 | 2926 | irmp_pause_time = 0;\r |
2927 | }\r | |
2928 | }\r | |
2929 | else\r | |
2930 | #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL\r | |
2931 | \r | |
4225a882 | 2932 | if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&\r |
2933 | irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r | |
2934 | { // pulse & pause timings correct for "1"?\r | |
48664931 | 2935 | ANALYZE_PUTCHAR ('1');\r |
2936 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2937 | irmp_store_bit (1);\r |
2938 | wait_for_space = 0;\r | |
2939 | }\r | |
2940 | else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&\r | |
2941 | irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)\r | |
2942 | { // pulse & pause timings correct for "0"?\r | |
48664931 | 2943 | ANALYZE_PUTCHAR ('0');\r |
2944 | ANALYZE_NEWLINE ();\r | |
4225a882 | 2945 | irmp_store_bit (0);\r |
2946 | wait_for_space = 0;\r | |
2947 | }\r | |
2948 | else\r | |
111d6191 | 2949 | #if IRMP_SUPPORT_KATHREIN_PROTOCOL\r |
2950 | \r | |
2951 | if (irmp_param.protocol == IRMP_KATHREIN_PROTOCOL &&\r | |
2952 | irmp_pulse_time >= KATHREIN_1_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&\r | |
2953 | (((irmp_bit == 8 || irmp_bit == 6) &&\r | |
2954 | irmp_pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||\r | |
2955 | (irmp_bit == 12 &&\r | |
2956 | irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))\r | |
2957 | \r | |
2958 | {\r | |
2959 | if (irmp_bit == 8)\r | |
2960 | {\r | |
2961 | irmp_bit++;\r | |
2962 | ANALYZE_PUTCHAR ('S');\r | |
2963 | ANALYZE_NEWLINE ();\r | |
111d6191 | 2964 | irmp_tmp_command <<= 1;\r |
2965 | }\r | |
2966 | else\r | |
2967 | {\r | |
2968 | ANALYZE_PUTCHAR ('S');\r | |
2969 | ANALYZE_NEWLINE ();\r | |
2970 | irmp_store_bit (1);\r | |
2971 | }\r | |
2972 | wait_for_space = 0;\r | |
2973 | }\r | |
2974 | else\r | |
2975 | #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL\r | |
4225a882 | 2976 | { // timing incorrect!\r |
48664931 | 2977 | ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r |
2978 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r | |
1f54e86c | 2979 | // irmp_busy_flag = FALSE;\r |
4225a882 | 2980 | irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r |
2981 | irmp_pause_time = 0;\r | |
2982 | }\r | |
2983 | \r | |
2984 | irmp_pulse_time = 1; // set counter to 1, not 0\r | |
2985 | }\r | |
2986 | }\r | |
2987 | else\r | |
2988 | { // counting the pulse length ...\r | |
d155e9ab | 2989 | if (! irmp_input) // still light?\r |
4225a882 | 2990 | { // yes...\r |
2991 | irmp_pulse_time++; // increment counter\r | |
2992 | }\r | |
2993 | else\r | |
2994 | { // now it's dark!\r | |
2995 | wait_for_space = 1; // let's count the time (see above)\r | |
2996 | irmp_pause_time = 1; // set pause counter to 1, not 0\r | |
2997 | }\r | |
2998 | }\r | |
2999 | \r | |
881dbf79 | 3000 | if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\r |
4225a882 | 3001 | {\r |
c7a47e89 | 3002 | if (last_irmp_command == irmp_tmp_command && repetition_len < AUTO_FRAME_REPETITION_LEN)\r |
592411d1 | 3003 | {\r |
3004 | repetition_frame_number++;\r | |
3005 | }\r | |
3006 | else\r | |
4225a882 | 3007 | {\r |
592411d1 | 3008 | repetition_frame_number = 0;\r |
3009 | }\r | |
3010 | \r | |
3011 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r | |
3012 | // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame\r | |
3013 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))\r | |
3014 | {\r | |
48664931 | 3015 | ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3016 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3017 | repetition_len = 0;\r | |
592411d1 | 3018 | }\r |
3019 | else\r | |
3020 | #endif\r | |
3021 | \r | |
770a1a9d | 3022 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r |
3023 | // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame\r | |
3024 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)\r | |
3025 | {\r | |
3026 | ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r | |
c7a47e89 | 3027 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3028 | repetition_len = 0;\r | |
770a1a9d | 3029 | }\r |
3030 | else\r | |
3031 | #endif\r | |
3032 | \r | |
592411d1 | 3033 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r |
3034 | // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r | |
3035 | if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))\r | |
3036 | {\r | |
48664931 | 3037 | ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3038 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3039 | repetition_len = 0;\r | |
592411d1 | 3040 | }\r |
3041 | else\r | |
3042 | #endif\r | |
3043 | \r | |
3044 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r | |
d155e9ab | 3045 | // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r |
592411d1 | 3046 | if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))\r |
3047 | {\r | |
48664931 | 3048 | ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r |
c7a47e89 | 3049 | repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r |
3050 | repetition_len = 0;\r | |
4225a882 | 3051 | }\r |
3052 | else\r | |
592411d1 | 3053 | #endif\r |
3054 | \r | |
4225a882 | 3055 | {\r |
0f700c8e | 3056 | ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit);\r |
4225a882 | 3057 | irmp_ir_detected = TRUE;\r |
3058 | \r | |
3059 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r | |
3060 | if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r | |
3061 | { // check for repetition frame\r | |
3062 | if ((~irmp_tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted\r | |
3063 | {\r | |
3064 | irmp_tmp_command = last_irmp_denon_command; // use command received before!\r | |
08f2dd9d | 3065 | last_irmp_denon_command = 0;\r |
4225a882 | 3066 | \r |
3067 | irmp_protocol = irmp_param.protocol; // store protocol\r | |
3068 | irmp_address = irmp_tmp_address; // store address\r | |
3069 | irmp_command = irmp_tmp_command ; // store command\r | |
3070 | }\r | |
3071 | else\r | |
3072 | {\r | |
08f2dd9d | 3073 | ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r |
4225a882 | 3074 | irmp_ir_detected = FALSE;\r |
3075 | last_irmp_denon_command = irmp_tmp_command;\r | |
08f2dd9d | 3076 | repetition_len = 0;\r |
4225a882 | 3077 | }\r |
3078 | }\r | |
3079 | else\r | |
3080 | #endif // IRMP_SUPPORT_DENON_PROTOCOL\r | |
592411d1 | 3081 | \r |
3082 | #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1\r | |
d155e9ab | 3083 | if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)\r |
3084 | { // Grundig start frame?\r | |
48664931 | 3085 | ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");\r |
592411d1 | 3086 | irmp_ir_detected = FALSE;\r |
592411d1 | 3087 | }\r |
3088 | else\r | |
d155e9ab | 3089 | #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL\r |
3090 | \r | |
3091 | #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r | |
3092 | if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)\r | |
3093 | { // Nokia start frame?\r | |
48664931 | 3094 | ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");\r |
d155e9ab | 3095 | irmp_ir_detected = FALSE;\r |
3096 | }\r | |
3097 | else\r | |
3098 | #endif // IRMP_SUPPORT_NOKIA_PROTOCOL\r | |
4225a882 | 3099 | {\r |
cb8474cc | 3100 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r |
3101 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame\r | |
3102 | {\r | |
c7a47e89 | 3103 | if (repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r |
6db2522c | 3104 | {\r |
c7a47e89 | 3105 | ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len);\r |
6db2522c | 3106 | irmp_tmp_address = last_irmp_address; // address is last address\r |
3107 | irmp_tmp_command = last_irmp_command; // command is last command\r | |
3108 | irmp_flags |= IRMP_FLAG_REPETITION;\r | |
c7a47e89 | 3109 | repetition_len = 0;\r |
6db2522c | 3110 | }\r |
3111 | else\r | |
3112 | {\r | |
c7a47e89 | 3113 | ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",\r |
3114 | repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r | |
6db2522c | 3115 | irmp_ir_detected = FALSE;\r |
3116 | }\r | |
cb8474cc | 3117 | }\r |
4225a882 | 3118 | #endif // IRMP_SUPPORT_NEC_PROTOCOL\r |
770a1a9d | 3119 | \r |
3120 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
3121 | if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r | |
3122 | {\r | |
a03ad359 | 3123 | uint8_t xor_value;\r |
770a1a9d | 3124 | // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\r |
3125 | // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);\r | |
3126 | \r | |
a03ad359 | 3127 | xor_value = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r |
770a1a9d | 3128 | \r |
a03ad359 | 3129 | if (xor_value != (xor_check[2] & 0x0F))\r |
770a1a9d | 3130 | {\r |
a03ad359 | 3131 | ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F);\r |
770a1a9d | 3132 | irmp_ir_detected = FALSE;\r |
3133 | }\r | |
3134 | \r | |
a03ad359 | 3135 | xor_value = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r |
770a1a9d | 3136 | \r |
a03ad359 | 3137 | if (xor_value != xor_check[5])\r |
770a1a9d | 3138 | {\r |
a03ad359 | 3139 | ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]);\r |
770a1a9d | 3140 | irmp_ir_detected = FALSE;\r |
3141 | }\r | |
0f700c8e | 3142 | \r |
cea96148 | 3143 | irmp_flags |= genre2; // write the genre2 bits into MSB of the flag byte\r |
770a1a9d | 3144 | }\r |
3145 | #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r | |
3146 | \r | |
c7a47e89 | 3147 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r |
3148 | if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode = 6?\r | |
3149 | {\r | |
3150 | irmp_protocol = IRMP_RC6A_PROTOCOL;\r | |
3151 | }\r | |
3152 | else\r | |
3153 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r | |
26b6c304 | 3154 | {\r |
3155 | irmp_protocol = irmp_param.protocol;\r | |
3156 | }\r | |
d823e852 | 3157 | \r |
3158 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r | |
3159 | if (irmp_param.protocol == IRMP_FDC_PROTOCOL)\r | |
3160 | {\r | |
3161 | if (irmp_tmp_command & 0x000F) // released key?\r | |
3162 | {\r | |
3163 | irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80; // yes, set bit 7\r | |
3164 | }\r | |
3165 | else\r | |
3166 | {\r | |
3167 | irmp_tmp_command >>= 4; // no, it's a pressed key\r | |
3168 | }\r | |
3169 | irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000\r | |
3170 | irmp_tmp_address &= 0x003F;\r | |
3171 | }\r | |
3172 | #endif\r | |
3173 | \r | |
4225a882 | 3174 | irmp_address = irmp_tmp_address; // store address\r |
3175 | #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r | |
03780b34 | 3176 | if (irmp_param.protocol == IRMP_NEC_PROTOCOL)\r |
3177 | {\r | |
3178 | last_irmp_address = irmp_tmp_address; // store as last address, too\r | |
3179 | }\r | |
4225a882 | 3180 | #endif\r |
3181 | \r | |
3182 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r | |
6f750020 | 3183 | if (irmp_param.protocol == IRMP_RC5_PROTOCOL)\r |
3184 | {\r | |
3185 | irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r | |
3186 | }\r | |
4225a882 | 3187 | #endif\r |
3188 | irmp_command = irmp_tmp_command; // store command\r | |
3189 | \r | |
3190 | #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r | |
3191 | irmp_id = irmp_tmp_id;\r | |
3192 | #endif\r | |
3193 | }\r | |
3194 | }\r | |
3195 | \r | |
3196 | if (irmp_ir_detected)\r | |
3197 | {\r | |
03780b34 | 3198 | if (last_irmp_command == irmp_tmp_command &&\r |
3199 | last_irmp_address == irmp_tmp_address &&\r | |
c7a47e89 | 3200 | repetition_len < IRMP_KEY_REPETITION_LEN)\r |
4225a882 | 3201 | {\r |
3202 | irmp_flags |= IRMP_FLAG_REPETITION;\r | |
3203 | }\r | |
3204 | \r | |
3205 | last_irmp_address = irmp_tmp_address; // store as last address, too\r | |
3206 | last_irmp_command = irmp_tmp_command; // store as last command, too\r | |
3207 | \r | |
c7a47e89 | 3208 | repetition_len = 0;\r |
4225a882 | 3209 | }\r |
879b06c2 | 3210 | else\r |
3211 | {\r | |
48664931 | 3212 | ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r |
879b06c2 | 3213 | }\r |
4225a882 | 3214 | \r |
1f54e86c | 3215 | // irmp_busy_flag = FALSE;\r |
4225a882 | 3216 | irmp_start_bit_detected = 0; // and wait for next start bit\r |
3217 | irmp_tmp_command = 0;\r | |
3218 | irmp_pulse_time = 0;\r | |
3219 | irmp_pause_time = 0;\r | |
770a1a9d | 3220 | \r |
3221 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
3222 | if (irmp_protocol == IRMP_JVC_PROTOCOL) // the stop bit of JVC frame is also start bit of next frame\r | |
3223 | { // set pulse time here!\r | |
3224 | irmp_pulse_time = ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));\r | |
3225 | }\r | |
3226 | #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r | |
4225a882 | 3227 | }\r |
3228 | }\r | |
3229 | }\r | |
879b06c2 | 3230 | return (irmp_ir_detected);\r |
4225a882 | 3231 | }\r |
3232 | \r | |
48664931 | 3233 | #ifdef ANALYZE\r |
4225a882 | 3234 | \r |
2eab5ec9 | 3235 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
3236 | * main functions - for Unix/Linux + Windows only!\r | |
3237 | *\r | |
3238 | * AVR: see main.c!\r | |
3239 | *\r | |
3240 | * Compile it under linux with:\r | |
3241 | * cc irmp.c -o irmp\r | |
3242 | *\r | |
3243 | * usage: ./irmp [-v|-s|-a|-l|-p] < file\r | |
3244 | *\r | |
3245 | * options:\r | |
3246 | * -v verbose\r | |
3247 | * -s silent\r | |
3248 | * -a analyze\r | |
3249 | * -l list pulse/pauses\r | |
3250 | * -p print timings\r | |
3251 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
3252 | */\r | |
4225a882 | 3253 | \r |
fef942f6 | 3254 | static void\r |
3255 | print_timings (void)\r | |
3256 | {\r | |
c7a47e89 | 3257 | printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN, sizeof (PAUSE_LEN));\r |
2eab5ec9 | 3258 | printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN);\r |
3259 | puts ("");\r | |
6f750020 | 3260 | printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");\r |
fef942f6 | 3261 | printf ("====================================================================================\n");\r |
6f750020 | 3262 | printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3263 | SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX,\r | |
3264 | SIRCS_0_PULSE_LEN_MIN, SIRCS_0_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX,\r | |
3265 | SIRCS_1_PULSE_LEN_MIN, SIRCS_1_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX);\r | |
3266 | \r | |
3267 | printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3268 | NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX,\r | |
3269 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r | |
3270 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r | |
3271 | \r | |
3272 | printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3273 | 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,\r | |
3274 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r | |
3275 | NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r | |
3276 | \r | |
3277 | printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3278 | SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX,\r | |
3279 | SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_0_PAUSE_LEN_MIN, SAMSUNG_0_PAUSE_LEN_MAX,\r | |
3280 | SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_1_PAUSE_LEN_MIN, SAMSUNG_1_PAUSE_LEN_MAX);\r | |
3281 | \r | |
3282 | printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3283 | MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX,\r | |
3284 | MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_0_PAUSE_LEN_MIN, MATSUSHITA_0_PAUSE_LEN_MAX,\r | |
3285 | MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_1_PAUSE_LEN_MIN, MATSUSHITA_1_PAUSE_LEN_MAX);\r | |
3286 | \r | |
3287 | printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3288 | KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX,\r | |
3289 | KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_0_PAUSE_LEN_MIN, KASEIKYO_0_PAUSE_LEN_MAX,\r | |
3290 | KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_1_PAUSE_LEN_MIN, KASEIKYO_1_PAUSE_LEN_MAX);\r | |
3291 | \r | |
3292 | printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3293 | RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX,\r | |
3294 | RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_0_PAUSE_LEN_MIN, RECS80_0_PAUSE_LEN_MAX,\r | |
3295 | RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_1_PAUSE_LEN_MIN, RECS80_1_PAUSE_LEN_MAX);\r | |
3296 | \r | |
3297 | printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3298 | RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r | |
3299 | RC5_BIT_LEN_MIN, RC5_BIT_LEN_MAX);\r | |
3300 | \r | |
3301 | printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3302 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r | |
3303 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX,\r | |
3304 | DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX);\r | |
3305 | \r | |
beda975f | 3306 | printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3307 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,\r | |
3308 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX,\r | |
3309 | THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX);\r | |
3310 | \r | |
c7a47e89 | 3311 | printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
6f750020 | 3312 | RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX, RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX,\r |
c7a47e89 | 3313 | RC6_BIT_PULSE_LEN_MIN, RC6_BIT_PULSE_LEN_MAX, RC6_BIT_PAUSE_LEN_MIN, RC6_BIT_PAUSE_LEN_MAX);\r |
6f750020 | 3314 | \r |
3315 | printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3316 | RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX, RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX,\r | |
3317 | RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_0_PAUSE_LEN_MIN, RECS80EXT_0_PAUSE_LEN_MAX,\r | |
3318 | RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_1_PAUSE_LEN_MIN, RECS80EXT_1_PAUSE_LEN_MAX);\r | |
3319 | \r | |
3320 | printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3321 | NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX,\r | |
3322 | NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX,\r | |
3323 | NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX);\r | |
3324 | \r | |
3325 | printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r | |
3326 | BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r | |
3327 | BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r | |
3328 | \r | |
2eab5ec9 | 3329 | printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",\r |
3330 | BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r | |
3331 | BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r | |
3332 | \r | |
6f750020 | 3333 | printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r |
3334 | BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r | |
3335 | BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r | |
3336 | \r | |
3337 | printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r | |
3338 | BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r | |
3339 | BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r | |
3340 | \r | |
3341 | printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3342 | BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_0_PAUSE_LEN_MIN, BANG_OLUFSEN_0_PAUSE_LEN_MAX,\r | |
3343 | BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_1_PAUSE_LEN_MIN, BANG_OLUFSEN_1_PAUSE_LEN_MAX);\r | |
3344 | \r | |
3345 | printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",\r | |
89e8cafb | 3346 | GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r |
3347 | GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX,\r | |
3348 | GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX);\r | |
6f750020 | 3349 | \r |
12948cf3 | 3350 | printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r |
3351 | SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r | |
3352 | SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r | |
3353 | SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX,\r | |
3354 | SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX,\r | |
31c1f035 | 3355 | 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX,\r |
3356 | 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX);\r | |
6f750020 | 3357 | \r |
3358 | printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3359 | FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX,\r | |
3360 | FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX,\r | |
3361 | FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_1_PAUSE_LEN_MIN, FDC_1_PAUSE_LEN_MAX);\r | |
3362 | \r | |
3363 | printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3364 | RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX,\r | |
3365 | RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_0_PAUSE_LEN_MIN, RCCAR_0_PAUSE_LEN_MAX,\r | |
3366 | RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_1_PAUSE_LEN_MIN, RCCAR_1_PAUSE_LEN_MAX);\r | |
9405f84a | 3367 | \r |
3368 | printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3369 | NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX, NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX,\r | |
3370 | NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_0_PAUSE_LEN_MIN, NIKON_0_PAUSE_LEN_MAX,\r | |
3371 | NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_1_PAUSE_LEN_MIN, NIKON_1_PAUSE_LEN_MAX);\r | |
f50e01e7 | 3372 | \r |
3373 | printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r | |
3374 | LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX, LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX,\r | |
3375 | LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_0_PAUSE_LEN_MIN, LEGO_0_PAUSE_LEN_MAX,\r | |
3376 | LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_1_PAUSE_LEN_MIN, LEGO_1_PAUSE_LEN_MAX);\r | |
3377 | \r | |
fef942f6 | 3378 | }\r |
3379 | \r | |
77f488bb | 3380 | void\r |
48664931 | 3381 | print_spectrum (char * text, int * buf, int is_pulse)\r |
77f488bb | 3382 | {\r |
3383 | int i;\r | |
3384 | int j;\r | |
48664931 | 3385 | int min;\r |
3386 | int max;\r | |
3387 | int max_value = 0;\r | |
77f488bb | 3388 | int value;\r |
3389 | int sum = 0;\r | |
3390 | int counter = 0;\r | |
3391 | double average = 0;\r | |
48664931 | 3392 | double tolerance;\r |
77f488bb | 3393 | \r |
48664931 | 3394 | puts ("-------------------------------------------------------------------------------");\r |
77f488bb | 3395 | printf ("%s:\n", text);\r |
3396 | \r | |
3397 | for (i = 0; i < 256; i++)\r | |
3398 | {\r | |
48664931 | 3399 | if (buf[i] > max_value)\r |
77f488bb | 3400 | {\r |
48664931 | 3401 | max_value = buf[i];\r |
77f488bb | 3402 | }\r |
3403 | }\r | |
3404 | \r | |
53c11f07 | 3405 | for (i = 1; i < 100; i++)\r |
77f488bb | 3406 | {\r |
3407 | if (buf[i] > 0)\r | |
3408 | {\r | |
3409 | printf ("%3d ", i);\r | |
48664931 | 3410 | value = (buf[i] * 60) / max_value;\r |
77f488bb | 3411 | \r |
3412 | for (j = 0; j < value; j++)\r | |
3413 | {\r | |
3414 | putchar ('o');\r | |
3415 | }\r | |
3416 | printf (" %d\n", buf[i]);\r | |
3417 | \r | |
3418 | sum += i * buf[i];\r | |
3419 | counter += buf[i];\r | |
3420 | }\r | |
3421 | else\r | |
3422 | {\r | |
48664931 | 3423 | max = i - 1;\r |
3424 | \r | |
77f488bb | 3425 | if (counter > 0)\r |
3426 | {\r | |
3427 | average = (float) sum / (float) counter;\r | |
48664931 | 3428 | \r |
3429 | if (is_pulse)\r | |
3430 | {\r | |
3431 | printf ("pulse ");\r | |
3432 | }\r | |
3433 | else\r | |
3434 | {\r | |
3435 | printf ("pause ");\r | |
3436 | }\r | |
3437 | \r | |
3438 | printf ("avg: %4.1f=%6.1f us, ", average, (1000000. * average) / (float) F_INTERRUPTS);\r | |
3439 | printf ("min: %2d=%6.1f us, ", min, (1000000. * min) / (float) F_INTERRUPTS);\r | |
3440 | printf ("max: %2d=%6.1f us, ", max, (1000000. * max) / (float) F_INTERRUPTS);\r | |
3441 | \r | |
3442 | tolerance = (max - average);\r | |
3443 | \r | |
3444 | if (average - min > tolerance)\r | |
3445 | {\r | |
3446 | tolerance = average - min;\r | |
3447 | }\r | |
3448 | \r | |
3449 | tolerance = tolerance * 100 / average;\r | |
3450 | printf ("tol: %4.1f%%\n", tolerance);\r | |
77f488bb | 3451 | }\r |
48664931 | 3452 | \r |
77f488bb | 3453 | counter = 0;\r |
3454 | sum = 0;\r | |
48664931 | 3455 | min = i + 1;\r |
77f488bb | 3456 | }\r |
3457 | }\r | |
3458 | }\r | |
3459 | \r | |
d823e852 | 3460 | #define STATE_LEFT_SHIFT 0x01\r |
3461 | #define STATE_RIGHT_SHIFT 0x02\r | |
3462 | #define STATE_LEFT_CTRL 0x04\r | |
3463 | #define STATE_LEFT_ALT 0x08\r | |
3464 | #define STATE_RIGHT_ALT 0x10\r | |
3465 | \r | |
3466 | #define KEY_ESCAPE 0x1B // keycode = 0x006e\r | |
3467 | #define KEY_MENUE 0x80 // keycode = 0x0070\r | |
3468 | #define KEY_BACK 0x81 // keycode = 0x0071\r | |
3469 | #define KEY_FORWARD 0x82 // keycode = 0x0072\r | |
3470 | #define KEY_ADDRESS 0x83 // keycode = 0x0073\r | |
3471 | #define KEY_WINDOW 0x84 // keycode = 0x0074\r | |
3472 | #define KEY_1ST_PAGE 0x85 // keycode = 0x0075\r | |
3473 | #define KEY_STOP 0x86 // keycode = 0x0076\r | |
3474 | #define KEY_MAIL 0x87 // keycode = 0x0077\r | |
3475 | #define KEY_FAVORITES 0x88 // keycode = 0x0078\r | |
c6ade1d2 | 3476 | #define KEY_NEW_PAGE 0x89 // keycode = 0x0079\r |
3477 | #define KEY_SETUP 0x8A // keycode = 0x007a\r | |
3478 | #define KEY_FONT 0x8B // keycode = 0x007b\r | |
3479 | #define KEY_PRINT 0x8C // keycode = 0x007c\r | |
3480 | #define KEY_ON_OFF 0x8E // keycode = 0x007c\r | |
3481 | \r | |
3482 | #define KEY_INSERT 0x90 // keycode = 0x004b\r | |
3483 | #define KEY_DELETE 0x91 // keycode = 0x004c\r | |
3484 | #define KEY_LEFT 0x92 // keycode = 0x004f\r | |
3485 | #define KEY_HOME 0x93 // keycode = 0x0050\r | |
3486 | #define KEY_END 0x94 // keycode = 0x0051\r | |
3487 | #define KEY_UP 0x95 // keycode = 0x0053\r | |
3488 | #define KEY_DOWN 0x96 // keycode = 0x0054\r | |
3489 | #define KEY_PAGE_UP 0x97 // keycode = 0x0055\r | |
3490 | #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056\r | |
3491 | #define KEY_RIGHT 0x99 // keycode = 0x0059\r | |
3492 | #define KEY_MOUSE_1 0x9E // keycode = 0x0400\r | |
3493 | #define KEY_MOUSE_2 0x9F // keycode = 0x0800\r | |
d823e852 | 3494 | \r |
3495 | static uint8_t\r | |
3496 | get_fdc_key (uint16_t cmd)\r | |
3497 | {\r | |
3498 | static uint8_t key_table[128] =\r | |
3499 | {\r | |
3500 | // 0 1 2 3 4 5 6 7 8 9 A B C D E F\r | |
3501 | Content-type: text/html ]>