From 9e16d6996dd343a83a0a34d2d39c5dbd5abd3705 Mon Sep 17 00:00:00 2001 From: ukw Date: Sat, 12 Jun 2010 20:21:45 +0000 Subject: [PATCH] Version 1.6.4: added RC CAR git-svn-id: svn://mikrocontroller.net/irmp@27 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- irmp.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++----- irmp.h | 18 ++++++++++++++++- irmpconfig.h | 5 +++-- 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/irmp.c b/irmp.c index 9136774..125694c 100644 --- a/irmp.c +++ b/irmp.c @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.45 2010/06/11 14:47:24 fm Exp $ + * $Id: irmp.c,v 1.46 2010/06/12 20:29:43 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -515,8 +515,6 @@ typedef unsigned int16 uint16_t; #define FDC1_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define FDC1_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define FDC1_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC1_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC1_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define FDC1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define FDC1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define FDC1_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) @@ -528,8 +526,6 @@ typedef unsigned int16 uint16_t; #define FDC2_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) #define FDC2_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define FDC2_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define FDC2_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) -#define FDC2_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1) #define FDC2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) #define FDC2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1) #define FDC2_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) @@ -537,6 +533,17 @@ typedef unsigned int16 uint16_t; #define FDC2_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) #define FDC2_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) + #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t! #ifdef DEBUG @@ -1158,6 +1165,31 @@ static PROGMEM IRMP_PARAMETER fdc2_param = #endif +#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1 + +static PROGMEM IRMP_PARAMETER rccar_param = +{ + IRMP_RCCAR_PROTOCOL, // protocol: ir protocol + RCCAR_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + RCCAR_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + RCCAR_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + RCCAR_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + RCCAR_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + RCCAR_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + RCCAR_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + RCCAR_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + RCCAR_ADDRESS_OFFSET, // address_offset: address offset + RCCAR_ADDRESS_OFFSET + RCCAR_ADDRESS_LEN, // address_end: end of address + RCCAR_COMMAND_OFFSET, // command_offset: command offset + RCCAR_COMMAND_OFFSET + RCCAR_COMMAND_LEN, // command_end: end of command + RCCAR_COMPLETE_DATA_LEN, // complete_len: complete length of frame + RCCAR_STOP_BIT, // stop_bit: flag: frame has stop bit + RCCAR_LSB, // lsb_first: flag: LSB first + RCCAR_FLAGS // flags: some flags +}; + +#endif + static uint8_t irmp_bit; // current bit position static IRMP_PARAMETER irmp_param; @@ -1635,6 +1667,17 @@ irmp_ISR (void) } else #endif // IRMP_SUPPORT_FDC2_PROTOCOL == 1 +#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1 + if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX) + { + DEBUG_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, + RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX); + irmp_param_p = (IRMP_PARAMETER *) &rccar_param; + } + else +#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1 { DEBUG_PRINTF ("protocol = UNKNOWN\n"); irmp_start_bit_detected = 0; // wait for another start bit... @@ -2275,6 +2318,8 @@ print_timings (void) FDC1_START_BIT_PULSE_LEN_MIN, FDC1_START_BIT_PULSE_LEN_MAX, FDC1_START_BIT_PAUSE_LEN_MIN, FDC1_START_BIT_PAUSE_LEN_MAX); printf ("FDC2 1 %3d - %3d %3d - %3d\n", FDC2_START_BIT_PULSE_LEN_MIN, FDC2_START_BIT_PULSE_LEN_MAX, FDC2_START_BIT_PAUSE_LEN_MIN, FDC2_START_BIT_PAUSE_LEN_MAX); + printf ("RCCAR 1 %3d - %3d %3d - %3d\n", + RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX); } void diff --git a/irmp.h b/irmp.h index 1329412..91ff09c 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.30 2010/06/11 14:47:24 fm Exp $ + * $Id: irmp.h,v 1.31 2010/06/12 20:29:44 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -45,6 +45,7 @@ extern "C" #define IRMP_SIEMENS_PROTOCOL 17 // Siemens, e.g. Gigaset #define IRMP_FDC1_PROTOCOL 18 // FDC keyboard - protocol 1 #define IRMP_FDC2_PROTOCOL 19 // FDC keyboard - protocol 2 +#define IRMP_RCCAR_PROTOCOL 20 // RC Car // some flags of struct IRMP_PARAMETER: #define IRMP_PARAM_FLAG_IS_MANCHESTER 0x01 @@ -314,6 +315,21 @@ extern "C" #define FDC2_LSB 1 // LSB...MSB #define FDC2_FLAGS 0 // flags +#define RCCAR_START_BIT_PULSE_TIME 2000.0e-6 // 2000 usec pulse +#define RCCAR_START_BIT_PAUSE_TIME 2000.0e-6 // 2000 usec pause +#define RCCAR_PULSE_TIME 600.0e-6 // 360 usec pulse +#define RCCAR_1_PAUSE_TIME 450.0e-6 // 650 usec pause +#define RCCAR_0_PAUSE_TIME 900.0e-6 // 180 usec pause +#define RCCAR_FRAME_REPEAT_PAUSE_TIME 40.0e-3 // frame repeat after 40ms +#define RCCAR_ADDRESS_OFFSET 0 // skip 0 bits +#define RCCAR_ADDRESS_LEN 0 // read 8 address bits +#define RCCAR_COMMAND_OFFSET 0 // skip 24 bits (8 address bits + 12 status bits + 4 repeat bits) +#define RCCAR_COMMAND_LEN 13 // read 8 bits +#define RCCAR_COMPLETE_DATA_LEN 13 // complete length +#define RCCAR_STOP_BIT 1 // has stop bit +#define RCCAR_LSB 0 // LSB...MSB +#define RCCAR_FLAGS 0 // flags + #define AUTO_FRAME_REPETITION_TIME 50.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms #define TRUE 1 diff --git a/irmpconfig.h b/irmpconfig.h index 3f30b61..f46883f 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.15 2010/06/11 14:47:24 fm Exp $ + * $Id: irmpconfig.h,v 1.16 2010/06/12 20:29:44 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -38,7 +38,7 @@ #define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 // flag: support Matsushita uses ~50 bytes #define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // flag: support Kaseikyo uses ~50 bytes #define IRMP_SUPPORT_RECS80_PROTOCOL 1 // flag: support RECS80 uses ~50 bytes -#define IRMP_SUPPORT_RC5_PROTOCOL 1 // flag: support RC5 uses ~250 bytes +#define IRMP_SUPPORT_RC5_PROTOCOL 0 // flag: support RC5 uses ~250 bytes #define IRMP_SUPPORT_DENON_PROTOCOL 1 // flag: support DENON uses ~250 bytes #define IRMP_SUPPORT_RC6_PROTOCOL 1 // flag: support RC6 uses ~200 bytes #define IRMP_SUPPORT_RECS80EXT_PROTOCOL 1 // flag: support RECS80EXT uses ~50 bytes @@ -46,6 +46,7 @@ #define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 1 // flag: support Bang & Olufsen uses ~200 bytes #define IRMP_SUPPORT_GRUNDIG_PROTOCOL 1 // flag: support Grundig uses ~150 bytes #define IRMP_SUPPORT_NOKIA_PROTOCOL 1 // flag: support Nokia uses ~150 bytes +#define IRMP_SUPPORT_RCCAR_PROTOCOL 1 // flag: support RC car uses ~150 bytes /*--------------------------------------------------------------------------------------------------------------------------------------------------- * THE FOLLOWING DECODERS WORK ONLY FOR F_INTERRUPTS > 14500! -- 2.39.2