summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorukw2010-08-28 22:42:29 +0000
committerukw2010-08-28 22:42:29 +0000
commit770a1a9d7a8e23b224c1fbb84c9fd34e08abe3c7 (patch)
tree7206045109316b1195386820953a58330923fa01
parentb38ca40b6e723a27fdd413b2d0f068259e984a77 (diff)
downloadirmp-770a1a9d7a8e23b224c1fbb84c9fd34e08abe3c7.zip
Version 1.7.3: better support of Kaseikyo and Apple remote controls
git-svn-id: svn://mikrocontroller.net/irmp@44 aeb2e35e-bfc4-4214-b83c-9e8de998ed28
-rw-r--r--IR-Data/Panasonic-Blue-Ray.txt2
-rw-r--r--IR-Data/test-suite.sh2
-rw-r--r--README.txt4
-rw-r--r--irmp.c133
-rw-r--r--irmp.exebin19968 -> 25088 bytes
-rw-r--r--irmp.h25
-rw-r--r--irmpconfig.h25
-rw-r--r--irsnd.c60
-rw-r--r--irsndconfig.h8
9 files changed, 225 insertions, 34 deletions
diff --git a/IR-Data/Panasonic-Blue-Ray.txt b/IR-Data/Panasonic-Blue-Ray.txt
index f26d35d..af9ef9f 100644
--- a/IR-Data/Panasonic-Blue-Ray.txt
+++ b/IR-Data/Panasonic-Blue-Ray.txt
@@ -2,7 +2,7 @@
00000000000000000000000000000000000001111111111111111000000111000000111111111110000001110000001110000001110000011100000011100000011100000011100000111100000111000000111000000111000000111111111111000001110000001110000001110000011110000011110000011100000011111111111100000111111111111100000111000000111111111111000001111000001110000001110000001110000011110000011110000011110000011100000011111111111100000111100000111111111111000000111111111111000001111111111110000001111111111110000011110000011110000011111111111100000111100000111111111111100000111111111111000001111000001111000001111000001111111111110000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000011111111111111110000011110000011111111111100000011100000011100000111100000111100000111100000111000000111000001111000001111000001111000001110000001111111111110000011110000011110000011100000111100000111100000111100000111111111111000001111111111111000001111000001111111111110000011110000011110000011110000011110000011100000111100000111100000111100000111111111111000001111000001111111111111000001111111111110000011111111111110000011111111111100000111100000111100000111111111111100000111000001111111111111000001111111111111000001110000011110000011110000011111111111110000011111111111111111
# Power
00000000000000000000000000000000000011111111111111110000001110000001111111111100000011100000011100000011100000011100000111000000111000000111000000111000001111000001110000001110000001111111111110000011110000011100000011100000011100000111100000111100000111111111111000000111111111111000001110000001111111111110000011110000011110000011100000011100000011100000111100000111100000111100000111111111111000001111000001111111111110000001111111111110000011111111111110000011111111111100000111100000111100000111111111111000000111000001111111111111000001111111111111000001110000011110000011110000011111111111110000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000111111111111111100000011100000111111111111100000111000000111000000111000001111000001111000001111000001110000001110000011110000011110000011110000011111111111100000111100000111100000111100000111000001111000001111000001111111111111000001111111111110000011110000011111111111110000011100000111100000111100000111100000111100000111000001111000001111000001111111111111000001110000011111111111110000011111111111100000011111111111100000111111111111100000111000001111000001111111111111000001111000001111111111110000011111111111110000011110000011100000111100000111111111111100000111111111111111111
-# Power (laenger gedrueckt)
+# Power (TV?) (laenger gedrueckt)
0000000000000000000000000000000000000111111111111111100000011100000011111111111000000111000000111000000111000001110000001110000001110000001110000011110000011100000011100000011100000111111111111100000111000000111000000111000001111000001110000001110000001110000011110000011110000011111111111100000011100000111100000111100000111100000111000000111000001111000001111000001111111111110000001110000011111111111110000011111111111100000111111111111100000111111111111000000111000001111000001111111111111000001111000001111111111110000011111111111110000011111111111100000111111111111100000111100000111111111111000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111000000111000001111111111110000001110000001110000011110000011110000011110000011100000011100000111100000111100000111100000111000000111111111111000001111000001111000001110000011110000011110000011110000011110000011100000111100000111111111111100000111100000111000001111000001111000001111000001111000001110000011110000011111111111110000011110000011111111111100000111111111111100000111111111111000001111111111111000001111000001110000001111111111110000011110000011111111111100000111111111111100000111111111111100000111111111111000001111000001111111111111000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000011111111111111110000001110000011111111111110000011110000011110000011100000111100000111100000111100000111100000111000001111000001111000001111000001111111111110000011110000011110000011110000011110000011100000111100000111100000111100000111100000111111111111000001111000001111000001110000011110000011110000011110000011110000011100000111111111111100000111100000111111111111000001111111111111000001111111111111000001111111111110000011110000011110000011111111111100000111100000111111111111100000111111111111000001111111111111000001111111111110000001110000011111111111110000011111111111111111111
# Taste 1
000000000000000000000000000000000000011111111111111100000011100000011111111111100000011000000111000000111000000111000000111000001110000001110000001110000001110000011110000011100000011111111111100000011100000111100000111000000111000000111000001111000001111111111110000001111111111110000011110000011111111111100000011100000011100000111100000111100000111100000111000001111000001111000001111000001111000001110000011110000011111111111110000011110000011100000111100000111100000111100000111000000111000001111000001111111111111000001110000001111111111110000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000011111111111111110000011110000011111111111100000011100000111100000111100000111100000111000000111000001111000001111000001111000001110000011110000011111111111110000011110000011100000111100000111100000111100000111100000111111111111000001111111111111000001111000001111111111110000011110000011110000011110000011100000111100000111100000111100000111100000111000001111000001111000001111000001111111111110000011110000011110000011110000011100000111100000111100000111100000111100000111111111111000001111000001111111111111000001111111111111111111
diff --git a/IR-Data/test-suite.sh b/IR-Data/test-suite.sh
index 840b7ac..53585ed 100644
--- a/IR-Data/test-suite.sh
+++ b/IR-Data/test-suite.sh
@@ -43,10 +43,12 @@ for j in \
Sony_Bravia_RM-ED0009_new.txt \
Yamaha-RAV388.txt \
apple.txt \
+ apple-unibody-remote.txt \
bo_beolink1000-10kHz.txt \
denon.txt \
elta_radio.txt \
fdc.txt \
+ jvc.txt \
nec-repetition.txt \
nec-skymaster-dt500.txt \
nec.txt \
diff --git a/README.txt b/README.txt
index 36d8795..e065ac2 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,8 @@
IRMP - Infrared Multi Protocol Decoder
--------------------------------------
-Version IRMP: 1.7.2 01.07.2010
-Version IRSND: 1.7.2 01.07.2010
+Version IRMP: 1.7.3 29.08.2010
+Version IRSND: 1.7.3 29.08.2010
Dokumentation:
diff --git a/irmp.c b/irmp.c
index 861836c..4077f54 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.75 2010/07/01 09:00:16 fm Exp $
+ * $Id: irmp.c,v 1.79 2010/08/28 22:14:56 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -439,9 +439,9 @@ typedef uint8_t PAUSE_LEN;
#define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
#define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
-#define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_60 + 0.5) + 1)
-#define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
-#define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
+#define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
+#define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
#define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)
#define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
@@ -566,6 +566,19 @@ typedef uint8_t PAUSE_LEN;
#define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
#define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
+#define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+#define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
+#define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_40 + 0.5) - 1) // HACK!
+#define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
+#define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+#define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
+#define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+#define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
+#define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+// autodetect JVC repetition frame within 50 msec:
+#define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
+
#define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!
#ifdef ANALYZE
@@ -1257,11 +1270,12 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
irmp_command &= 0xff;
rtc = TRUE;
}
- else if ((irmp_command & 0xFF00) == 0xD100)
+ else if (irmp_address == 0x87EE)
{
ANALYZE_PRINTF ("Switching to APPLE protocol\n");
irmp_protocol = IRMP_APPLE_PROTOCOL;
- irmp_command &= 0xff;
+ irmp_address = (irmp_command & 0xFF00) >> 8;
+ irmp_command &= 0x00FF;
rtc = TRUE;
}
break;
@@ -1300,19 +1314,22 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
}
// these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
-static uint16_t irmp_tmp_address; // ir address
-static uint16_t irmp_tmp_command; // ir command
+static uint16_t irmp_tmp_address; // ir address
+static uint16_t irmp_tmp_command; // ir command
#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
-static uint16_t irmp_tmp_address2; // ir address
-static uint16_t irmp_tmp_command2; // ir command
+static uint16_t irmp_tmp_address2; // ir address
+static uint16_t irmp_tmp_command2; // ir command
#endif
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)
+static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)
+#endif
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
+static uint8_t xor_check[6]; // check kaseikyo "parity" bits
#endif
-static uint8_t irmp_bit; // current bit position
+static uint8_t irmp_bit; // current bit position
/*---------------------------------------------------------------------------------------------------------------------------------------------------
* store bit
@@ -1326,6 +1343,7 @@ static uint8_t irmp_bit;
static void
irmp_store_bit (uint8_t value)
{
+
if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)
{
if (irmp_param.lsb_first)
@@ -1350,12 +1368,34 @@ irmp_store_bit (uint8_t value)
irmp_tmp_command |= value;
}
}
+
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
else if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)
{
irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first
}
#endif
+
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
+ else if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit >= 20 && irmp_bit < 24)
+ {
+ irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8)); // store 4 system bits in upper nibble with LSB first
+ }
+
+ if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)
+ {
+ if (value)
+ {
+ xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);
+ }
+ else
+ {
+ xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));
+ }
+ }
+
+#endif
+
irmp_bit++;
}
@@ -1513,6 +1553,19 @@ irmp_ISR (void)
else
#endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1
+ if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame
+ irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&
+ irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)
+ {
+ ANALYZE_PRINTF ("protocol = NEC or JVC repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
+ JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,
+ JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);
+ irmp_param_p = (IRMP_PARAMETER *) &nec_param; // tricky: use nec parameters
+ }
+ else
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
+
#if IRMP_SUPPORT_NEC_PROTOCOL == 1
if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
@@ -1967,6 +2020,18 @@ irmp_ISR (void)
{
irmp_bit++;
}
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1
+ else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit
+ {
+ ANALYZE_PRINTF ("Switching to JVC protocol\n");
+ irmp_param.stop_bit = TRUE; // set flag
+ irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol
+ irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
+ irmp_tmp_command = (irmp_tmp_address >> 4); // set command: upper 12 bits are command bits
+ irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits
+ irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...
+ }
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
else
{
ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);
@@ -2333,6 +2398,17 @@ irmp_ISR (void)
else
#endif
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
+ // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
+ if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)
+ {
+ ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
+ repetition_frame_number + 1, repetition_counter, AUTO_FRAME_REPETITION_LEN);
+ repetition_counter = 0;
+ }
+ else
+#endif
+
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
// if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))
@@ -2417,6 +2493,32 @@ irmp_ISR (void)
}
}
#endif // IRMP_SUPPORT_NEC_PROTOCOL
+
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
+ if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)
+ {
+ uint8_t xor;
+ // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
+ // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);
+
+ xor = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);
+
+ if (xor != (xor_check[2] & 0x0F))
+ {
+ ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check[2] & 0x0F);
+ irmp_ir_detected = FALSE;
+ }
+
+ xor = xor_check[2] ^ xor_check[3] ^ xor_check[4];
+
+ if (xor != xor_check[5])
+ {
+ ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]);
+ irmp_ir_detected = FALSE;
+ }
+ }
+#endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
+
irmp_protocol = irmp_param.protocol;
#if IRMP_SUPPORT_FDC_PROTOCOL == 1
@@ -2477,6 +2579,13 @@ irmp_ISR (void)
irmp_tmp_command = 0;
irmp_pulse_time = 0;
irmp_pause_time = 0;
+
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1
+ if (irmp_protocol == IRMP_JVC_PROTOCOL) // the stop bit of JVC frame is also start bit of next frame
+ { // set pulse time here!
+ irmp_pulse_time = ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));
+ }
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
}
}
}
diff --git a/irmp.exe b/irmp.exe
index 8c536cc..808c9e2 100644
--- a/irmp.exe
+++ b/irmp.exe
Binary files differ
diff --git a/irmp.h b/irmp.h
index 5035f37..c8c709a 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.39 2010/06/25 13:18:36 fm Exp $
+ * $Id: irmp.h,v 1.41 2010/08/18 12:03:26 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -45,6 +45,7 @@ extern "C"
#define IRMP_SIEMENS_PROTOCOL 17 // Siemens, e.g. Gigaset
#define IRMP_FDC_PROTOCOL 18 // FDC keyboard
#define IRMP_RCCAR_PROTOCOL 19 // RC Car
+#define IRMP_JVC_PROTOCOL 20 // JVC
// some flags of struct IRMP_PARAMETER:
#define IRMP_PARAM_FLAG_IS_MANCHESTER 0x01
@@ -128,7 +129,8 @@ extern "C"
#define KASEIKYO_PULSE_TIME 423.0e-6 // 525 usec pulse
#define KASEIKYO_1_PAUSE_TIME 1269.0e-6 // 525 usec pause
#define KASEIKYO_0_PAUSE_TIME 423.0e-6 // 1690 usec pause
-#define KASEIKYO_FRAME_REPEAT_PAUSE_TIME 45.0e-3 // frame repeat after 45ms
+#define KASEIKYO_AUTO_REPETITION_PAUSE_TIME 74.0e-3 // repetition after 74 ms
+#define KASEIKYO_FRAME_REPEAT_PAUSE_TIME 74.0e-3 // frame repeat after 74 ms
#define KASEIKYO_ADDRESS_OFFSET 0 // skip 0 bits
#define KASEIKYO_ADDRESS_LEN 16 // read 16 address bits
#define KASEIKYO_COMMAND_OFFSET 28 // skip 28 bits (16 manufacturer & 4 parity & 8 genre)
@@ -136,6 +138,7 @@ extern "C"
#define KASEIKYO_COMPLETE_DATA_LEN 48 // complete length
#define KASEIKYO_STOP_BIT 1 // has stop bit
#define KASEIKYO_LSB 1 // LSB...MSB?
+#define KASEIKYO_FRAMES 2 // KASEIKYO sends 1st frame 2 times
#define KASEIKYO_FLAGS 0 // flags
#define RECS80_START_BIT_PULSE_TIME 158.0e-6 // 158 usec pulse
@@ -314,7 +317,23 @@ extern "C"
#define RCCAR_LSB 1 // LSB...MSB
#define RCCAR_FLAGS 0 // flags
-#define AUTO_FRAME_REPETITION_TIME 50.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms
+#define JVC_START_BIT_PULSE_TIME 9000.0e-6 // 9000 usec pulse
+#define JVC_START_BIT_PAUSE_TIME 4500.0e-6 // 4500 usec pause
+#define JVC_PULSE_TIME 560.0e-6 // 560 usec pulse
+#define JVC_1_PAUSE_TIME 1690.0e-6 // 1690 usec pause
+#define JVC_0_PAUSE_TIME 560.0e-6 // 560 usec pause
+#define JVC_FRAME_REPEAT_PAUSE_TIME 25.0e-3 // frame repeat after 25ms
+#define JVC_ADDRESS_OFFSET 0 // skip 0 bits
+#define JVC_ADDRESS_LEN 4 // read 4 address bits
+#define JVC_COMMAND_OFFSET 4 // skip 4 bits
+#define JVC_COMMAND_LEN 12 // read 12 bits
+#define JVC_COMPLETE_DATA_LEN 16 // complete length
+#define JVC_STOP_BIT 1 // has stop bit
+#define JVC_LSB 1 // LSB...MSB
+#define JVC_FLAGS 0 // flags
+
+#define AUTO_FRAME_REPETITION_TIME 80.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms
+ // KASEIKYO: automatic repetition after 75ms
#define TRUE 1
#define FALSE 0
diff --git a/irmpconfig.h b/irmpconfig.h
index a9b2f1b..2d26848 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.34 2010/06/26 18:11:08 fm Exp $
+ * $Id: irmpconfig.h,v 1.37 2010/08/18 12:03:26 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -47,14 +47,15 @@
#define IRMP_SUPPORT_NEC_PROTOCOL 1 // NEC + APPLE >= 10000 ~250 bytes
#define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1 // Samsung + Samsung32 >= 10000 ~250 bytes
#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 // Matsushita >= 10000 ~50 bytes
-#define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // support Kaseikyo >= 10000 ~50 bytes
-#define IRMP_SUPPORT_DENON_PROTOCOL 1 // support DENON >= 10000 ~250 bytes
-#define IRMP_SUPPORT_RC5_PROTOCOL 0 // RC5 >= 10000 ~250 bytes
-#define IRMP_SUPPORT_RC6_PROTOCOL 0 // RC6 >= 10000 ~200 bytes
-#define IRMP_SUPPORT_GRUNDIG_PROTOCOL 0 // Grundig >= 10000 ~150 bytes
-#define IRMP_SUPPORT_NOKIA_PROTOCOL 0 // Nokia >= 10000 ~150 bytes
-#define IRMP_SUPPORT_NUBERT_PROTOCOL 0 // NUBERT >= 10000 ~50 bytes
-#define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 0 // Bang & Olufsen >= 10000 ~200 bytes
+#define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // Kaseikyo >= 10000 ~250 bytes
+#define IRMP_SUPPORT_DENON_PROTOCOL 1 // DENON >= 10000 ~250 bytes
+#define IRMP_SUPPORT_JVC_PROTOCOL 1 // JVC >= 10000 ~250 bytes
+#define IRMP_SUPPORT_RC5_PROTOCOL 1 // RC5 >= 10000 ~250 bytes
+#define IRMP_SUPPORT_RC6_PROTOCOL 1 // RC6 >= 10000 ~200 bytes
+#define IRMP_SUPPORT_GRUNDIG_PROTOCOL 1 // Grundig >= 10000 ~150 bytes
+#define IRMP_SUPPORT_NOKIA_PROTOCOL 1 // Nokia >= 10000 ~150 bytes
+#define IRMP_SUPPORT_NUBERT_PROTOCOL 1 // NUBERT >= 10000 ~50 bytes
+#define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 1 // Bang & Olufsen >= 10000 ~200 bytes
#define IRMP_SUPPORT_FDC_PROTOCOL 0 // FDC3402 keyboard >= 10000 (better 15000) ~50 bytes (~400 in combination with RC5)
#define IRMP_SUPPORT_RCCAR_PROTOCOL 0 // RC Car >= 10000 (better 15000) ~150 bytes (~500 in combination with RC5)
#define IRMP_SUPPORT_SIEMENS_PROTOCOL 0 // Siemens Gigaset >= 15000 ~150 bytes
@@ -105,4 +106,10 @@
#define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0
#endif
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
+#warning JVC protocol needs also NEC protocol, NEC protocol enabled
+#undef IRMP_SUPPORT_NEC_PROTOCOL
+#define IRMP_SUPPORT_NEC_PROTOCOL 1
+#endif
+
#endif /* _WC_IRMPCONFIG_H_ */
diff --git a/irsnd.c b/irsnd.c
index 029d476..ee91c6b 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.20 2010/06/15 15:47:21 fm Exp $
+ * $Id: irsnd.c,v 1.21 2010/08/18 12:03:26 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
@@ -84,6 +84,14 @@ typedef unsigned short uint16_t;
#define MATSUSHITA_0_PAUSE_LEN (uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME + 0.5)
#define MATSUSHITA_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * MATSUSHITA_FRAME_REPEAT_PAUSE_TIME + 0.5) // use uint16_t!
+#define KASEIKYO_START_BIT_PULSE_LEN (uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME + 0.5)
+#define KASEIKYO_START_BIT_PAUSE_LEN (uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME + 0.5)
+#define KASEIKYO_PULSE_LEN (uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME + 0.5)
+#define KASEIKYO_1_PAUSE_LEN (uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME + 0.5)
+#define KASEIKYO_0_PAUSE_LEN (uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME + 0.5)
+#define KASEIKYO_AUTO_REPETITION_PAUSE_LEN (uint16_t)(F_INTERRUPTS * KASEIKYO_AUTO_REPETITION_PAUSE_TIME + 0.5) // use uint16_t!
+#define KASEIKYO_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * KASEIKYO_FRAME_REPEAT_PAUSE_TIME + 0.5) // use uint16_t!
+
#define RECS80_START_BIT_PULSE_LEN (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME + 0.5)
#define RECS80_START_BIT_PAUSE_LEN (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME + 0.5)
#define RECS80_PULSE_LEN (uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME + 0.5)
@@ -390,6 +398,29 @@ irsnd_send_data (IRMP_DATA * irmp_data_p, uint8_t do_wait)
break;
}
#endif
+#if IRSND_SUPPORT_KASEIKYO_PROTOCOL == 1
+ case IRMP_KASEIKYO_PROTOCOL:
+ {
+ uint8_t xor;
+
+ address = bitsrevervse (irmp_data_p->address, KASEIKYO_ADDRESS_LEN);
+ command = bitsrevervse (irmp_data_p->command, KASEIKYO_COMMAND_LEN + 4);
+
+ xor = ((address & 0x000F) ^ ((address & 0x00F0) >> 4) ^ ((address & 0x0F00) >> 8) ^ ((address & 0xF000) >> 12)) & 0x0F;
+
+ irsnd_buffer[0] = (address & 0xFF00) >> 8; // AAAAAAAA
+ irsnd_buffer[1] = (address & 0x00FF); // AAAAAAAA
+ irsnd_buffer[2] = xor << 4 | (command & 0x000F); // XXXXCCCC
+ irsnd_buffer[3] = 0 | (command & 0xF000) >> 12; // 0000CCCC
+ irsnd_buffer[4] = (command & 0x0FF0) >> 4; // CCCCCCCC
+
+ xor = irsnd_buffer[2] ^ irsnd_buffer[3] ^ irsnd_buffer[4];
+
+ irsnd_buffer[5] = xor;
+ irsnd_busy = TRUE;
+ break;
+ }
+#endif
#if IRSND_SUPPORT_RECS80_PROTOCOL == 1
case IRMP_RECS80_PROTOCOL:
{
@@ -743,6 +774,24 @@ irsnd_ISR (void)
break;
}
#endif
+#if IRSND_SUPPORT_KASEIKYO_PROTOCOL == 1
+ case IRMP_KASEIKYO_PROTOCOL:
+ {
+ startbit_pulse_len = KASEIKYO_START_BIT_PULSE_LEN;
+ startbit_pause_len = KASEIKYO_START_BIT_PAUSE_LEN;
+ pulse_1_len = KASEIKYO_PULSE_LEN;
+ pause_1_len = KASEIKYO_1_PAUSE_LEN;
+ pulse_0_len = KASEIKYO_PULSE_LEN;
+ pause_0_len = KASEIKYO_0_PAUSE_LEN;
+ has_stop_bit = KASEIKYO_STOP_BIT;
+ complete_data_len = KASEIKYO_COMPLETE_DATA_LEN;
+ n_auto_repetitions = (repeat_counter == 0) ? KASEIKYO_FRAMES : 1; // 2 frames auto repetition if first frame
+ auto_repetition_pause_len = KASEIKYO_AUTO_REPETITION_PAUSE_LEN; // 75 ms pause
+ repeat_frame_pause_len = KASEIKYO_FRAME_REPEAT_PAUSE_LEN;
+ irsnd_set_freq (IRSND_FREQ_38_KHZ);
+ break;
+ }
+#endif
#if IRSND_SUPPORT_RECS80_PROTOCOL == 1
case IRMP_RECS80_PROTOCOL:
{
@@ -963,6 +1012,9 @@ irsnd_ISR (void)
#if IRSND_SUPPORT_MATSUSHITA_PROTOCOL == 1
case IRMP_MATSUSHITA_PROTOCOL:
#endif
+#if IRSND_SUPPORT_KASEIKYO_PROTOCOL == 1
+ case IRMP_KASEIKYO_PROTOCOL:
+#endif
#if IRSND_SUPPORT_RECS80_PROTOCOL == 1
case IRMP_RECS80_PROTOCOL:
#endif
@@ -986,9 +1038,9 @@ irsnd_ISR (void)
#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_RCCAR_PROTOCOL == 1
+#if IRSND_SUPPORT_SIRCS_PROTOCOL == 1 || IRSND_SUPPORT_NEC_PROTOCOL == 1 || IRSND_SUPPORT_SAMSUNG_PROTOCOL == 1 || IRSND_SUPPORT_MATSUSHITA_PROTOCOL == 1 || \
+ IRSND_SUPPORT_KASEIKYO_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_RCCAR_PROTOCOL == 1
{
if (pulse_counter == 0)
{
diff --git a/irsndconfig.h b/irsndconfig.h
index cde0a90..5220a4a 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.9 2010/07/01 11:17:11 fm Exp $
+ * $Id: irsndconfig.h,v 1.10 2010/08/18 12:03:26 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -33,8 +33,8 @@
#define IRSND_SUPPORT_SIRCS_PROTOCOL 1 // Sony SIRCS >= 10000 uses ~150 bytes
#define IRSND_SUPPORT_NEC_PROTOCOL 1 // NEC + APPLE >= 10000 uses ~100 bytes
#define IRSND_SUPPORT_SAMSUNG_PROTOCOL 1 // Samsung + Samsung32 >= 10000 uses ~300 bytes
-#define IRSND_SUPPORT_MATSUSHITA_PROTOCOL 1 // Matsushita >= 10000 uses ~150 bytes
-#define IRSND_SUPPORT_KASEIKYO_PROTOCOL 0 // Kaseikyo NOT SUPPORTED YET!
+#define IRSND_SUPPORT_MATSUSHITA_PROTOCOL 1 // Matsushita >= 10000 uses ~200 bytes
+#define IRSND_SUPPORT_KASEIKYO_PROTOCOL 1 // Kaseikyo >= 10000 uses ~150 bytes
#define IRSND_SUPPORT_RC5_PROTOCOL 1 // RC5 >= 10000 uses ~150 bytes
#define IRSND_SUPPORT_DENON_PROTOCOL 1 // DENON >= 10000 uses ~200 bytes
#define IRSND_SUPPORT_RC6_PROTOCOL 0 // RC6 NOT SUPPORTED YET!
@@ -47,6 +47,8 @@
#define IRSND_SUPPORT_SIEMENS_PROTOCOL 0 // Siemens, Gigaset >= 15000 uses ~150 bytes
#define IRSND_SUPPORT_RECS80_PROTOCOL 0 // RECS80 >= 20000 uses ~100 bytes
#define IRSND_SUPPORT_RECS80EXT_PROTOCOL 0 // RECS80EXT >= 20000 uses ~100 bytes
+#define IRSND_SUPPORT_JVC_PROTOCOL 0 // JVC NOT SUPPORTED YET!
+
/*---------------------------------------------------------------------------------------------------------------------------------------------------
* Change hardware pin here: