summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorukw2015-05-29 08:27:04 +0000
committerukw2015-05-29 08:27:04 +0000
commitc2b70f0bf049613af736f73d9117327a5e3cf00b (patch)
tree0a92497927e0460f2705df2f39d8c1ff395f862a
parent458a6d64e3f8847f7daa9b513875d1c7d32ed4cc (diff)
downloadirmp-c2b70f0bf049613af736f73d9117327a5e3cf00b.zip
Version 2.9.2: added S100 protocol, some minor corrections
git-svn-id: svn://mikrocontroller.net/irmp@161 aeb2e35e-bfc4-4214-b83c-9e8de998ed28
-rw-r--r--README.txt4
-rw-r--r--irmp.c94
-rw-r--r--irmp.h16
-rw-r--r--irmpconfig.h5
-rw-r--r--irmpprotocols.h23
-rw-r--r--irsnd.c6
-rw-r--r--irsndconfig.h3
7 files changed, 133 insertions, 18 deletions
diff --git a/README.txt b/README.txt
index 3fd8ebb..9128b17 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,8 @@
IRMP - Infrared Multi Protocol Decoder
--------------------------------------
-Version IRMP: 2.9.1 28.05.2015
-Version IRSND: 2.9.1 28.05.2015
+Version IRMP: 2.9.2 29.05.2015
+Version IRSND: 2.9.2 29.05.2015
Dokumentation:
diff --git a/irmp.c b/irmp.c
index a75e8d7..ee462c3 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.c,v 1.174 2015/05/28 06:48:19 fm Exp $
+ * $Id: irmp.c,v 1.175 2015/05/29 08:23:56 fm Exp $
*
* Supported AVR mikrocontrollers:
*
@@ -37,6 +37,7 @@
#endif
#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
+ IRMP_SUPPORT_S100_PROTOCOL == 1 || \
IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
@@ -178,6 +179,17 @@
#define RC5_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define RC5_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with S100, so keep tolerance for S100 minimal here:
+#define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
+#define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
+#else
+#define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
+#define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
+#endif
+
+#define S100_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
+#define S100_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
+
#define DENON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define DENON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
#define DENON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
@@ -579,6 +591,7 @@ static const char proto_samsung48[] PROGMEM = "SAMSG48";
static const char proto_merlin[] PROGMEM = "MERLIN";
static const char proto_pentax[] PROGMEM = "PENTAX";
static const char proto_fan[] PROGMEM = "FAN";
+static const char proto_s100[] PROGMEM = "S100";
static const char proto_radio1[] PROGMEM = "RADIO1";
@@ -630,6 +643,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM =
proto_merlin,
proto_pentax,
proto_fan,
+ proto_s100,
proto_radio1
};
@@ -1261,6 +1275,31 @@ static const PROGMEM IRMP_PARAMETER rc5_param =
#endif
+#if IRMP_SUPPORT_S100_PROTOCOL == 1
+
+static const PROGMEM IRMP_PARAMETER s100_param =
+{
+ IRMP_S100_PROTOCOL, // protocol: ir protocol
+ S100_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
+ S100_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
+ S100_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
+ S100_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
+ 0, // pulse_0_len_min: here: not used
+ 0, // pulse_0_len_max: here: not used
+ 0, // pause_0_len_min: here: not used
+ 0, // pause_0_len_max: here: not used
+ S100_ADDRESS_OFFSET, // address_offset: address offset
+ S100_ADDRESS_OFFSET + S100_ADDRESS_LEN, // address_end: end of address
+ S100_COMMAND_OFFSET, // command_offset: command offset
+ S100_COMMAND_OFFSET + S100_COMMAND_LEN, // command_end: end of command
+ S100_COMPLETE_DATA_LEN, // complete_len: complete length of frame
+ S100_STOP_BIT, // stop_bit: flag: frame has stop bit
+ S100_LSB, // lsb_first: flag: LSB first
+ S100_FLAGS // flags: some flags
+};
+
+#endif
+
#if IRMP_SUPPORT_DENON_PROTOCOL == 1
static const PROGMEM IRMP_PARAMETER denon_param =
@@ -1870,11 +1909,11 @@ static const PROGMEM IRMP_PARAMETER radio1_param =
#endif
-static uint_fast8_t irmp_bit; // current bit position
-static IRMP_PARAMETER irmp_param;
+static uint_fast8_t irmp_bit; // current bit position
+static IRMP_PARAMETER irmp_param;
#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
-static IRMP_PARAMETER irmp_param2;
+static IRMP_PARAMETER irmp_param2;
#endif
static volatile uint_fast8_t irmp_ir_detected = FALSE;
@@ -2030,6 +2069,12 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
rtc = TRUE;
break;
#endif
+#if IRMP_SUPPORT_S100_PROTOCOL == 1
+ case IRMP_S100_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
@@ -2378,7 +2423,7 @@ irmp_ISR (void)
static uint_fast16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition
static uint_fast16_t denon_repetition_len = 0xFFFF; // denon repetition len of 2nd auto generated frame
#endif
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
static uint_fast8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit
#endif
#if IRMP_SUPPORT_MANCHESTER == 1
@@ -2451,7 +2496,7 @@ irmp_ISR (void)
#endif
irmp_bit = 0xff;
irmp_pause_time = 1; // 1st pause: set to 1, not to 0!
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
rc5_cmd_bit6 = 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
#endif
}
@@ -2747,6 +2792,37 @@ irmp_ISR (void)
else
#endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
+#if IRMP_SUPPORT_S100_PROTOCOL == 1
+ if (((irmp_pulse_time >= S100_START_BIT_LEN_MIN && irmp_pulse_time <= S100_START_BIT_LEN_MAX) ||
+ (irmp_pulse_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX)) &&
+ ((irmp_pause_time >= S100_START_BIT_LEN_MIN && irmp_pause_time <= S100_START_BIT_LEN_MAX) ||
+ (irmp_pause_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX)))
+ { // it's S100
+#ifdef ANALYZE
+ ANALYZE_PRINTF ("protocol = S100, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
+ S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX,
+ 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX,
+ S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX,
+ 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX);
+#endif // ANALYZE
+
+ irmp_param_p = (IRMP_PARAMETER *) &s100_param;
+ last_pause = irmp_pause_time;
+
+ if ((irmp_pulse_time > S100_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX) ||
+ (irmp_pause_time > S100_START_BIT_LEN_MAX && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX))
+ {
+ last_value = 0;
+ rc5_cmd_bit6 = 1<<6;
+ }
+ else
+ {
+ last_value = 1;
+ }
+ }
+ else
+#endif // IRMP_SUPPORT_S100_PROTOCOL == 1
+
#if IRMP_SUPPORT_RC5_PROTOCOL == 1
if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||
(irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&
@@ -4494,6 +4570,12 @@ irmp_ISR (void)
irmp_tmp_command |= rc5_cmd_bit6; // store bit 6
}
#endif
+#if IRMP_SUPPORT_S100_PROTOCOL == 1
+ if (irmp_param.protocol == IRMP_S100_PROTOCOL)
+ {
+ irmp_tmp_command |= rc5_cmd_bit6; // store bit 6
+ }
+#endif
irmp_command = irmp_tmp_command; // store command
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
diff --git a/irmp.h b/irmp.h
index 74a54f3..8e906e0 100644
--- a/irmp.h
+++ b/irmp.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.h,v 1.94 2015/05/07 06:51:10 fm Exp $
+ * $Id: irmp.h,v 1.95 2015/05/29 08:23:56 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
@@ -96,6 +96,20 @@
# define IRMP_SUPPORT_ORTEK_PROTOCOL 0
#endif
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_S100_PROTOCOL == 1
+# warning RC5 protocol conflicts wih S100, please enable only one of both protocols
+# warning S100 protocol disabled
+# undef IRMP_SUPPORT_S100_PROTOCOL
+# define IRMP_SUPPORT_S100_PROTOCOL 0
+#endif
+
+#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1 && IRMP_SUPPORT_FAN_PROTOCOL == 1
+# warning NUBERT protocol conflicts wih FAN, please enable only one of both protocols
+# warning FAN protocol disabled
+# undef IRMP_SUPPORT_FAN_PROTOCOL
+# define IRMP_SUPPORT_FAN_PROTOCOL 0
+#endif
+
#if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1
# warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols
# warning ORTEK protocol disabled
diff --git a/irmpconfig.h b/irmpconfig.h
index 3f87fd7..2bbc42e 100644
--- a/irmpconfig.h
+++ b/irmpconfig.h
@@ -6,7 +6,7 @@
* Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
* Extensions for PIC 12F1820 W.Strobl 2014-07-20
*
- * $Id: irmpconfig.h,v 1.130 2015/05/28 06:46:49 fm Exp $
+ * $Id: irmpconfig.h,v 1.132 2015/05/29 08:24:37 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
@@ -72,7 +72,7 @@
#define IRMP_SUPPORT_BOSE_PROTOCOL 0 // BOSE >= 10000 ~150 bytes
#define IRMP_SUPPORT_KATHREIN_PROTOCOL 0 // Kathrein >= 10000 ~200 bytes
#define IRMP_SUPPORT_NUBERT_PROTOCOL 0 // NUBERT >= 10000 ~50 bytes
-#define IRMP_SUPPORT_FAN_PROTOCOL 1 // FAN (ventilator) >= 10000 ~50 bytes
+#define IRMP_SUPPORT_FAN_PROTOCOL 0 // FAN (ventilator) >= 10000 ~50 bytes
#define IRMP_SUPPORT_SPEAKER_PROTOCOL 0 // SPEAKER (~NUBERT) >= 10000 ~50 bytes
#define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 0 // Bang & Olufsen >= 10000 ~200 bytes
#define IRMP_SUPPORT_RECS80_PROTOCOL 0 // RECS80 (SAA3004) >= 15000 ~50 bytes
@@ -93,6 +93,7 @@
#define IRMP_SUPPORT_SAMSUNG48_PROTOCOL 0 // Samsung48 >= 10000 ~100 bytes (SAMSUNG must be enabled!)
#define IRMP_SUPPORT_MERLIN_PROTOCOL 0 // Merlin >= 15000 (better 20000) ~300 bytes
#define IRMP_SUPPORT_PENTAX_PROTOCOL 0 // Pentax >= 10000 ~150 bytes
+#define IRMP_SUPPORT_S100_PROTOCOL 0 // S100 >= 10000 ~250 bytes
#define IRMP_SUPPORT_RADIO1_PROTOCOL 0 // RADIO, e.g. TEVION >= 10000 ~250 bytes (experimental)
/*---------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/irmpprotocols.h b/irmpprotocols.h
index 33de666..515c895 100644
--- a/irmpprotocols.h
+++ b/irmpprotocols.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 2013-2015 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmpprotocols.h,v 1.34 2015/05/28 06:46:49 fm Exp $
+ * $Id: irmpprotocols.h,v 1.35 2015/05/29 08:23:56 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
@@ -69,9 +69,10 @@
#define IRMP_MERLIN_PROTOCOL 42 // Merlin (Pollin 620 185)
#define IRMP_PENTAX_PROTOCOL 43 // Pentax camera
#define IRMP_FAN_PROTOCOL 44 // FAN (ventilator), very similar to NUBERT, but last bit is data bit instead of stop bit
-#define IRMP_RADIO1_PROTOCOL 45 // Radio protocol (experimental status), do not use it yet!
+#define IRMP_S100_PROTOCOL 45 // very similar to RC5, but 14 instead of 13 data bits
+#define IRMP_RADIO1_PROTOCOL 46 // Radio protocol (experimental status), do not use it yet!
-#define IRMP_N_PROTOCOLS 45 // number of supported protocols
+#define IRMP_N_PROTOCOLS 46 // number of supported protocols
/*---------------------------------------------------------------------------------------------------------------------------------------------------
* timing constants:
@@ -276,6 +277,22 @@ typedef uint8_t PAUSE_LEN;
#define RC5_FLAGS IRMP_PARAM_FLAG_IS_MANCHESTER // flags
/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * S100: very similar to RC5, but 14 insted of 13 bits
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#define S100_BIT_TIME 889.0e-6 // 889 usec pulse/pause
+#define S100_FRAME_REPEAT_PAUSE_TIME 88.9e-3 // frame repeat after 88.9ms
+
+#define S100_ADDRESS_OFFSET 1 // skip 1 bit (2nd start)
+#define S100_ADDRESS_LEN 6 // read 1 toggle bit (for key repetition detection) + 5 address bits
+#define S100_COMMAND_OFFSET 7 // skip 5 bits (2nd start + 1 toggle + 5 address)
+#define S100_COMMAND_LEN 7 // read 7 command bits
+#define S100_COMPLETE_DATA_LEN 14 // complete length
+#define S100_STOP_BIT 0 // has no stop bit
+#define S100_LSB 0 // MSB...LSB
+#define S100_FLAGS IRMP_PARAM_FLAG_IS_MANCHESTER // flags
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
* DENON:
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
diff --git a/irsnd.c b/irsnd.c
index e477e4d..923a30a 100644
--- a/irsnd.c
+++ b/irsnd.c
@@ -13,7 +13,7 @@
* ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284, ATmega1284P
* ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
*
- * $Id: irsnd.c,v 1.88 2015/05/27 09:33:14 fm Exp $
+ * $Id: irsnd.c,v 1.89 2015/05/29 08:23:56 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
@@ -145,7 +145,7 @@
# define IRSND_BIT_NUMBER 2
# endif // IRSND_OCx
-#elif defined (__AVR_ATxmega128A1U__) // ATxmega128A1U
+#elif defined (__AVR_XMEGA__) // ATxmega
# if IRSND_OCx == IRSND_XMEGA_OC0A
# define IRSND_BIT_NUMBER 0
# elif IRSND_OCx == IRSND_XMEGA_OC0B
@@ -159,7 +159,7 @@
# elif IRSND_OCx == IRSND_XMEGA_OC1B
# define IRSND_BIT_NUMBER 5
# else
-# error Wrong value for IRSND_OCx, choose IRSND_OC0, IRSND_OC1A, or IRSND_OC1B in irsndconfig.h
+# error Wrong value for IRSND_OCx, choose IRSND_XMEGA_OC0A, IRSND_XMEGA_OC0B, IRSND_XMEGA_OC0C, IRSND_XMEGA_OC0D, IRSND_XMEGA_OC1A, or IRSND_XMEGA_OC1B in irsndconfig.h
# endif // IRSND_OCx
#elif defined (PIC_C18) //Microchip C18 compiler
diff --git a/irsndconfig.h b/irsndconfig.h
index a42eacd..e661f37 100644
--- a/irsndconfig.h
+++ b/irsndconfig.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 2010-2015 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irsndconfig.h,v 1.71 2015/05/28 06:46:49 fm Exp $
+ * $Id: irsndconfig.h,v 1.73 2015/05/29 08:24:37 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
@@ -82,6 +82,7 @@
#define IRSND_SUPPORT_LGAIR_PROTOCOL 0 // LG Air Condition >= 10000 ~150 bytes.
#define IRSND_SUPPORT_SAMSUNG48_PROTOCOL 0 // Samsung48 >= 10000 ~100 bytes
#define IRSND_SUPPORT_PENTAX_PROTOCOL 0 // Pentax >= 10000 ~150 bytes
+#define IRSND_SUPPORT_S100_PROTOCOL 0 // S100 >= 10000 ~150 bytes
/*---------------------------------------------------------------------------------------------------------------------------------------------------