*\r
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.46 2010/06/12 20:29:43 fm Exp $\r
+ * $Id: irmp.c,v 1.97 2011/02/25 15:24:06 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\r
*\r
* Typical manufacturers:\r
*\r
- * SIRCS - Sony\r
- * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers\r
- * SAMSUNG - Samsung\r
- * SAMSUNG32 - Samsung\r
- * MATSUSHITA - Matsushita\r
- * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")\r
- * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba\r
- * RC5 - Philips and other European manufacturers\r
- * DENON - Denon\r
- * RC6 - Philips and other European manufacturers\r
- * APPLE - Apple\r
- * NUBERT - Nubert Subwoofer System\r
- * B&O - Bang & Olufsen\r
- * PANASONIC - Panasonic (older, yet not implemented)\r
- * GRUNDIG - Grundig\r
- * NOKIA - Nokia\r
- * SIEMENS - Siemens, e.g. Gigaset M740AV\r
+ * SIRCS - Sony\r
+ * NEC - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers\r
+ * SAMSUNG - Samsung\r
+ * SAMSUNG32 - Samsung\r
+ * MATSUSHITA - Matsushita\r
+ * KASEIKYO - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")\r
+ * RECS80 - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba\r
+ * RC5 - Philips and other European manufacturers\r
+ * DENON - Denon, Sharp\r
+ * RC6 - Philips and other European manufacturers\r
+ * APPLE - Apple\r
+ * NUBERT - Nubert Subwoofer System\r
+ * B&O - Bang & Olufsen\r
+ * PANASONIC - Panasonic (older, yet not implemented)\r
+ * GRUNDIG - Grundig\r
+ * NOKIA - Nokia\r
+ * SIEMENS - Siemens, e.g. Gigaset M740AV\r
+ * FDC - FDC IR keyboard\r
+ * RCCAR - IR remote control for RC cars\r
+ * JVC - JVC\r
+ * NIKON - Nikon cameras\r
+ * RUWIDO - T-Home\r
+ * KATHREIN - Kathrein\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
* frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit\r
* data: 5 address bits + 10 command bits\r
*\r
+ * Theory:\r
+ *\r
* data "0": data "1":\r
* ------________________ ------______________\r
* 275us 775us 275us 1900us\r
*\r
+ * Practice:\r
+ *\r
+ * data "0": data "1":\r
+ * ------________________ ------______________\r
+ * 310us 745us 310us 1780us\r
+ *\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
* RC6\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
+ * SIEMENS or RUWIDO:\r
+ * ------------------\r
+ *\r
+ * SIEMENS frame: 1 start bit + 22 data bits + no stop bit\r
+ * SIEMENS data: 13 address bits + 1 repeat bit + 7 data bits + 1 unknown bit\r
+ *\r
+ * start bit data "0": data "1":\r
+ * -------_______ _______------- -------_______\r
+ * 250us 250us 250us 250us 250us 250us\r
+ *\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ *\r
* PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)\r
* -----------------------------------------------------------------------------------------\r
*\r
#include <string.h>\r
#include <inttypes.h>\r
\r
-#define DEBUG\r
+#define ANALYZE\r
#define PROGMEM\r
#define memcpy_P memcpy\r
\r
#include <string.h>\r
typedef unsigned char uint8_t;\r
typedef unsigned short uint16_t;\r
-#define DEBUG\r
+#define ANALYZE\r
#define PROGMEM\r
#define memcpy_P memcpy\r
\r
#endif // windows\r
#endif // unix\r
\r
-#include "irmp.h"\r
+#ifndef IRMP_USE_AS_LIB\r
#include "irmpconfig.h"\r
+#endif\r
+#include "irmp.h"\r
+\r
+#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1\r
+#define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1\r
+#else\r
+#define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0\r
+#endif\r
\r
-#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
-#define IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL 1\r
+#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
+#define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1\r
#else\r
-#define IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL 0\r
+#define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0\r
#endif\r
\r
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_RC6_PROTOCOL == 1 || IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 \r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_RC6_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_IR60_PROTOCOL\r
#define IRMP_SUPPORT_MANCHESTER 1\r
#else\r
#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_LEN (uint8_t)(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
+#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_IMON_PROTOCOL == 1 \r
+#define IRMP_SUPPORT_SERIAL 1\r
+#else\r
+#define IRMP_SUPPORT_SERIAL 0\r
+#endif\r
+\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
#define MAX_TOLERANCE_00 1.0 // +0%\r
#define MIN_TOLERANCE_60 0.4 // -60%\r
#define MAX_TOLERANCE_60 1.6 // +60%\r
\r
+#define MIN_TOLERANCE_70 0.3 // -70%\r
+#define MAX_TOLERANCE_70 1.7 // +70%\r
+\r
#define SIRCS_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define SIRCS_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // only 5% to avoid conflict with RC6\r
+#if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:\r
+#define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r
+#else // only 5% + 1 to avoid conflict with RC6:\r
+#define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#endif\r
#define SIRCS_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define SIRCS_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define SIRCS_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
#define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
#define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+// autodetect nec repetition frame within 50 msec:\r
+// NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms\r
+#if 0\r
+#define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#else\r
+#define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)\r
+#endif\r
\r
#define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
-#define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_60 + 0.5) + 1)\r
-#define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
-#define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define KASEIKYO_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
#define KASEIKYO_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
#define KASEIKYO_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
\r
\r
#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RC5_START_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RC5_START_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RC5_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RC5_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
#define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
+#define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)) // no -1, avoid conflict with RUWIDO\r
+#else\r
+#define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // be more tolerant\r
+#endif\r
#define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
#define RC6_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#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 RC6_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RC6_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 600 - 1400\r
+#define RC6_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // pauses: 600 - 1200\r
+#define RC6_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * RC6_BIT_TIME * MAX_TOLERANCE_60 + 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
#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // 10% is too big (uint8_t)\r
+#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((PAUSE_LEN)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // value must be below IRMP_TIMEOUT\r
#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
-#define GRUNDIG_OR_NOKIA_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define GRUNDIG_OR_NOKIA_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define GRUNDIG_OR_NOKIA_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)\r
-#define GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-\r
-#define SIEMENS_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) - 1)\r
-#define SIEMENS_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) + 1)\r
-#define SIEMENS_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) - 1)\r
-#define SIEMENS_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME * 1 + 0.5) + 1)\r
-\r
-#define FDC1_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define FDC1_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define FDC1_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define FDC1_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define FDC1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define FDC1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define FDC1_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define FDC1_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define FDC1_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define FDC1_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-\r
-#define FDC2_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define FDC2_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define FDC2_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define FDC2_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define FDC2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
-#define FDC2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
-#define FDC2_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
-#define FDC2_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
-#define FDC2_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define FDC2_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC2_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))\r
+#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME_2 * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME_2 * MAX_TOLERANCE_60 + 0.5) + 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2 ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME_2 * MAX_TOLERANCE_60 + 0.5) + 1)\r
+\r
+#define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX\r
+#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))\r
+#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r
+#define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define FDC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#if 0\r
+#define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255\r
+#else\r
+#define FDC_0_PAUSE_LEN_MIN (1) // simply use 1\r
+#endif\r
+#define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
#define RCCAR_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RCCAR_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RCCAR_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RCCAR_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define RCCAR_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define RCCAR_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define RCCAR_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define RCCAR_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+\r
+#define JVC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define JVC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#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!\r
+#define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!\r
+#define JVC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define JVC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#define JVC_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define JVC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#define JVC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
+#define JVC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+// autodetect JVC repetition frame within 50 msec:\r
+#define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+\r
+#define NIKON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_START_BIT_PAUSE_LEN_MIN ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_START_BIT_PAUSE_LEN_MAX ((uint16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define NIKON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+\r
+#define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_0_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_0_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+\r
+#define NETBOX_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define NETBOX_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define NETBOX_PULSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))\r
+#define NETBOX_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))\r
+#define NETBOX_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))\r
+#define NETBOX_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))\r
+\r
+#define IMON_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define IMON_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define IMON_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define IMON_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define IMON_PULSE_LEN ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME))\r
+#define IMON_PAUSE_LEN ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME))\r
+#define IMON_PULSE_REST_LEN ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME / 4))\r
+#define IMON_PAUSE_REST_LEN ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME / 4))\r
\r
#define AUTO_FRAME_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint16_t!\r
\r
-#ifdef DEBUG\r
-#define DEBUG_PUTCHAR(a) { if (! silent) { putchar (a); } }\r
-#define DEBUG_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }\r
-#define DEBUG_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }\r
-#define DEBUG_NEWLINE() { if (verbose) { putchar ('\n'); } }\r
+#ifdef ANALYZE\r
+#define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }\r
+#define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }\r
+#define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }\r
+#define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }\r
static int silent;\r
static int time_counter;\r
static int verbose;\r
#else\r
-#define DEBUG_PUTCHAR(a)\r
-#define DEBUG_ONLY_NORMAL_PUTCHAR(a)\r
-#define DEBUG_PRINTF(...)\r
-#define DEBUG_NEWLINE()\r
+#define ANALYZE_PUTCHAR(a)\r
+#define ANALYZE_ONLY_NORMAL_PUTCHAR(a)\r
+#define ANALYZE_PRINTF(...)\r
+#define ANALYZE_NEWLINE()\r
#endif\r
\r
#if IRMP_LOGGING == 1\r
#endif\r
#define UART0_TXEN_BIT_VALUE (1<<TXEN0)\r
#define UART0_UDR UDR0\r
+#define UART0_U2X U2X0\r
\r
#else\r
\r
#endif\r
#define UART0_TXEN_BIT_VALUE (1<<TXEN)\r
#define UART0_UDR UDR\r
+#define UART0_U2X U2X\r
\r
#endif\r
\r
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 = 0;\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
\r
#endif\r
\r
+#if IRMP_SUPPORT_NEC16_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER nec16_param =\r
+{\r
+ IRMP_NEC16_PROTOCOL, // protocol: ir protocol\r
+ NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ NEC16_ADDRESS_OFFSET, // address_offset: address offset\r
+ NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN, // address_end: end of address\r
+ NEC16_COMMAND_OFFSET, // command_offset: command offset\r
+ NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN, // command_end: end of command\r
+ NEC16_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ NEC16_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NEC16_LSB, // lsb_first: flag: LSB first\r
+ NEC16_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
\r
static PROGMEM IRMP_PARAMETER samsung_param =\r
static PROGMEM IRMP_PARAMETER rc5_param =\r
{\r
IRMP_RC5_PROTOCOL, // protocol: ir protocol\r
- RC5_BIT_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
- RC5_BIT_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
- RC5_BIT_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
- RC5_BIT_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
- 1, // pause_0_len_max: maximum length of pause with bit value 0\r
+ RC5_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ RC5_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ RC5_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ RC5_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r
+ RC5_BIT_LEN_MIN_2, // pulse_0_len_min: here: minimum length of long pulse\r
+ RC5_BIT_LEN_MAX_2, // pulse_0_len_max: here: maximum length of long pulse\r
+ RC5_BIT_LEN_MIN_2, // pause_0_len_min: here: minimum length of long pause\r
+ RC5_BIT_LEN_MAX_2, // pause_0_len_max: here: maximum length of long pause\r
RC5_ADDRESS_OFFSET, // address_offset: address offset\r
RC5_ADDRESS_OFFSET + RC5_ADDRESS_LEN, // address_end: end of address\r
RC5_COMMAND_OFFSET, // command_offset: command offset\r
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
- 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
- 1, // pause_0_len_max: maximum length of pause with bit value 0\r
+\r
+ RC6_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ RC6_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ RC6_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ RC6_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r
+ RC6_BIT_PULSE_LEN_MIN_2, // pulse_0_len_min: here: minimum length of long pulse\r
+ RC6_BIT_PULSE_LEN_MAX_2, // pulse_0_len_max: here: maximum length of long pulse\r
+ RC6_BIT_PAUSE_LEN_MIN_2, // pause_0_len_min: here: minimum length of long pause\r
+ RC6_BIT_PAUSE_LEN_MAX_2, // pause_0_len_max: here: maximum length of long pause\r
RC6_ADDRESS_OFFSET, // address_offset: address offset\r
RC6_ADDRESS_OFFSET + RC6_ADDRESS_LEN, // address_end: end of address\r
RC6_COMMAND_OFFSET, // command_offset: command offset\r
\r
#endif\r
\r
-#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
+#if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
+\r
+static uint8_t first_bit;\r
\r
static PROGMEM IRMP_PARAMETER grundig_param =\r
{\r
IRMP_GRUNDIG_PROTOCOL, // protocol: ir protocol\r
- GRUNDIG_OR_NOKIA_BIT_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
- GRUNDIG_OR_NOKIA_BIT_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
- GRUNDIG_OR_NOKIA_BIT_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
- GRUNDIG_OR_NOKIA_BIT_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
- 1, // pause_0_len_max: maximum length of pause with bit value 0\r
+\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2, // pulse_0_len_min: here: minimum length of long pulse\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2, // pulse_0_len_max: here: maximum length of long pulse\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MIN_2, // pause_0_len_min: here: minimum length of long pause\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MAX_2, // pause_0_len_max: here: maximum length of long pause\r
+\r
GRUNDIG_ADDRESS_OFFSET, // address_offset: address offset\r
GRUNDIG_ADDRESS_OFFSET + GRUNDIG_ADDRESS_LEN, // address_end: end of address\r
GRUNDIG_COMMAND_OFFSET, // command_offset: command offset\r
GRUNDIG_COMMAND_OFFSET + GRUNDIG_COMMAND_LEN + 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)\r
NOKIA_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!\r
- GRUNDIG_OR_NOKIA_STOP_BIT, // stop_bit: flag: frame has stop bit\r
- GRUNDIG_OR_NOKIA_LSB, // lsb_first: flag: LSB first\r
- GRUNDIG_OR_NOKIA_FLAGS // flags: some flags\r
+ GRUNDIG_NOKIA_IR60_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ GRUNDIG_NOKIA_IR60_LSB, // lsb_first: flag: LSB first\r
+ GRUNDIG_NOKIA_IR60_FLAGS // flags: some flags\r
};\r
\r
#endif\r
\r
-#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
\r
-static PROGMEM IRMP_PARAMETER siemens_param =\r
+static PROGMEM IRMP_PARAMETER ruwido_param =\r
{\r
- IRMP_SIEMENS_PROTOCOL, // protocol: ir protocol\r
- SIEMENS_BIT_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
- SIEMENS_BIT_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
- SIEMENS_BIT_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
- SIEMENS_BIT_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
- 1, // pause_0_len_max: maximum length of pause with bit value 0\r
- SIEMENS_ADDRESS_OFFSET, // address_offset: address offset\r
- SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN, // address_end: end of address\r
- SIEMENS_COMMAND_OFFSET, // command_offset: command offset\r
- SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN, // command_end: end of command\r
- SIEMENS_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
- SIEMENS_STOP_BIT, // stop_bit: flag: frame has stop bit\r
- SIEMENS_LSB, // lsb_first: flag: LSB first\r
- SIEMENS_FLAGS // flags: some flags\r
+ IRMP_RUWIDO_PROTOCOL, // protocol: ir protocol\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2, // pulse_0_len_min: here: minimum length of long pulse\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2, // pulse_0_len_max: here: maximum length of long pulse\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2, // pause_0_len_min: here: minimum length of long pause\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2, // pause_0_len_max: here: maximum length of long pause\r
+ RUWIDO_ADDRESS_OFFSET, // address_offset: address offset\r
+ RUWIDO_ADDRESS_OFFSET + RUWIDO_ADDRESS_LEN, // address_end: end of address\r
+ RUWIDO_COMMAND_OFFSET, // command_offset: command offset\r
+ RUWIDO_COMMAND_OFFSET + RUWIDO_COMMAND_LEN, // command_end: end of command\r
+ SIEMENS_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!\r
+ SIEMENS_OR_RUWIDO_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ SIEMENS_OR_RUWIDO_LSB, // lsb_first: flag: LSB first\r
+ SIEMENS_OR_RUWIDO_FLAGS // flags: some flags\r
};\r
\r
#endif\r
\r
-#if IRMP_SUPPORT_FDC1_PROTOCOL == 1\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
\r
-static PROGMEM IRMP_PARAMETER fdc1_param =\r
+static PROGMEM IRMP_PARAMETER fdc_param =\r
{\r
- IRMP_FDC1_PROTOCOL, // protocol: ir protocol\r
- FDC1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
- FDC1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
- FDC1_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
- FDC1_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
- FDC1_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
- FDC1_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
- FDC1_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
- FDC1_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
- FDC1_ADDRESS_OFFSET, // address_offset: address offset\r
- FDC1_ADDRESS_OFFSET + FDC1_ADDRESS_LEN, // address_end: end of address\r
- FDC1_COMMAND_OFFSET, // command_offset: command offset\r
- FDC1_COMMAND_OFFSET + FDC1_COMMAND_LEN, // command_end: end of command\r
- FDC1_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
- FDC1_STOP_BIT, // stop_bit: flag: frame has stop bit\r
- FDC1_LSB, // lsb_first: flag: LSB first\r
- FDC1_FLAGS // flags: some flags\r
-};\r
-\r
-#endif\r
-\r
-#if IRMP_SUPPORT_FDC2_PROTOCOL == 1\r
-\r
-static PROGMEM IRMP_PARAMETER fdc2_param =\r
-{\r
- IRMP_FDC2_PROTOCOL, // protocol: ir protocol\r
- FDC2_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
- FDC2_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
- FDC2_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
- FDC2_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
- FDC2_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
- FDC2_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
- FDC2_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
- FDC2_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
- FDC2_ADDRESS_OFFSET, // address_offset: address offset\r
- FDC2_ADDRESS_OFFSET + FDC2_ADDRESS_LEN, // address_end: end of address\r
- FDC2_COMMAND_OFFSET, // command_offset: command offset\r
- FDC2_COMMAND_OFFSET + FDC2_COMMAND_LEN, // command_end: end of command\r
- FDC2_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
- FDC2_STOP_BIT, // stop_bit: flag: frame has stop bit\r
- FDC2_LSB, // lsb_first: flag: LSB first\r
- FDC2_FLAGS // flags: some flags\r
+ IRMP_FDC_PROTOCOL, // protocol: ir protocol\r
+ FDC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ FDC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ FDC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ FDC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ FDC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ FDC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ FDC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ FDC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ FDC_ADDRESS_OFFSET, // address_offset: address offset\r
+ FDC_ADDRESS_OFFSET + FDC_ADDRESS_LEN, // address_end: end of address\r
+ FDC_COMMAND_OFFSET, // command_offset: command offset\r
+ FDC_COMMAND_OFFSET + FDC_COMMAND_LEN, // command_end: end of command\r
+ FDC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ FDC_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ FDC_LSB, // lsb_first: flag: LSB first\r
+ FDC_FLAGS // flags: some flags\r
};\r
\r
#endif\r
\r
#endif\r
\r
+#if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER nikon_param =\r
+{\r
+ IRMP_NIKON_PROTOCOL, // protocol: ir protocol\r
+ NIKON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ NIKON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ NIKON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ NIKON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ NIKON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ NIKON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ NIKON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ NIKON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ NIKON_ADDRESS_OFFSET, // address_offset: address offset\r
+ NIKON_ADDRESS_OFFSET + NIKON_ADDRESS_LEN, // address_end: end of address\r
+ NIKON_COMMAND_OFFSET, // command_offset: command offset\r
+ NIKON_COMMAND_OFFSET + NIKON_COMMAND_LEN, // command_end: end of command\r
+ NIKON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ NIKON_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NIKON_LSB, // lsb_first: flag: LSB first\r
+ NIKON_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER kathrein_param =\r
+{\r
+ IRMP_KATHREIN_PROTOCOL, // protocol: ir protocol\r
+ KATHREIN_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ KATHREIN_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ KATHREIN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ KATHREIN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ KATHREIN_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ KATHREIN_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ KATHREIN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ KATHREIN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ KATHREIN_ADDRESS_OFFSET, // address_offset: address offset\r
+ KATHREIN_ADDRESS_OFFSET + KATHREIN_ADDRESS_LEN, // address_end: end of address\r
+ KATHREIN_COMMAND_OFFSET, // command_offset: command offset\r
+ KATHREIN_COMMAND_OFFSET + KATHREIN_COMMAND_LEN, // command_end: end of command\r
+ KATHREIN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ KATHREIN_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ KATHREIN_LSB, // lsb_first: flag: LSB first\r
+ KATHREIN_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER netbox_param =\r
+{\r
+ IRMP_NETBOX_PROTOCOL, // protocol: ir protocol\r
+ NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value\r
+ NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value\r
+ NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value\r
+ NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value\r
+ NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value\r
+ NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value\r
+ NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value\r
+ NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value\r
+ NETBOX_ADDRESS_OFFSET, // address_offset: address offset\r
+ NETBOX_ADDRESS_OFFSET + NETBOX_ADDRESS_LEN, // address_end: end of address\r
+ NETBOX_COMMAND_OFFSET, // command_offset: command offset\r
+ NETBOX_COMMAND_OFFSET + NETBOX_COMMAND_LEN, // command_end: end of command\r
+ NETBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ NETBOX_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NETBOX_LSB, // lsb_first: flag: LSB first\r
+ NETBOX_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_IMON_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER imon_param =\r
+{\r
+ IRMP_IMON_PROTOCOL, // protocol: ir protocol\r
+ IMON_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ IMON_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ IMON_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ IMON_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1\r
+ IMON_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ IMON_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ IMON_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ IMON_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0\r
+ IMON_ADDRESS_OFFSET, // address_offset: address offset\r
+ IMON_ADDRESS_OFFSET + IMON_ADDRESS_LEN, // address_end: end of address\r
+ IMON_COMMAND_OFFSET, // command_offset: command offset\r
+ IMON_COMMAND_OFFSET + IMON_COMMAND_LEN, // command_end: end of command\r
+ IMON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ IMON_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ IMON_LSB, // lsb_first: flag: LSB first\r
+ IMON_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
static uint8_t irmp_bit; // current bit position\r
static IRMP_PARAMETER irmp_param;\r
\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static IRMP_PARAMETER irmp_param2;\r
+#endif\r
+\r
static volatile uint8_t irmp_ir_detected;\r
static volatile uint8_t irmp_protocol;\r
static volatile uint16_t irmp_address;\r
static volatile uint16_t irmp_id; // only used for SAMSUNG protocol\r
static volatile uint8_t irmp_flags;\r
\r
-#ifdef DEBUG\r
+#ifdef ANALYZE\r
static uint8_t IRMP_PIN;\r
#endif\r
\r
* @details Configures IRMP input pin\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*/\r
-#ifndef DEBUG\r
+#ifndef ANALYZE\r
void\r
irmp_init (void)\r
{\r
irmp_command &= 0xff;\r
rtc = TRUE;\r
}\r
- else if ((irmp_command & 0xFF00) == 0xD100)\r
+ else if (irmp_address == 0x87EE)\r
{\r
- DEBUG_PRINTF ("Switching to APPLE protocol\n");\r
+ ANALYZE_PRINTF ("Switching to APPLE protocol\n");\r
irmp_protocol = IRMP_APPLE_PROTOCOL;\r
- irmp_command &= 0xff;\r
+ irmp_address = (irmp_command & 0xFF00) >> 8;\r
+ irmp_command &= 0x00FF;\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+#endif\r
+#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
+ case IRMP_SIEMENS_PROTOCOL:\r
+ case IRMP_RUWIDO_PROTOCOL:\r
+ if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001))\r
+ {\r
+ irmp_command >>= 1;\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+#endif\r
+#if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r
+ case IRMP_KATHREIN_PROTOCOL:\r
+ if (irmp_command != 0x0000)\r
+ {\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+#endif\r
+#if IRMP_SUPPORT_IR60_PROTOCOL == 1\r
+ case IRMP_IR60_PROTOCOL:\r
+ if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame\r
+ {\r
rtc = TRUE;\r
}\r
break;\r
#endif\r
+#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ case IRMP_RCCAR_PROTOCOL:\r
+ // frame in irmp_data:\r
+ // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0\r
+ // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0\r
+ irmp_address = (irmp_command & 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0\r
+ irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0\r
+ ((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0\r
+ ((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0\r
+ rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0\r
+ break;\r
+#endif\r
+#if 1 // squeeze code to 8 bit, upper bit indicates release-key\r
+#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+ case IRMP_NETBOX_PROTOCOL:\r
+ if (irmp_command & 0x1000) // last bit set?\r
+ {\r
+ if ((irmp_command & 0x1f) == 0x15) // key pressed: 101 01 (LSB)\r
+ {\r
+ irmp_command >>= 5;\r
+ irmp_command &= 0x7F;\r
+ rtc = TRUE;\r
+ }\r
+ else if ((irmp_command & 0x1f) == 0x10) // key released: 000 01 (LSB)\r
+ {\r
+ irmp_command >>= 5;\r
+ irmp_command |= 0x80;\r
+ rtc = TRUE;\r
+ }\r
+ else\r
+ {\r
+ ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ANALYZE_PRINTF("error NETBOX: last bit not set\n");\r
+ }\r
+ break;\r
+#endif\r
+#endif // 0\r
default:\r
rtc = TRUE;\r
}\r
}\r
\r
// these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()\r
-static uint16_t irmp_tmp_address; // ir address\r
-static uint16_t irmp_tmp_command; // ir command\r
+static uint16_t irmp_tmp_address; // ir address\r
+static uint16_t irmp_tmp_command; // ir command\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static uint16_t irmp_tmp_address2; // ir address\r
+static uint16_t irmp_tmp_command2; // ir command\r
+#endif\r
+\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
-static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)\r
+static uint16_t irmp_tmp_id; // ir id (only SAMSUNG)\r
+#endif\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
+static uint8_t xor_check[6]; // check kaseikyo "parity" bits\r
#endif\r
\r
-static uint8_t irmp_bit; // current bit position\r
+static uint8_t irmp_bit; // current bit position\r
\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* store bit\r
* @param value to store: 0 or 1\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*/\r
+// verhindert, dass irmp_store_bit() inline compiliert wird:\r
+// static void irmp_store_bit (uint8_t) __attribute__ ((noinline));\r
+\r
static void\r
irmp_store_bit (uint8_t value)\r
{\r
+#if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
+ if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)\r
+ {\r
+ first_bit = value;\r
+ }\r
+ else\r
+#endif\r
+\r
if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)\r
{\r
if (irmp_param.lsb_first)\r
irmp_tmp_command |= value;\r
}\r
}\r
+\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
else if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)\r
{\r
irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first\r
}\r
#endif\r
+\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
+ else if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit >= 20 && irmp_bit < 24)\r
+ {\r
+ irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8)); // store 4 system bits in upper nibble with LSB first\r
+ }\r
+\r
+ if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)\r
+ {\r
+ if (value)\r
+ {\r
+ xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);\r
+ }\r
+ else\r
+ {\r
+ xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));\r
+ }\r
+ }\r
+\r
+#endif\r
+\r
irmp_bit++;\r
}\r
\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * store bit\r
+ * @details store bit in temp address or temp command\r
+ * @param value to store: 0 or 1\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static void\r
+irmp_store_bit2 (uint8_t value)\r
+{\r
+ uint8_t irmp_bit2;\r
+\r
+ if (irmp_param.protocol)\r
+ {\r
+ irmp_bit2 = irmp_bit - 2;\r
+ }\r
+ else\r
+ {\r
+ irmp_bit2 = irmp_bit - 1;\r
+ }\r
+\r
+ if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)\r
+ {\r
+ irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset)); // CV wants cast\r
+ }\r
+ else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)\r
+ {\r
+ irmp_tmp_command2 |= (((uint16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset)); // CV wants cast\r
+ }\r
+}\r
+#endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* ISR routine\r
* @details ISR routine, called 10000 times per second\r
uint8_t\r
irmp_ISR (void)\r
{\r
- static uint8_t irmp_start_bit_detected; // flag: start bit detected\r
- static uint8_t wait_for_space; // flag: wait for data bit space\r
- static uint8_t wait_for_start_space; // flag: wait for start bit space\r
- static uint8_t irmp_pulse_time; // count bit time for pulse\r
- static uint8_t 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 uint8_t repetition_frame_number;\r
+ static uint8_t irmp_start_bit_detected; // flag: start bit detected\r
+ static uint8_t wait_for_space; // flag: wait for data bit space\r
+ static uint8_t wait_for_start_space; // flag: wait for start bit space\r
+ static uint8_t irmp_pulse_time; // count bit time for pulse\r
+ 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_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
+ static uint16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition\r
#endif\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
- static uint8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit\r
+ static uint8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit\r
#endif\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
- static uint8_t last_pause; // last pause value\r
+ static PAUSE_LEN last_pause; // last pause value\r
#endif\r
#if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
- static uint8_t last_value; // last bit value\r
+ static uint8_t last_value; // last bit value\r
#endif\r
- uint8_t irmp_input; // input value\r
+ uint8_t irmp_input; // input value\r
\r
-#ifdef DEBUG\r
+#ifdef ANALYZE\r
time_counter++;\r
#endif\r
\r
{ // no...\r
if (! irmp_input) // receiving burst?\r
{ // yes...\r
-#ifdef DEBUG\r
+#ifdef ANALYZE\r
if (! irmp_pulse_time)\r
{\r
- DEBUG_PRINTF("%8d [starting pulse]\n", time_counter);\r
+ ANALYZE_PRINTF("%8d [starting pulse]\n", time_counter);\r
}\r
#endif\r
irmp_pulse_time++; // increment counter\r
wait_for_space = 0;\r
irmp_tmp_command = 0;\r
irmp_tmp_address = 0;\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ irmp_tmp_command2 = 0;\r
+ irmp_tmp_address2 = 0;\r
+#endif\r
+\r
irmp_bit = 0xff;\r
irmp_pause_time = 1; // 1st pause: set to 1, not to 0!\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
}\r
else\r
{\r
- repetition_counter++;\r
+ if (repetition_len < 0xFFFF) // avoid overflow of counter\r
+ {\r
+ repetition_len++;\r
+ }\r
}\r
}\r
}\r
{ // yes\r
irmp_pause_time++; // increment counter\r
\r
+#if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r
+ if (((irmp_pulse_time < NIKON_START_BIT_PULSE_LEN_MIN || irmp_pulse_time > NIKON_START_BIT_PULSE_LEN_MAX) && irmp_pause_time > IRMP_TIMEOUT_LEN) ||\r
+ irmp_pause_time > IRMP_TIMEOUT_NIKON_LEN)\r
+#else\r
if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r
+#endif\r
{ // yes...\r
- DEBUG_PRINTF ("error 1: pause after start bit pulse %d too long: %d\n", irmp_pulse_time, irmp_pause_time);\r
- DEBUG_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
{ // receiving first data pulse!\r
IRMP_PARAMETER * irmp_param_p = (IRMP_PARAMETER *) 0;\r
\r
- DEBUG_PRINTF ("start-bit: pulse = %d, pause = %d\n", irmp_pulse_time, irmp_pause_time);\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ irmp_param2.protocol = 0;\r
+#endif\r
+\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
irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)\r
{ // it's SIRCS\r
- DEBUG_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX,\r
SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param;\r
else\r
#endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r
\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+ if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame\r
+ irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = NEC or JVC repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,\r
+ JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &nec_param; // tricky: use nec parameters\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+\r
#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r
else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
{ // it's NEC\r
- DEBUG_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
\r
else\r
#endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r
\r
+#if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r
+ if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,\r
+ NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &nikon_param;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1\r
+\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r
{ // it's SAMSUNG\r
- DEBUG_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX,\r
SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &samsung_param;\r
if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)\r
{ // it's MATSUSHITA\r
- DEBUG_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX,\r
MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;\r
if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)\r
{ // it's KASEIKYO\r
- DEBUG_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX,\r
KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;\r
if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RECS80\r
- DEBUG_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX,\r
RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &recs80_param;\r
#endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1\r
\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
- if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||\r
- (irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&\r
- ((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||\r
- (irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))\r
+ if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||\r
+ (irmp_pulse_time >= RC5_START_BIT_LEN_MIN_2 && irmp_pulse_time <= RC5_START_BIT_LEN_MAX_2)) &&\r
+ ((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||\r
+ (irmp_pause_time >= RC5_START_BIT_LEN_MIN_2 && irmp_pause_time <= RC5_START_BIT_LEN_MAX_2)))\r
{ // it's RC5\r
- DEBUG_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5 or FDC\n");\r
+ ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r
+ FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+ memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");\r
+ ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r
+ RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+ memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ {\r
+ ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN_2, RC5_START_BIT_LEN_MAX_2,\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_START_BIT_LEN_MIN_2, RC5_START_BIT_LEN_MAX_2);\r
+ }\r
+\r
irmp_param_p = (IRMP_PARAMETER *) &rc5_param;\r
last_pause = irmp_pause_time;\r
\r
- if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||\r
- (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))\r
+ if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= RC5_START_BIT_LEN_MAX_2) ||\r
+ (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= RC5_START_BIT_LEN_MAX_2))\r
{\r
last_value = 0;\r
rc5_cmd_bit6 = 1<<6;\r
((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||\r
(irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))\r
{ // it's DENON\r
- DEBUG_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r
DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,\r
DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r
if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RC6\r
- DEBUG_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX,\r
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
if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RECS80EXT\r
- DEBUG_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX,\r
RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;\r
if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)\r
{ // it's NUBERT\r
- DEBUG_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX,\r
NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &nubert_param;\r
if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&\r
irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)\r
{ // it's BANG_OLUFSEN\r
- DEBUG_PRINTF ("protocol = BANG_OLUFSEN\n");\r
- DEBUG_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");\r
+ ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
- DEBUG_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r
BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r
- DEBUG_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r
BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
- DEBUG_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r
BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;\r
else\r
#endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
\r
-#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
- if (irmp_pulse_time >= GRUNDIG_OR_NOKIA_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX &&\r
- irmp_pause_time >= GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MAX)\r
+#if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
+ if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&\r
+ irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)\r
{ // it's GRUNDIG\r
- DEBUG_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- GRUNDIG_OR_NOKIA_START_BIT_LEN_MIN, GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX,\r
- GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MIN, GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r
+ GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &grundig_param;\r
last_pause = irmp_pause_time;\r
last_value = 1;\r
}\r
else\r
-#endif // IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
-\r
-#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
- if (((irmp_pulse_time >= SIEMENS_START_BIT_LEN_MIN && irmp_pulse_time <= SIEMENS_START_BIT_LEN_MAX) ||\r
- (irmp_pulse_time >= 2 * SIEMENS_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * SIEMENS_START_BIT_LEN_MAX)) &&\r
- ((irmp_pause_time >= SIEMENS_START_BIT_LEN_MIN && irmp_pause_time <= SIEMENS_START_BIT_LEN_MAX) ||\r
- (irmp_pause_time >= 2 * SIEMENS_START_BIT_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_START_BIT_LEN_MAX)))\r
- { // it's SIEMENS\r
- DEBUG_PRINTF ("protocol = SIEMENS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX,\r
- SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX);\r
- irmp_param_p = (IRMP_PARAMETER *) &siemens_param;\r
+#endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
+ if (((irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||\r
+ (irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2 && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2)) &&\r
+ ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) || \r
+ (irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2 && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2)))\r
+ { // it's RUWIDO or SIEMENS\r
+ ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
+ SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN_2, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX_2,\r
+ SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN_2, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX_2);\r
+ irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;\r
last_pause = irmp_pause_time;\r
last_value = 1;\r
}\r
else\r
-#endif // IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
-#if IRMP_SUPPORT_FDC1_PROTOCOL == 1\r
- if (irmp_pulse_time >= FDC1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC1_START_BIT_PULSE_LEN_MAX &&\r
- irmp_pause_time >= FDC1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC1_START_BIT_PAUSE_LEN_MAX)\r
- {\r
- DEBUG_PRINTF ("protocol = FDC1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- FDC1_START_BIT_PULSE_LEN_MIN, FDC1_START_BIT_PULSE_LEN_MAX,\r
- FDC1_START_BIT_PAUSE_LEN_MIN, FDC1_START_BIT_PAUSE_LEN_MAX);\r
- irmp_param_p = (IRMP_PARAMETER *) &fdc1_param;\r
- }\r
- else\r
-#endif // IRMP_SUPPORT_FDC1_PROTOCOL == 1\r
-#if IRMP_SUPPORT_FDC2_PROTOCOL == 1\r
- if (irmp_pulse_time >= FDC2_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC2_START_BIT_PULSE_LEN_MAX &&\r
- irmp_pause_time >= FDC2_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC2_START_BIT_PAUSE_LEN_MAX)\r
+#endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("protocol = FDC2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
- FDC2_START_BIT_PULSE_LEN_MIN, FDC2_START_BIT_PULSE_LEN_MAX,\r
- FDC2_START_BIT_PAUSE_LEN_MIN, FDC2_START_BIT_PAUSE_LEN_MAX);\r
- irmp_param_p = (IRMP_PARAMETER *) &fdc2_param;\r
+ ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r
+ FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &fdc_param;\r
}\r
else\r
-#endif // IRMP_SUPPORT_FDC2_PROTOCOL == 1\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+\r
#if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r
RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r
irmp_param_p = (IRMP_PARAMETER *) &rccar_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r
+ if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)\r
+ { // it's KATHREIN\r
+ ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX,\r
+ KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &kathrein_param;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+ if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)\r
+ { // it's NETBOX\r
+ ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX,\r
+ NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &netbox_param;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_IMON_PROTOCOL == 1\r
+ if (irmp_pulse_time >= IMON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= IMON_START_BIT_PULSE_LEN_MAX &&\r
+ irmp_pause_time >= IMON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= IMON_START_BIT_PAUSE_LEN_MAX)\r
+ { // it's IMON\r
+ ANALYZE_PRINTF ("protocol = IMON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ IMON_START_BIT_PULSE_LEN_MIN, IMON_START_BIT_PULSE_LEN_MAX,\r
+ IMON_START_BIT_PAUSE_LEN_MIN, IMON_START_BIT_PAUSE_LEN_MAX);\r
+ irmp_param_p = (IRMP_PARAMETER *) &imon_param;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_IMON_PROTOCOL == 1\r
+\r
{\r
- DEBUG_PRINTF ("protocol = UNKNOWN\n");\r
+ ANALYZE_PRINTF ("protocol = UNKNOWN\n");\r
irmp_start_bit_detected = 0; // wait for another start bit...\r
}\r
\r
{\r
memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));\r
\r
-#ifdef DEBUG\r
+#ifdef ANALYZE\r
if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r
{\r
- DEBUG_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r
- DEBUG_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\r
+ ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r
+ ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\r
}\r
else\r
{\r
- DEBUG_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
- DEBUG_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
+ ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,\r
+ irmp_param.pulse_0_len_min, irmp_param.pulse_0_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
+ irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r
}\r
\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+ if (irmp_param2.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);\r
+ ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);\r
+ ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);\r
+ ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);\r
+ }\r
+#endif\r
+\r
+\r
#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r
+ ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r
}\r
#endif\r
\r
if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r
{\r
- DEBUG_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
- DEBUG_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r
+ ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
+ ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r
}\r
\r
#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
- DEBUG_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);\r
+ ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
+ ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);\r
}\r
#endif\r
\r
- DEBUG_PRINTF ("command_offset: %2d\n", irmp_param.command_offset);\r
- DEBUG_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset);\r
- DEBUG_PRINTF ("complete_len: %3d\n", irmp_param.complete_len);\r
- DEBUG_PRINTF ("stop_bit: %3d\n", irmp_param.stop_bit);\r
-#endif // DEBUG\r
+ ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset);\r
+ ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset);\r
+ ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len);\r
+ ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param.stop_bit);\r
+#endif // ANALYZE\r
}\r
\r
irmp_bit = 0;\r
\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
- if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) && irmp_param.protocol != IRMP_RC6_PROTOCOL) // manchester, but not rc6\r
+ if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r
+ irmp_param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO\r
+ irmp_param.protocol != IRMP_RC6_PROTOCOL) // Manchester, but not RC6\r
{\r
- if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)\r
+ if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= irmp_param.pulse_0_len_max) // XXXXXXXX!!!\r
{\r
- DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);\r
}\r
- else if (! last_value)\r
+ else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
{\r
- DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
- DEBUG_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);\r
}\r
}\r
else\r
#endif // IRMP_SUPPORT_MANCHESTER == 1\r
\r
+#if IRMP_SUPPORT_SERIAL == 1\r
+ if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r
+ {\r
+ ; // do nothing\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_SERIAL == 1\r
+\r
+\r
#if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)\r
{ // pause timings correct for "1"?\r
- DEBUG_PUTCHAR ('1'); // yes, store 1\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('1'); // yes, store 1\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (1);\r
}\r
else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)\r
{ // pause timings correct for "0"?\r
- DEBUG_PUTCHAR ('0'); // yes, store 0\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('0'); // yes, store 0\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (0);\r
}\r
}\r
+ else\r
#endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r
+ {\r
+ ; // else do nothing\r
+ }\r
\r
irmp_pulse_time = 1; // set counter to 1, not 0\r
irmp_pause_time = 0;\r
{ // yes...\r
if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1)\r
{\r
- if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max)\r
+ if (\r
+#if IRMP_SUPPORT_MANCHESTER == 1\r
+ (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||\r
+#endif\r
+#if IRMP_SUPPORT_SERIAL == 1\r
+ (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||\r
+#endif\r
+ (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max))\r
{\r
-#ifdef DEBUG\r
+#ifdef ANALYZE\r
if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r
{\r
- DEBUG_PRINTF ("stop bit detected\n");\r
+ ANALYZE_PRINTF ("stop bit detected\n");\r
}\r
#endif\r
irmp_param.stop_bit = 0;\r
}\r
else\r
{\r
- DEBUG_PRINTF ("stop bit timing wrong\n");\r
+ ANALYZE_PRINTF ("error: stop bit timing wrong\n");\r
\r
irmp_start_bit_detected = 0; // wait for another start bit...\r
irmp_pulse_time = 0;\r
}\r
else\r
{\r
- irmp_pause_time++; // increment counter\r
+ irmp_pause_time++; // increment counter\r
\r
#if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r
- if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits:\r
- irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12\r
- irmp_bit >= 12 - 1) // pause too long?\r
- { // yes, break and close this frame\r
- irmp_param.complete_len = irmp_bit + 1; // set new complete length\r
- got_light = TRUE; // this is a lie, but helps (generates stop bit)\r
- irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length\r
- irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length\r
+ if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits:\r
+ irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12\r
+ irmp_bit >= 12 - 1) // pause too long?\r
+ { // yes, break and close this frame\r
+ irmp_param.complete_len = irmp_bit + 1; // set new complete length\r
+ got_light = TRUE; // this is a lie, but helps (generates stop bit)\r
+ irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8; // new: store number of additional bits in upper byte of address!\r
+ irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length\r
+ irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length\r
+ }\r
+ else\r
+#endif\r
+#if IRMP_SUPPORT_SERIAL == 1\r
+ // NETBOX generates no stop bit, here is the timeout condition:\r
+ if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL &&\r
+ irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit))\r
+ {\r
+ got_light = TRUE; // this is a lie, but helps (generates stop bit)\r
}\r
else\r
#endif\r
-#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
+#if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)\r
{\r
- if (irmp_pause_time > 2 * irmp_param.pause_1_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)\r
+ if (irmp_pause_time > IR60_TIMEOUT_LEN && irmp_bit == 6)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to IR60 protocol\n");\r
+ got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
+ irmp_param.stop_bit = TRUE; // set flag\r
+\r
+ irmp_param.protocol = IRMP_IR60_PROTOCOL; // change protocol\r
+ irmp_param.complete_len = IR60_COMPLETE_DATA_LEN; // correct complete len\r
+ irmp_param.address_offset = IR60_ADDRESS_OFFSET;\r
+ irmp_param.address_end = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;\r
+ irmp_param.command_offset = IR60_COMMAND_OFFSET;\r
+ irmp_param.command_end = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;\r
+\r
+ irmp_tmp_command <<= 1;\r
+ irmp_tmp_command |= first_bit;\r
+ }\r
+ else if (irmp_pause_time >= irmp_param.pause_0_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)\r
{ // special manchester decoder\r
irmp_param.complete_len = GRUNDIG_COMPLETE_DATA_LEN; // correct complete len\r
got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
}\r
else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r
{\r
- DEBUG_PRINTF ("Switching to NOKIA protocol\n");\r
+ ANALYZE_PRINTF ("Switching to NOKIA protocol\n");\r
irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol\r
irmp_param.address_offset = NOKIA_ADDRESS_OFFSET;\r
irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;\r
}\r
else\r
#endif\r
+#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_RUWIDO_PROTOCOL && !irmp_param.stop_bit)\r
+ {\r
+ if (irmp_pause_time >= irmp_param.pause_0_len_max && irmp_bit >= RUWIDO_COMPLETE_DATA_LEN - 2)\r
+ { // special manchester decoder\r
+ irmp_param.complete_len = RUWIDO_COMPLETE_DATA_LEN; // correct complete len\r
+ got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
+ irmp_param.stop_bit = TRUE; // set flag\r
+ }\r
+ else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");\r
+ irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol\r
+ irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET;\r
+ irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;\r
+ irmp_param.command_offset = SIEMENS_COMMAND_OFFSET;\r
+ irmp_param.command_end = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;\r
+\r
+ // 76543210\r
+ // RUWIDO: AAAAAAAAACCCCCCCp\r
+ // SIEMENS: AAAAAAAAAAACCCCCCCCCCp\r
+ irmp_tmp_address <<= 2;\r
+ irmp_tmp_address |= (irmp_tmp_command >> 6);\r
+ irmp_tmp_command &= 0x003F;\r
+ irmp_tmp_command <<= 4;\r
+ irmp_tmp_command |= last_value;\r
+ }\r
+ }\r
+ else\r
+#endif\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r
- irmp_pause_time > 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r
+ irmp_pause_time >= irmp_param.pause_0_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r
{ // special manchester decoder\r
got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
irmp_param.stop_bit = TRUE; // set flag\r
{\r
irmp_bit++;\r
}\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+ else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit\r
+ {\r
+ ANALYZE_PRINTF ("Switching to JVC protocol\n");\r
+ irmp_param.stop_bit = TRUE; // set flag\r
+ irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol\r
+ irmp_param.complete_len = irmp_bit; // patch length: 16 or 17\r
+ irmp_tmp_command = (irmp_tmp_address >> 4); // set command: upper 12 bits are command bits\r
+ irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits\r
+ irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...\r
+ }\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
else\r
{\r
- DEBUG_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);\r
+ ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
\r
irmp_start_bit_detected = 0; // wait for another start bit...\r
irmp_pulse_time = 0;\r
\r
if (got_light)\r
{\r
- DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
#if IRMP_SUPPORT_MANCHESTER == 1\r
- if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // manchester\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 0\r
+ if (irmp_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= irmp_param.pulse_0_len_max */)\r
+#else // better:\r
+ if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= irmp_param.pulse_0_len_max &&\r
+ irmp_pause_time <= irmp_param.pause_0_len_max)\r
+#endif\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
- DEBUG_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
- DEBUG_PUTCHAR ('0');\r
- irmp_store_bit (0);\r
- last_value = 0;\r
- DEBUG_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 > irmp_param.pause_0_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
- DEBUG_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
- DEBUG_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
- DEBUG_NEWLINE ();\r
- last_value = (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
+#endif\r
+ {\r
+ ANALYZE_NEWLINE ();\r
+ }\r
+ last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r
+ }\r
+ }\r
}\r
- else // if (irmp_pulse_time >= irmp_param.pulse_1_len_max && irmp_pulse_time <= irmp_param.pulse_1_len_max)\r
+ else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max /* &&\r
+ irmp_pause_time <= irmp_param.pause_0_len_max */)\r
{\r
uint8_t manchester_value;\r
\r
- if (last_pause > irmp_param.pause_1_len_max && last_pause <= 2 * irmp_param.pause_1_len_max)\r
+ if (last_pause > irmp_param.pause_1_len_max && last_pause <= irmp_param.pause_0_len_max)\r
{\r
manchester_value = last_value ? 0 : 1;\r
last_value = manchester_value;\r
manchester_value = last_value;\r
}\r
\r
-#if 0\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 == 0) // RC6 mode != 0 ???\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 = 0;\r
}\r
#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
-#endif // 0\r
\r
- DEBUG_PUTCHAR (manchester_value + '0');\r
- DEBUG_NEWLINE ();\r
irmp_store_bit (manchester_value);\r
}\r
+ else\r
+ {\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&\r
+ irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&\r
+ ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||\r
+ (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ irmp_param.protocol = 0; // switch to FDC, see below\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&\r
+ irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&\r
+ ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||\r
+ (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ irmp_param.protocol = 0; // switch to RCCAR, see below\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ {\r
+ ANALYZE_PUTCHAR ('?');\r
+ ANALYZE_NEWLINE ();\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
+ }\r
+ }\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)\r
+ {\r
+ if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 1 (FDC)\n");\r
+ irmp_store_bit2 (1);\r
+ }\r
+ else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 0 (FDC)\n");\r
+ irmp_store_bit2 (0);\r
+ }\r
+\r
+ if (! irmp_param.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to FDC protocol\n");\r
+ memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
+ irmp_param2.protocol = 0;\r
+ irmp_tmp_address = irmp_tmp_address2;\r
+ irmp_tmp_command = irmp_tmp_command2;\r
+ }\r
+ }\r
+#endif // IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
+ if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)\r
+ {\r
+ if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 1 (RCCAR)\n");\r
+ irmp_store_bit2 (1);\r
+ }\r
+ else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF (" 0 (RCCAR)\n");\r
+ irmp_store_bit2 (0);\r
+ }\r
+\r
+ if (! irmp_param.protocol)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to RCCAR protocol\n");\r
+ memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
+ irmp_param2.protocol = 0;\r
+ irmp_tmp_address = irmp_tmp_address2;\r
+ irmp_tmp_command = irmp_tmp_command2;\r
+ }\r
+ }\r
+#endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
\r
last_pause = irmp_pause_time;\r
wait_for_space = 0;\r
else\r
#endif // IRMP_SUPPORT_MANCHESTER == 1\r
\r
+#if IRMP_SUPPORT_SERIAL == 1\r
+ if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)\r
+ {\r
+ while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)\r
+ {\r
+ ANALYZE_PUTCHAR ('1');\r
+ irmp_store_bit (1);\r
+\r
+ if (irmp_pulse_time >= irmp_param.pulse_1_len_min)\r
+ {\r
+ irmp_pulse_time -= irmp_param.pulse_1_len_min;\r
+ }\r
+ else\r
+ {\r
+ irmp_pulse_time = 0;\r
+ }\r
+ }\r
+\r
+ while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)\r
+ {\r
+ ANALYZE_PUTCHAR ('0');\r
+ irmp_store_bit (0);\r
+\r
+ if (irmp_pause_time >= irmp_param.pause_1_len_min)\r
+ {\r
+ irmp_pause_time -= irmp_param.pause_1_len_min;\r
+ }\r
+ else\r
+ {\r
+ irmp_pause_time = 0;\r
+ }\r
+ }\r
+ ANALYZE_NEWLINE ();\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_SERIAL == 1\r
\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit == 16) // Samsung: 16th bit\r
if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&\r
irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("SYNC\n");\r
+ ANALYZE_PRINTF ("SYNC\n");\r
wait_for_space = 0;\r
irmp_tmp_id = 0;\r
irmp_bit++;\r
\r
if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PUTCHAR ('1');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('1');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (1);\r
wait_for_space = 0;\r
}\r
else\r
{\r
- DEBUG_PUTCHAR ('0');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('0');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (0);\r
wait_for_space = 0;\r
}\r
\r
- DEBUG_PRINTF ("Switching to SAMSUNG32 protocol\n");\r
+ ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");\r
}\r
else\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3 Samsung: 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
}\r
else\r
#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL\r
\r
+#if IRMP_SUPPORT_NEC16_PROTOCOL\r
+ if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 8 &&\r
+ irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ ANALYZE_PRINTF ("Switching to NEC16 protocol\n");\r
+ memcpy_P (&irmp_param, &nec16_param, sizeof (IRMP_PARAMETER));\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_NEC16_PROTOCOL\r
+\r
#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r
{\r
{\r
if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("3rd start bit\n");\r
+ ANALYZE_PRINTF ("3rd start bit\n");\r
wait_for_space = 0;\r
- irmp_tmp_id = 0;\r
irmp_bit++;\r
}\r
else\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3a B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3a B&O: 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
}\r
{\r
if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("trailer bit\n");\r
+ ANALYZE_PRINTF ("trailer bit\n");\r
wait_for_space = 0;\r
- irmp_tmp_id = 0;\r
irmp_bit++;\r
}\r
else\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3b B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3b B&O: 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
}\r
{\r
if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)\r
{ // pulse & pause timings correct for "1"?\r
- DEBUG_PUTCHAR ('1');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('1');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (1);\r
last_value = 1;\r
wait_for_space = 0;\r
}\r
else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)\r
{ // pulse & pause timings correct for "0"?\r
- DEBUG_PUTCHAR ('0');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('0');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (0);\r
last_value = 0;\r
wait_for_space = 0;\r
}\r
else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)\r
{\r
- DEBUG_PUTCHAR (last_value + '0');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR (last_value + '0');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (last_value);\r
wait_for_space = 0;\r
}\r
else\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3c B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3c B&O: 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
}\r
}\r
else\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3d B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3d B&O: 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
}\r
if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&\r
irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
{ // pulse & pause timings correct for "1"?\r
- DEBUG_PUTCHAR ('1');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('1');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (1);\r
wait_for_space = 0;\r
}\r
else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&\r
irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)\r
{ // pulse & pause timings correct for "0"?\r
- DEBUG_PUTCHAR ('0');\r
- DEBUG_NEWLINE ();\r
+ ANALYZE_PUTCHAR ('0');\r
+ ANALYZE_NEWLINE ();\r
irmp_store_bit (0);\r
wait_for_space = 0;\r
}\r
else\r
+#if IRMP_SUPPORT_KATHREIN_PROTOCOL\r
+\r
+ if (irmp_param.protocol == IRMP_KATHREIN_PROTOCOL &&\r
+ irmp_pulse_time >= KATHREIN_1_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&\r
+ (((irmp_bit == 8 || irmp_bit == 6) &&\r
+ irmp_pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||\r
+ (irmp_bit == 12 &&\r
+ irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))\r
+\r
+ {\r
+ if (irmp_bit == 8)\r
+ {\r
+ irmp_bit++;\r
+ ANALYZE_PUTCHAR ('S');\r
+ ANALYZE_NEWLINE ();\r
+ irmp_tmp_id = 0;\r
+ irmp_tmp_command <<= 1;\r
+ }\r
+ else\r
+ {\r
+ ANALYZE_PUTCHAR ('S');\r
+ ANALYZE_NEWLINE ();\r
+ irmp_store_bit (1);\r
+ }\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_KATHREIN_PROTOCOL\r
{ // timing incorrect!\r
- DEBUG_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_PRINTF ("error 3: 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
}\r
}\r
}\r
\r
- if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\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
// if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame\r
if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))\r
{\r
- DEBUG_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
+ ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+ repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+ repetition_len = 0;\r
+ }\r
+ else\r
+#endif\r
+\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
+ // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame\r
+ 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_len, AUTO_FRAME_REPETITION_LEN);\r
+ repetition_len = 0;\r
}\r
else\r
#endif\r
// if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))\r
{\r
- DEBUG_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
+ ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+ repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+ repetition_len = 0;\r
}\r
else\r
#endif\r
// if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))\r
{\r
- DEBUG_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
+ ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+ repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+ repetition_len = 0;\r
}\r
else\r
#endif\r
\r
{\r
- DEBUG_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
}\r
else\r
{\r
- DEBUG_PRINTF ("waiting for inverted command repetition\n");\r
+ ANALYZE_PRINTF ("waiting for inverted command repetition\n");\r
irmp_ir_detected = FALSE;\r
last_irmp_denon_command = irmp_tmp_command;\r
}\r
#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)\r
{ // Grundig start frame?\r
- DEBUG_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");\r
+ ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");\r
irmp_ir_detected = FALSE;\r
}\r
else\r
#if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)\r
{ // Nokia start frame?\r
- DEBUG_PRINTF ("Detected NOKIA start frame, ignoring it\n");\r
+ ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");\r
irmp_ir_detected = FALSE;\r
}\r
else\r
#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame\r
{\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
+ if (repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r
+ {\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_len = 0;\r
+ }\r
+ else\r
+ {\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
#endif // IRMP_SUPPORT_NEC_PROTOCOL\r
+\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r
+ {\r
+ uint8_t xor;\r
+ // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\r
+ // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);\r
+\r
+ xor = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r
+\r
+ if (xor != (xor_check[2] & 0x0F))\r
+ {\r
+ ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check[2] & 0x0F);\r
+ irmp_ir_detected = FALSE;\r
+ }\r
+\r
+ xor = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r
+\r
+ if (xor != xor_check[5])\r
+ {\r
+ ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]);\r
+ irmp_ir_detected = FALSE;\r
+ }\r
+ }\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
+ if (irmp_param.protocol == IRMP_FDC_PROTOCOL)\r
+ {\r
+ if (irmp_tmp_command & 0x000F) // released key?\r
+ {\r
+ irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80; // yes, set bit 7\r
+ }\r
+ else\r
+ {\r
+ irmp_tmp_command >>= 4; // no, it's a pressed key\r
+ }\r
+ irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000\r
+ irmp_tmp_address &= 0x003F;\r
+ }\r
+#endif\r
+\r
irmp_address = irmp_tmp_address; // store address\r
#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
last_irmp_address = irmp_tmp_address; // store as last address, too\r
#endif\r
\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
- irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r
+ if (irmp_param.protocol == IRMP_RC5_PROTOCOL)\r
+ {\r
+ irmp_tmp_command |= rc5_cmd_bit6; // store bit 6\r
+ }\r
#endif\r
irmp_command = irmp_tmp_command; // store command\r
\r
{\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
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
- DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
}\r
\r
irmp_start_bit_detected = 0; // and wait for next start bit\r
irmp_tmp_command = 0;\r
irmp_pulse_time = 0;\r
irmp_pause_time = 0;\r
+\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+ if (irmp_protocol == IRMP_JVC_PROTOCOL) // the stop bit of JVC frame is also start bit of next frame\r
+ { // set pulse time here!\r
+ irmp_pulse_time = ((uint8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));\r
+ }\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
}\r
}\r
}\r
return (irmp_ir_detected);\r
}\r
\r
-#ifdef DEBUG\r
-\r
-// main function - for unix/linux + windows only!\r
-// AVR: see main.c!\r
-// Compile it under linux with:\r
-// cc irmp.c -o irmp\r
-//\r
-// usage: ./irmp [-v|-s|-a|-l|-p] < file\r
-// options:\r
-// -v verbose\r
-// -s silent\r
-// -a analyze\r
-// -l list pulse/pauses\r
-// -p print timings\r
+#ifdef ANALYZE\r
+\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * main functions - for Unix/Linux + Windows only!\r
+ *\r
+ * AVR: see main.c!\r
+ *\r
+ * Compile it under linux with:\r
+ * cc irmp.c -o irmp\r
+ *\r
+ * usage: ./irmp [-v|-s|-a|-l|-p] < file\r
+ *\r
+ * options:\r
+ * -v verbose\r
+ * -s silent\r
+ * -a analyze\r
+ * -l list pulse/pauses\r
+ * -p print timings\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
\r
static void\r
print_timings (void)\r
{\r
- printf ("PROTOCOL START BIT NO. START BIT PULSE START BIT PAUSE\n");\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
printf ("====================================================================================\n");\r
- printf ("SIRCS 1 %3d - %3d %3d - %3d\n",\r
- SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);\r
- printf ("NEC 1 %3d - %3d %3d - %3d\n",\r
- NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r
- printf ("NEC (rep) 1 %3d - %3d %3d - %3d\n",\r
- NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
- printf ("SAMSUNG 1 %3d - %3d %3d - %3d\n",\r
- SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);\r
- printf ("MATSUSHITA 1 %3d - %3d %3d - %3d\n",\r
- MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);\r
- printf ("KASEIKYO 1 %3d - %3d %3d - %3d\n",\r
- KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);\r
- printf ("RECS80 1 %3d - %3d %3d - %3d\n",\r
- RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);\r
- printf ("RC5 1 %3d - %3d %3d - %3d\n",\r
- RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
- printf ("DENON 1 %3d - %3d %3d - %3d or %3d - %3d\n",\r
- DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r
- printf ("RC6 1 %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
- printf ("RECS80EXT 1 %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
- printf ("NUBERT 1 %3d - %3d %3d - %3d\n",\r
- NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
- printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r
- BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
- printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d\n",\r
- GRUNDIG_OR_NOKIA_START_BIT_LEN_MIN, GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX, GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MIN, GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN_MAX);\r
- printf ("SIEMENS 1 %3d - %3d %3d - %3d\n",\r
- SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX, SIEMENS_START_BIT_LEN_MIN, SIEMENS_START_BIT_LEN_MAX);\r
- printf ("FDC1 1 %3d - %3d %3d - %3d\n",\r
- FDC1_START_BIT_PULSE_LEN_MIN, FDC1_START_BIT_PULSE_LEN_MAX, FDC1_START_BIT_PAUSE_LEN_MIN, FDC1_START_BIT_PAUSE_LEN_MAX);\r
- printf ("FDC2 1 %3d - %3d %3d - %3d\n",\r
- FDC2_START_BIT_PULSE_LEN_MIN, FDC2_START_BIT_PULSE_LEN_MAX, FDC2_START_BIT_PAUSE_LEN_MIN, FDC2_START_BIT_PAUSE_LEN_MAX);\r
- printf ("RCCAR 1 %3d - %3d %3d - %3d\n",\r
- RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r
+ printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX,\r
+ SIRCS_0_PULSE_LEN_MIN, SIRCS_0_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX,\r
+ SIRCS_1_PULSE_LEN_MIN, SIRCS_1_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX);\r
+\r
+ printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX,\r
+ NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX,\r
+ SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_0_PAUSE_LEN_MIN, SAMSUNG_0_PAUSE_LEN_MAX,\r
+ SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_1_PAUSE_LEN_MIN, SAMSUNG_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX,\r
+ MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_0_PAUSE_LEN_MIN, MATSUSHITA_0_PAUSE_LEN_MAX,\r
+ MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_1_PAUSE_LEN_MIN, MATSUSHITA_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX,\r
+ KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_0_PAUSE_LEN_MIN, KASEIKYO_0_PAUSE_LEN_MAX,\r
+ KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_1_PAUSE_LEN_MIN, KASEIKYO_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX,\r
+ RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_0_PAUSE_LEN_MIN, RECS80_0_PAUSE_LEN_MAX,\r
+ RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_1_PAUSE_LEN_MIN, RECS80_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
+ RC5_BIT_LEN_MIN, RC5_BIT_LEN_MAX);\r
+\r
+ printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r
+ 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 %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_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
+ RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_0_PAUSE_LEN_MIN, RECS80EXT_0_PAUSE_LEN_MAX,\r
+ RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_1_PAUSE_LEN_MIN, RECS80EXT_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX,\r
+ NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX,\r
+ NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
+\r
+ printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_0_PAUSE_LEN_MIN, BANG_OLUFSEN_0_PAUSE_LEN_MAX,\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_1_PAUSE_LEN_MIN, BANG_OLUFSEN_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n",\r
+ GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r
+ GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX,\r
+ GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX);\r
+\r
+ printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX,\r
+ SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN_2, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX_2,\r
+ SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN_2, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX_2);\r
+\r
+ printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX,\r
+ FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX,\r
+ FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_1_PAUSE_LEN_MIN, FDC_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX,\r
+ RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_0_PAUSE_LEN_MIN, RCCAR_0_PAUSE_LEN_MAX,\r
+ RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_1_PAUSE_LEN_MIN, RCCAR_1_PAUSE_LEN_MAX);\r
+\r
+ printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n",\r
+ NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX, NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX,\r
+ NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_0_PAUSE_LEN_MIN, NIKON_0_PAUSE_LEN_MAX,\r
+ NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_1_PAUSE_LEN_MIN, NIKON_1_PAUSE_LEN_MAX);\r
}\r
\r
void\r
-print_spectrum (char * text, int * buf)\r
+print_spectrum (char * text, int * buf, int is_pulse)\r
{\r
int i;\r
int j;\r
- int max = 0;\r
+ int min;\r
+ int max;\r
+ int max_value = 0;\r
int value;\r
int sum = 0;\r
int counter = 0;\r
double average = 0;\r
+ double tolerance;\r
\r
- puts ("--------------------------------------------------------------------------------------------------------------");\r
+ puts ("-------------------------------------------------------------------------------");\r
printf ("%s:\n", text);\r
\r
for (i = 0; i < 256; i++)\r
{\r
- if (buf[i] > max)\r
+ if (buf[i] > max_value)\r
{\r
- max = buf[i];\r
+ max_value = buf[i];\r
}\r
}\r
\r
- for (i = 0; i < 100; i++)\r
+ for (i = 1; i < 100; i++)\r
{\r
if (buf[i] > 0)\r
{\r
printf ("%3d ", i);\r
- value = (buf[i] * 100) / max;\r
+ value = (buf[i] * 60) / max_value;\r
\r
for (j = 0; j < value; j++)\r
{\r
}\r
else\r
{\r
+ max = i - 1;\r
+\r
if (counter > 0)\r
{\r
average = (float) sum / (float) counter;\r
- printf ("average: %0.2f = %0.2f usec\n", average, (1000000. * average) / (float) F_INTERRUPTS);\r
+\r
+ if (is_pulse)\r
+ {\r
+ printf ("pulse ");\r
+ }\r
+ else\r
+ {\r
+ printf ("pause ");\r
+ }\r
+\r
+ printf ("avg: %4.1f=%6.1f us, ", average, (1000000. * average) / (float) F_INTERRUPTS);\r
+ printf ("min: %2d=%6.1f us, ", min, (1000000. * min) / (float) F_INTERRUPTS);\r
+ printf ("max: %2d=%6.1f us, ", max, (1000000. * max) / (float) F_INTERRUPTS);\r
+\r
+ tolerance = (max - average);\r
+\r
+ if (average - min > tolerance)\r
+ {\r
+ tolerance = average - min;\r
+ }\r
+\r
+ tolerance = tolerance * 100 / average;\r
+ printf ("tol: %4.1f%%\n", tolerance);\r
}\r
+\r
counter = 0;\r
sum = 0;\r
+ min = i + 1;\r
+ }\r
+ }\r
+}\r
+\r
+#define STATE_LEFT_SHIFT 0x01\r
+#define STATE_RIGHT_SHIFT 0x02\r
+#define STATE_LEFT_CTRL 0x04\r
+#define STATE_LEFT_ALT 0x08\r
+#define STATE_RIGHT_ALT 0x10\r
+\r
+#define KEY_ESCAPE 0x1B // keycode = 0x006e\r
+#define KEY_MENUE 0x80 // keycode = 0x0070\r
+#define KEY_BACK 0x81 // keycode = 0x0071\r
+#define KEY_FORWARD 0x82 // keycode = 0x0072\r
+#define KEY_ADDRESS 0x83 // keycode = 0x0073\r
+#define KEY_WINDOW 0x84 // keycode = 0x0074\r
+#define KEY_1ST_PAGE 0x85 // keycode = 0x0075\r
+#define KEY_STOP 0x86 // keycode = 0x0076\r
+#define KEY_MAIL 0x87 // keycode = 0x0077\r
+#define KEY_FAVORITES 0x88 // keycode = 0x0078\r
+#define KEY_NEW_PAGE 0x89 // keycode = 0x0079\r
+#define KEY_SETUP 0x8A // keycode = 0x007a\r
+#define KEY_FONT 0x8B // keycode = 0x007b\r
+#define KEY_PRINT 0x8C // keycode = 0x007c\r
+#define KEY_ON_OFF 0x8E // keycode = 0x007c\r
+\r
+#define KEY_INSERT 0x90 // keycode = 0x004b\r
+#define KEY_DELETE 0x91 // keycode = 0x004c\r
+#define KEY_LEFT 0x92 // keycode = 0x004f\r
+#define KEY_HOME 0x93 // keycode = 0x0050\r
+#define KEY_END 0x94 // keycode = 0x0051\r
+#define KEY_UP 0x95 // keycode = 0x0053\r
+#define KEY_DOWN 0x96 // keycode = 0x0054\r
+#define KEY_PAGE_UP 0x97 // keycode = 0x0055\r
+#define KEY_PAGE_DOWN 0x98 // keycode = 0x0056\r
+#define KEY_RIGHT 0x99 // keycode = 0x0059\r
+#define KEY_MOUSE_1 0x9E // keycode = 0x0400\r
+#define KEY_MOUSE_2 0x9F // keycode = 0x0800\r
+\r
+static uint8_t\r
+get_fdc_key (uint16_t cmd)\r
+{\r
+ static uint8_t key_table[128] =\r
+ {\r
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F\r
+ 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b',\r
+ '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a',\r
+ 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x',\r
+ 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,\r
+\r
+ 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',\r
+ '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A',\r
+ 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X',\r
+ 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0\r
+ };\r
+ static uint8_t state;\r
+\r
+ uint8_t key = 0;\r
+\r
+ switch (cmd)\r
+ {\r
+ case 0x002C: state |= STATE_LEFT_SHIFT; break; // pressed left shift\r
+ case 0x00AC: state &= ~STATE_LEFT_SHIFT; break; // released left shift\r
+ case 0x0039: state |= STATE_RIGHT_SHIFT; break; // pressed right shift\r
+ case 0x00B9: state &= ~STATE_RIGHT_SHIFT; break; // released right shift\r
+ case 0x003A: state |= STATE_LEFT_CTRL; break; // pressed left ctrl\r
+ case 0x00BA: state &= ~STATE_LEFT_CTRL; break; // released left ctrl\r
+ case 0x003C: state |= STATE_LEFT_ALT; break; // pressed left alt\r
+ case 0x00BC: state &= ~STATE_LEFT_ALT; break; // released left alt\r
+ case 0x003E: state |= STATE_RIGHT_ALT; break; // pressed left alt\r
+ case 0x00BE: state &= ~STATE_RIGHT_ALT; break; // released left alt\r
+\r
+ case 0x006e: key = KEY_ESCAPE; break;\r
+ case 0x004b: key = KEY_INSERT; break;\r
+ case 0x004c: key = KEY_DELETE; break;\r
+ case 0x004f: key = KEY_LEFT; break;\r
+ case 0x0050: key = KEY_HOME; break;\r
+ case 0x0051: key = KEY_END; break;\r
+ case 0x0053: key = KEY_UP; break;\r
+ case 0x0054: key = KEY_DOWN; break;\r
+ case 0x0055: key = KEY_PAGE_UP; break;\r
+ case 0x0056: key = KEY_PAGE_DOWN; break;\r
+ case 0x0059: key = KEY_RIGHT; break;\r
+ case 0x0400: key = KEY_MOUSE_1; break;\r
+ case 0x0800: key = KEY_MOUSE_2; break;\r
+\r
+ default:\r
+ {\r
+ if (!(cmd & 0x80)) // pressed key\r
+ {\r
+ if (cmd >= 0x70 && cmd <= 0x7F) // function keys\r
+ {\r
+ key = cmd + 0x10; // 7x -> 8x\r
+ }\r
+ else if (cmd < 64) // key listed in key_table\r
+ {\r
+ if (state & (STATE_LEFT_ALT | STATE_RIGHT_ALT))\r
+ {\r
+ switch (cmd)\r
+ {\r
+ case 0x0003: key = '²'; break;\r
+ case 0x0008: key = '{'; break;\r
+ case 0x0009: key = '['; break;\r
+ case 0x000A: key = ']'; break;\r
+ case 0x000B: key = '}'; break;\r
+ case 0x000C: key = '\\'; break;\r
+ case 0x001C: key = '~'; break;\r
+ case 0x002D: key = '|'; break;\r
+ case 0x0034: key = 'µ'; break;\r
+ }\r
+ }\r
+ else if (state & (STATE_LEFT_CTRL))\r
+ {\r
+ if (key_table[cmd] >= 'a' && key_table[cmd] <= 'z')\r
+ {\r
+ key = key_table[cmd] - 'a' + 1;\r
+ }\r
+ else\r
+ {\r
+ key = key_table[cmd];\r
+ }\r
+ }\r
+ else\r
+ {\r
+ int idx = cmd + ((state & (STATE_LEFT_SHIFT | STATE_RIGHT_SHIFT)) ? 64 : 0);\r
+\r
+ if (key_table[idx])\r
+ {\r
+ key = key_table[idx];\r
+ }\r
+ }\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ 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
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
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
\r
if (! analyze)\r
{\r
- for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++) // newline: long pause of 800 msec\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
\r
last_ch = ch;\r
\r
- if (! analyze && ! list)\r
- {\r
- (void) irmp_ISR ();\r
-\r
- if (irmp_get_data (&irmp_data))\r
- {\r
- DEBUG_ONLY_NORMAL_PUTCHAR (' ');\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
+ next_tick ();\r
}\r
\r
if (analyze)\r
{\r
- print_spectrum ("START PULSES", start_pulses);\r
- print_spectrum ("START PAUSES", start_pauses);\r
- print_spectrum ("PULSES", pulses);\r
- print_spectrum ("PAUSES", pauses);\r
- puts ("--------------------------------------------------------------------------------------------------------------");\r
+ print_spectrum ("START PULSES", start_pulses, TRUE);\r
+ print_spectrum ("START PAUSES", start_pauses, FALSE);\r
+ print_spectrum ("PULSES", pulses, TRUE);\r
+ print_spectrum ("PAUSES", pauses, FALSE);\r
+ puts ("-------------------------------------------------------------------------------");\r
}\r
return 0;\r
}\r
\r
-#endif // DEBUG\r
+#endif // ANALYZE\r