+ IRMP_A1TVBOX_PROTOCOL, // protocol: ir protocol\r
+\r
+ A1TVBOX_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse\r
+ A1TVBOX_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse\r
+ A1TVBOX_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause\r
+ A1TVBOX_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
+ A1TVBOX_ADDRESS_OFFSET, // address_offset: address offset\r
+ A1TVBOX_ADDRESS_OFFSET + A1TVBOX_ADDRESS_LEN, // address_end: end of address\r
+ A1TVBOX_COMMAND_OFFSET, // command_offset: command offset\r
+ A1TVBOX_COMMAND_OFFSET + A1TVBOX_COMMAND_LEN, // command_end: end of command\r
+ A1TVBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame\r
+ A1TVBOX_STOP_BIT, // stop_bit: flag: frame has stop bit\r
+ A1TVBOX_LSB, // lsb_first: flag: LSB first\r
+ A1TVBOX_FLAGS // flags: some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER ortek_param =\r
+{\r
+ IRMP_ORTEK_PROTOCOL, // protocol: ir protocol\r
+\r
+ 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_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 uint8_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 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 uint8_t irmp_flags;\r
+// static volatile uint8_t irmp_busy_flag;\r
+\r
+#ifdef ANALYZE\r
+#define input(x) (x)\r
+static uint8_t IRMP_PIN;\r
+static uint8_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
+#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