summaryrefslogtreecommitdiff
path: root/irmp.c
diff options
context:
space:
mode:
authorukw2012-07-11 13:14:36 +0000
committerukw2012-07-11 13:14:36 +0000
commit3a7e26e1f87a0e738f763d2df005d5da1690696d (patch)
treed48381acd034c546fb3e9af6010bbb17b6c85701 /irmp.c
parent21a4e0eeeb70b7312cc252d8b471dd24663151e5 (diff)
downloadirmp-3a7e26e1f87a0e738f763d2df005d5da1690696d.zip
Version 2.2.4: added BOSE protocol
git-svn-id: svn://mikrocontroller.net/irmp@103 aeb2e35e-bfc4-4214-b83c-9e8de998ed28
Diffstat (limited to 'irmp.c')
-rw-r--r--irmp.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/irmp.c b/irmp.c
index 136662d..5cd0c72 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.c,v 1.125 2012/06/18 09:00:45 fm Exp $
+ * $Id: irmp.c,v 1.127 2012/07/11 13:13:50 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -165,8 +165,14 @@
#define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
+
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
+#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
+#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
+#else
#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
+#endif
#define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
@@ -354,6 +360,18 @@
#define LEGO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
#define LEGO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+#define BOSE_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define BOSE_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define BOSE_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define BOSE_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define BOSE_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define BOSE_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define BOSE_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define BOSE_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define BOSE_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
+#define BOSE_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
+#define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * 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
@@ -413,7 +431,8 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =
"NEC16",
"NEC42",
"LEGO",
- "THOMSON"
+ "THOMSON",
+ "BOSE"
};
#endif
@@ -1194,6 +1213,31 @@ static const PROGMEM IRMP_PARAMETER thomson_param =
#endif
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1
+
+static const PROGMEM IRMP_PARAMETER bose_param =
+{
+ IRMP_BOSE_PROTOCOL, // protocol: ir protocol
+ BOSE_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
+ BOSE_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
+ BOSE_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
+ BOSE_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
+ BOSE_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
+ BOSE_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
+ BOSE_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
+ BOSE_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
+ BOSE_ADDRESS_OFFSET, // address_offset: address offset
+ BOSE_ADDRESS_OFFSET + BOSE_ADDRESS_LEN, // address_end: end of address
+ BOSE_COMMAND_OFFSET, // command_offset: command offset
+ BOSE_COMMAND_OFFSET + BOSE_COMMAND_LEN, // command_end: end of command
+ BOSE_COMPLETE_DATA_LEN, // complete_len: complete length of frame
+ BOSE_STOP_BIT, // stop_bit: flag: frame has stop bit
+ BOSE_LSB, // lsb_first: flag: LSB first
+ BOSE_FLAGS // flags: some flags
+};
+
+#endif
+
static uint8_t irmp_bit; // current bit position
static IRMP_PARAMETER irmp_param;
@@ -1301,6 +1345,15 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
}
break;
#endif
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1
+ case IRMP_BOSE_PROTOCOL:
+ if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
+ {
+ irmp_command &= 0xff;
+ rtc = TRUE;
+ }
+ break;
+#endif
#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
case IRMP_SIEMENS_PROTOCOL:
case IRMP_RUWIDO_PROTOCOL:
@@ -1957,6 +2010,18 @@ irmp_ISR (void)
else
#endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1
+ if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&
+ irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)
+ {
+ ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
+ BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX,
+ BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX);
+ irmp_param_p = (IRMP_PARAMETER *) &bose_param;
+ }
+ else
+#endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
+
#if IRMP_SUPPORT_RC6_PROTOCOL == 1
if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&
irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)