summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorukw2011-08-16 07:54:28 +0000
committerukw2011-08-16 07:54:28 +0000
commit03780b34ba14fb64f369e677a2548ac2b130cccd (patch)
tree52e53a53086e79fd0fbd705c42a191f700020700
parent63b94f48a1be836c6b63f502929c356e31b67f19 (diff)
downloadirmp-03780b34ba14fb64f369e677a2548ac2b130cccd.zip
improved key repetition detection for RC5
git-svn-id: svn://mikrocontroller.net/irmp@74 aeb2e35e-bfc4-4214-b83c-9e8de998ed28
-rw-r--r--irmp.c17
-rw-r--r--irmp.h8
-rw-r--r--irmpconfig.h2
3 files changed, 18 insertions, 9 deletions
diff --git a/irmp.c b/irmp.c
index 130a5ce..3309a4c 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.c,v 1.104 2011/05/22 21:40:52 fm Exp $
+ * $Id: irmp.c,v 1.106 2011/08/16 07:51:19 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -1621,6 +1621,12 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
}
break;
#endif
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1
+ case IRMP_RC5_PROTOCOL:
+ irmp_address &= ~0x20; // clear toggle bit
+ rtc = TRUE;
+ break;
+#endif
#if IRMP_SUPPORT_IR60_PROTOCOL == 1
case IRMP_IR60_PROTOCOL:
if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
@@ -3328,7 +3334,10 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
irmp_address = irmp_tmp_address; // store address
#if IRMP_SUPPORT_NEC_PROTOCOL == 1
- last_irmp_address = irmp_tmp_address; // store as last address, too
+ if (irmp_param.protocol == IRMP_NEC_PROTOCOL)
+ {
+ last_irmp_address = irmp_tmp_address; // store as last address, too
+ }
#endif
#if IRMP_SUPPORT_RC5_PROTOCOL == 1
@@ -3347,8 +3356,8 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
if (irmp_ir_detected)
{
- if (last_irmp_command == irmp_command &&
- last_irmp_address == irmp_address &&
+ if (last_irmp_command == irmp_tmp_command &&
+ last_irmp_address == irmp_tmp_address &&
repetition_len < IRMP_KEY_REPETITION_LEN)
{
irmp_flags |= IRMP_FLAG_REPETITION;
diff --git a/irmp.h b/irmp.h
index ed43178..6198263 100644
--- a/irmp.h
+++ b/irmp.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.h,v 1.62 2011/05/20 09:31:25 fm Exp $
+ * $Id: irmp.h,v 1.64 2011/08/16 07:51:19 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -206,8 +206,8 @@ typedef uint8_t PAUSE_LEN;
#define RC5_BIT_TIME 889.0e-6 // 889 usec pulse/pause
#define RC5_FRAME_REPEAT_PAUSE_TIME 45.0e-3 // frame repeat after 45ms
-#define RC5_ADDRESS_OFFSET 2 // skip 2 bits (2nd start + 1 toggle)
-#define RC5_ADDRESS_LEN 5 // read 5 address bits
+#define RC5_ADDRESS_OFFSET 1 // skip 1 bit (2nd start)
+#define RC5_ADDRESS_LEN 6 // read 1 toggle bit (for key repetition detection) + 5 address bits
#define RC5_COMMAND_OFFSET 7 // skip 5 bits (2nd start + 1 toggle + 5 address)
#define RC5_COMMAND_LEN 6 // read 6 command bits
#define RC5_COMPLETE_DATA_LEN 13 // complete length
@@ -401,7 +401,7 @@ typedef uint8_t PAUSE_LEN;
#define NIKON_START_BIT_PULSE_TIME 2200.0e-6 // 2200 usec pulse
#define NIKON_START_BIT_PAUSE_TIME 27100.0e-6 // 27100 usec pause
-#define NIKON_PULSE_TIME 500.0e-6 // 520 usec pulse
+#define NIKON_PULSE_TIME 500.0e-6 // 500 usec pulse
#define NIKON_1_PAUSE_TIME 3500.0e-6 // 3500 usec pause
#define NIKON_0_PAUSE_TIME 1500.0e-6 // 1500 usec pause
#define NIKON_FRAME_REPEAT_PAUSE_TIME 60.0e-3 // frame repeat after 60ms
diff --git a/irmpconfig.h b/irmpconfig.h
index 8c7af33..457b369 100644
--- a/irmpconfig.h
+++ b/irmpconfig.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmpconfig.h,v 1.69 2011/05/20 09:31:25 fm Exp $
+ * $Id: irmpconfig.h,v 1.71 2011/08/16 07:32:39 fm Exp $
*
* ATMEGA88 @ 8 MHz
*