From eaaf80c3a29b0c4bcc2040b8202152e8c0b675f0 Mon Sep 17 00:00:00 2001 From: ukw Date: Thu, 10 Jun 2010 21:16:48 +0000 Subject: [PATCH] Version 1.6.2: added FDC2 protocol git-svn-id: svn://mikrocontroller.net/irmp@24 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- irmp.aps | 2 +- irmp.c | 143 +++++++++++++++++++++++++++++++++----------------- irmp.h | 45 ++++++++++------ irmpconfig.h | 8 +-- irsnd.c | 48 ++++++++--------- irsndconfig.h | 8 +-- 6 files changed, 161 insertions(+), 93 deletions(-) diff --git a/irmp.aps b/irmp.aps index 664e6c2..32d565e 100644 --- a/irmp.aps +++ b/irmp.aps @@ -1 +1 @@ -irmp07-Jan-2010 20:23:4909-Jun-2010 11:02:51241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmp.hirmpconfig.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\0-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\Program Files\WinAVR-20090313\bin\avr-gcc.exeC:\Program Files\WinAVR-20090313\utils\bin\make.exe00000main.c100001irmp.c100002irmp.h100003irmpconfig.h1 +irmp07-Jan-2010 20:23:4910-Jun-2010 18:12:17241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmp.hirmpconfig.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\0-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\Program Files\WinAVR-20090313\bin\avr-gcc.exeC:\Program Files\WinAVR-20090313\utils\bin\make.exe00000main.c100001irmp.c100002irmp.h100003irmpconfig.h1 diff --git a/irmp.c b/irmp.c index afcf5e6..90bc280 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.39 2010/06/10 10:09:47 fm Exp $ + * $Id: irmp.c,v 1.41 2010/06/10 21:24:50 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -421,10 +421,10 @@ typedef unsigned int16 uint16_t; #define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_00 + 0.5) - 1) +#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_00 + 0.5) + 1) +#define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_00 + 0.5) - 1) +#define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_00 + 0.5) + 1) #define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) @@ -505,18 +505,31 @@ typedef unsigned int16 uint16_t; #define SIEMENS_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) - 1) #define SIEMENS_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) + 1) -#define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define FDC1_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#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) +#define FDC1_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define FDC1_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define FDC1_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) + +#define FDC2_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#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) +#define FDC2_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1) +#define FDC2_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) +#define FDC2_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1) #define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t! @@ -1073,26 +1086,50 @@ static PROGMEM IRMP_PARAMETER siemens_param = #endif -#if IRMP_SUPPORT_FDC_PROTOCOL == 1 +#if IRMP_SUPPORT_FDC1_PROTOCOL == 1 -static PROGMEM IRMP_PARAMETER fdc_param = +static PROGMEM IRMP_PARAMETER fdc1_param = { - IRMP_FDC_PROTOCOL, // protocol: ir protocol - FDC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 - FDC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 - FDC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 - FDC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 - FDC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 - FDC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 - FDC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 - FDC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 - FDC_ADDRESS_OFFSET, // address_offset: address offset - FDC_ADDRESS_OFFSET + FDC_ADDRESS_LEN, // address_end: end of address - FDC_COMMAND_OFFSET, // command_offset: command offset - FDC_COMMAND_OFFSET + FDC_COMMAND_LEN, // command_end: end of command - FDC_COMPLETE_DATA_LEN, // complete_len: complete length of frame - FDC_STOP_BIT, // stop_bit: flag: frame has stop bit - FDC_LSB // lsb_first: flag: LSB first + IRMP_FDC1_PROTOCOL, // protocol: ir protocol + FDC1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + FDC1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + FDC1_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + FDC1_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + FDC1_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + FDC1_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + FDC1_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + FDC1_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + FDC1_ADDRESS_OFFSET, // address_offset: address offset + FDC1_ADDRESS_OFFSET + FDC1_ADDRESS_LEN, // address_end: end of address + FDC1_COMMAND_OFFSET, // command_offset: command offset + FDC1_COMMAND_OFFSET + FDC1_COMMAND_LEN, // command_end: end of command + FDC1_COMPLETE_DATA_LEN, // complete_len: complete length of frame + FDC1_STOP_BIT, // stop_bit: flag: frame has stop bit + FDC1_LSB // lsb_first: flag: LSB first +}; + +#endif + +#if IRMP_SUPPORT_FDC2_PROTOCOL == 1 + +static PROGMEM IRMP_PARAMETER fdc2_param = +{ + IRMP_FDC2_PROTOCOL, // protocol: ir protocol + FDC2_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + FDC2_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + FDC2_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + FDC2_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + FDC2_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + FDC2_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + FDC2_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + FDC2_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + FDC2_ADDRESS_OFFSET, // address_offset: address offset + FDC2_ADDRESS_OFFSET + FDC2_ADDRESS_LEN, // address_end: end of address + FDC2_COMMAND_OFFSET, // command_offset: command offset + FDC2_COMMAND_OFFSET + FDC2_COMMAND_LEN, // command_end: end of command + FDC2_COMPLETE_DATA_LEN, // complete_len: complete length of frame + FDC2_STOP_BIT, // stop_bit: flag: frame has stop bit + FDC2_LSB // lsb_first: flag: LSB first }; #endif @@ -1553,18 +1590,28 @@ irmp_ISR (void) } else #endif // IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 -#if IRMP_SUPPORT_FDC_PROTOCOL == 1 - if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX && - irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX) +#if IRMP_SUPPORT_FDC1_PROTOCOL == 1 + if (irmp_pulse_time >= FDC1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC1_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= FDC1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC1_START_BIT_PAUSE_LEN_MAX) { - DEBUG_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", - FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, - FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX); - irmp_param_p = (IRMP_PARAMETER *) &fdc_param; + DEBUG_PRINTF ("protocol = FDC1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + FDC1_START_BIT_PULSE_LEN_MIN, FDC1_START_BIT_PULSE_LEN_MAX, + FDC1_START_BIT_PAUSE_LEN_MIN, FDC1_START_BIT_PAUSE_LEN_MAX); + irmp_param_p = (IRMP_PARAMETER *) &fdc1_param; } else -#endif // IRMP_SUPPORT_NEC_PROTOCOL == 1 - +#endif // IRMP_SUPPORT_FDC1_PROTOCOL == 1 +#if IRMP_SUPPORT_FDC2_PROTOCOL == 1 + if (irmp_pulse_time >= FDC2_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC2_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= FDC2_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC2_START_BIT_PAUSE_LEN_MAX) + { + DEBUG_PRINTF ("protocol = FDC2, start bit timings: pulse: %3d - %3d, pause: %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); + irmp_param_p = (IRMP_PARAMETER *) &fdc2_param; + } + else +#endif // IRMP_SUPPORT_FDC2_PROTOCOL == 1 { DEBUG_PRINTF ("protocol = UNKNOWN\n"); irmp_start_bit_detected = 0; // wait for another start bit... @@ -2368,8 +2415,10 @@ print_timings (void) GRUNDIG_OR_NOKIA_START_BIT_LEN_MIN, GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX, GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MIN, GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MAX); printf ("SIEMENS 1 %3d - %3d %3d - %3d\n", SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX, SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX); - printf ("FDC 1 %3d - %3d %3d - %3d\n", - FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX); + printf ("FDC1 1 %3d - %3d %3d - %3d\n", + 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); } int @@ -2576,7 +2625,7 @@ main (int argc, char ** argv) if (! analyze) { - for (i = 0; i < 8000; i++) // newline: long pause of 800 msec + for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++) // newline: long pause of 800 msec { (void) irmp_ISR (); } diff --git a/irmp.h b/irmp.h index f952637..d9ddfa2 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.27 2010/06/10 10:05:56 fm Exp $ + * $Id: irmp.h,v 1.28 2010/06/10 21:24:50 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -43,7 +43,8 @@ extern "C" #define IRMP_GRUNDIG_PROTOCOL 15 // Grundig #define IRMP_NOKIA_PROTOCOL 16 // Nokia #define IRMP_SIEMENS_PROTOCOL 17 // Siemens, e.g. Gigaset -#define IRMP_FDC_PROTOCOL 18 // FDC keyboard +#define IRMP_FDC1_PROTOCOL 18 // FDC keyboard - protocol 1 +#define IRMP_FDC2_PROTOCOL 19 // FDC keyboard - protocol 2 #define SIRCS_START_BIT_PULSE_TIME 2400.0e-6 // 2400 usec pulse #define SIRCS_START_BIT_PAUSE_TIME 600.0e-6 // 600 usec pause @@ -265,19 +266,33 @@ extern "C" #define SIEMENS_STOP_BIT 0 // has no stop bit #define SIEMENS_LSB 0 // MSB...LSB -#define FDC_START_BIT_PULSE_TIME 1390.0e-6 // 1390 usec pulse -#define FDC_START_BIT_PAUSE_TIME 640.0e-6 // 640 usec pause -#define FDC_PULSE_TIME 200.0e-6 // 200 usec pulse -#define FDC_1_PAUSE_TIME 475.0e-6 // 475 usec pause -#define FDC_0_PAUSE_TIME 145.0e-6 // 145 usec pause -#define FDC_FRAME_REPEAT_PAUSE_TIME 40.0e-3 // frame repeat after 40ms -#define FDC_ADDRESS_OFFSET 0 // skip 0 bits -#define FDC_ADDRESS_LEN 16 // read 16 address bits -#define FDC_COMMAND_OFFSET 25 // skip 25 bits (16 address + 9 0-bits) -#define FDC_COMMAND_LEN 12 // read 12 bits -#define FDC_COMPLETE_DATA_LEN 40 // complete length -#define FDC_STOP_BIT 1 // has stop bit -#define FDC_LSB 1 // LSB...MSB +#define FDC1_START_BIT_PULSE_TIME 1390.0e-6 // 1390 usec pulse +#define FDC1_START_BIT_PAUSE_TIME 640.0e-6 // 640 usec pause +#define FDC1_PULSE_TIME 200.0e-6 // 200 usec pulse +#define FDC1_1_PAUSE_TIME 475.0e-6 // 475 usec pause +#define FDC1_0_PAUSE_TIME 145.0e-6 // 145 usec pause +#define FDC1_FRAME_REPEAT_PAUSE_TIME 40.0e-3 // frame repeat after 40ms +#define FDC1_ADDRESS_OFFSET 0 // skip 0 bits +#define FDC1_ADDRESS_LEN 8 // read 8 address bits +#define FDC1_COMMAND_OFFSET 24 // skip 24 bits (8 address bits + 12 status bits + 4 repeat bits) +#define FDC1_COMMAND_LEN 8 // read 8 bits +#define FDC1_COMPLETE_DATA_LEN 40 // complete length +#define FDC1_STOP_BIT 1 // has stop bit +#define FDC1_LSB 1 // LSB...MSB + +#define FDC2_START_BIT_PULSE_TIME 2120.0e-6 // 2120 usec pulse +#define FDC2_START_BIT_PAUSE_TIME 920.0e-6 // 920 usec pause +#define FDC2_PULSE_TIME 400.0e-6 // 400 usec pulse +#define FDC2_1_PAUSE_TIME 660.0e-6 // 660 usec pause +#define FDC2_0_PAUSE_TIME 145.0e-6 // 140 usec pause +#define FDC2_FRAME_REPEAT_PAUSE_TIME 40.0e-3 // frame repeat after 40ms +#define FDC2_ADDRESS_OFFSET 0 // skip 0 bits +#define FDC2_ADDRESS_LEN 8 // read 8 address bits +#define FDC2_COMMAND_OFFSET 24 // skip 24 bits (8 address bits + 12 status bits + 4 repeat bits) +#define FDC2_COMMAND_LEN 8 // read 8 bits +#define FDC2_COMPLETE_DATA_LEN 40 // complete length +#define FDC2_STOP_BIT 1 // has stop bit +#define FDC2_LSB 1 // LSB...MSB #define AUTO_FRAME_REPETITION_TIME 50.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms diff --git a/irmpconfig.h b/irmpconfig.h index 8d8b7d4..7fadb90 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.12 2010/06/10 10:09:47 fm Exp $ + * $Id: irmpconfig.h,v 1.13 2010/06/10 21:24:50 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -53,10 +53,12 @@ */ #if F_INTERRUPTS >= 14500 #define IRMP_SUPPORT_SIEMENS_PROTOCOL 1 // flag: support Siemens Gigaset uses ~150 bytes -#define IRMP_SUPPORT_FDC_PROTOCOL 1 // flag: support FDC keyboard uses ~150 bytes +#define IRMP_SUPPORT_FDC1_PROTOCOL 1 // flag: support FDC1 keyboard uses ~150 bytes +#define IRMP_SUPPORT_FDC2_PROTOCOL 1 // flag: support FDC2 keyboard uses ~150 bytes #else #define IRMP_SUPPORT_SIEMENS_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! -#define IRMP_SUPPORT_FDC_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! +#define IRMP_SUPPORT_FDC1_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! +#define IRMP_SUPPORT_FDC2_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! #endif /*--------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/irsnd.c b/irsnd.c index b6138f0..c2a4da7 100644 --- a/irsnd.c +++ b/irsnd.c @@ -3,7 +3,7 @@ * * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irsnd.c,v 1.17 2010/06/10 10:05:56 fm Exp $ + * $Id: irsnd.c,v 1.18 2010/06/10 21:24:50 fm Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -153,12 +153,12 @@ typedef unsigned short uint16_t; #define IRSND_FREQ_56_KHZ (uint8_t) ((F_CPU / 56000 / 2) - 1) #define IRSND_FREQ_455_KHZ (uint8_t) ((F_CPU / 455000 / 2) - 1) -#define FDC_START_BIT_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME + 0.5) -#define FDC_START_BIT_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME + 0.5) -#define FDC_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME + 0.5) -#define FDC_1_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME + 0.5) -#define FDC_0_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME + 0.5) -#define FDC_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * FDC_FRAME_REPEAT_PAUSE_TIME + 0.5) // use uint16_t! +#define FDC1_START_BIT_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME + 0.5) +#define FDC1_START_BIT_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME + 0.5) +#define FDC1_PULSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME + 0.5) +#define FDC1_1_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME + 0.5) +#define FDC1_0_PAUSE_LEN (uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME + 0.5) +#define FDC1_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * FDC1_FRAME_REPEAT_PAUSE_TIME + 0.5) // use uint16_t! static volatile uint8_t irsnd_busy; static volatile uint8_t irsnd_protocol; @@ -490,11 +490,11 @@ irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait) break; } #endif -#if IRSND_SUPPORT_FDC_PROTOCOL == 1 - case IRMP_FDC_PROTOCOL: +#if IRSND_SUPPORT_FDC1_PROTOCOL == 1 + case IRMP_FDC1_PROTOCOL: { - address = bitsrevervse (irmp_data_p->address, FDC_ADDRESS_LEN); - command = bitsrevervse (irmp_data_p->command, FDC_COMMAND_LEN); + address = bitsrevervse (irmp_data_p->address, FDC1_ADDRESS_LEN); + command = bitsrevervse (irmp_data_p->command, FDC1_COMMAND_LEN); irsnd_buffer[0] = (address & 0xFF00) >> 8; // AAAAAAAA irsnd_buffer[1] = (address & 0x00FF); // AAAAAAAA @@ -879,20 +879,20 @@ irsnd_ISR (void) break; } #endif -#if IRSND_SUPPORT_FDC_PROTOCOL == 1 - case IRMP_FDC_PROTOCOL: +#if IRSND_SUPPORT_FDC1_PROTOCOL == 1 + case IRMP_FDC1_PROTOCOL: { - startbit_pulse_len = FDC_START_BIT_PULSE_LEN; - startbit_pause_len = FDC_START_BIT_PAUSE_LEN; - complete_data_len = FDC_COMPLETE_DATA_LEN; - pulse_1_len = FDC_PULSE_LEN; - pause_1_len = FDC_1_PAUSE_LEN; - pulse_0_len = FDC_PULSE_LEN; - pause_0_len = FDC_0_PAUSE_LEN; - has_stop_bit = FDC_STOP_BIT; + startbit_pulse_len = FDC1_START_BIT_PULSE_LEN; + startbit_pause_len = FDC1_START_BIT_PAUSE_LEN; + complete_data_len = FDC1_COMPLETE_DATA_LEN; + pulse_1_len = FDC1_PULSE_LEN; + pause_1_len = FDC1_1_PAUSE_LEN; + pulse_0_len = FDC1_PULSE_LEN; + pause_0_len = FDC1_0_PAUSE_LEN; + has_stop_bit = FDC1_STOP_BIT; n_auto_repetitions = 1; // 1 frame auto_repetition_pause_len = 0; - repeat_frame_pause_len = FDC_FRAME_REPEAT_PAUSE_LEN; + repeat_frame_pause_len = FDC1_FRAME_REPEAT_PAUSE_LEN; irsnd_set_freq (IRSND_FREQ_38_KHZ); break; } @@ -941,13 +941,13 @@ irsnd_ISR (void) case IRMP_BANG_OLUFSEN_PROTOCOL: #endif #if IRSND_SUPPORT_NEC_PROTOCOL == 1 - case IRMP_FDC_PROTOCOL: + case IRMP_FDC1_PROTOCOL: #endif #if IRSND_SUPPORT_SIRCS_PROTOCOL == 1 || IRSND_SUPPORT_NEC_PROTOCOL == 1 || IRSND_SUPPORT_SAMSUNG_PROTOCOL == 1 || IRSND_SUPPORT_MATSUSHITA_PROTOCOL == 1 || \ IRSND_SUPPORT_RECS80_PROTOCOL == 1 || IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 || IRSND_SUPPORT_DENON_PROTOCOL == 1 || IRSND_SUPPORT_NUBERT_PROTOCOL == 1 || \ - IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || IRSND_SUPPORT_FDC_PROTOCOL == 1 + IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || IRSND_SUPPORT_FDC1_PROTOCOL == 1 { if (pulse_counter == 0) { diff --git a/irsndconfig.h b/irsndconfig.h index 253a308..05f27b2 100644 --- a/irsndconfig.h +++ b/irsndconfig.h @@ -3,7 +3,7 @@ * * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de * - * $Id: irsndconfig.h,v 1.6 2010/06/08 23:34:14 fm Exp $ + * $Id: irsndconfig.h,v 1.7 2010/06/10 21:24:50 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -50,10 +50,12 @@ */ #if F_INTERRUPTS >= 14500 #define IRSND_SUPPORT_SIEMENS_PROTOCOL 1 // flag: support Siemens, e.g. Gigaset uses ~150 bytes -#define IRSND_SUPPORT_FDC_PROTOCOL 1 // flag: support FDC infrared keyboard uses ~150 bytes +#define IRSND_SUPPORT_FDC1_PROTOCOL 1 // flag: support FDC1 infrared keyboard uses ~150 bytes +#define IRSND_SUPPORT_FDC2_PROTOCOL 1 // flag: support FDC2 infrared keyboard uses ~150 bytes #else #define IRSND_SUPPORT_SIEMENS_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! -#define IRSND_SUPPORT_FDC_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! +#define IRSND_SUPPORT_FDC1_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! +#define IRSND_SUPPORT_FDC2_PROTOCOL 0 // DO NOT CHANGE! F_INTERRUPTS too low! #endif -- 2.39.2