*\r
* Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irmp.c,v 1.127 2012/07/11 13:13:50 fm Exp $\r
+ * $Id: irmp.c,v 1.131 2012/11/18 17:51:26 fm Exp $\r
*\r
* ATMEGA88 @ 8 MHz\r
*\r
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
#endif\r
GPIO_Init(IRMP_PORT, &GPIO_InitStructure);\r
+#elif defined(STELLARIS_ARM_CORTEX_M4)\r
+ // Enable the GPIO port\r
+ ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH);\r
+\r
+ // Set as an input\r
+ ROM_GPIODirModeSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_DIR_MODE_IN);\r
+ ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN,\r
+ GPIO_STRENGTH_2MA,\r
+ GPIO_PIN_TYPE_STD_WPU);\r
#else // AVR\r
IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r
IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r
else\r
{\r
ANALYZE_PRINTF ("CRC error in LEGO protocol\n");\r
- rtc = TRUE;\r
+ // rtc = TRUE; // don't accept codes with CRC errors\r
}\r
break;\r
}\r
}\r
else\r
{\r
- ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
+ if ((irmp_tmp_command & 0x03) == 0)\r
+ {\r
+ ANALYZE_PRINTF ("%8.3fms waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
+ last_irmp_denon_command = irmp_tmp_command;\r
+ }\r
+ else\r
+ {\r
+ ANALYZE_PRINTF ("%8.3fms got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
+ last_irmp_denon_command = 0;\r
+ }\r
irmp_ir_detected = FALSE;\r
- last_irmp_denon_command = irmp_tmp_command;\r
repetition_len = 0;\r
}\r
}\r
#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r
{\r
- uint8_t xor;\r
+ uint8_t xor_value;\r
// ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\r
// xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);\r
\r
- xor = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r
+ xor_value = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r
\r
- if (xor != (xor_check[2] & 0x0F))\r
+ if (xor_value != (xor_check[2] & 0x0F))\r
{\r
- ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check[2] & 0x0F);\r
+ ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F);\r
irmp_ir_detected = FALSE;\r
}\r
\r
- xor = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r
+ xor_value = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r
\r
- if (xor != xor_check[5])\r
+ if (xor_value != xor_check[5])\r
{\r
- ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]);\r
+ ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]);\r
irmp_ir_detected = FALSE;\r
}\r
\r
}\r
}\r
}\r
+\r
+#if defined(STELLARIS_ARM_CORTEX_M4)\r
+ // Clear the timer interrupt\r
+ TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);\r
+#endif\r
+\r
return (irmp_ir_detected);\r
}\r
\r
else if (ch == '\n')\r
{\r
IRMP_PIN = 0xff;\r
+ time_counter = 0;\r
\r
if (list && pause > 0)\r
{\r
}\r
else if (ch == '#')\r
{\r
+ time_counter = 0;\r
+\r
if (analyze)\r
{\r
while ((ch = getchar()) != '\n' && ch != EOF)\r