+ ORTEK_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ ORTEK_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ ORTEK_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ ORTEK_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause\r
+ 0, // pulse_0_len_min: here: not used\r
+ 0, // pulse_0_len_max: here: not used\r
+ 0, // pause_0_len_min: here: not used\r
+ 0, // pause_0_len_max: here: not used\r
+ ORTEK_ADDRESS_OFFSET, // address_offset: address offset\r
+ ORTEK_ADDRESS_OFFSET + ORTEK_ADDRESS_LEN, // address_end: end of address\r
+ ORTEK_COMMAND_OFFSET, // command_offset: command offset\r
+ ORTEK_COMMAND_OFFSET + ORTEK_COMMAND_LEN, // command_end: end of command\r
+ ORTEK_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ ORTEK_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ ORTEK_LSB, // lsb_first: flag: LSB first\r
+ ORTEK_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER roomba_param =\r
+{\r
+ IRMP_ROOMBA_PROTOCOL, // protocol: ir protocol\r
+ ROOMBA_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ ROOMBA_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ ROOMBA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ ROOMBA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ ROOMBA_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ ROOMBA_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ ROOMBA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ ROOMBA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ ROOMBA_ADDRESS_OFFSET, // address_offset: address offset\r
+ ROOMBA_ADDRESS_OFFSET + ROOMBA_ADDRESS_LEN, // address_end: end of address\r
+ ROOMBA_COMMAND_OFFSET, // command_offset: command offset\r
+ ROOMBA_COMMAND_OFFSET + ROOMBA_COMMAND_LEN, // command_end: end of command\r
+ ROOMBA_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ ROOMBA_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ ROOMBA_LSB, // lsb_first: flag: LSB first\r
+ ROOMBA_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER rcmm_param =\r
+{\r
+ IRMP_RCMM32_PROTOCOL, // protocol: ir protocol\r
+\r
+ RCMM32_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ RCMM32_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ 0, // pause_1_len_min: here: minimum length of short pause\r
+ 0, // pause_1_len_max: here: maximum length of short pause\r
+ RCMM32_BIT_PULSE_LEN_MIN, // pulse_0_len_min: here: not used\r
+ RCMM32_BIT_PULSE_LEN_MAX, // pulse_0_len_max: here: not used\r
+ 0, // pause_0_len_min: here: not used\r
+ 0, // pause_0_len_max: here: not used\r
+ RCMM32_ADDRESS_OFFSET, // address_offset: address offset\r
+ RCMM32_ADDRESS_OFFSET + RCMM32_ADDRESS_LEN, // address_end: end of address\r
+ RCMM32_COMMAND_OFFSET, // command_offset: command offset\r
+ RCMM32_COMMAND_OFFSET + RCMM32_COMMAND_LEN, // command_end: end of command\r
+ RCMM32_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ RCMM32_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RCMM32_LSB, // lsb_first: flag: LSB first\r
+ RCMM32_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_PENTAX_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER pentax_param =\r
+{\r
+ IRMP_PENTAX_PROTOCOL, // protocol: ir protocol\r
+ PENTAX_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ PENTAX_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ PENTAX_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ PENTAX_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ PENTAX_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ PENTAX_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ PENTAX_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ PENTAX_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ PENTAX_ADDRESS_OFFSET, // address_offset: address offset\r
+ PENTAX_ADDRESS_OFFSET + PENTAX_ADDRESS_LEN, // address_end: end of address\r
+ PENTAX_COMMAND_OFFSET, // command_offset: command offset\r
+ PENTAX_COMMAND_OFFSET + PENTAX_COMMAND_LEN, // command_end: end of command\r
+ PENTAX_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ PENTAX_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ PENTAX_LSB, // lsb_first: flag: LSB first\r
+ PENTAX_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ACP24_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER acp24_param =\r
+{\r
+ IRMP_ACP24_PROTOCOL, // protocol: ir protocol\r
+ ACP24_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ ACP24_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ ACP24_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ ACP24_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ ACP24_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ ACP24_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ ACP24_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ ACP24_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ ACP24_ADDRESS_OFFSET, // address_offset: address offset\r
+ ACP24_ADDRESS_OFFSET + ACP24_ADDRESS_LEN, // address_end: end of address\r
+ ACP24_COMMAND_OFFSET, // command_offset: command offset\r
+ ACP24_COMMAND_OFFSET + ACP24_COMMAND_LEN, // command_end: end of command\r
+ ACP24_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ ACP24_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ ACP24_LSB, // lsb_first: flag: LSB first\r
+ ACP24_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RADIO1_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER radio1_param =\r
+{\r
+ IRMP_RADIO1_PROTOCOL, // protocol: ir protocol\r
+\r
+ RADIO1_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1\r
+ RADIO1_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1\r
+ RADIO1_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1\r
+ RADIO1_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1\r
+ RADIO1_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0\r
+ RADIO1_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0\r
+ RADIO1_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0\r
+ RADIO1_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0\r
+ RADIO1_ADDRESS_OFFSET, // address_offset: address offset\r
+ RADIO1_ADDRESS_OFFSET + RADIO1_ADDRESS_LEN, // address_end: end of address\r
+ RADIO1_COMMAND_OFFSET, // command_offset: command offset\r
+ RADIO1_COMMAND_OFFSET + RADIO1_COMMAND_LEN, // command_end: end of command\r
+ RADIO1_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ RADIO1_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ RADIO1_LSB, // lsb_first: flag: LSB first\r
+ RADIO1_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+static uint_fast8_t irmp_bit; // current bit position\r
+static IRMP_PARAMETER irmp_param;\r
+\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
+static IRMP_PARAMETER irmp_param2;\r
+#endif\r
+\r
+static volatile uint_fast8_t irmp_ir_detected = FALSE;\r
+static volatile uint_fast8_t irmp_protocol;\r
+static volatile uint_fast16_t irmp_address;\r
+static volatile uint_fast16_t irmp_command;\r
+static volatile uint_fast16_t irmp_id; // only used for SAMSUNG protocol\r
+static volatile uint_fast8_t irmp_flags;\r
+// static volatile uint_fast8_t irmp_busy_flag;\r
+\r
+#ifdef ANALYZE\r
+#define input(x) (x)\r
+static uint_fast8_t IRMP_PIN;\r
+static uint_fast8_t radio;\r
+#endif\r
+\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * Initialize IRMP decoder\r
+ * @details Configures IRMP input pin\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#ifndef ANALYZE\r
+void\r
+irmp_init (void)\r
+{\r
+#if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing\r
+#elif defined (ARM_STM32) // STM32\r
+ GPIO_InitTypeDef GPIO_InitStructure;\r
+\r
+ /* GPIOx clock enable */\r
+# if defined (ARM_STM32L1XX)\r
+ RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+# elif defined (ARM_STM32F10X)\r
+ RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+# elif defined (ARM_STM32F4XX)\r
+ RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+# endif\r
+\r
+ /* GPIO Configuration */\r
+ GPIO_InitStructure.GPIO_Pin = IRMP_BIT;\r
+# if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;\r
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
+ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
+ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
+# elif defined (ARM_STM32F10X)\r
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
+# endif\r
+ GPIO_Init(IRMP_PORT, &GPIO_InitStructure);\r
+\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, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);\r
+\r
+#elif defined(__SDCC_stm8) // STM8\r
+ IRMP_GPIO_STRUCT->DDR &= ~(1<<IRMP_BIT); // pin is input\r
+ IRMP_GPIO_STRUCT->CR1 |= (1<<IRMP_BIT); // activate pullup\r
+\r
+#elif defined (TEENSY_ARM_CORTEX_M4) // TEENSY\r
+ pinMode(IRMP_PIN, INPUT);\r
+\r
+#else // AVR\r
+ IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup\r
+ IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input\r
+#endif\r
+\r
+#if IRMP_LOGGING == 1\r
+ irmp_uart_init ();\r
+#endif\r
+}\r
+#endif\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * Get IRMP data\r
+ * @details gets decoded IRMP data\r
+ * @param pointer in order to store IRMP data\r
+ * @return TRUE: successful, FALSE: failed\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+uint_fast8_t\r
+irmp_get_data (IRMP_DATA * irmp_data_p)\r
+{\r
+ uint_fast8_t rtc = FALSE;\r
+\r
+ if (irmp_ir_detected)\r
+ {\r
+ switch (irmp_protocol)\r
+ {\r
+#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
+ case IRMP_SAMSUNG_PROTOCOL:\r
+ if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r
+ {\r
+ irmp_command &= 0xff;\r
+ irmp_command |= irmp_id << 8;\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1\r
+ case IRMP_SAMSUNG48_PROTOCOL:\r
+ irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8);\r
+ rtc = TRUE;\r
+ break;\r
+#endif\r
+#endif\r
+\r
+#if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
+ case IRMP_NEC_PROTOCOL:\r
+ if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r
+ {\r
+ irmp_command &= 0xff;\r
+ rtc = TRUE;\r
+ }\r
+ else if (irmp_address == 0x87EE)\r
+ {\r
+#ifdef ANALYZE\r
+ ANALYZE_PRINTF ("Switching to APPLE protocol\n");\r
+#endif // ANALYZE\r
+ irmp_protocol = IRMP_APPLE_PROTOCOL;\r
+ irmp_address = (irmp_command & 0xFF00) >> 8;\r
+ irmp_command &= 0x00FF;\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+#endif\r
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r
+ case IRMP_BOSE_PROTOCOL:\r
+ if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r
+ {\r
+ irmp_command &= 0xff;\r
+ rtc = TRUE;\r
+ }\r
+ break;\r
+#endif\r