Rev 838 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 838 | Rev 903 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /*--------------------------------------------------------------------------------------------------------------------------------------------------- |
1 | /*--------------------------------------------------------------------------------------------------------------------------------------------------- |
2 | * irmp.c - infrared multi-protocol decoder, supports several remote control protocols |
2 | * irmp.c - infrared multi-protocol decoder, supports several remote control protocols |
3 | * |
3 | * |
4 | * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de |
4 | * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de |
5 | * |
5 | * |
6 | * $Id: irmp.c,v 1.84 2010/11/09 19:18:32 fm Exp $ |
6 | * $Id: irmp.c,v 1.87 2011/01/18 13:02:15 fm Exp $ |
7 | * |
7 | * |
8 | * ATMEGA88 @ 8 MHz |
8 | * ATMEGA88 @ 8 MHz |
9 | * |
9 | * |
10 | * Typical manufacturers: |
10 | * Typical manufacturers: |
11 | * |
11 | * |
Line 15... | Line 15... | ||
15 | * SAMSUNG32 - Samsung |
15 | * SAMSUNG32 - Samsung |
16 | * MATSUSHITA - Matsushita |
16 | * MATSUSHITA - Matsushita |
17 | * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application") |
17 | * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application") |
18 | * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba |
18 | * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba |
19 | * RC5 - Philips and other European manufacturers |
19 | * RC5 - Philips and other European manufacturers |
20 | * DENON - Denon |
20 | * DENON - Denon, Sharp |
21 | * RC6 - Philips and other European manufacturers |
21 | * RC6 - Philips and other European manufacturers |
22 | * APPLE - Apple |
22 | * APPLE - Apple |
23 | * NUBERT - Nubert Subwoofer System |
23 | * NUBERT - Nubert Subwoofer System |
24 | * B&O - Bang & Olufsen |
24 | * B&O - Bang & Olufsen |
25 | * PANASONIC - Panasonic (older, yet not implemented) |
25 | * PANASONIC - Panasonic (older, yet not implemented) |
Line 151... | Line 151... | ||
151 | * ----- |
151 | * ----- |
152 | * |
152 | * |
153 | * frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit |
153 | * frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit |
154 | * data: 5 address bits + 10 command bits |
154 | * data: 5 address bits + 10 command bits |
155 | * |
155 | * |
- | 156 | * Theory: |
|
- | 157 | * |
|
156 | * data "0": data "1": |
158 | * data "0": data "1": |
157 | * ------________________ ------______________ |
159 | * ------________________ ------______________ |
158 | * 275us 775us 275us 1900us |
160 | * 275us 775us 275us 1900us |
159 | * |
161 | * |
- | 162 | * Practice: |
|
- | 163 | * |
|
- | 164 | * data "0": data "1": |
|
- | 165 | * ------________________ ------______________ |
|
- | 166 | * 310us 745us 310us 1780us |
|
- | 167 | * |
|
160 | *--------------------------------------------------------------------------------------------------------------------------------------------------- |
168 | *--------------------------------------------------------------------------------------------------------------------------------------------------- |
161 | * |
169 | * |
162 | * RC6 |
170 | * RC6 |
163 | * --- |
171 | * --- |
164 | * |
172 | * |
Line 2033... | Line 2041... | ||
2033 | irmp_pause_time = 0; |
2041 | irmp_pause_time = 0; |
2034 | } |
2042 | } |
2035 | } |
2043 | } |
2036 | else |
2044 | else |
2037 | { |
2045 | { |
2038 | irmp_pause_time++; // increment counter |
2046 | irmp_pause_time++; // increment counter |
Line 2039... | Line 2047... | ||
2039 | 2047 | ||
2040 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1 |
2048 | #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1 |
2041 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits: |
2049 | if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits: |
2042 | irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12 |
2050 | irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12 |
2043 | irmp_bit >= 12 - 1) // pause too long? |
2051 | irmp_bit >= 12 - 1) // pause too long? |
2044 | { // yes, break and close this frame |
2052 | { // yes, break and close this frame |
2045 | irmp_param.complete_len = irmp_bit + 1; // set new complete length |
2053 | irmp_param.complete_len = irmp_bit + 1; // set new complete length |
- | 2054 | got_light = TRUE; // this is a lie, but helps (generates stop bit) |
|
2046 | got_light = TRUE; // this is a lie, but helps (generates stop bit) |
2055 | irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8; // new: store number of additional bits in upper byte of address! |
2047 | irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length |
2056 | irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length |
2048 | irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length |
2057 | irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length |
2049 | } |
2058 | } |
2050 | else |
2059 | else |
2051 | #endif |
2060 | #endif |
2052 | #if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1 |
2061 | #if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1 |
Line 2212... | Line 2221... | ||
2212 | irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG; |
2221 | irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG; |
2213 | irmp_param.address_offset = 5; |
2222 | irmp_param.address_offset = 5; |
2214 | irmp_param.address_end = irmp_param.address_offset + 15; |
2223 | irmp_param.address_end = irmp_param.address_offset + 15; |
2215 | irmp_param.command_offset = irmp_param.address_end + 1; // skip 1 system bit, changes like a toggle bit |
2224 | irmp_param.command_offset = irmp_param.address_end + 1; // skip 1 system bit, changes like a toggle bit |
2216 | irmp_param.command_end = irmp_param.command_offset + 16 - 1; |
2225 | irmp_param.command_end = irmp_param.command_offset + 16 - 1; |
2217 | irmp_tmp_address = 1; // addr 0 - 32767 --> 32768 - 65535 |
2226 | irmp_tmp_address = 0; |
2218 | } |
2227 | } |
2219 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 |
2228 | #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 |
Line 2220... | Line 2229... | ||
2220 | 2229 | ||
2221 | irmp_store_bit (manchester_value); |
2230 | irmp_store_bit (manchester_value); |
Line 2857... | Line 2866... | ||
2857 | { |
2866 | { |
2858 | max_value = buf[i]; |
2867 | max_value = buf[i]; |
2859 | } |
2868 | } |
2860 | } |
2869 | } |
Line 2861... | Line 2870... | ||
2861 | 2870 | ||
2862 | for (i = 0; i < 100; i++) |
2871 | for (i = 1; i < 100; i++) |
2863 | { |
2872 | { |
2864 | if (buf[i] > 0) |
2873 | if (buf[i] > 0) |
2865 | { |
2874 | { |
2866 | printf ("%3d ", i); |
2875 | printf ("%3d ", i); |