*\r
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.17 2010/04/16 09:23:29 fm Exp $\r
+ * $Id: irmp.c,v 1.39 2010/06/10 10:09:47 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\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
* 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
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
*\r
* data "0": data "1":\r
* ------________________ ------______________\r
- * 275us 1050us 275us 1900us\r
+ * 275us 775us 275us 1900us\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
+ * GRUNDIG\r
+ * -------\r
+ *\r
+ * packet: 1 start frame + 19,968ms pause + N info frames + 117,76ms pause + 1 stop frame\r
+ * frame: 1 pre bit + 1 start bit + 9 data bits + no stop bit\r
+ * pause between info frames: 117,76ms\r
+ *\r
+ * data of start frame: 9 x 1\r
+ * data of info frame: 9 command bits\r
+ * data of stop frame: 9 x 1\r
+ *\r
+ * pre bit: start bit data "0": data "1":\r
+ * ------____________ ------______ ______------ ------______ \r
+ * 528us 2639us 528us 528us 528us 528us 528us 528us\r
+ *\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ *\r
+ * NOKIA:\r
+ * ------\r
+ *\r
+ * Timing similar to Grundig, but 16 data bits:\r
+ * frame: 1 pre bit + 1 start bit + 8 command bits + 8 address bits + no stop bit\r
+ *\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ *\r
* PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)\r
* -----------------------------------------------------------------------------------------\r
*\r
#include "irmp.h"\r
#include "irmpconfig.h"\r
\r
+#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
+#define IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL 1\r
+#else\r
+#define IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL 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_REPETITION_TIME (uint16_t)(F_INTERRUPTS * 100.0e-3 + 0.5) // autodetect key repetition within 100 msec\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 SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
-#define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
-#define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
-#define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
-#define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
-#define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
+#define SAMSUNG_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define SAMSUNG_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define SAMSUNG_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define SAMSUNG_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define SAMSUNG_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define SAMSUNG_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
\r
#define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
#define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
#define RECS80_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
#define RECS80_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
\r
-#define RC5_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define RC5_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define RC5_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define RC5_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\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_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
\r
-#define DENON_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define DENON_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define DENON_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define DENON_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define DENON_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define DENON_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\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
+#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_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
#define NUBERT_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
#define NUBERT_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
\r
-#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_05 + 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)\r
-#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-\r
-#define AUTO_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_REPETITION_TIME + 0.5) // use uint16_t!\r
+#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 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_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_START_BIT4_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_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 FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define FDC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define FDC_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_20 + 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
+#define FDC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define FDC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\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_PRINTF(...) { if (! silent) { printf (__VA_ARGS__); } }\r
-static int silent;\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
+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
#endif\r
\r
#if IRMP_LOGGING == 1\r
-#define irmp_logIsr(x) irmp_logIr((x) ? 1:0)\r
-#define UART_BAUD 9600L\r
-\r
-// calculate real baud rate:\r
-#define UBRR_VAL ((F_CPU+UART_BAUD*8)/(UART_BAUD*16)-1) // round\r
-#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) // real baudrate\r
-\r
-#ifdef CODEVISION\r
-#if ((BAUD_REAL*1000)/UART_BAUD-1000) > 10\r
-# error Error of baud rate of RS232 UARTx is more than 1%. That is too high!\r
+#define BAUD 9600L\r
+#include <util/setbaud.h>\r
+\r
+#ifdef UBRR0H\r
+\r
+#define UART0_UBRRH UBRR0H\r
+#define UART0_UBRRL UBRR0L\r
+#define UART0_UCSRA UCSR0A\r
+#define UART0_UCSRB UCSR0B\r
+#define UART0_UCSRC UCSR0C\r
+#define UART0_UDRE_BIT_VALUE (1<<UDRE0)\r
+#define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)\r
+#define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)\r
+#ifdef URSEL0\r
+#define UART0_URSEL_BIT_VALUE (1<<URSEL0)\r
+#else\r
+#define UART0_URSEL_BIT_VALUE (0)\r
#endif\r
+#define UART0_TXEN_BIT_VALUE (1<<TXEN0)\r
+#define UART0_UDR UDR0\r
\r
-#else // not CODEVISION\r
-\r
-#define BAUD_ERROR ((BAUD_REAL*1000)/UART_BAUD-1000) // error in promille\r
+#else\r
\r
-#if ((BAUD_ERROR > 10) || (-BAUD_ERROR < 10))\r
-# error Error of baud rate of RS232 UARTx is more than 1%. That is too high!\r
+#define UART0_UBRRH UBRRH\r
+#define UART0_UBRRL UBRRL\r
+#define UART0_UCSRA UCSRA\r
+#define UART0_UCSRB UCSRB\r
+#define UART0_UCSRC UCSRC\r
+#define UART0_UDRE_BIT_VALUE (1<<UDRE)\r
+#define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)\r
+#define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)\r
+#ifdef URSEL\r
+#define UART0_URSEL_BIT_VALUE (1<<URSEL)\r
+#else\r
+#define UART0_URSEL_BIT_VALUE (0)\r
#endif\r
+#define UART0_TXEN_BIT_VALUE (1<<TXEN)\r
+#define UART0_UDR UDR\r
\r
-#endif // CODEVISION\r
+#endif\r
\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* Initialize UART\r
void\r
irmp_uart_init (void)\r
{\r
- UCSR0B |= (1<<TXEN0); // activate UART0 TX\r
- UBRR0H = UBRR_VAL >> 8; // store baudrate (upper byte)\r
- UBRR0L = UBRR_VAL & 0xFF; // store baudrate (lower byte)\r
+ UART0_UBRRH = UBRRH_VALUE; // set baud rate\r
+ UART0_UBRRL = UBRRL_VALUE;\r
+\r
+#if USE_2X\r
+ UART0_UCSRA = (1<<U2X);\r
+#else\r
+ UART0_UCSRA = 0;\r
+#endif\r
+\r
+ UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;\r
+ UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX\r
}\r
\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
void\r
irmp_uart_putc (unsigned char ch)\r
{\r
- while (!(UCSR0A & (1<<UDRE0)))\r
+ while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))\r
{\r
;\r
}\r
\r
- UDR0 = ch;\r
+ UART0_UDR = ch;\r
}\r
\r
/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* Log IR signal\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*/\r
-#define c_startcycles 2 // min count of zeros before start of logging\r
-#define c_endBits 1000 // log buffer size\r
-#define c_datalen 700 // number of sequenced highbits to detect end\r
+\r
+#define STARTCYCLES 2 // min count of zeros before start of logging\r
+#define ENDBITS 1000 // number of sequenced highbits to detect end\r
+#define DATALEN 700 // log buffer size\r
\r
static void\r
-irmp_logIr (uint8_t val)\r
+irmp_log (uint8_t val)\r
{\r
- static uint8_t s_data[c_datalen]; // logging buffer\r
- static uint16_t s_dataIdx; // number of written bits\r
- static uint8_t s_startcycles; // current number of start-zeros\r
- static uint16_t s_ctr; // counts sequenced highbits - to detect end\r
+ static uint8_t buf[DATALEN]; // logging buffer\r
+ static uint16_t buf_idx; // number of written bits\r
+ static uint8_t startcycles; // current number of start-zeros\r
+ static uint16_t cnt; // counts sequenced highbits - to detect end\r
\r
- if ((val == 0) && (s_startcycles < c_startcycles) && !s_dataIdx) // prevent that single random zeros init logging\r
+ if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging\r
{\r
- ++s_startcycles;\r
+ startcycles++;\r
}\r
else\r
{\r
- s_startcycles = 0;\r
+ startcycles = 0;\r
\r
- if ( (val == 0) // start or continue logging on "0"\r
- || ((val == 1) && (s_dataIdx != 0))) // "1" cannot init logging\r
+ if (! val || (val && buf_idx != 0)) // start or continue logging on "0", "1" cannot init logging\r
{\r
- if (val)\r
- { // set or clear bit in bitarray\r
- s_data[(s_dataIdx / 8)] |= (1<<(s_dataIdx % 8));\r
- }\r
- else\r
- {\r
- s_data[(s_dataIdx / 8)] &= ~(1<<(s_dataIdx % 8));\r
- }\r
+ if (buf_idx < DATALEN * 8) // index in range?\r
+ { // yes\r
+ if (val)\r
+ {\r
+ buf[(buf_idx / 8)] |= (1<<(buf_idx % 8)); // set bit\r
+ }\r
+ else\r
+ {\r
+ buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8)); // reset bit\r
+ }\r
\r
- ++s_dataIdx;\r
+ buf_idx++;\r
+ }\r
\r
if (val)\r
- { // if high received then look at log-stop condition\r
- ++s_ctr;\r
+ { // if high received then look at log-stop condition\r
+ cnt++;\r
\r
- if (s_ctr > c_endBits)\r
- { // if stop condition (200 sequenced ones) meets, output on uart\r
+ if (cnt > ENDBITS)\r
+ { // if stop condition is true, output on uart\r
uint16_t i;\r
\r
- for (i = 0; i < c_startcycles; ++i)\r
+ for (i = 0; i < STARTCYCLES; i++)\r
{\r
- irmp_uart_putc ('0'); // the ignored starting zeros\r
+ irmp_uart_putc ('0'); // the ignored starting zeros\r
}\r
\r
- for (i = 0;i < (s_dataIdx - c_endBits + 20) / 8; ++i) // transform bitset into uart chars\r
+ for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++) // transform bitset into uart chars\r
{\r
- uint8_t d = s_data[i];\r
+ uint8_t d = buf[i];\r
uint8_t j;\r
\r
- for (j = 0;j<8;++j)\r
+ for (j = 0; j < 8; j++)\r
{\r
irmp_uart_putc ((d & 1) + '0');\r
d >>= 1;\r
}\r
\r
irmp_uart_putc ('\n');\r
- s_dataIdx = 0;\r
+ buf_idx = 0;\r
}\r
}\r
else\r
{\r
- s_ctr = 0;\r
+ cnt = 0;\r
}\r
}\r
}\r
}\r
\r
#else\r
-#define irmp_logIsr(x)\r
+#define irmp_log(val)\r
#endif\r
\r
typedef struct\r
\r
static PROGMEM IRMP_PARAMETER sircs_param =\r
{\r
- IRMP_SIRCS_PROTOCOL,\r
- SIRCS_1_PULSE_LEN_MIN,\r
- SIRCS_1_PULSE_LEN_MAX,\r
- SIRCS_PAUSE_LEN_MIN,\r
- SIRCS_PAUSE_LEN_MAX,\r
- SIRCS_0_PULSE_LEN_MIN,\r
- SIRCS_0_PULSE_LEN_MAX,\r
- SIRCS_PAUSE_LEN_MIN,\r
- SIRCS_PAUSE_LEN_MAX,\r
- SIRCS_ADDRESS_OFFSET,\r
- SIRCS_ADDRESS_OFFSET + SIRCS_ADDRESS_LEN,\r
- SIRCS_COMMAND_OFFSET,\r
- SIRCS_COMMAND_OFFSET + SIRCS_COMMAND_LEN,\r
- SIRCS_COMPLETE_DATA_LEN,\r
- SIRCS_STOP_BIT,\r
- SIRCS_LSB\r
+ IRMP_SIRCS_PROTOCOL, // protocol: ir protocol\r
+ SIRCS_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ SIRCS_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ SIRCS_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ SIRCS_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ SIRCS_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ SIRCS_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ SIRCS_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ SIRCS_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ SIRCS_ADDRESS_OFFSET, // address_offset: address offset\r
+ SIRCS_ADDRESS_OFFSET + SIRCS_ADDRESS_LEN, // address_end: end of address\r
+ SIRCS_COMMAND_OFFSET, // command_offset: command offset\r
+ SIRCS_COMMAND_OFFSET + SIRCS_COMMAND_LEN, // command_end: end of command\r
+ SIRCS_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ SIRCS_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ SIRCS_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER nec_param =\r
{\r
- IRMP_NEC_PROTOCOL,\r
- NEC_PULSE_LEN_MIN,\r
- NEC_PULSE_LEN_MAX,\r
- NEC_1_PAUSE_LEN_MIN,\r
- NEC_1_PAUSE_LEN_MAX,\r
- NEC_PULSE_LEN_MIN,\r
- NEC_PULSE_LEN_MAX,\r
- NEC_0_PAUSE_LEN_MIN,\r
- NEC_0_PAUSE_LEN_MAX,\r
- NEC_ADDRESS_OFFSET,\r
- NEC_ADDRESS_OFFSET + NEC_ADDRESS_LEN,\r
- NEC_COMMAND_OFFSET,\r
- NEC_COMMAND_OFFSET + NEC_COMMAND_LEN,\r
- NEC_COMPLETE_DATA_LEN,\r
- NEC_STOP_BIT,\r
- NEC_LSB\r
+ IRMP_NEC_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
+ NEC_ADDRESS_OFFSET, // address_offset: address offset\r
+ NEC_ADDRESS_OFFSET + NEC_ADDRESS_LEN, // address_end: end of address\r
+ NEC_COMMAND_OFFSET, // command_offset: command offset\r
+ NEC_COMMAND_OFFSET + NEC_COMMAND_LEN, // command_end: end of command\r
+ NEC_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NEC_LSB // lsb_first: flag: LSB first\r
+};\r
+\r
+static PROGMEM IRMP_PARAMETER nec_rep_param =\r
+{\r
+ IRMP_NEC_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
+ 0, // address_offset: address offset\r
+ 0, // address_end: end of address\r
+ 0, // command_offset: command offset\r
+ 0, // command_end: end of command\r
+ 0, // complete_len: complete length of frame\r
+ NEC_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NEC_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER samsung_param =\r
{\r
- IRMP_SAMSUNG_PROTOCOL,\r
- SAMSUNG_PULSE_LEN_MIN,\r
- SAMSUNG_PULSE_LEN_MAX,\r
- SAMSUNG_1_PAUSE_LEN_MIN,\r
- SAMSUNG_1_PAUSE_LEN_MAX,\r
- SAMSUNG_PULSE_LEN_MIN,\r
- SAMSUNG_PULSE_LEN_MAX,\r
- SAMSUNG_0_PAUSE_LEN_MIN,\r
- SAMSUNG_0_PAUSE_LEN_MAX,\r
- SAMSUNG_ADDRESS_OFFSET,\r
- SAMSUNG_ADDRESS_OFFSET + SAMSUNG_ADDRESS_LEN,\r
- SAMSUNG_COMMAND_OFFSET,\r
- SAMSUNG_COMMAND_OFFSET + SAMSUNG_COMMAND_LEN,\r
- SAMSUNG_COMPLETE_DATA_LEN,\r
- SAMSUNG_STOP_BIT,\r
- SAMSUNG_LSB\r
+ IRMP_SAMSUNG_PROTOCOL, // protocol: ir protocol\r
+ SAMSUNG_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ SAMSUNG_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ SAMSUNG_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ SAMSUNG_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ SAMSUNG_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ SAMSUNG_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ SAMSUNG_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ SAMSUNG_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ SAMSUNG_ADDRESS_OFFSET, // address_offset: address offset\r
+ SAMSUNG_ADDRESS_OFFSET + SAMSUNG_ADDRESS_LEN, // address_end: end of address\r
+ SAMSUNG_COMMAND_OFFSET, // command_offset: command offset\r
+ SAMSUNG_COMMAND_OFFSET + SAMSUNG_COMMAND_LEN, // command_end: end of command\r
+ SAMSUNG_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ SAMSUNG_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ SAMSUNG_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER matsushita_param =\r
{\r
- IRMP_MATSUSHITA_PROTOCOL,\r
- MATSUSHITA_PULSE_LEN_MIN,\r
- MATSUSHITA_PULSE_LEN_MAX,\r
- MATSUSHITA_1_PAUSE_LEN_MIN,\r
- MATSUSHITA_1_PAUSE_LEN_MAX,\r
- MATSUSHITA_PULSE_LEN_MIN,\r
- MATSUSHITA_PULSE_LEN_MAX,\r
- MATSUSHITA_0_PAUSE_LEN_MIN,\r
- MATSUSHITA_0_PAUSE_LEN_MAX,\r
- MATSUSHITA_ADDRESS_OFFSET,\r
- MATSUSHITA_ADDRESS_OFFSET + MATSUSHITA_ADDRESS_LEN,\r
- MATSUSHITA_COMMAND_OFFSET,\r
- MATSUSHITA_COMMAND_OFFSET + MATSUSHITA_COMMAND_LEN,\r
- MATSUSHITA_COMPLETE_DATA_LEN,\r
- MATSUSHITA_STOP_BIT,\r
- MATSUSHITA_LSB\r
+ IRMP_MATSUSHITA_PROTOCOL, // protocol: ir protocol\r
+ MATSUSHITA_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ MATSUSHITA_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ MATSUSHITA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ MATSUSHITA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ MATSUSHITA_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ MATSUSHITA_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ MATSUSHITA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ MATSUSHITA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ MATSUSHITA_ADDRESS_OFFSET, // address_offset: address offset\r
+ MATSUSHITA_ADDRESS_OFFSET + MATSUSHITA_ADDRESS_LEN, // address_end: end of address\r
+ MATSUSHITA_COMMAND_OFFSET, // command_offset: command offset\r
+ MATSUSHITA_COMMAND_OFFSET + MATSUSHITA_COMMAND_LEN, // command_end: end of command\r
+ MATSUSHITA_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ MATSUSHITA_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ MATSUSHITA_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER kaseikyo_param =\r
{\r
- IRMP_KASEIKYO_PROTOCOL,\r
- KASEIKYO_PULSE_LEN_MIN,\r
- KASEIKYO_PULSE_LEN_MAX,\r
- KASEIKYO_1_PAUSE_LEN_MIN,\r
- KASEIKYO_1_PAUSE_LEN_MAX,\r
- KASEIKYO_PULSE_LEN_MIN,\r
- KASEIKYO_PULSE_LEN_MAX,\r
- KASEIKYO_0_PAUSE_LEN_MIN,\r
- KASEIKYO_0_PAUSE_LEN_MAX,\r
- KASEIKYO_ADDRESS_OFFSET,\r
- KASEIKYO_ADDRESS_OFFSET + KASEIKYO_ADDRESS_LEN,\r
- KASEIKYO_COMMAND_OFFSET,\r
- KASEIKYO_COMMAND_OFFSET + KASEIKYO_COMMAND_LEN,\r
- KASEIKYO_COMPLETE_DATA_LEN,\r
- KASEIKYO_STOP_BIT,\r
- KASEIKYO_LSB\r
+ IRMP_KASEIKYO_PROTOCOL, // protocol: ir protocol\r
+ KASEIKYO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ KASEIKYO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ KASEIKYO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ KASEIKYO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ KASEIKYO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ KASEIKYO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ KASEIKYO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ KASEIKYO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ KASEIKYO_ADDRESS_OFFSET, // address_offset: address offset\r
+ KASEIKYO_ADDRESS_OFFSET + KASEIKYO_ADDRESS_LEN, // address_end: end of address\r
+ KASEIKYO_COMMAND_OFFSET, // command_offset: command offset\r
+ KASEIKYO_COMMAND_OFFSET + KASEIKYO_COMMAND_LEN, // command_end: end of command\r
+ KASEIKYO_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ KASEIKYO_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ KASEIKYO_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER recs80_param =\r
{\r
- IRMP_RECS80_PROTOCOL,\r
- RECS80_PULSE_LEN_MIN,\r
- RECS80_PULSE_LEN_MAX,\r
- RECS80_1_PAUSE_LEN_MIN,\r
- RECS80_1_PAUSE_LEN_MAX,\r
- RECS80_PULSE_LEN_MIN,\r
- RECS80_PULSE_LEN_MAX,\r
- RECS80_0_PAUSE_LEN_MIN,\r
- RECS80_0_PAUSE_LEN_MAX,\r
- RECS80_ADDRESS_OFFSET,\r
- RECS80_ADDRESS_OFFSET + RECS80_ADDRESS_LEN,\r
- RECS80_COMMAND_OFFSET,\r
- RECS80_COMMAND_OFFSET + RECS80_COMMAND_LEN,\r
- RECS80_COMPLETE_DATA_LEN,\r
- RECS80_STOP_BIT,\r
- RECS80_LSB\r
+ IRMP_RECS80_PROTOCOL, // protocol: ir protocol\r
+ RECS80_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ RECS80_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ RECS80_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ RECS80_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ RECS80_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ RECS80_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ RECS80_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ RECS80_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ RECS80_ADDRESS_OFFSET, // address_offset: address offset\r
+ RECS80_ADDRESS_OFFSET + RECS80_ADDRESS_LEN, // address_end: end of address\r
+ RECS80_COMMAND_OFFSET, // command_offset: command offset\r
+ RECS80_COMMAND_OFFSET + RECS80_COMMAND_LEN, // command_end: end of command\r
+ RECS80_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ RECS80_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RECS80_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER rc5_param =\r
{\r
- IRMP_RC5_PROTOCOL,\r
- RC5_BIT_LEN_MIN,\r
- RC5_BIT_LEN_MAX,\r
- RC5_BIT_LEN_MIN,\r
- RC5_BIT_LEN_MAX,\r
- 1, // tricky: use this as stop bit length\r
- 1,\r
- 1,\r
- 1,\r
- RC5_ADDRESS_OFFSET,\r
- RC5_ADDRESS_OFFSET + RC5_ADDRESS_LEN,\r
- RC5_COMMAND_OFFSET,\r
- RC5_COMMAND_OFFSET + RC5_COMMAND_LEN,\r
- RC5_COMPLETE_DATA_LEN,\r
- RC5_STOP_BIT,\r
- RC5_LSB\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_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
+ RC5_COMMAND_OFFSET + RC5_COMMAND_LEN, // command_end: end of command\r
+ RC5_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ RC5_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RC5_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER denon_param =\r
{\r
- IRMP_DENON_PROTOCOL,\r
- DENON_PULSE_LEN_MIN,\r
- DENON_PULSE_LEN_MAX,\r
- DENON_1_PAUSE_LEN_MIN,\r
- DENON_1_PAUSE_LEN_MAX,\r
- DENON_PULSE_LEN_MIN,\r
- DENON_PULSE_LEN_MAX,\r
- DENON_0_PAUSE_LEN_MIN,\r
- DENON_0_PAUSE_LEN_MAX,\r
- DENON_ADDRESS_OFFSET,\r
- DENON_ADDRESS_OFFSET + DENON_ADDRESS_LEN,\r
- DENON_COMMAND_OFFSET,\r
- DENON_COMMAND_OFFSET + DENON_COMMAND_LEN,\r
- DENON_COMPLETE_DATA_LEN,\r
- DENON_STOP_BIT,\r
- DENON_LSB\r
+ IRMP_DENON_PROTOCOL, // protocol: ir protocol\r
+ DENON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ DENON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ DENON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ DENON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ DENON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ DENON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ DENON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ DENON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ DENON_ADDRESS_OFFSET, // address_offset: address offset\r
+ DENON_ADDRESS_OFFSET + DENON_ADDRESS_LEN, // address_end: end of address\r
+ DENON_COMMAND_OFFSET, // command_offset: command offset\r
+ DENON_COMMAND_OFFSET + DENON_COMMAND_LEN, // command_end: end of command\r
+ DENON_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ DENON_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ DENON_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER rc6_param =\r
{\r
- IRMP_RC6_PROTOCOL,\r
- RC6_BIT_LEN_MIN,\r
- RC6_BIT_LEN_MAX,\r
- RC6_BIT_LEN_MIN,\r
- RC6_BIT_LEN_MAX,\r
- 1, // tricky: use this as stop bit length\r
- 1,\r
- 1,\r
- 1,\r
- RC6_ADDRESS_OFFSET,\r
- RC6_ADDRESS_OFFSET + RC6_ADDRESS_LEN,\r
- RC6_COMMAND_OFFSET,\r
- RC6_COMMAND_OFFSET + RC6_COMMAND_LEN,\r
- RC6_COMPLETE_DATA_LEN_SHORT,\r
- RC6_STOP_BIT,\r
- RC6_LSB\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
+ 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
+ RC6_COMMAND_OFFSET + RC6_COMMAND_LEN, // command_end: end of command\r
+ RC6_COMPLETE_DATA_LEN_SHORT, // complete_len: complete length of frame\r
+ RC6_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RC6_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER recs80ext_param =\r
{\r
- IRMP_RECS80EXT_PROTOCOL,\r
- RECS80EXT_PULSE_LEN_MIN,\r
- RECS80EXT_PULSE_LEN_MAX,\r
- RECS80EXT_1_PAUSE_LEN_MIN,\r
- RECS80EXT_1_PAUSE_LEN_MAX,\r
- RECS80EXT_PULSE_LEN_MIN,\r
- RECS80EXT_PULSE_LEN_MAX,\r
- RECS80EXT_0_PAUSE_LEN_MIN,\r
- RECS80EXT_0_PAUSE_LEN_MAX,\r
- RECS80EXT_ADDRESS_OFFSET,\r
- RECS80EXT_ADDRESS_OFFSET + RECS80EXT_ADDRESS_LEN,\r
- RECS80EXT_COMMAND_OFFSET,\r
- RECS80EXT_COMMAND_OFFSET + RECS80EXT_COMMAND_LEN,\r
- RECS80EXT_COMPLETE_DATA_LEN,\r
- RECS80EXT_STOP_BIT,\r
- RECS80EXT_LSB\r
+ IRMP_RECS80EXT_PROTOCOL, // protocol: ir protocol\r
+ RECS80EXT_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ RECS80EXT_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ RECS80EXT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ RECS80EXT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ RECS80EXT_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ RECS80EXT_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ RECS80EXT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ RECS80EXT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ RECS80EXT_ADDRESS_OFFSET, // address_offset: address offset\r
+ RECS80EXT_ADDRESS_OFFSET + RECS80EXT_ADDRESS_LEN, // address_end: end of address\r
+ RECS80EXT_COMMAND_OFFSET, // command_offset: command offset\r
+ RECS80EXT_COMMAND_OFFSET + RECS80EXT_COMMAND_LEN, // command_end: end of command\r
+ RECS80EXT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ RECS80EXT_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RECS80EXT_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER nubert_param =\r
{\r
- IRMP_NUBERT_PROTOCOL,\r
- NUBERT_1_PULSE_LEN_MIN,\r
- NUBERT_1_PULSE_LEN_MAX,\r
- NUBERT_1_PAUSE_LEN_MIN,\r
- NUBERT_1_PAUSE_LEN_MAX,\r
- NUBERT_0_PULSE_LEN_MIN,\r
- NUBERT_0_PULSE_LEN_MAX,\r
- NUBERT_0_PAUSE_LEN_MIN,\r
- NUBERT_0_PAUSE_LEN_MAX,\r
- NUBERT_ADDRESS_OFFSET,\r
- NUBERT_ADDRESS_OFFSET + NUBERT_ADDRESS_LEN,\r
- NUBERT_COMMAND_OFFSET,\r
- NUBERT_COMMAND_OFFSET + NUBERT_COMMAND_LEN,\r
- NUBERT_COMPLETE_DATA_LEN,\r
- NUBERT_STOP_BIT,\r
- NUBERT_LSB\r
+ IRMP_NUBERT_PROTOCOL, // protocol: ir protocol\r
+ NUBERT_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ NUBERT_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ NUBERT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ NUBERT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ NUBERT_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ NUBERT_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ NUBERT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ NUBERT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ NUBERT_ADDRESS_OFFSET, // address_offset: address offset\r
+ NUBERT_ADDRESS_OFFSET + NUBERT_ADDRESS_LEN, // address_end: end of address\r
+ NUBERT_COMMAND_OFFSET, // command_offset: command offset\r
+ NUBERT_COMMAND_OFFSET + NUBERT_COMMAND_LEN, // command_end: end of command\r
+ NUBERT_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ NUBERT_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ NUBERT_LSB // lsb_first: flag: LSB first\r
};\r
\r
#endif\r
\r
static PROGMEM IRMP_PARAMETER bang_olufsen_param =\r
{\r
- IRMP_BANG_OLUFSEN_PROTOCOL,\r
- BANG_OLUFSEN_PULSE_LEN_MIN,\r
- BANG_OLUFSEN_PULSE_LEN_MAX,\r
- BANG_OLUFSEN_1_PAUSE_LEN_MIN,\r
- BANG_OLUFSEN_1_PAUSE_LEN_MAX,\r
- BANG_OLUFSEN_PULSE_LEN_MIN,\r
- BANG_OLUFSEN_PULSE_LEN_MAX,\r
- BANG_OLUFSEN_0_PAUSE_LEN_MIN,\r
- BANG_OLUFSEN_0_PAUSE_LEN_MAX,\r
- BANG_OLUFSEN_ADDRESS_OFFSET,\r
- BANG_OLUFSEN_ADDRESS_OFFSET + BANG_OLUFSEN_ADDRESS_LEN,\r
- BANG_OLUFSEN_COMMAND_OFFSET,\r
- BANG_OLUFSEN_COMMAND_OFFSET + BANG_OLUFSEN_COMMAND_LEN,\r
- BANG_OLUFSEN_COMPLETE_DATA_LEN,\r
- BANG_OLUFSEN_STOP_BIT,\r
- BANG_OLUFSEN_LSB\r
+ IRMP_BANG_OLUFSEN_PROTOCOL, // protocol: ir protocol\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ BANG_OLUFSEN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ BANG_OLUFSEN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ BANG_OLUFSEN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ BANG_OLUFSEN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ BANG_OLUFSEN_ADDRESS_OFFSET, // address_offset: address offset\r
+ BANG_OLUFSEN_ADDRESS_OFFSET + BANG_OLUFSEN_ADDRESS_LEN, // address_end: end of address\r
+ BANG_OLUFSEN_COMMAND_OFFSET, // command_offset: command offset\r
+ BANG_OLUFSEN_COMMAND_OFFSET + BANG_OLUFSEN_COMMAND_LEN, // command_end: end of command\r
+ BANG_OLUFSEN_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ BANG_OLUFSEN_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ BANG_OLUFSEN_LSB // lsb_first: flag: LSB first\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\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
+ 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
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER siemens_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
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
+\r
+static PROGMEM IRMP_PARAMETER fdc_param =\r
+{\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
};\r
\r
#endif\r
\r
-static uint8_t irmp_bit; // current bit position\r
+static uint8_t irmp_bit; // current bit position\r
static IRMP_PARAMETER irmp_param;\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_command;\r
-static volatile uint16_t irmp_id; // only used for SAMSUNG protocol\r
+static volatile uint16_t irmp_id; // only used for SAMSUNG protocol\r
static volatile uint8_t irmp_flags;\r
\r
#ifdef DEBUG\r
irmp_init (void)\r
{\r
#ifndef PIC_CCS_COMPILER\r
- IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r
- IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r
+ IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r
+ IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r
#endif // PIC_CCS_COMPILER\r
\r
#if IRMP_LOGGING == 1\r
* @details ISR routine, called 10000 times per second\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*/\r
-void\r
+uint8_t\r
irmp_ISR (void)\r
{\r
static uint8_t irmp_start_bit_detected; // flag: start bit detected\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
#if IRMP_SUPPORT_DENON_PROTOCOL == 1\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
#endif\r
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_RC6_PROTOCOL == 1 || IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
static uint8_t last_pause; // last pause value\r
#endif\r
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_RC6_PROTOCOL == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_RC6_PROTOCOL == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 || \\r
+ IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 \r
static uint8_t last_value; // last bit value\r
#endif\r
uint8_t irmp_input; // input value\r
\r
+#ifdef DEBUG\r
+ time_counter++;\r
+#endif\r
+\r
irmp_input = input(IRMP_PIN);\r
\r
- irmp_logIsr(irmp_input); // log ir signal, if IRMP_LOGGING defined\r
+ irmp_log(irmp_input); // log ir signal, if IRMP_LOGGING defined\r
\r
if (! irmp_ir_detected) // ir code already detected?\r
{ // no...\r
if (! irmp_start_bit_detected) // start bit detected?\r
{ // no...\r
- if (!irmp_input) // receiving burst?\r
+ if (! irmp_input) // receiving burst?\r
{ // yes...\r
+#ifdef DEBUG\r
+ if (! irmp_pulse_time)\r
+ {\r
+ DEBUG_PRINTF("%8d [starting pulse]\n", time_counter);\r
+ }\r
+#endif\r
irmp_pulse_time++; // increment counter\r
}\r
else\r
\r
if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r
{ // yes...\r
- DEBUG_PRINTF ("error 1: pause after start bit %d too long: %d\n", irmp_pulse_time, irmp_pause_time);\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
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
}\r
else\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
\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
+ { // it's SIRCS\r
DEBUG_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
- memcpy_P (&irmp_param, &sircs_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_SIRCS_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
- (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
- if (irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
- {\r
- DEBUG_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
- {\r
- DEBUG_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
- }\r
-\r
- memcpy_P (&irmp_param, &nec_param, sizeof (IRMP_PARAMETER));\r
-\r
- if (irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
- {\r
- irmp_param.address_offset = 0;\r
- irmp_param.address_end = 0;\r
- irmp_param.command_offset = 0;\r
- irmp_param.command_end = 0;\r
- irmp_param.complete_len = 0;\r
- }\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
+ 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
+ }\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
+ 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
+ irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\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
+ { // it's SAMSUNG\r
DEBUG_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
- memcpy_P (&irmp_param, &samsung_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &samsung_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
#if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\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
+ { // it's MATSUSHITA\r
DEBUG_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
- memcpy_P (&irmp_param, &matsushita_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r
#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\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
+ { // it's KASEIKYO\r
DEBUG_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
- memcpy_P (&irmp_param, &kaseikyo_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
#if IRMP_SUPPORT_RECS80_PROTOCOL == 1\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
+ { // it's RECS80\r
DEBUG_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
- memcpy_P (&irmp_param, &recs80_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &recs80_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1\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
- { // it's RC5\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
- memcpy_P (&irmp_param, &rc5_param, sizeof (IRMP_PARAMETER));\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
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
- memcpy_P (&irmp_param, &denon_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &denon_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r
DEBUG_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
- memcpy_P (&irmp_param, &rc6_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &rc6_param;\r
last_pause = 0;\r
last_value = 0;\r
}\r
#if IRMP_SUPPORT_RECS80EXT_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
+ { // it's RECS80EXT\r
DEBUG_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
- memcpy_P (&irmp_param, &recs80ext_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r
#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\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
+ { // it's NUBERT\r
DEBUG_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
- memcpy_P (&irmp_param, &nubert_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &nubert_param;\r
}\r
else\r
#endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r
#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\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
+ { // 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
BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
DEBUG_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
- memcpy_P (&irmp_param, &bang_olufsen_param, sizeof (IRMP_PARAMETER));\r
+ irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;\r
last_value = 0;\r
}\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
+ { // 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
+ 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
+ last_pause = irmp_pause_time;\r
+ last_value = 1;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\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 = 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_NEC_PROTOCOL == 1\r
+\r
{\r
DEBUG_PRINTF ("protocol = UNKNOWN\n");\r
irmp_start_bit_detected = 0; // wait for another start bit...\r
\r
if (irmp_start_bit_detected)\r
{\r
+ memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));\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
+\r
#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r
{\r
#endif\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
+\r
#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\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
+ 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
}\r
\r
irmp_bit = 0;\r
{\r
if (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
DEBUG_PUTCHAR ('1');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (1);\r
}\r
else if (! last_value)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
DEBUG_PUTCHAR ('0');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
}\r
}\r
else\r
#endif // IRMP_SUPPORT_RC5_PROTOCOL == 1\r
\r
+#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL || irmp_param.protocol == IRMP_NOKIA_PROTOCOL)\r
+ {\r
+ if (irmp_pause_time > GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX && irmp_pause_time <= 2 * GRUNDIG_OR_NOKIA_START_BIT_LEN_MAX)\r
+ {\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PUTCHAR ('0');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (0);\r
+ }\r
+ else if (! last_value)\r
+ {\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PUTCHAR ('1');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (1);\r
+ }\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_SIEMENS_PROTOCOL)\r
+ {\r
+ if (irmp_pause_time > SIEMENS_START_BIT_LEN_MAX && irmp_pause_time <= 2 * SIEMENS_START_BIT_LEN_MAX)\r
+ {\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PUTCHAR ('0');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (0);\r
+ }\r
+ else if (! last_value)\r
+ {\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PUTCHAR ('1');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (1);\r
+ }\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+\r
#if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_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_PUTCHAR ('\n');\r
+ DEBUG_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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
}\r
}\r
if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max)\r
{\r
#ifdef DEBUG\r
- if (irmp_param.protocol != IRMP_RC5_PROTOCOL)\r
+ if (irmp_param.protocol != IRMP_RC5_PROTOCOL &&\r
+ irmp_param.protocol != IRMP_RC6_PROTOCOL &&\r
+ irmp_param.protocol != IRMP_GRUNDIG_PROTOCOL &&\r
+ irmp_param.protocol != IRMP_NOKIA_PROTOCOL &&\r
+ irmp_param.protocol != IRMP_SIEMENS_PROTOCOL)\r
{\r
DEBUG_PRINTF ("stop bit detected\n");\r
}\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
+ 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
irmp_pause_time > 2 * RC5_BIT_LEN_MAX && irmp_bit >= RC5_COMPLETE_DATA_LEN - 2 && !irmp_param.stop_bit)\r
{ // special rc5 decoder\r
got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
- irmp_param.stop_bit = TRUE; // set flag\r
+ irmp_param.stop_bit = TRUE; // set flag\r
}\r
else\r
#endif\r
irmp_pause_time > 2 * RC6_BIT_LEN_MAX && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r
{ // special rc6 decoder\r
got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
- irmp_param.stop_bit = TRUE; // set flag\r
+ irmp_param.stop_bit = TRUE; // set flag\r
+ }\r
+ else\r
+#endif\r
+#if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL &&\r
+ irmp_pause_time > 2 * GRUNDIG_OR_NOKIA_BIT_LEN_MAX && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2 && !irmp_param.stop_bit)\r
+ { // special Grundig/Nokia 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
+ irmp_param.stop_bit = TRUE; // set flag\r
+ }\r
+ else\r
+#endif\r
+#if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL &&\r
+ irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r
+ {\r
+ DEBUG_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
+ irmp_param.command_offset = NOKIA_COMMAND_OFFSET;\r
+ irmp_param.command_end = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;\r
+\r
+ if (irmp_tmp_command & 0x300)\r
+ {\r
+ irmp_tmp_address = (irmp_tmp_command >> 8);\r
+ irmp_tmp_command &= 0xFF;\r
+ }\r
+ }\r
+ else\r
+#endif\r
+#if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL &&\r
+ irmp_pause_time > 2 * GRUNDIG_OR_NOKIA_BIT_LEN_MAX && irmp_bit >= NOKIA_COMPLETE_DATA_LEN - 2 && !irmp_param.stop_bit)\r
+ { // special Grundig/Nokia decoder\r
+ got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
+ irmp_param.stop_bit = TRUE; // set flag\r
+ }\r
+ else\r
+#endif\r
+#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_SIEMENS_PROTOCOL &&\r
+ irmp_pause_time > 2 * SIEMENS_BIT_LEN_MAX && irmp_bit >= SIEMENS_COMPLETE_DATA_LEN - 2 && !irmp_param.stop_bit)\r
+ { // special rc5 decoder\r
+ got_light = TRUE; // this is a lie, but generates a stop bit ;-)\r
+ irmp_param.stop_bit = TRUE; // set flag\r
}\r
else\r
#endif\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
\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 ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
\r
#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
- if (irmp_param.protocol == IRMP_RC5_PROTOCOL) // special rc5 decoder\r
+ if (irmp_param.protocol == IRMP_RC5_PROTOCOL) // special rc5 decoder\r
{\r
if (irmp_pulse_time > RC5_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_BIT_LEN_MAX)\r
{\r
DEBUG_PUTCHAR ('1');\r
irmp_store_bit (1);\r
DEBUG_PUTCHAR ('0');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
last_value = 0;\r
}\r
}\r
\r
DEBUG_PUTCHAR (rc5_value + '0');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (rc5_value);\r
}\r
\r
else\r
#endif\r
\r
+#if IRMP_SUPPORT_GRUNDIG_OR_NOKIA_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL || // special Grundig decoder\r
+ irmp_param.protocol == IRMP_NOKIA_PROTOCOL) // special Nokia decoder\r
+ {\r
+ if (irmp_pulse_time > GRUNDIG_OR_NOKIA_BIT_LEN_MAX && irmp_pulse_time <= 2 * GRUNDIG_OR_NOKIA_BIT_LEN_MAX)\r
+ {\r
+ DEBUG_PUTCHAR ('0');\r
+ irmp_store_bit (0);\r
+ DEBUG_PUTCHAR ('1');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (1);\r
+ last_value = 1;\r
+ }\r
+\r
+ else // if (irmp_pulse_time >= GRUNDIG_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_OR_NOKIA_BIT_LEN_MAX)\r
+ {\r
+ uint8_t grundig_value;\r
+\r
+ if (last_pause > GRUNDIG_OR_NOKIA_BIT_LEN_MAX && last_pause <= 2 * GRUNDIG_OR_NOKIA_BIT_LEN_MAX)\r
+ {\r
+ grundig_value = last_value ? 0 : 1;\r
+ last_value = grundig_value;\r
+ }\r
+ else\r
+ {\r
+ grundig_value = last_value;\r
+ }\r
+\r
+ DEBUG_PUTCHAR (grundig_value + '0');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (grundig_value);\r
+ }\r
+\r
+ last_pause = irmp_pause_time;\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
+#endif\r
+\r
#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_RC6_PROTOCOL) // special rc6 decoder\r
{\r
DEBUG_PUTCHAR ('0');\r
irmp_store_bit (0);\r
last_value = 0;\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
break;\r
\r
default:\r
DEBUG_PUTCHAR ('0');\r
irmp_store_bit (0);\r
DEBUG_PUTCHAR ('1');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (1);\r
last_value = 1;\r
}\r
}\r
\r
DEBUG_PUTCHAR (rc5_value + '0');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (rc5_value);\r
}\r
\r
wait_for_space = 0;\r
}\r
else\r
+#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_SIEMENS_PROTOCOL) // special siemens decoder\r
+ {\r
+ if (irmp_pulse_time > SIEMENS_BIT_LEN_MAX && irmp_pulse_time <= 2 * SIEMENS_BIT_LEN_MAX)\r
+ {\r
+ DEBUG_PUTCHAR ('0');\r
+ irmp_store_bit (0);\r
+ DEBUG_PUTCHAR ('1');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (1);\r
+ last_value = 1;\r
+ }\r
+\r
+ else // if (irmp_pulse_time >= SIEMENS_BIT_LEN_MIN && irmp_pulse_time <= SIEMENS_BIT_LEN_MAX)\r
+ {\r
+ uint8_t siemens_value;\r
+\r
+ if (last_pause > SIEMENS_BIT_LEN_MAX && last_pause <= 2 * SIEMENS_BIT_LEN_MAX)\r
+ {\r
+ siemens_value = last_value ? 0 : 1;\r
+ last_value = siemens_value;\r
+ }\r
+ else\r
+ {\r
+ siemens_value = last_value;\r
+ }\r
+\r
+ DEBUG_PUTCHAR (siemens_value + '0');\r
+ DEBUG_NEWLINE ();\r
+ irmp_store_bit (siemens_value);\r
+ }\r
+\r
+ last_pause = irmp_pause_time;\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
#endif\r
\r
#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
}\r
else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)\r
{\r
+ irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;\r
+ irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;\r
+ irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r
+ irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;\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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (1);\r
wait_for_space = 0;\r
}\r
else\r
{\r
DEBUG_PUTCHAR ('0');\r
- DEBUG_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
wait_for_space = 0;\r
}\r
\r
DEBUG_PRINTF ("Switching to SAMSUNG32 protocol\n");\r
-\r
- irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;\r
- irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;\r
- irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r
- irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;\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
irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
irmp_pause_time = 0;\r
}\r
-\r
- irmp_pulse_time = 1; // set counter to 1, not 0\r
}\r
else\r
#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL\r
{\r
if (irmp_pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)\r
{\r
- if (irmp_bit == 1) // Bang & Olufsen: 3rd bit\r
+ if (irmp_bit == 1) // Bang & Olufsen: 3rd bit\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
irmp_bit++;\r
}\r
else\r
- { // timing incorrect!\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
- irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
+ DEBUG_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
- irmp_pulse_time = 1; // set counter to 1, not 0\r
}\r
- else if (irmp_bit == 19) // Bang & Olufsen: trailer bit\r
+ else if (irmp_bit == 19) // Bang & Olufsen: trailer bit\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
irmp_bit++;\r
}\r
else\r
- { // timing incorrect!\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
- irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
+ DEBUG_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
- irmp_pulse_time = 1; // set counter to 1, not 0\r
}\r
else\r
{\r
- if (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
+ 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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (1);\r
last_value = 1;\r
wait_for_space = 0;\r
}\r
- else if (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
+ 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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
last_value = 0;\r
wait_for_space = 0;\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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (last_value);\r
wait_for_space = 0;\r
}\r
else\r
- { // timing incorrect!\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
- irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
+ DEBUG_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
else\r
- { // timing incorrect!\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
- irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
+ DEBUG_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
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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (1);\r
wait_for_space = 0;\r
}\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_PUTCHAR ('\n');\r
+ DEBUG_NEWLINE ();\r
irmp_store_bit (0);\r
wait_for_space = 0;\r
}\r
else\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
irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
irmp_pause_time = 0;\r
}\r
}\r
else\r
{ // counting the pulse length ...\r
- if (!irmp_input) // still light?\r
+ if (! irmp_input) // still light?\r
{ // yes...\r
irmp_pulse_time++; // increment counter\r
}\r
\r
if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?\r
{\r
- // if SIRCS/SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore it.\r
- if ((irmp_param.protocol == IRMP_SIRCS_PROTOCOL ||\r
- irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL ||\r
- irmp_param.protocol == IRMP_NUBERT_PROTOCOL) &&\r
- last_irmp_command == irmp_tmp_command && repetition_counter < AUTO_REPETITION_LEN)\r
+ if (last_irmp_command == irmp_tmp_command && repetition_counter < AUTO_FRAME_REPETITION_LEN)\r
+ {\r
+ repetition_frame_number++;\r
+ }\r
+ else\r
+ {\r
+ repetition_frame_number = 0;\r
+ }\r
+\r
+#if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\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, recognized SIRCS, SAMSUNG32 or NUBERT repetition, counter = %d, auto repetition len = %d\n",\r
- repetition_counter, AUTO_REPETITION_LEN);\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
}\r
else\r
+#endif\r
+\r
+#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\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
+ }\r
+ else\r
+#endif\r
+\r
+#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\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
+ }\r
+ else\r
+#endif\r
+\r
{\r
DEBUG_PRINTF ("code detected, length = %d\n", irmp_bit);\r
irmp_ir_detected = TRUE;\r
}\r
else\r
#endif // IRMP_SUPPORT_DENON_PROTOCOL\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
+ irmp_ir_detected = FALSE;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL\r
+\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
+ irmp_ir_detected = FALSE;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_NOKIA_PROTOCOL\r
{\r
#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame\r
{\r
if (last_irmp_command == irmp_command &&\r
last_irmp_address == irmp_address &&\r
- repetition_counter < IRMP_REPETITION_TIME)\r
+ repetition_counter < IRMP_KEY_REPETITION_LEN)\r
{\r
irmp_flags |= IRMP_FLAG_REPETITION;\r
}\r
\r
repetition_counter = 0;\r
}\r
+ else\r
+ {\r
+ DEBUG_ONLY_NORMAL_PUTCHAR ('\n');\r
+ }\r
\r
irmp_start_bit_detected = 0; // and wait for next start bit\r
irmp_tmp_command = 0;\r
}\r
}\r
}\r
+ return (irmp_ir_detected);\r
}\r
\r
#ifdef DEBUG\r
// Compile it under linux with:\r
// cc irmp.c -o irmp\r
//\r
-// usage: ./irmp [-v|-s|-a] < file\r
+// usage: ./irmp [-v|-s|-a|-p] < file\r
\r
static void\r
print_timings (void)\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 ("FDC 1 %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
}\r
\r
int\r
main (int argc, char ** argv)\r
{\r
int i;\r
- int verbose = FALSE;\r
int analyze = FALSE;\r
int ch;\r
int last_ch = 0;\r
else if (! strcmp (argv[1], "-a"))\r
{\r
analyze = TRUE;\r
- verbose = TRUE;\r
}\r
else if (! strcmp (argv[1], "-s"))\r
{\r
{\r
if (last_ch != ch)\r
{\r
- if (verbose && pause > 0)\r
+ if (analyze && pause > 0)\r
{\r
printf ("pause: %d\n", pause);\r
\r
{\r
if (last_ch != ch)\r
{\r
- if (verbose)\r
+ if (analyze)\r
{\r
printf ("pulse: %d ", pulse);\r
\r
{\r
IRMP_PIN = 0xff;\r
\r
- if (verbose && pause > 0)\r
+ if (analyze && pause > 0)\r
{\r
printf ("pause: %d\n", pause);\r
}\r
{\r
for (i = 0; i < 8000; i++) // newline: long pause of 800 msec\r
{\r
- irmp_ISR ();\r
+ (void) irmp_ISR ();\r
}\r
}\r
first_pulse = TRUE;\r
\r
while ((ch = getchar()) != '\n' && ch != EOF)\r
{\r
- if (ch != '\r') // ignore CR in DOS/Windows files\r
+ if (ch != '\r') // ignore CR in DOS/Windows files\r
{\r
putchar (ch);\r
}\r
\r
if (! analyze)\r
{\r
- irmp_ISR ();\r
+ (void) irmp_ISR ();\r
}\r
\r
if (irmp_get_data (&irmp_data))\r
{\r
- printf ("protcol = %d, address = 0x%04x, code = 0x%04x, flags = 0x%02x\n",\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