*\r
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.52 2010/06/15 15:47:21 fm Exp $\r
+ * $Id: irmp.c,v 1.62 2010/06/23 10:48:58 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\r
*\r
#endif // unix\r
\r
#include "irmp.h"\r
+#ifndef IRMP_USE_AS_LIB\r
#include "irmpconfig.h"\r
+#endif\r
\r
#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
#define IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL 1\r
#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
-#define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
-#define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
-#define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
-#define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#if 0\r
+#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
+#else\r
+#define FDC_0_PAUSE_LEN_MIN (1) // simply use 1\r
+#endif\r
+#define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
#define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
static uint8_t irmp_bit; // current bit position\r
static IRMP_PARAMETER irmp_param;\r
\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static IRMP_PARAMETER irmp_param2;\r
+#endif\r
+\r
static volatile uint8_t irmp_ir_detected;\r
static volatile uint8_t irmp_protocol;\r
static volatile uint16_t irmp_address;\r
// Bit 12 11 10 9 8 7 6 5 4 3 2 1 0\r
// 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
irmp_address = (irmp_command & 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0\r
-printf ("\n! %04x ", irmp_command);\r
irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0\r
((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0\r
((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0\r
rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0\r
-printf ("%04x\n", irmp_command);\r
break;\r
#endif\r
default:\r
// these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()\r
static uint16_t irmp_tmp_address; // ir address\r
static uint16_t irmp_tmp_command; // ir command\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static uint16_t irmp_tmp_address2; // ir address\r
+static uint16_t irmp_tmp_command2; // ir command\r
+#endif\r
+\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)\r
#endif\r
* @param value to store: 0 or 1\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*/\r
+// verhindert, dass irmp_store_bit() inline compiliert wird:\r
+// static void irmp_store_bit (uint8_t) __attribute__ ((noinline));\r
+\r
static void\r
irmp_store_bit (uint8_t value)\r
{\r
irmp_bit++;\r
}\r
\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * store bit\r
+ * @details store bit in temp address or temp command\r
+ * @param value to store: 0 or 1\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static void\r
+irmp_store_bit2 (uint8_t value)\r
+{\r
+ uint8_t irmp_bit2;\r
+\r
+ if (irmp_param.protocol)\r
+ {\r
+ irmp_bit2 = irmp_bit - 2;\r
+ }\r
+ else\r
+ {\r
+ irmp_bit2 = irmp_bit - 1;\r
+ }\r
+\r
+ if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)\r
+ {\r
+ irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset)); // CV wants cast\r
+ }\r
+ else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)\r
+ {\r
+ irmp_tmp_command2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset)); // CV wants cast\r
+ }\r
+}\r
+#endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* ISR routine\r
* @details ISR routine, called 10000 times per second\r
wait_for_space = 0;\r
irmp_tmp_command = 0;\r
irmp_tmp_address = 0;\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ irmp_tmp_command2 = 0;\r
+ irmp_tmp_address2 = 0;\r
+#endif\r
+\r
irmp_bit = 0xff;\r
irmp_pause_time = 1; // 1st pause: set to 1, not to 0!\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
{ // receiving first data pulse!\r
IRMP_PARAMETER * irmp_param_p = (IRMP_PARAMETER *) 0;\r
\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ irmp_param2.protocol = 0;\r
+#endif\r
+\r
ANALYZE_PRINTF ("start-bit: pulse = %d, pause = %d\n", irmp_pulse_time, irmp_pause_time);\r
\r
#if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r
((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||\r
(irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))\r
{ // it's RC5\r
- ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5 or FDC\n");\r
+ ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r
+ FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+ memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");\r
+ ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r
+ RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+ memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+ }\r
+\r
irmp_param_p = (IRMP_PARAMETER *) &rc5_param;\r
last_pause = irmp_pause_time;\r
\r
2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r
}\r
\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ if (irmp_param2.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);\r
+ ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);\r
+ ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);\r
+ ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);\r
+ }\r
+#endif\r
+\r
+\r
#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r
{\r
irmp_bit = 0;\r
\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
- if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) && irmp_param.protocol != IRMP_RC6_PROTOCOL) // manchester, but not rc6\r
+ if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) && irmp_param.protocol != IRMP_RC6_PROTOCOL) // Manchester, but not RC6\r
{\r
if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)\r
{\r
ANALYZE_NEWLINE ();\r
irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);\r
}\r
- else if (! last_value)\r
+ else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
{\r
ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
irmp_store_bit (0);\r
}\r
}\r
+ else\r
#endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r
+ {\r
+ ; // else do nothing\r
+ }\r
\r
irmp_pulse_time = 1; // set counter to 1, not 0\r
irmp_pause_time = 0;\r
ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
- if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // manchester\r
+ if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester\r
{\r
#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
- if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit >= 3 && irmp_bit <= 5) // special bits of rc6\r
+ if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit >= 3 && irmp_bit <= 5) // special bits of RC6\r
{\r
if (irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MAX && irmp_pause_time > RC6_TOGGLE_BIT_LEN_MAX)\r
{\r
irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 );\r
ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r
irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 );\r
- ANALYZE_NEWLINE ();\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ if (! irmp_param2.protocol)\r
+#endif\r
+ {\r
+ ANALYZE_NEWLINE ();\r
+ }\r
last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r
}\r
- else // if (irmp_pulse_time >= irmp_param.pulse_1_len_max && irmp_pulse_time <= irmp_param.pulse_1_len_max)\r
+ else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max)\r
{\r
uint8_t manchester_value;\r
\r
#endif // 0\r
\r
ANALYZE_PUTCHAR (manchester_value + '0');\r
- ANALYZE_NEWLINE ();\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ if (! irmp_param2.protocol)\r
+#endif\r
+ {\r
+ ANALYZE_NEWLINE ();\r
+ }\r
irmp_store_bit (manchester_value);\r
}\r
+ else\r
+ {\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&\r
+ irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&\r
+ ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||\r
+ (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ irmp_param.protocol = 0; // switch to FDC, see below\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&\r
+ irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&\r
+ ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||\r
+ (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ irmp_param.protocol = 0; // switch to RCCAR, see below\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ ANALYZE_NEWLINE ();\r
+ ANALYZE_PRINTF ("error 3 RC5: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+ irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
+ irmp_pause_time = 0;\r
+ }\r
+ }\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)\r
+ {\r
+ if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 1 (FDC)\n");\r
+ irmp_store_bit2 (1);\r
+ }\r
+ else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 0 (FDC)\n");\r
+ irmp_store_bit2 (0);\r
+ }\r
+\r
+ if (! irmp_param.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to FDC protocol\n");\r
+ memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
+ irmp_param2.protocol = 0;\r
+ irmp_tmp_address = irmp_tmp_address2;\r
+ irmp_tmp_command = irmp_tmp_command2;\r
+ }\r
+ }\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)\r
+ {\r
+ if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 1 (RCCAR)\n");\r
+ irmp_store_bit2 (1);\r
+ }\r
+ else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 0 (RCCAR)\n");\r
+ irmp_store_bit2 (0);\r
+ }\r
+\r
+ if (! irmp_param.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to RCCAR protocol\n");\r
+ memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
+ irmp_param2.protocol = 0;\r
+ irmp_tmp_address = irmp_tmp_address2;\r
+ irmp_tmp_command = irmp_tmp_command2;\r
+ }\r
+ }\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
\r
last_pause = irmp_pause_time;\r
wait_for_space = 0;\r
{\r
ANALYZE_PRINTF ("3rd start bit\n");\r
wait_for_space = 0;\r
- irmp_tmp_id = 0;\r
irmp_bit++;\r
}\r
else\r
{\r
ANALYZE_PRINTF ("trailer bit\n");\r
wait_for_space = 0;\r
- irmp_tmp_id = 0;\r
irmp_bit++;\r
}\r
else\r
}\r
}\r
\r
- if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\r
+ if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\r
{\r
if (last_irmp_command == irmp_tmp_command && repetition_counter < AUTO_FRAME_REPETITION_LEN)\r
{\r
}\r
#endif // IRMP_SUPPORT_NEC_PROTOCOL\r
irmp_protocol = irmp_param.protocol;\r
+\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_FDC_PROTOCOL)\r
+ {\r
+ if (irmp_tmp_command & 0x000F) // released key?\r
+ {\r
+ irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80; // yes, set bit 7\r
+ }\r
+ else\r
+ {\r
+ irmp_tmp_command >>= 4; // no, it's a pressed key\r
+ }\r
+ irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000\r
+ irmp_tmp_address &= 0x003F;\r
+ }\r
+#endif\r
+\r
irmp_address = irmp_tmp_address; // store address\r
#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
last_irmp_address = irmp_tmp_address; // store as last address, too\r
#endif\r
\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
- irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r
+ if (irmp_param.protocol == IRMP_RC5_PROTOCOL)\r
+ {\r
+ irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r
+ }\r
#endif\r
irmp_command = irmp_tmp_command; // store command\r
\r
static void\r
print_timings (void)\r
{\r
- printf ("PROTOCOL START BIT NO. START BIT PULSE START BIT PAUSE\n");\r
+ printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n");\r
printf ("====================================================================================\n");\r
- printf ("SIRCS 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("NEC 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("NEC (rep) 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("SAMSUNG 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("MATSUSHITA 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("KASEIKYO 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("RECS80 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("RC5 1 %3d - %3d %3d - %3d\n",\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
- printf ("DENON 1 %3d - %3d %3d - %3d or %3d - %3d\n",\r
- DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r
- printf ("RC6 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("RECS80EXT 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("NUBERT 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
- printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d\n",\r
- 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);\r
- printf ("SIEMENS 1 %3d - %3d %3d - %3d\n",\r
- SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX, SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX);\r
- printf ("FDC 1 %3d - %3d %3d - %3d\n",\r
- 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
- printf ("RCCAR 1 %3d - %3d %3d - %3d\n",\r
- 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
+ printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ SIRCS_0_PULSE_LEN_MIN, SIRCS_0_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX,\r
+ SIRCS_1_PULSE_LEN_MIN, SIRCS_1_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX);\r
+\r
+ printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_0_PAUSE_LEN_MIN, SAMSUNG_0_PAUSE_LEN_MAX,\r
+ SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_1_PAUSE_LEN_MIN, SAMSUNG_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_0_PAUSE_LEN_MIN, MATSUSHITA_0_PAUSE_LEN_MAX,\r
+ MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_1_PAUSE_LEN_MIN, MATSUSHITA_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_0_PAUSE_LEN_MIN, KASEIKYO_0_PAUSE_LEN_MAX,\r
+ KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_1_PAUSE_LEN_MIN, KASEIKYO_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_0_PAUSE_LEN_MIN, RECS80_0_PAUSE_LEN_MAX,\r
+ RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_1_PAUSE_LEN_MIN, RECS80_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_BIT_LEN_MIN, RC5_BIT_LEN_MAX);\r
+\r
+ printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r
+ DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX,\r
+ DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ RC6_BIT_LEN_MIN, RC6_BIT_LEN_MAX);\r
+\r
+ printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_0_PAUSE_LEN_MIN, RECS80EXT_0_PAUSE_LEN_MAX,\r
+ RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_1_PAUSE_LEN_MIN, RECS80EXT_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX,\r
+ NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_0_PAUSE_LEN_MIN, BANG_OLUFSEN_0_PAUSE_LEN_MAX,\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_1_PAUSE_LEN_MIN, BANG_OLUFSEN_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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,\r
+ GRUNDIG_OR_NOKIA_BIT_LEN_MIN, GRUNDIG_OR_NOKIA_BIT_LEN_MAX);\r
+\r
+ printf ("SIEMENS 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX, SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX,\r
+ SIEMENS_BIT_LEN_MIN, SIEMENS_BIT_LEN_MAX);\r
+\r
+ printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX,\r
+ FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_1_PAUSE_LEN_MIN, FDC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ 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
+ RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_0_PAUSE_LEN_MIN, RCCAR_0_PAUSE_LEN_MAX,\r
+ RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_1_PAUSE_LEN_MIN, RCCAR_1_PAUSE_LEN_MAX);\r
}\r
\r
void\r
}\r
}\r
\r
+#define STATE_LEFT_SHIFT 0x01\r
+#define STATE_RIGHT_SHIFT 0x02\r
+#define STATE_LEFT_CTRL 0x04\r
+#define STATE_LEFT_ALT 0x08\r
+#define STATE_RIGHT_ALT 0x10\r
+\r
+#define KEY_ESCAPE 0x1B // keycode = 0x006e\r
+#define KEY_MENUE 0x80 // keycode = 0x0070\r
+#define KEY_BACK 0x81 // keycode = 0x0071\r
+#define KEY_FORWARD 0x82 // keycode = 0x0072\r
+#define KEY_ADDRESS 0x83 // keycode = 0x0073\r
+#define KEY_WINDOW 0x84 // keycode = 0x0074\r
+#define KEY_1ST_PAGE 0x85 // keycode = 0x0075\r
+#define KEY_STOP 0x86 // keycode = 0x0076\r
+#define KEY_MAIL 0x87 // keycode = 0x0077\r
+#define KEY_FAVORITES 0x88 // keycode = 0x0078\r
+#define KEY_NEW_PAGE 0x99 // keycode = 0x0079\r
+#define KEY_SETUP 0x9A // keycode = 0x007a\r
+#define KEY_FONT 0x9B // keycode = 0x007b\r
+#define KEY_ON_OFF 0x9C // keycode = 0x007c\r
+\r
+#define KEY_INSERT 0xA0 // keycode = 0x004b\r
+#define KEY_DELETE 0xA1 // keycode = 0x004c\r
+#define KEY_LEFT 0xA2 // keycode = 0x004f\r
+#define KEY_HOME 0xA3 // keycode = 0x0050\r
+#define KEY_END 0xA4 // keycode = 0x0051\r
+#define KEY_UP 0xA5 // keycode = 0x0053\r
+#define KEY_DOWN 0xA6 // keycode = 0x0054\r
+#define KEY_PAGE_UP 0xA7 // keycode = 0x0055\r
+#define KEY_PAGE_DOWN 0xA8 // keycode = 0x0056\r
+#define KEY_RIGHT 0xA9 // keycode = 0x0059\r
+\r
+static uint8_t\r
+get_fdc_key (uint16_t cmd)\r
+{\r
+ static uint8_t key_table[128] =\r
+ {\r
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F\r
+ 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',\r
+ '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',\r
+ 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',\r
+ 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,\r
+\r
+ 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',\r
+ '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',\r
+ 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',\r
+ 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0\r
+ };\r
+ static uint8_t state;\r
+\r
+ uint8_t key = 0;\r
+\r
+ switch (cmd)\r
+ {\r
+ case 0x002C: state |= STATE_LEFT_SHIFT; break; // pressed left shift\r
+ case 0x00AC: state &= ~STATE_LEFT_SHIFT; break; // released left shift\r
+ case 0x0039: state |= STATE_RIGHT_SHIFT; break; // pressed right shift\r
+ case 0x00B9: state &= ~STATE_RIGHT_SHIFT; break; // released right shift\r
+ case 0x003A: state |= STATE_LEFT_CTRL; break; // pressed left ctrl\r
+ case 0x00BA: state &= ~STATE_LEFT_CTRL; break; // released left ctrl\r
+ case 0x003C: state |= STATE_LEFT_ALT; break; // pressed left alt\r
+ case 0x00BC: state &= ~STATE_LEFT_ALT; break; // released left alt\r
+ case 0x003E: state |= STATE_RIGHT_ALT; break; // pressed left alt\r
+ case 0x00BE: state &= ~STATE_RIGHT_ALT; break; // released left alt\r
+\r
+ case 0x006e: key = KEY_ESCAPE; break;\r
+ case 0x004b: key = KEY_INSERT; break;\r
+ case 0x004c: key = KEY_DELETE; break;\r
+ case 0x004f: key = KEY_LEFT; break;\r
+ case 0x0050: key = KEY_HOME; break;\r
+ case 0x0051: key = KEY_END; break;\r
+ case 0x0053: key = KEY_UP; break;\r
+ case 0x0054: key = KEY_DOWN; break;\r
+ case 0x0055: key = KEY_PAGE_UP; break;\r
+ case 0x0056: key = KEY_PAGE_DOWN; break;\r
+ case 0x0059: key = KEY_RIGHT; break;\r
+\r
+ default:\r
+ {\r
+ if (!(cmd & 0x80)) // pressed key\r
+ {\r
+ if (cmd >= 0x70 && cmd <= 0x7F) // function keys\r
+ {\r
+ key = cmd + 0x10; // 7x -> 8x\r
+ }\r
+ else if (cmd < 64) // key listed in key_table\r
+ {\r
+ if (state & (STATE_LEFT_ALT | STATE_RIGHT_ALT))\r
+ {\r
+ switch (cmd)\r
+ {\r
+ case 0x0003: key = '²'; break;\r
+ case 0x0008: key = '{'; break;\r
+ case 0x0009: key = '['; break;\r
+ case 0x000A: key = ']'; break;\r
+ case 0x000B: key = '}'; break;\r
+ case 0x000C: key = '\\'; break;\r
+ case 0x001C: key = '~'; break;\r
+ case 0x002D: key = '|'; break;\r
+ case 0x0034: key = 'µ'; break;\r
+ }\r
+ }\r
+ else if (state & (STATE_LEFT_CTRL))\r
+ {\r
+ if (key_table[cmd] >= 'a' && key_table[cmd] <= 'z')\r
+ {\r
+ key = key_table[cmd] - 'a' + 1;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ int idx = cmd + ((state & (STATE_LEFT_SHIFT | STATE_RIGHT_SHIFT)) ? 64 : 0);\r
+\r
+ if (key_table[idx])\r
+ {\r
+ key = key_table[idx];\r
+ }\r
+ }\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ return (key);\r
+}\r
+\r
int\r
main (int argc, char ** argv)\r
{\r
\r
if (! analyze)\r
{\r
- for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++) // newline: long pause of 800 msec\r
+ for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++) // newline: long pause of 800 msec\r
{\r
(void) irmp_ISR ();\r
}\r
\r
if (irmp_get_data (&irmp_data))\r
{\r
+ uint8_t key;\r
+\r
ANALYZE_ONLY_NORMAL_PUTCHAR (' ');\r
- printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",\r
- irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags);\r
+\r
+ if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0)\r
+ {\r
+ if (key >= 32 && key < 0x7F)\r
+ {\r
+ printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %c\n",\r
+ irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key, key);\r
+ }\r
+ else\r
+ {\r
+ printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",\r
+ irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",\r
+ irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags);\r
+ }\r
}\r
}\r
}\r