]> cloudbase.mooo.com Git - irmp.git/commitdiff
Version 1.8.0: added JVC in irsnd, fitted APPLE protocol to IRMP 1.7.3
authorukw <ukw@aeb2e35e-bfc4-4214-b83c-9e8de998ed28>
Thu, 2 Sep 2010 10:07:18 +0000 (10:07 +0000)
committerukw <ukw@aeb2e35e-bfc4-4214-b83c-9e8de998ed28>
Thu, 2 Sep 2010 10:07:18 +0000 (10:07 +0000)
git-svn-id: svn://mikrocontroller.net/irmp@46 aeb2e35e-bfc4-4214-b83c-9e8de998ed28

IR-Data/test-suite.sh
README.txt
irmp.c
irmp.exe
irmp.h
irmpconfig.h
irsnd.c
irsnd.exe
irsndconfig.h
main.c

index 53585edb6787394efc1a9179a39508bbcb839d9f..a1abf02c3fb4ab93a6ae365770f59da9dc1a9797 100644 (file)
@@ -28,6 +28,7 @@ for j in                            \
     Grundig_TP715.txt               \
     Grundig_TP715_SatTV.txt         \
     Grundig_TP715_Video.txt         \
+    Kathrein-UFS-912-Remote.txt     \
     Matsushita.txt                  \
     Nokia.txt                       \
     Panasonic-Blue-Ray.txt          \
@@ -62,28 +63,30 @@ for j in                            \
     rc6-hold.txt                    \
     rc6.txt                         \
     sharp-denon.txt                 \
-    sharp-denon2.txt
+    sharp-denon2.txt                \
+    xbox360-10kHz.txt
 do
     echo "testing $j ..."
     if tmpsrc/irmp -v < $j | grep -q error
     then
-        tmpsrc/irmp -v < $j | grep error
-        echo "test failed"
-        exit 1
+       tmpsrc/irmp -v < $j | grep error
+       echo "test failed"
+       exit 1
     fi
 done
 
 for j in                                \
     Siemens-Gigaset-M740AV-15kHz.txt    \
     bo_beolink1000-15kHz.txt            \
-    denon-15kHz.txt
+    denon-15kHz.txt                     \
+    xbox360-15kHz.txt
 do
     echo "testing $j ..."
     if tmpsrc/irmp-15kHz -v < $j | grep -q error
     then
-        tmpsrc/irmp-15kHz -v < $j | grep error
-        echo "test failed"
-        exit 1
+       tmpsrc/irmp-15kHz -v < $j | grep error
+       echo "test failed"
+       exit 1
     fi
 done
 
@@ -95,9 +98,9 @@ do
     echo "testing $j ..."
     if tmpsrc/irmp-20kHz -v < $j | grep -q error
     then
-        tmpsrc/irmp-20kHz -v < $j | grep error
-        echo "test failed"
-        exit 1
+       tmpsrc/irmp-20kHz -v < $j | grep error
+       echo "test failed"
+       exit 1
     fi
 done
 
index e065ac21c3a34c778462d6cd33cdd88b85bfd99f..0bf0e382a3cf58c76a6df1674b07bf651ec60942 100644 (file)
@@ -1,8 +1,8 @@
 IRMP - Infrared Multi Protocol Decoder\r
 --------------------------------------\r
 \r
-Version IRMP:  1.7.3  29.08.2010\r
-Version IRSND: 1.7.3  29.08.2010\r
+Version IRMP:  1.8.0  02.09.2010\r
+Version IRSND: 1.8.0  92.09.2010\r
 \r
 Dokumentation:\r
  \r
diff --git a/irmp.c b/irmp.c
index 4077f54fd83e7c6a047c895b714fe9872c02e045..879d50e7c5149ff87a99d5c7435dac575cc13944 100644 (file)
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmp.c,v 1.79 2010/08/28 22:14:56 fm Exp $\r
+ * $Id: irmp.c,v 1.82 2010/08/31 15:22:24 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
@@ -342,16 +342,6 @@ typedef unsigned int16  uint16_t;
 #define IRMP_SUPPORT_MANCHESTER                 0\r
 #endif\r
 \r
-#define IRMP_TIMEOUT_TIME                       16500.0e-6                  // timeout after 16.5 ms darkness\r
-#define IRMP_TIMEOUT_TIME_MS                    16500L                      // timeout after 16.5 ms darkness\r
-\r
-#if (F_INTERRUPTS * IRMP_TIMEOUT_TIME_MS) / 1000000 >= 254\r
-typedef uint16_t    PAUSE_LEN;\r
-#else\r
-typedef uint8_t     PAUSE_LEN;\r
-#endif\r
-\r
-#define IRMP_TIMEOUT_LEN                        (PAUSE_LEN)(F_INTERRUPTS * IRMP_TIMEOUT_TIME + 0.5)\r
 #define IRMP_KEY_REPETITION_LEN                 (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5)           // autodetect key repetition within 150 msec\r
 \r
 #define MIN_TOLERANCE_00                        1.0                           // -0%\r
@@ -474,8 +464,10 @@ typedef uint8_t     PAUSE_LEN;
 #define RC6_START_BIT_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define RC6_TOGGLE_BIT_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RC6_TOGGLE_BIT_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define RC6_BIT_LEN_MIN                         ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RC6_BIT_LEN_MAX                         ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RC6_BIT_PULSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RC6_BIT_PULSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_30 + 0.5) + 1)       // pulses: 300 - 700\r
+#define RC6_BIT_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)       // pauses: 300 - 600\r
+#define RC6_BIT_PAUSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
 #define RECS80EXT_START_BIT_PULSE_LEN_MIN       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r
 #define RECS80EXT_START_BIT_PULSE_LEN_MAX       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)\r
