*\r
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.14 2010/03/29 09:33:29 fm Exp $\r
+ * $Id: irmp.c,v 1.15 2010/04/12 10:15:40 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\r
*\r
*\r
*---------------------------------------------------------------------------------------------------------------------------------------------------\r
*\r
+ * BANG_OLUFSEN\r
+ * ------------\r
+ *\r
+ * frame: 4 start bits + 16 data bits + 1 trailer bit + 1 stop bit\r
+ * data: 0 address bits + 16 command bits\r
+ *\r
+ * 1st start bit: 2nd start bit: 3rd start bit: 4th start bit:\r
+ * -----________ -----________ -----_____________ -----________\r
+ * 210us 3000us 210us 3000us 210us 15000us 210us 3000us\r
+ *\r
+ * data "0": data "1": data "repeat bit": trailer bit: stop bit:\r
+ * -----________ -----_____________ -----___________ -----_____________ -----____...\r
+ * 210us 3000us 210us 9000us 210us 6000us 210us 12000us 210us\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
-#define IRMP_TIMEOUT 120 // timeout after 12 ms darkness\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
\r
#define MIN_TOLERANCE_10 0.9 // -10%\r
\r
#define RECS80_START_BIT_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
#define RECS80_START_BIT_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80_START_BIT_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80_START_BIT_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define RECS80_START_BIT_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80_START_BIT_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
#define RECS80_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
#define RECS80_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80_1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80_1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define RECS80_1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80_1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define RECS80_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
\r
#define RC5_START_BIT_LEN_MIN (uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_20 + 0.5)\r
#define RC5_START_BIT_LEN_MAX (uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_20 + 0.5)\r
\r
#define RECS80EXT_START_BIT_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
#define RECS80EXT_START_BIT_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_START_BIT_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_START_BIT_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define RECS80EXT_START_BIT_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80EXT_START_BIT_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
#define RECS80EXT_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
#define RECS80EXT_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
-#define RECS80EXT_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define RECS80EXT_1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80EXT_1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define RECS80EXT_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define RECS80EXT_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
\r
#define NUBERT_START_BIT_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5)\r
#define NUBERT_START_BIT_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5)\r
#define NUBERT_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5)\r
#define NUBERT_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5)\r
\r
+#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_PULSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_PULSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+#define BANG_OLUFSEN_1_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_1_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_0_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_0_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_R_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_R_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5)\r
+#define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5)\r
+\r
#define AUTO_REPETITION_LEN (uint16_t)(F_INTERRUPTS * AUTO_REPETITION_TIME + 0.5) // use uint16_t!\r
\r
#ifdef DEBUG\r
\r
#endif\r
\r
-#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1\r
+#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r
\r
static PROGMEM IRMP_PARAMETER nubert_param =\r
{\r
\r
#endif\r
\r
+#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\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
+};\r
+\r
+#endif\r
+\r
static uint8_t irmp_bit; // current bit position\r
static IRMP_PARAMETER irmp_param;\r
\r
static uint8_t wait_for_start_space; // flag: wait for start bit space\r
static uint8_t irmp_pulse_time; // count bit time for pulse\r
static uint8_t irmp_pause_time; // count bit time for pause\r
- static uint16_t last_irmp_address; // save last irmp address to recognize key repetition\r
- static uint16_t last_irmp_command; // save last irmp command to recognize key repetition\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
#if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
static uint16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition\r
static 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
- static uint8_t rc5_last_pause; // last pause value\r
- static uint8_t rc5_last_value; // last bit value\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
+ static uint8_t last_value; // last bit value\r
#endif\r
uint8_t irmp_input; // input value\r
\r
{ // yes\r
irmp_pause_time++; // increment counter\r
\r
- if (irmp_pause_time > IRMP_TIMEOUT) // timeout?\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
irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit\r
if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)\r
{ // it's SIRCS\r
- DEBUG_PRINTF ("protocol = SIRCS, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
{ // 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: %2d - %2d, pause: %2d - %2d\n",\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: %2d - %2d, pause: %2d - %2d\n",\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
if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r
{ // it's SAMSUNG\r
- DEBUG_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)\r
{ // it's MATSUSHITA\r
- DEBUG_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)\r
{ // it's KASEIKYO\r
- DEBUG_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RECS80\r
- DEBUG_PRINTF ("protocol = RECS80, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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_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
- DEBUG_PRINTF ("protocol = RC5, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
- rc5_last_pause = irmp_pause_time;\r
+ last_pause = irmp_pause_time;\r
\r
if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||\r
(irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))\r
{\r
- rc5_last_value = 0;\r
+ last_value = 0;\r
rc5_cmd_bit6 = 1<<6;\r
}\r
else\r
{\r
- rc5_last_value = 1;\r
+ last_value = 1;\r
}\r
}\r
else\r
((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||\r
(irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))\r
{ // it's DENON\r
- DEBUG_PRINTF ("protocol = DENON, start bit timings: pulse: %2d - %2d, pause: %2d - %2d or %2d - %2d\n",\r
+ DEBUG_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r
DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,\r
DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r
if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RC6\r
- DEBUG_PRINTF ("protocol = RC6, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
- rc5_last_pause = 0;\r
- rc5_last_value = 0;\r
+ last_pause = 0;\r
+ last_value = 0;\r
}\r
else\r
#endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)\r
{ // it's RECS80EXT\r
- DEBUG_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&\r
irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)\r
{ // it's NUBERT\r
- DEBUG_PRINTF ("protocol = NUBERT, start bit timings: pulse: %2d - %2d, pause: %2d - %2d\n",\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
else\r
#endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r
\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
+ 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
+ BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
+ DEBUG_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);\r
+ DEBUG_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,\r
+ BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);\r
+ DEBUG_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+ 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
+ last_value = 0;\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_BANG_OLUFSEN_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
- DEBUG_PRINTF ("pulse_1 = %2d - %2d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r
- DEBUG_PRINTF ("pause_1 = %2d - %2d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\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
+#if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("pulse_toggle = %2d - %2d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r
+ DEBUG_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r
}\r
- DEBUG_PRINTF ("pulse_0 = %2d - %2d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
- DEBUG_PRINTF ("pause_0 = %2d - %2d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r
- DEBUG_PRINTF ("command_offset = %d\n", irmp_param.command_offset);\r
- DEBUG_PRINTF ("command_len = %d\n", irmp_param.command_end - irmp_param.command_offset);\r
- DEBUG_PRINTF ("complete_len = %d\n", irmp_param.complete_len);\r
- DEBUG_PRINTF ("stop_bit = %d\n", irmp_param.stop_bit);\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
+#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r
+ {\r
+ DEBUG_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
+ DEBUG_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);\r
+ }\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
}\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 = %2d, pause = %2d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
DEBUG_PUTCHAR ('1');\r
DEBUG_PUTCHAR ('\n');\r
irmp_store_bit (1);\r
}\r
- else if (! rc5_last_value)\r
+ else if (! last_value)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %2d, pause = %2d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
DEBUG_PUTCHAR ('0');\r
DEBUG_PUTCHAR ('\n');\r
irmp_store_bit (0);\r
#if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %2d, pause = %2d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", 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
}\r
else\r
#endif\r
- if (irmp_pause_time > IRMP_TIMEOUT) // timeout?\r
+ if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?\r
{ // yes...\r
if (irmp_bit == irmp_param.complete_len - 1 && irmp_param.stop_bit == 0)\r
{\r
\r
if (got_light)\r
{\r
- DEBUG_PRINTF ("[bit %2d: pulse = %2d, pause = %2d] ", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ DEBUG_PRINTF ("[bit %2d: pulse = %3d, pause = %3d] ", 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
DEBUG_PUTCHAR ('0');\r
DEBUG_PUTCHAR ('\n');\r
irmp_store_bit (0);\r
- rc5_last_value = 0;\r
+ last_value = 0;\r
}\r
\r
else // if (irmp_pulse_time >= RC5_BIT_LEN_MIN && irmp_pulse_time <= RC5_BIT_LEN_MAX)\r
{\r
uint8_t rc5_value;\r
\r
- if (rc5_last_pause > RC5_BIT_LEN_MAX && rc5_last_pause <= 2 * RC5_BIT_LEN_MAX)\r
+ if (last_pause > RC5_BIT_LEN_MAX && last_pause <= 2 * RC5_BIT_LEN_MAX)\r
{\r
- rc5_value = rc5_last_value ? 0 : 1;\r
- rc5_last_value = rc5_value;\r
+ rc5_value = last_value ? 0 : 1;\r
+ last_value = rc5_value;\r
}\r
else\r
{\r
- rc5_value = rc5_last_value;\r
+ rc5_value = last_value;\r
}\r
\r
DEBUG_PUTCHAR (rc5_value + '0');\r
irmp_store_bit (rc5_value);\r
}\r
\r
- rc5_last_pause = irmp_pause_time;\r
+ last_pause = irmp_pause_time;\r
wait_for_space = 0;\r
}\r
else\r
\r
DEBUG_PUTCHAR ('0');\r
irmp_store_bit (0);\r
- rc5_last_value = 0;\r
+ last_value = 0;\r
DEBUG_PUTCHAR ('\n');\r
break;\r
\r
DEBUG_PUTCHAR ('1');\r
DEBUG_PUTCHAR ('\n');\r
irmp_store_bit (1);\r
- rc5_last_value = 1;\r
+ last_value = 1;\r
}\r
else // if (irmp_pulse_time >= RC6_BIT_LEN_MIN && irmp_pulse_time <= RC6_BIT_LEN_MAX)\r
{\r
uint8_t rc5_value;\r
\r
- if (rc5_last_pause > RC6_BIT_LEN_MAX && rc5_last_pause <= 2 * RC6_BIT_LEN_MAX)\r
+ if (last_pause > RC6_BIT_LEN_MAX && last_pause <= 2 * RC6_BIT_LEN_MAX)\r
{\r
- rc5_value = rc5_last_value ? 0 : 1;\r
- rc5_last_value = rc5_value;\r
+ rc5_value = last_value ? 0 : 1;\r
+ last_value = rc5_value;\r
}\r
else\r
{\r
- rc5_value = rc5_last_value;\r
+ rc5_value = last_value;\r
}\r
\r
if (irmp_bit == 1 && rc5_value == 0)\r
irmp_store_bit (rc5_value);\r
}\r
\r
- rc5_last_pause = irmp_pause_time;\r
+ last_pause = irmp_pause_time;\r
break;\r
} // switch\r
\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
- irmp_start_bit_detected = 0; // reset flags and wait for next start bit\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
+ irmp_start_bit_detected = 0; // reset flags and wait for next start bit\r
irmp_pause_time = 0;\r
}\r
\r
else\r
#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL\r
\r
+#if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
+ if (irmp_param.protocol == IRMP_BANG_OLUFSEN_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
+ {\r
+ if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)\r
+ {\r
+ DEBUG_PRINTF ("3rd start bit\n");\r
+ wait_for_space = 0;\r
+ irmp_tmp_id = 0;\r
+ irmp_bit++;\r
+ }\r
+ else\r
+ { // timing incorrect!\r
+ DEBUG_PRINTF ("error 3a B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ 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
+ {\r
+ if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)\r
+ {\r
+ DEBUG_PRINTF ("trailer bit\n");\r
+ wait_for_space = 0;\r
+ irmp_tmp_id = 0;\r
+ irmp_bit++;\r
+ }\r
+ else\r
+ { // timing incorrect!\r
+ DEBUG_PRINTF ("error 3b B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ 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
+ DEBUG_PUTCHAR ('1');\r
+ DEBUG_PUTCHAR ('\n');\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
+ DEBUG_PUTCHAR ('0');\r
+ DEBUG_PUTCHAR ('\n');\r
+ irmp_store_bit (0);\r
+ last_value = 0;\r
+ wait_for_space = 0;\r
+ }\r
+ else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)\r
+ {\r
+ DEBUG_PUTCHAR (last_value + '0');\r
+ DEBUG_PUTCHAR ('\n');\r
+ irmp_store_bit (last_value);\r
+ wait_for_space = 0;\r
+ }\r
+ else\r
+ { // timing incorrect!\r
+ DEBUG_PRINTF ("error 3c B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+ 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
+ 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
+ irmp_pause_time = 0;\r
+ }\r
+ }\r
+ else\r
+#endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL\r
+\r
if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&\r
irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
{ // pulse & pause timings correct for "1"?\r
printf ("\nSTATITSTICS:\n");\r
printf ("---------------------------------\n");\r
printf ("number of start pulses: %d\n", n_start_pulses);\r
- printf ("minimum start pulse length: %d usec\n", (F_INTERRUPTS * min_start_pulse) / 100);\r
- printf ("maximum start pulse length: %d usec\n", (F_INTERRUPTS * max_start_pulse) / 100);\r
+ printf ("minimum start pulse length: %d usec\n", (1000000 * min_start_pulse) / F_INTERRUPTS);\r
+ printf ("maximum start pulse length: %d usec\n", (1000000 * max_start_pulse) / F_INTERRUPTS);\r
if (n_start_pulses > 0)\r
{\r
- printf ("average start pulse length: %d usec\n", ((F_INTERRUPTS * sum_start_pulses) / n_start_pulses) / 100);\r
+ printf ("average start pulse length: %d usec\n", ((1000000 * sum_start_pulses) / n_start_pulses) / F_INTERRUPTS);\r
}\r
putchar ('\n');\r
printf ("number of start pauses: %d\n", n_start_pauses);\r
if (n_start_pauses > 0)\r
{\r
- printf ("minimum start pause length: %d usec\n", (F_INTERRUPTS * min_start_pause) / 100);\r
- printf ("maximum start pause length: %d usec\n", (F_INTERRUPTS * max_start_pause) / 100);\r
- printf ("average start pause length: %d usec\n", ((F_INTERRUPTS * sum_start_pauses) / n_start_pauses) / 100);\r
+ printf ("minimum start pause length: %d usec\n", (1000000 * min_start_pause) / F_INTERRUPTS);\r
+ printf ("maximum start pause length: %d usec\n", (1000000 * max_start_pause) / F_INTERRUPTS);\r
+ printf ("average start pause length: %d usec\n", ((1000000 * sum_start_pauses) / n_start_pauses) / F_INTERRUPTS);\r
}\r
putchar ('\n');\r
printf ("number of long pulses: %d\n", n_pulses_long);\r
if (n_pulses_long > 0)\r
{\r
- printf ("minimum long pulse length: %d usec\n", (F_INTERRUPTS * min_pulse_long) / 100);\r
- printf ("maximum long pulse length: %d usec\n", (F_INTERRUPTS * max_pulse_long) / 100);\r
- printf ("average long pulse length: %d usec\n", ((F_INTERRUPTS * sum_pulses_long) / n_pulses_long) / 100);\r
+ printf ("minimum long pulse length: %d usec\n", (1000000 * min_pulse_long) / F_INTERRUPTS);\r
+ printf ("maximum long pulse length: %d usec\n", (1000000 * max_pulse_long) / F_INTERRUPTS);\r
+ printf ("average long pulse length: %d usec\n", ((1000000 * sum_pulses_long) / n_pulses_long) / F_INTERRUPTS);\r
}\r
putchar ('\n');\r
printf ("number of short pulses: %d\n", n_pulses_short);\r
if (n_pulses_short > 0)\r
{\r
- printf ("minimum short pulse length: %d usec\n", (F_INTERRUPTS * min_pulse_short) / 100);\r
- printf ("maximum short pulse length: %d usec\n", (F_INTERRUPTS * max_pulse_short) / 100);\r
- printf ("average short pulse length: %d usec\n", ((F_INTERRUPTS * sum_pulses_short) / n_pulses_short) / 100);\r
+ printf ("minimum short pulse length: %d usec\n", (1000000 * min_pulse_short) / F_INTERRUPTS);\r
+ printf ("maximum short pulse length: %d usec\n", (1000000 * max_pulse_short) / F_INTERRUPTS);\r
+ printf ("average short pulse length: %d usec\n", ((1000000 * sum_pulses_short) / n_pulses_short) / F_INTERRUPTS);\r
\r
}\r
putchar ('\n');\r
printf ("number of long pauses: %d\n", n_pauses_long);\r
if (n_pauses_long > 0)\r
{\r
- printf ("minimum long pause length: %d usec\n", (F_INTERRUPTS * min_pause_long) / 100);\r
- printf ("maximum long pause length: %d usec\n", (F_INTERRUPTS * max_pause_long) / 100);\r
- printf ("average long pause length: %d usec\n", ((F_INTERRUPTS * sum_pauses_long) / n_pauses_long) / 100);\r
+ printf ("minimum long pause length: %d usec\n", (1000000 * min_pause_long) / F_INTERRUPTS);\r
+ printf ("maximum long pause length: %d usec\n", (1000000 * max_pause_long) / F_INTERRUPTS);\r
+ printf ("average long pause length: %d usec\n", ((1000000 * sum_pauses_long) / n_pauses_long) / F_INTERRUPTS);\r
}\r
putchar ('\n');\r
printf ("number of short pauses: %d\n", n_pauses_short);\r
if (n_pauses_short > 0)\r
{\r
- printf ("minimum short pause length: %d usec\n", (F_INTERRUPTS * min_pause_short) / 100);\r
- printf ("maximum short pause length: %d usec\n", (F_INTERRUPTS * max_pause_short) / 100);\r
- printf ("average short pause length: %d usec\n", ((F_INTERRUPTS * sum_pauses_short) / n_pauses_short) / 100);\r
+ printf ("minimum short pause length: %d usec\n", (1000000 * min_pause_short) / F_INTERRUPTS);\r
+ printf ("maximum short pause length: %d usec\n", (1000000 * max_pause_short) / F_INTERRUPTS);\r
+ printf ("average short pause length: %d usec\n", ((1000000 * sum_pauses_short) / n_pauses_short) / F_INTERRUPTS);\r
}\r
}\r
return 0;\r