*\r
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.63 2010/06/23 12:05:36 fm Exp $\r
+ * $Id: irmp.c,v 1.73 2010/06/26 18:13:11 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\r
*\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
+ * SIEMENS:\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
#define IRMP_TIMEOUT_TIME_MS 16500L // timeout after 16.5 ms darkness\r
\r
#if (F_INTERRUPTS * IRMP_TIMEOUT_TIME_MS) / 1000000 >= 254\r
-#define IRMP_TIMEOUT_LEN (uint16_t)(F_INTERRUPTS * IRMP_TIMEOUT_TIME + 0.5)\r
typedef uint16_t PAUSE_LEN;\r
#else\r
-#define IRMP_TIMEOUT_LEN (uint8_t)(F_INTERRUPTS * IRMP_TIMEOUT_TIME + 0.5)\r
typedef uint8_t PAUSE_LEN;\r
#endif\r
\r
+#define IRMP_TIMEOUT_LEN (PAUSE_LEN)(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
\r
#define MIN_TOLERANCE_00 1.0 // -0%\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
\r
#ifdef ANALYZE\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
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\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 ("IRMP_TIMEOUT_LEN: %d\n", IRMP_TIMEOUT_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 %3d - %3d %3d - %3d %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