@@ -617,6 +609,7 @@ static int      verbose;
 #endif\r
 #define UART0_TXEN_BIT_VALUE                    (1<<TXEN0)\r
 #define UART0_UDR                               UDR0\r
+#define UART0_U2X                               U2X0\r
 \r
 #else\r
 \r
@@ -635,6 +628,7 @@ static int      verbose;
 #endif\r
 #define UART0_TXEN_BIT_VALUE                    (1<<TXEN)\r
 #define UART0_UDR                               UDR\r
+#define UART0_U2X                               U2X\r
 \r
 #endif\r
 \r
@@ -650,9 +644,9 @@ irmp_uart_init (void)
     UART0_UBRRL = UBRRL_VALUE;\r
 \r
 #if USE_2X\r
-    UART0_UCSRA |= (1<<U2X);\r
+    UART0_UCSRA |= (1<<UART0_U2X);\r
 #else\r
-    UART0_UCSRA &= ~(1<<U2X);\r
+    UART0_UCSRA &= ~(1<<UART0_U2X);\r
 #endif\r
 \r
     UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;\r
@@ -1005,10 +999,10 @@ static PROGMEM IRMP_PARAMETER denon_param =
 static PROGMEM IRMP_PARAMETER rc6_param =\r
 {\r
     IRMP_RC6_PROTOCOL,                                                  // protocol:        ir protocol\r
-    RC6_BIT_LEN_MIN,                                                    // pulse_1_len_min: minimum length of pulse with bit value 1\r
-    RC6_BIT_LEN_MAX,                                                    // pulse_1_len_max: maximum length of pulse with bit value 1\r
-    RC6_BIT_LEN_MIN,                                                    // pause_1_len_min: minimum length of pause with bit value 1\r
-    RC6_BIT_LEN_MAX,                                                    // pause_1_len_max: maximum length of pause with bit value 1\r
+    RC6_BIT_PULSE_LEN_MIN,                                              // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    RC6_BIT_PULSE_LEN_MAX,                                              // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    RC6_BIT_PAUSE_LEN_MIN,                                              // pause_1_len_min: minimum length of pause with bit value 1\r
+    RC6_BIT_PAUSE_LEN_MAX,                                              // pause_1_len_max: maximum length of pause with bit value 1\r
     1,  // tricky: use this as stop bit length                          // pulse_0_len_min: minimum length of pulse with bit value 0\r
     1,                                                                  // pulse_0_len_max: maximum length of pulse with bit value 0\r
     1,                                                                  // pause_0_len_min: minimum length of pause with bit value 0\r
@@ -1446,7 +1440,7 @@ irmp_ISR (void)
     static PAUSE_LEN    irmp_pause_time;                                        // count bit time for pause\r
     static uint16_t     last_irmp_address = 0xFFFF;                             // save last irmp address to recognize key repetition\r
     static uint16_t     last_irmp_command = 0xFFFF;                             // save last irmp command to recognize key repetition\r
-    static uint16_t     repetition_counter;                                     // SIRCS repeats frame 2-5 times with 45 ms pause\r
+    static uint16_t     repetition_len;                                         // SIRCS repeats frame 2-5 times with 45 ms pause\r
     static uint8_t      repetition_frame_number;\r
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
     static uint16_t     last_irmp_denon_command;                                // save last irmp command to recognize DENON frame repetition\r
@@ -1507,9 +1501,9 @@ irmp_ISR (void)
                 }\r
                 else\r
                 {\r
-                    if (repetition_counter < 0xFFFF)                            // avoid overflow of counter\r
+                    if (repetition_len < 0xFFFF)                                // avoid overflow of counter\r
                     {\r
-                        repetition_counter++;\r
+                        repetition_len++;\r
                     }\r
                 }\r
             }\r
@@ -1524,8 +1518,17 @@ irmp_ISR (void)
 \r
                     if (irmp_pause_time > IRMP_TIMEOUT_LEN)                     // timeout?\r
                     {                                                           // yes...\r
-                        ANALYZE_PRINTF ("error 1: pause after start bit pulse %d too long: %d\n", irmp_pulse_time, irmp_pause_time);\r
-                        ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+                        if (irmp_protocol == IRMP_JVC_PROTOCOL)                 // don't show eror if JVC protocol, irmp_pulse_time has been set below!\r
+                        {\r
+                            ;\r
+                        }\r
+                        else\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+                        {\r
+                            ANALYZE_PRINTF ("%8d error 1: pause after start bit pulse %d too long: %d\n", time_counter, irmp_pulse_time, irmp_pause_time);\r
+                            ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+                        }\r
                         irmp_start_bit_detected = 0;                            // reset flags, let's wait for another start bit\r
                         irmp_pulse_time         = 0;\r
                         irmp_pause_time         = 0;\r
@@ -1539,7 +1542,7 @@ irmp_ISR (void)
                     irmp_param2.protocol = 0;\r
 #endif\r
 \r
-                    ANALYZE_PRINTF ("start-bit: pulse = %d, pause = %d\n", irmp_pulse_time, irmp_pause_time);\r
+                    ANALYZE_PRINTF ("%8d [start-bit: pulse = %2d, pause = %2d]\n", time_counter, irmp_pulse_time, irmp_pause_time);\r
 \r
 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r
                     if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&\r
@@ -1717,7 +1720,7 @@ irmp_ISR (void)
                                         RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX);\r
                         irmp_param_p = (IRMP_PARAMETER *) &rc6_param;\r
                         last_pause = 0;\r
