From a42d1ee6fcf934b9764d26410b2aababb0b69f41 Mon Sep 17 00:00:00 2001 From: ukw Date: Fri, 25 Feb 2011 08:54:01 +0000 Subject: [PATCH] version 1.9.6: corrected RECS80 decoder git-svn-id: svn://mikrocontroller.net/irmp@61 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- README.txt | 2 +- irmp.c | 78 ++++++++++++++++++++++++++++++---------------------- irmp.h | 18 ++++++------ irmpconfig.h | 18 ++++++------ 4 files changed, 64 insertions(+), 52 deletions(-) diff --git a/README.txt b/README.txt index bf5428b..c42ba9b 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ IRMP - Infrared Multi Protocol Decoder -------------------------------------- -Version IRMP: 1.9.6 23.02.2010 +Version IRMP: 1.9.7 25.02.2010 Version IRSND: 1.9.1 22.01.2010 Dokumentation: diff --git a/irmp.c b/irmp.c index 79b9c85..19495fe 100644 --- a/irmp.c +++ b/irmp.c @@ -3,29 +3,35 @@ * * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.95 2011/02/23 15:03:27 fm Exp $ + * $Id: irmp.c,v 1.96 2011/02/25 08:35:32 fm Exp $ * * ATMEGA88 @ 8 MHz * * Typical manufacturers: * - * SIRCS - Sony - * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers - * SAMSUNG - Samsung - * SAMSUNG32 - Samsung - * MATSUSHITA - Matsushita - * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application") - * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba - * RC5 - Philips and other European manufacturers - * DENON - Denon, Sharp - * RC6 - Philips and other European manufacturers - * APPLE - Apple - * NUBERT - Nubert Subwoofer System - * B&O - Bang & Olufsen - * PANASONIC - Panasonic (older, yet not implemented) - * GRUNDIG - Grundig - * NOKIA - Nokia - * SIEMENS - Siemens, e.g. Gigaset M740AV + * SIRCS - Sony + * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers + * SAMSUNG - Samsung + * SAMSUNG32 - Samsung + * MATSUSHITA - Matsushita + * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application") + * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba + * RC5 - Philips and other European manufacturers + * DENON - Denon, Sharp + * RC6 - Philips and other European manufacturers + * APPLE - Apple + * NUBERT - Nubert Subwoofer System + * B&O - Bang & Olufsen + * PANASONIC - Panasonic (older, yet not implemented) + * GRUNDIG - Grundig + * NOKIA - Nokia + * SIEMENS - Siemens, e.g. Gigaset M740AV + * FDC - FDC IR keyboard + * RCCAR - IR remote control for RC cars + * JVC - JVC + * NIKON - Nikon cameras + * RUWIDO - T-Home + * KATHREIN - Kathrein * *--------------------------------------------------------------------------------------------------------------------------------------------------- * @@ -592,10 +598,10 @@ typedef unsigned int16 uint16_t; #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MIN_TOLERANCE_10 + 0.5) - 1) #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MAX_TOLERANCE_10 + 0.5) + 1) -#define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#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 +#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5)) +#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) +#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5)) #define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) #define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1) #define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) @@ -1361,14 +1367,14 @@ static PROGMEM IRMP_PARAMETER kathrein_param = static PROGMEM IRMP_PARAMETER netbox_param = { IRMP_NETBOX_PROTOCOL, // protocol: ir protocol - NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1 - NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1 - NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1 - NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1 - NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0 - NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0 - NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0 - NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0 + NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value + NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value + NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value + NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value + NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value + NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value + NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value + NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value NETBOX_ADDRESS_OFFSET, // address_offset: address offset NETBOX_ADDRESS_OFFSET + NETBOX_ADDRESS_LEN, // address_end: end of address NETBOX_COMMAND_OFFSET, // command_offset: command offset @@ -1524,7 +1530,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0 break; #endif -#if 0 // LATER! +#if 1 // squeeze code to 8 bit, upper bit indicates release-key #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 case IRMP_NETBOX_PROTOCOL: if (irmp_command & 0x1000) // last bit set? @@ -2292,8 +2298,13 @@ irmp_ISR (void) { // yes... if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1) { - if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) || + if ( +#if IRMP_SUPPORT_MANCHESTER == 1 + (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) || +#endif +#if IRMP_SUPPORT_SERIAL == 1 (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) || +#endif (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max)) { #ifdef ANALYZE @@ -2331,8 +2342,9 @@ irmp_ISR (void) else #endif #if IRMP_SUPPORT_SERIAL == 1 + // NETBOX generates no stop bit, here is the timeout condition: if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL && - irmp_pause_time >= 100) + irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit)) { got_light = TRUE; // this is a lie, but helps (generates stop bit) } diff --git a/irmp.h b/irmp.h index e9f06ef..55a44c8 100644 --- a/irmp.h +++ b/irmp.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.h,v 1.54 2011/02/23 15:03:27 fm Exp $ + * $Id: irmp.h,v 1.55 2011/02/25 08:35:33 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -177,11 +177,11 @@ typedef uint8_t PAUSE_LEN; #define RECS80_1_PAUSE_TIME 7432.0e-6 // 7432 usec pause #define RECS80_0_PAUSE_TIME 4902.0e-6 // 4902 usec pause #define RECS80_FRAME_REPEAT_PAUSE_TIME 45.0e-3 // frame repeat after 45ms -#define RECS80_ADDRESS_OFFSET 2 // skip 2 bits (2nd start + 1 toggle) +#define RECS80_ADDRESS_OFFSET 1 // skip 1 bit (toggle bit) #define RECS80_ADDRESS_LEN 3 // read 3 address bits -#define RECS80_COMMAND_OFFSET 5 // skip 5 bits (2nd start + 1 toggle + 3 address) +#define RECS80_COMMAND_OFFSET 4 // skip 5 bits (2nd start + 1 toggle + 3 address) #define RECS80_COMMAND_LEN 6 // read 6 command bits -#define RECS80_COMPLETE_DATA_LEN 11 // complete length +#define RECS80_COMPLETE_DATA_LEN 10 // complete length #define RECS80_STOP_BIT 1 // has stop bit #define RECS80_LSB 0 // MSB...LSB #define RECS80_FLAGS 0 // flags @@ -416,10 +416,10 @@ typedef uint8_t PAUSE_LEN; #define KATHREIN_LSB 0 // MSB #define KATHREIN_FLAGS 0 // flags -#define NETBOX_START_BIT_PULSE_TIME 2500.0e-6 // 2500 usec pulse -#define NETBOX_START_BIT_PAUSE_TIME 833.0e-6 // 833 usec pause -#define NETBOX_PULSE_TIME 833.0e-6 // 833 usec pulse -#define NETBOX_PAUSE_TIME 833.0e-6 // 833 usec pause +#define NETBOX_START_BIT_PULSE_TIME 2400.0e-6 // 2400 usec pulse +#define NETBOX_START_BIT_PAUSE_TIME 800.0e-6 // 800 usec pause +#define NETBOX_PULSE_TIME 800.0e-6 // 800 usec pulse +#define NETBOX_PAUSE_TIME 800.0e-6 // 800 usec pause #define NETBOX_FRAMES 1 // Netbox sends 1 frame #define NETBOX_AUTO_REPETITION_PAUSE_TIME 35.0e-3 // auto repetition after 35ms #define NETBOX_FRAME_REPEAT_PAUSE_TIME 35.0e-3 // frame repeat after 35ms @@ -427,7 +427,7 @@ typedef uint8_t PAUSE_LEN; #define NETBOX_ADDRESS_LEN 3 // read 3 address bits #define NETBOX_COMMAND_OFFSET 3 // skip 3 bits #define NETBOX_COMMAND_LEN 13 // read 13 bits -#define NETBOX_COMPLETE_DATA_LEN 16 // complete length, last is stop bit +#define NETBOX_COMPLETE_DATA_LEN 16 // complete length #define NETBOX_STOP_BIT 0 // has no stop bit #define NETBOX_LSB 1 // LSB #define NETBOX_FLAGS IRMP_PARAM_FLAG_IS_SERIAL // flags diff --git a/irmpconfig.h b/irmpconfig.h index 6a6ab67..a19b46a 100644 --- a/irmpconfig.h +++ b/irmpconfig.h @@ -3,7 +3,7 @@ * * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irmpconfig.h,v 1.56 2011/02/23 15:05:21 fm Exp $ + * $Id: irmpconfig.h,v 1.57 2011/02/25 08:35:33 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -59,14 +59,14 @@ #define IRMP_SUPPORT_NUBERT_PROTOCOL 0 // NUBERT >= 10000 ~50 bytes #define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 0 // Bang & Olufsen >= 10000 ~200 bytes #define IRMP_SUPPORT_NIKON_PROTOCOL 0 // NIKON >= 10000 ~250 bytes -#define IRMP_SUPPORT_NETBOX_PROTOCOL 0 // Netbox keyboard >= 10000 ~400 bytes (PROTOTYPE!!!) -#define IRMP_SUPPORT_IMON_PROTOCOL 0 // Netbox keyboard >= 10000 ~400 bytes (PROTOTYPE!!!) +#define IRMP_SUPPORT_NETBOX_PROTOCOL 0 // Netbox keyboard >= 10000 ~400 bytes (PROTOTYPE!) +#define IRMP_SUPPORT_IMON_PROTOCOL 0 // IMON keyboard >= 10000 ~400 bytes (PROTOTYPE!) #define IRMP_SUPPORT_FDC_PROTOCOL 0 // FDC3402 keyboard >= 10000 (better 15000) ~150 bytes (~400 in combination with RC5) #define IRMP_SUPPORT_RCCAR_PROTOCOL 0 // RC Car >= 10000 (better 15000) ~150 bytes (~500 in combination with RC5) #define IRMP_SUPPORT_SIEMENS_PROTOCOL 0 // Siemens Gigaset >= 15000 ~550 bytes #define IRMP_SUPPORT_RUWIDO_PROTOCOL 0 // RUWIDO, T-Home >= 15000 ~550 bytes -#define IRMP_SUPPORT_RECS80_PROTOCOL 0 // RECS80 >= 20000 ~50 bytes -#define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0 // RECS80EXT >= 20000 ~50 bytes +#define IRMP_SUPPORT_RECS80_PROTOCOL 0 // RECS80 (SAA3004) >= 15000 ~50 bytes +#define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0 // RECS80EXT >= 15000 ~50 bytes /*--------------------------------------------------------------------------------------------------------------------------------------------------- * Change hardware pin here: @@ -110,14 +110,14 @@ #define IRMP_SUPPORT_RUWIDO_PROTOCOL 0 #endif -#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 20000 -#warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 20000) +#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000 +#warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000) #undef IRMP_SUPPORT_RECS80_PROTOCOL #define IRMP_SUPPORT_RECS80_PROTOCOL 0 #endif -#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 20000 -#warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 20000) +#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000 +#warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000) #undef IRMP_SUPPORT_RECS80EXT_PROTOCOL #define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0 #endif -- 2.39.2