-                        last_value = 0;\r
+                        last_value = 1;\r
                     }\r
                     else\r
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
@@ -1838,9 +1841,9 @@ irmp_ISR (void)
                         else\r
                         {\r
                             ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,\r
-                                          2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);\r
+                                            irmp_param.pulse_1_len_max + 1, 2 * irmp_param.pulse_1_len_max);\r
                             ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max,\r
-                                          2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r
+                                            irmp_param.pause_1_len_max + 1, 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
@@ -2056,35 +2059,60 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_MANCHESTER == 1\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_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)\r
                         {\r
-                            if (irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MAX && irmp_pause_time > RC6_TOGGLE_BIT_LEN_MAX)\r
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+                            if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)         // RC6 toggle bit\r
                             {\r
-                                ANALYZE_PUTCHAR ('1');\r
-                                irmp_store_bit (1);\r
+                                ANALYZE_PUTCHAR ('T');\r
+                                if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)                      // RC6 mode 6A\r
+                                {\r
+                                    irmp_store_bit (1);\r
+                                    last_value = 1;\r
+                                }\r
+                                else                                                                            // RC6 mode 0\r
+                                {\r
+                                    irmp_store_bit (0);\r
+                                    last_value = 0;\r
+                                }\r
+                                ANALYZE_NEWLINE ();\r
                             }\r
+                            else\r
+#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+                            {\r
+                                ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r
+                                irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0  :  1 );\r
 \r
-                            ANALYZE_PUTCHAR ('0');\r
-                            irmp_store_bit (0);\r
-                            last_value = 0;\r
-                            ANALYZE_NEWLINE ();\r
-                        }\r
-                        else\r
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+                                if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)      // RC6 toggle bit\r
+                                {\r
+                                    ANALYZE_PUTCHAR ('T');\r
+                                    irmp_store_bit (1);\r
+\r
+                                    if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)\r
+                                    {\r
+                                        last_value = 0;\r
+                                    }\r
+                                    else\r
+                                    {\r
+                                        last_value = 1;\r
+                                    }\r
+                                    ANALYZE_NEWLINE ();\r
+                                }\r
+                                else\r
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
-                        if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max)\r
-                        {\r
-                            ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\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
+                                {\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
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
-                            if (! irmp_param2.protocol)\r
+                                    if (! irmp_param2.protocol)\r
 #endif\r
-                            {\r
-                                ANALYZE_NEWLINE ();\r
+                                    {\r
+                                        ANALYZE_NEWLINE ();\r
+                                    }\r
+                                    last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r
+                                }\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_min && irmp_pulse_time <= irmp_param.pulse_1_len_max)\r
                         {\r
@@ -2100,22 +2128,28 @@ irmp_ISR (void)
                                 manchester_value = last_value;\r
                             }\r
 \r
-#if 0\r
-#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
-                            if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 0)     // RC6 mode != 0 ???\r
-                            {\r
-                                irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;\r
-                            }\r
-#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
-#endif // 0\r
-\r
                             ANALYZE_PUTCHAR (manchester_value + '0');\r
+\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
+\r
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+                            if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1)     // RC6 mode != 0 ???\r
+                            {\r
+                                ANALYZE_PRINTF ("Switching to RC6A protocol\n");\r
+                                irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;\r
+                                irmp_param.address_offset = 5;\r
+                                irmp_param.address_end = irmp_param.address_offset + 15;\r
+                                irmp_param.command_offset = irmp_param.address_end + 1;                                 // skip 1 system bit, changes like a toggle bit\r
+                                irmp_param.command_end = irmp_param.command_offset + 16 - 1;\r
+                                irmp_tmp_address = 1;                                                                   // addr 0 - 32767 --> 32768 - 65535\r
+                            }\r
+#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+\r
                             irmp_store_bit (manchester_value);\r
                         }\r
                         else\r
@@ -2145,7 +2179,7 @@ irmp_ISR (void)
                             {\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_PRINTF ("error 3 manchester: 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
@@ -2378,7 +2412,7 @@ irmp_ISR (void)
 \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
+                if (last_irmp_command == irmp_tmp_command && repetition_len < AUTO_FRAME_REPETITION_LEN)\r
                 {\r
                     repetition_frame_number++;\r
                 }\r
@@ -2392,8 +2426,8 @@ irmp_ISR (void)
                 if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))\r
                 {\r
                     ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_counter, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_counter = 0;\r
+                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+                    repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
@@ -2403,8 +2437,8 @@ irmp_ISR (void)
                 if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)\r
                 {\r
                     ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_counter, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_counter = 0;\r
+                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+                    repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
@@ -2414,8 +2448,8 @@ irmp_ISR (void)
                 if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))\r
                 {\r
                     ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_counter, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_counter = 0;\r
+                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+                    repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
@@ -2425,14 +2459,14 @@ irmp_ISR (void)
                 if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))\r
                 {\r
                     ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_counter, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_counter = 0;\r
+                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+                    repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
 \r
                 {\r
-                    ANALYZE_PRINTF ("code detected, length = %d\n", irmp_bit);\r
+                    ANALYZE_PRINTF ("%8d code detected, length = %d\n", time_counter, irmp_bit);\r
                     irmp_ir_detected = TRUE;\r
 \r
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
@@ -2477,18 +2511,18 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0)  // repetition frame\r
                         {\r
-                            if (repetition_counter < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r
+                            if (repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r
                             {\r
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_counter = %d\n", repetition_counter);\r
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len);\r
                                 irmp_tmp_address = last_irmp_address;                   // address is last address\r
                                 irmp_tmp_command = last_irmp_command;                   // command is last command\r
                                 irmp_flags |= IRMP_FLAG_REPETITION;\r
-                                repetition_counter = 0;\r
+                                repetition_len = 0;\r
                             }\r
                             else\r
                             {\r
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_counter = %d > %d\n",\r
-                                                repetition_counter, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",\r
+                                                repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r
                                 irmp_ir_detected = FALSE;\r
                             }\r
                         }\r
@@ -2519,6 +2553,14 @@ irmp_ISR (void)
                         }\r
 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+                        if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)     // RC6 mode = 6?\r
+                        {\r
+                            irmp_protocol = IRMP_RC6A_PROTOCOL;\r
+                        }\r
+                        else\r
+#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+\r
                         irmp_protocol = irmp_param.protocol;\r
 \r
 #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
@@ -2560,7 +2602,7 @@ irmp_ISR (void)
                 {\r
                     if (last_irmp_command == irmp_command &&\r
                         last_irmp_address == irmp_address &&\r
-                        repetition_counter < IRMP_KEY_REPETITION_LEN)\r
+                        repetition_len < IRMP_KEY_REPETITION_LEN)\r
                     {\r
                         irmp_flags |= IRMP_FLAG_REPETITION;\r
                     }\r
@@ -2568,7 +2610,7 @@ irmp_ISR (void)
                     last_irmp_address = irmp_tmp_address;                           // store as last address, too\r
                     last_irmp_command = irmp_tmp_command;                           // store as last command, too\r
 \r
-                    repetition_counter = 0;\r
+                    repetition_len = 0;\r
                 }\r
                 else\r
                 {\r
@@ -2616,7 +2658,7 @@ irmp_ISR (void)
 static void\r
 print_timings (void)\r
 {\r
-    printf ("IRMP_TIMEOUT_LEN:        %d\n", IRMP_TIMEOUT_LEN);\r
+    printf ("IRMP_TIMEOUT_LEN:        %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN, sizeof (PAUSE_LEN));\r
     printf ("IRMP_KEY_REPETITION_LEN  %d\n", IRMP_KEY_REPETITION_LEN);\r
     puts ("");\r
     printf ("PROTOCOL       S  S-PULSE    S-PAUSE    PULSE-0    PAUSE-0    PULSE-1    PAUSE-1\n");\r
@@ -2665,9 +2707,9 @@ print_timings (void)
             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
+    printf ("RC6            1  %3d - %3d  %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
+            RC6_BIT_PULSE_LEN_MIN, RC6_BIT_PULSE_LEN_MAX, RC6_BIT_PAUSE_LEN_MIN, RC6_BIT_PAUSE_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
@@ -2934,12 +2976,96 @@ get_fdc_key (uint16_t cmd)
     return (key);\r
 }\r
 \r
+static int         analyze = FALSE;\r
+static int         list = FALSE;\r
+static IRMP_DATA   irmp_data;\r
+\r
+static void\r
+next_tick (void)\r
+{\r
+    if (! analyze && ! list)\r
+    {\r
+        (void) irmp_ISR ();\r
+\r
+        if (irmp_get_data (&irmp_data))\r
+        {\r
+            uint8_t key;\r
+\r
+            ANALYZE_ONLY_NORMAL_PUTCHAR (' ');\r
+\r
+            if (verbose)\r
+            {\r
+                printf ("%8d ", time_counter);\r
+            }\r
+\r
+            if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0)\r
+            {\r
+                if ((key >= 0x20 && key < 0x7F) || key >= 0xA0)\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 if (key == '\r' || key == '\t' || key == KEY_ESCAPE || (key >= 0x80 && key <= 0x9F))                 // function keys\r
+                {\r
+                    char * p = (char *) NULL;\r
+\r
+                    switch (key)\r
+                    {\r
+                        case '\t'                : p = "TAB";           break;\r
+                        case '\r'                : p = "CR";            break;\r
+                        case KEY_ESCAPE          : p = "ESCAPE";        break;\r
+                        case KEY_MENUE           : p = "MENUE";         break;\r
+                        case KEY_BACK            : p = "BACK";          break;\r
+                        case KEY_FORWARD         : p = "FORWARD";       break;\r
+                        case KEY_ADDRESS         : p = "ADDRESS";       break;\r
+                        case KEY_WINDOW          : p = "WINDOW";        break;\r
+                        case KEY_1ST_PAGE        : p = "1ST_PAGE";      break;\r
+                        case KEY_STOP            : p = "STOP";          break;\r
+                        case KEY_MAIL            : p = "MAIL";          break;\r
+                        case KEY_FAVORITES       : p = "FAVORITES";     break;\r
+                        case KEY_NEW_PAGE        : p = "NEW_PAGE";      break;\r
+                        case KEY_SETUP           : p = "SETUP";         break;\r
+                        case KEY_FONT            : p = "FONT";          break;\r
+                        case KEY_PRINT           : p = "PRINT";         break;\r
+                        case KEY_ON_OFF          : p = "ON_OFF";        break;\r
+\r
+                        case KEY_INSERT          : p = "INSERT";        break;\r
+                        case KEY_DELETE          : p = "DELETE";        break;\r
+                        case KEY_LEFT            : p = "LEFT";          break;\r
+                        case KEY_HOME            : p = "HOME";          break;\r
+                        case KEY_END             : p = "END";           break;\r
+                        case KEY_UP              : p = "UP";            break;\r
+                        case KEY_DOWN            : p = "DOWN";          break;\r
+                        case KEY_PAGE_UP         : p = "PAGE_UP";       break;\r
+                        case KEY_PAGE_DOWN       : p = "PAGE_DOWN";     break;\r
+                        case KEY_RIGHT           : p = "RIGHT";         break;\r
+                        case KEY_MOUSE_1         : p = "KEY_MOUSE_1";   break;\r
+                        case KEY_MOUSE_2         : p = "KEY_MOUSE_2";   break;\r
+                        default                  : p = "<UNKNWON>";     break;\r
+                    }\r
+\r
+                    printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",\r
+                            irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key, p);\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
+\r
 int\r
 main (int argc, char ** argv)\r
 {\r
     int         i;\r
-    int         analyze = FALSE;\r
-    int         list = FALSE;\r
     int         ch;\r
     int         last_ch = 0;\r
     int         pulse = 0;\r
@@ -2953,8 +3079,6 @@ main (int argc, char ** argv)
     int         first_pulse = TRUE;\r
     int         first_pause = TRUE;\r
 \r
-    IRMP_DATA   irmp_data;\r
-\r
     if (argc == 2)\r
     {\r
         if (! strcmp (argv[1], "-v"))\r
@@ -3074,7 +3198,7 @@ main (int argc, char ** argv)
             {\r
                 for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++)               // newline: long pause of 800 msec\r
                 {\r
-                    (void) irmp_ISR ();\r
+                    next_tick ();\r
                 }\r
             }\r
             first_pulse = TRUE;\r
@@ -3108,78 +3232,7 @@ main (int argc, char ** argv)
 \r
         last_ch = ch;\r
 \r
-        if (! analyze && ! list)\r
-        {\r
-            (void) irmp_ISR ();\r
-\r
-            if (irmp_get_data (&irmp_data))\r
-            {\r
-                uint8_t key;\r
-\r
-                ANALYZE_ONLY_NORMAL_PUTCHAR (' ');\r
-\r
-                if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0)\r
-                {\r
-                    if ((key >= 0x20 && key < 0x7F) || key >= 0xA0)\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 if (key == '\r' || key == '\t' || key == KEY_ESCAPE || (key >= 0x80 && key <= 0x9F))                 // function keys\r
-                    {\r
-                        char * p = (char *) NULL;\r
-\r
-                        switch (key)\r
-                        {\r
-                            case '\t'                : p = "TAB";           break;\r
-                            case '\r'                : p = "CR";            break;\r
-                            case KEY_ESCAPE          : p = "ESCAPE";        break;\r
-                            case KEY_MENUE           : p = "MENUE";         break;\r
-                            case KEY_BACK            : p = "BACK";          break;\r
-                            case KEY_FORWARD         : p = "FORWARD";       break;\r
-                            case KEY_ADDRESS         : p = "ADDRESS";       break;\r
-                            case KEY_WINDOW          : p = "WINDOW";        break;\r
-                            case KEY_1ST_PAGE        : p = "1ST_PAGE";      break;\r
-                            case KEY_STOP            : p = "STOP";          break;\r
-                            case KEY_MAIL            : p = "MAIL";          break;\r
-                            case KEY_FAVORITES       : p = "FAVORITES";     break;\r
-                            case KEY_NEW_PAGE        : p = "NEW_PAGE";      break;\r
-                            case KEY_SETUP           : p = "SETUP";         break;\r
-                            case KEY_FONT            : p = "FONT";          break;\r
-                            case KEY_PRINT           : p = "PRINT";         break;\r
-                            case KEY_ON_OFF          : p = "ON_OFF";        break;\r
-\r
-                            case KEY_INSERT          : p = "INSERT";        break;\r
-                            case KEY_DELETE          : p = "DELETE";        break;\r
-                            case KEY_LEFT            : p = "LEFT";          break;\r
-                            case KEY_HOME            : p = "HOME";          break;\r
-                            case KEY_END             : p = "END";           break;\r
-                            case KEY_UP              : p = "UP";            break;\r
-                            case KEY_DOWN            : p = "DOWN";          break;\r
-                            case KEY_PAGE_UP         : p = "PAGE_UP";       break;\r
-                            case KEY_PAGE_DOWN       : p = "PAGE_DOWN";     break;\r
-                            case KEY_RIGHT           : p = "RIGHT";         break;\r
-                            case KEY_MOUSE_1         : p = "KEY_MOUSE_1";   break;\r
-                            case KEY_MOUSE_2         : p = "KEY_MOUSE_2";   break;\r
-                            default                  : p = "<UNKNWON>";     break;\r
-                        }\r
-\r
-                        printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",\r
-                                irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key, p);\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
+        next_tick ();\r
     }\r
 \r
     if (analyze)\r
index 808c9e2907ee03d68dc1a4491c908ab0e3894236..b6b3217f49184c95d3edb47318e1daf1d1f15b96 100644 (file)
Binary files a/irmp.exe and b/irmp.exe differ
diff --git a/irmp.h b/irmp.h
index c8c709acf50fabf13b79a1bc9da954428959d6a8..21ff7dbfa2f3e0eac7d571919265b193f4f6dff0 100644 (file)
--- a/irmp.h
+++ b/irmp.h
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmp.h,v 1.41 2010/08/18 12:03:26 fm Exp $\r
+ * $Id: irmp.h,v 1.43 2010/08/31 15:22:24 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
@@ -22,6 +22,21 @@ extern "C"
 {\r
 #endif\r
 \r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * timing constants:\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#define IRMP_TIMEOUT_TIME                       16500.0e-6                  // timeout after 16.5 ms darkness\r
+#define IRMP_TIMEOUT_TIME_MS                    16500L                      // timeout after 16.5 ms darkness\r
+\r
+#if (F_INTERRUPTS * IRMP_TIMEOUT_TIME_MS) / 1000000 >= 254\r
+typedef uint16_t    PAUSE_LEN;\r
+#else\r
+typedef uint8_t     PAUSE_LEN;\r
+#endif\r
+\r
+#define IRMP_TIMEOUT_LEN                        (PAUSE_LEN)(F_INTERRUPTS * IRMP_TIMEOUT_TIME + 0.5)\r
+\r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
  * IR protocols\r
  *---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -46,6 +61,7 @@ extern "C"
 #define IRMP_FDC_PROTOCOL                       18              // FDC keyboard\r
 #define IRMP_RCCAR_PROTOCOL                     19              // RC Car\r
 #define IRMP_JVC_PROTOCOL                       20              // JVC\r
+#define IRMP_RC6A_PROTOCOL                      21              // RC6A, e.g. Kathrein, XBOX\r
 \r
 // some flags of struct IRMP_PARAMETER:\r
 #define IRMP_PARAM_FLAG_IS_MANCHESTER           0x01\r
@@ -322,7 +338,7 @@ extern "C"
 #define JVC_PULSE_TIME                           560.0e-6                       //  560 usec pulse\r
 #define JVC_1_PAUSE_TIME                        1690.0e-6                       // 1690 usec pause\r
 #define JVC_0_PAUSE_TIME                         560.0e-6                       //  560 usec pause\r
-#define JVC_FRAME_REPEAT_PAUSE_TIME               25.0e-3                       // frame repeat after 25ms\r
+#define JVC_FRAME_REPEAT_PAUSE_TIME               22.0e-3                       // frame repeat after 22ms\r
 #define JVC_ADDRESS_OFFSET                       0                              // skip 0 bits\r
 #define JVC_ADDRESS_LEN                          4                              // read 4 address bits\r
 #define JVC_COMMAND_OFFSET                       4                              // skip 4 bits\r
index 2d2684889590b62d402102984ba6b22d6eaaeb2b..1a42f897fee988b04daa52b7bb47bfcd2d4b608f 100644 (file)
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmpconfig.h,v 1.37 2010/08/18 12:03:26 fm Exp $\r
+ * $Id: irmpconfig.h,v 1.39 2010/08/30 15:45:27 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
@@ -51,7 +51,7 @@
 #define IRMP_SUPPORT_DENON_PROTOCOL             1       // DENON                >= 10000                 ~250 bytes\r
 #define IRMP_SUPPORT_JVC_PROTOCOL               1       // JVC                  >= 10000                 ~250 bytes\r
 #define IRMP_SUPPORT_RC5_PROTOCOL               1       // RC5                  >= 10000                 ~250 bytes\r
-#define IRMP_SUPPORT_RC6_PROTOCOL               1       // RC6                  >= 10000                 ~200 bytes\r
+#define IRMP_SUPPORT_RC6_PROTOCOL               1       // RC6 & RC6A           >= 10000                 ~200 bytes\r
 #define IRMP_SUPPORT_GRUNDIG_PROTOCOL           1       // Grundig              >= 10000                 ~150 bytes\r
 #define IRMP_SUPPORT_NOKIA_PROTOCOL             1       // Nokia                >= 10000                 ~150 bytes\r
 #define IRMP_SUPPORT_NUBERT_PROTOCOL            1       // NUBERT               >= 10000                  ~50 bytes\r
diff --git a/irsnd.c b/irsnd.c
index ee91c6bda245be96d5afa37e4fd5b3b34264fae9..6f2e6b12caa153fe5db90221b75c29f739a56f06 100644 (file)
--- a/irsnd.c
+++ b/irsnd.c
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irsnd.c,v 1.21 2010/08/18 12:03:26 fm Exp $\r
+ * $Id: irsnd.c,v 1.24 2010/09/02 10:22:26 fm Exp $\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
@@ -26,6 +26,9 @@
 \r
 #ifdef WIN32                                                                 // test/debug on windows\r
 #include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
 #define F_CPU 8000000L\r
 typedef unsigned char    uint8_t;\r
 typedef unsigned short    uint16_t;\r
@@ -175,6 +178,14 @@ typedef unsigned short    uint16_t;
 #define RCCAR_0_PAUSE_LEN                       (uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME + 0.5)\r
 #define RCCAR_FRAME_REPEAT_PAUSE_LEN            (uint16_t)(F_INTERRUPTS * RCCAR_FRAME_REPEAT_PAUSE_TIME + 0.5)              // use uint16_t!\r
 \r
+#define JVC_START_BIT_PULSE_LEN                 (uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME + 0.5)\r
+#define JVC_START_BIT_PAUSE_LEN                 (uint8_t)(F_INTERRUPTS * JVC_START_BIT_PAUSE_TIME + 0.5)\r
+#define JVC_REPEAT_START_BIT_PAUSE_LEN          (uint8_t)(F_INTERRUPTS * JVC_REPEAT_START_BIT_PAUSE_TIME + 0.5)\r
+#define JVC_PULSE_LEN                           (uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME + 0.5)\r
+#define JVC_1_PAUSE_LEN                         (uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME + 0.5)\r
+#define JVC_0_PAUSE_LEN                         (uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME + 0.5)\r
+#define JVC_FRAME_REPEAT_PAUSE_LEN              (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME + 0.5)                // use uint16_t!\r
+\r
 static volatile uint8_t                         irsnd_busy;\r
 static volatile uint8_t                         irsnd_protocol;\r
 static volatile uint8_t                         irsnd_buffer[6];\r
@@ -334,8 +345,25 @@ irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait)
         }\r
 #endif\r
 #if IRSND_SUPPORT_NEC_PROTOCOL == 1\r
-        case IRMP_NEC_PROTOCOL:\r
         case IRMP_APPLE_PROTOCOL:\r
+        {\r
+            command = irmp_data_p->command | (irmp_data_p->address << 8);                               // store address as ID in upper byte of command\r
+            address = 0x87EE;                                                                           // set fixed NEC-lookalike address (customer ID of apple)\r
+\r
+            address = bitsrevervse (address, NEC_ADDRESS_LEN);\r
+            command = bitsrevervse (command, NEC_COMMAND_LEN);\r
+\r
+            irsnd_protocol = IRMP_NEC_PROTOCOL;                                                         // APPLE protocol is NEC with id instead of inverted command\r
+\r
+            irsnd_buffer[0] = (address & 0xFF00) >> 8;                                                  // AAAAAAAA\r
+            irsnd_buffer[1] = (address & 0x00FF);                                                       // AAAAAAAA\r
+            irsnd_buffer[2] = (command & 0xFF00) >> 8;                                                  // CCCCCCCC\r
+            irsnd_buffer[3] = (command & 0x00FF);                                                       // CCCCCCCC\r
+\r
+            irsnd_busy      = TRUE;\r
+            break;\r
+        }\r
+        case IRMP_NEC_PROTOCOL:\r
         {\r
             address = bitsrevervse (irmp_data_p->address, NEC_ADDRESS_LEN);\r
             command = bitsrevervse (irmp_data_p->command, NEC_COMMAND_LEN);\r
@@ -344,12 +372,8 @@ irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait)
             irsnd_buffer[1] = (address & 0x00FF);                                                               // AAAAAAAA\r
             irsnd_buffer[2] = (command & 0xFF00) >> 8;                                                          // CCCCCCCC\r
 \r
-            if (irsnd_protocol == IRMP_APPLE_PROTOCOL)\r
-            {\r
-                irsnd_protocol = IRMP_NEC_PROTOCOL; // APPLE protocol is NEC with fix bitmask instead of inverted command\r
-                irsnd_buffer[3] = 0x8B;                                                                         // 10001011\r
-            }\r
-            else\r
+            irsnd_protocol = IRMP_NEC_PROTOCOL; // APPLE protocol is NEC with fix bitmask instead of inverted command\r
+            irsnd_buffer[3] = 0x8B;                                                                         // 10001011\r
             {\r
                 irsnd_buffer[3] = ~((command & 0xFF00) >> 8);                                                   // cccccccc\r
             }\r
@@ -556,6 +580,19 @@ irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait)
             break;\r
         }\r
 #endif\r
+#if IRSND_SUPPORT_JVC_PROTOCOL == 1\r
+        case IRMP_JVC_PROTOCOL:\r
+        {\r
+            address = bitsrevervse (irmp_data_p->address, JVC_ADDRESS_LEN);\r
+            command = bitsrevervse (irmp_data_p->command, JVC_COMMAND_LEN);\r
+\r
+            irsnd_buffer[0] = ((address & 0x000F) << 4) | (command & 0x0F00) >> 8;                              // AAAACCCC\r
+            irsnd_buffer[1] = (command & 0x00FF);                                                               // CCCCCCCC\r
+\r
+            irsnd_busy      = TRUE;\r
+            break;\r
+        }\r
+#endif\r
         default:\r
         {\r
             break;\r
@@ -984,6 +1021,30 @@ irsnd_ISR (void)
                         break;\r
                     }\r
 #endif\r
+#if IRSND_SUPPORT_JVC_PROTOCOL == 1\r
+                    case IRMP_JVC_PROTOCOL:\r
+                    {\r
+                        if (repeat_counter != 0)                                                    // skip start bit if repetition frame\r
+                        {\r
+                            current_bit = 0;\r
+                        }\r
+\r
+                        startbit_pulse_len          = JVC_START_BIT_PULSE_LEN;\r
+                        startbit_pause_len          = JVC_START_BIT_PAUSE_LEN;\r
+                        complete_data_len           = JVC_COMPLETE_DATA_LEN;\r
+                        pulse_1_len                 = JVC_PULSE_LEN;\r
+                        pause_1_len                 = JVC_1_PAUSE_LEN;\r
+                        pulse_0_len                 = JVC_PULSE_LEN;\r
+                        pause_0_len                 = JVC_0_PAUSE_LEN;\r
+                        has_stop_bit                = JVC_STOP_BIT;\r
+                        n_auto_repetitions          = 1;                                            // 1 frame\r
+                        auto_repetition_pause_len   = 0;\r
+                        repeat_frame_pause_len      = JVC_FRAME_REPEAT_PAUSE_LEN;\r
+                        irsnd_set_freq (IRSND_FREQ_38_KHZ);\r
+\r
+                        break;\r
+                    }\r
+#endif\r
                     default:\r
                     {\r
                         irsnd_busy = FALSE;\r
@@ -1036,11 +1097,15 @@ irsnd_ISR (void)
 #if IRSND_SUPPORT_RCCAR_PROTOCOL == 1\r
                 case IRMP_RCCAR_PROTOCOL:\r
 #endif\r
+#if IRSND_SUPPORT_JVC_PROTOCOL == 1\r
+                case IRMP_JVC_PROTOCOL:\r
+#endif\r
 \r
 \r
 #if IRSND_SUPPORT_SIRCS_PROTOCOL == 1  || IRSND_SUPPORT_NEC_PROTOCOL == 1 || IRSND_SUPPORT_SAMSUNG_PROTOCOL == 1 || IRSND_SUPPORT_MATSUSHITA_PROTOCOL == 1 ||   \\r
     IRSND_SUPPORT_KASEIKYO_PROTOCOL == 1 || IRSND_SUPPORT_RECS80_PROTOCOL == 1 || IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 || IRSND_SUPPORT_DENON_PROTOCOL == 1 || \\r
-    IRSND_SUPPORT_NUBERT_PROTOCOL == 1 || IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || IRSND_SUPPORT_FDC_PROTOCOL == 1 || IRSND_SUPPORT_RCCAR_PROTOCOL == 1\r
+    IRSND_SUPPORT_NUBERT_PROTOCOL == 1 || IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || IRSND_SUPPORT_FDC_PROTOCOL == 1 || IRSND_SUPPORT_RCCAR_PROTOCOL == 1 ||   \\r
+    IRSND_SUPPORT_JVC_PROTOCOL == 1\r
                 {\r
                     if (pulse_counter == 0)\r
                     {\r
index 76481e3915fca96dbea84f8b077cb82af56f8c4f..02672d3bf586b73812692db1255309b7c50cfd12 100644 (file)
Binary files a/irsnd.exe and b/irsnd.exe differ
index 5220a4a2f31b7bca0d487ff782d660cdaef0347f..33a0c967ad3fe0f5f4865b0421a7f20d4e95efa9 100644 (file)
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irsndconfig.h,v 1.10 2010/08/18 12:03:26 fm Exp $\r
+ * $Id: irsndconfig.h,v 1.12 2010/08/31 15:22:24 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
@@ -37,7 +37,8 @@
 #define IRSND_SUPPORT_KASEIKYO_PROTOCOL         1       // Kaseikyo             >= 10000                    uses ~150 bytes\r
 #define IRSND_SUPPORT_RC5_PROTOCOL              1       // RC5                  >= 10000                    uses ~150 bytes\r
 #define IRSND_SUPPORT_DENON_PROTOCOL            1       // DENON                >= 10000                    uses ~200 bytes\r
-#define IRSND_SUPPORT_RC6_PROTOCOL              0       // RC6                  NOT SUPPORTED YET!\r
+#define IRSND_SUPPORT_JVC_PROTOCOL              1       // JVC                  >= 10000                    uses ~150 bytes\r
+#define IRSND_SUPPORT_RC6_PROTOCOL              0       // RC6                  NOT SUPPORTED YET! DON'T CHANGE!\r
 #define IRSND_SUPPORT_NUBERT_PROTOCOL           1       // NUBERT               >= 10000                    uses ~100 bytes\r
 #define IRSND_SUPPORT_BANG_OLUFSEN_PROTOCOL     1       // Bang&Olufsen         >= 10000                    uses ~250 bytes\r
 #define IRSND_SUPPORT_GRUNDIG_PROTOCOL          1       // Grundig              >= 10000                    uses ~300 bytes\r
@@ -47,7 +48,6 @@
 #define IRSND_SUPPORT_SIEMENS_PROTOCOL          0       // Siemens, Gigaset     >= 15000                    uses ~150 bytes\r
 #define IRSND_SUPPORT_RECS80_PROTOCOL           0       // RECS80               >= 20000                    uses ~100 bytes\r
 #define IRSND_SUPPORT_RECS80EXT_PROTOCOL        0       // RECS80EXT            >= 20000                    uses ~100 bytes\r
-#define IRSND_SUPPORT_JVC_PROTOCOL              0       // JVC                  NOT SUPPORTED YET!\r
 \r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -82,4 +82,3 @@
 #undef IRSND_SUPPORT_RECS80EXT_PROTOCOL\r
 #define IRSND_SUPPORT_RECS80EXT_PROTOCOL        0\r
 #endif\r
-\r
diff --git a/main.c b/main.c
index cfcb8c95396746267da7d54dec552e8b359a65e0..f28cce9292ac5dac717f05087a586811c05d310b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: main.c,v 1.7 2010/06/22 08:33:21 fm Exp $\r
+ * $Id: main.c,v 1.8 2010/08/30 15:45:27 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
@@ -108,9 +108,7 @@ main (void)
   #ifdef _OPTIMIZE_SIZE_\r
   #pragma optsize+\r
   #endif\r
-  static uint8_t *Proto[]={"SIRCS","NEC","SAMSUNG","MATSUSH","KASEIKYO","RECS80","RC5(x)","DENON","RC6","SAMSG32","APPLE"};\r
-  #define IRMP_APPLE_ADDRESS 0x77E1 \r
-\r
+  static uint8_t *Proto[]={"SIRCS","NEC","SAMSUNG","MATSUSH","KASEIKYO","RECS80","RC5(x)","DENON","RC6","SAMSG32","APPLE","RECS80X","NUBERT","B&O","GRUNDIG","NOKIA","SIEMENS","FDC","RCCAR","JVC","RC6A"};\r
 \r
   #if IRMP_LOGGING == 0\r
   // USART initialization has to be done here if Logging is off\r
@@ -146,9 +144,7 @@ main (void)
         // irmp_data.address is the address/manufacturer code of ir sender\r
         // irmp_data.command is the command code\r
         #if IRMP_LOGGING != 1\r
-        if((irmp_data.protocol == IRMP_NEC_PROTOCOL) && (irmp_data.address == IRMP_APPLE_ADDRESS))\r
-          printf("Code: Apple\n");\r
-        else printf("Code: %s\n",Proto[irmp_data.protocol-1]);\r
+        printf("Code: %s\n",Proto[irmp_data.protocol-1]);\r
         printf("Address: 0x%.2X\n",irmp_data.address);\r
         printf("Command: 0x%.2X\n\n",irmp_data.command);\r
         #endif\r