X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/458a6d64e3f8847f7daa9b513875d1c7d32ed4cc..4bcf310e81dd5d1bc29ad018f0cb7f87cd819448:/irmp.c?ds=sidebyside diff --git a/irmp.c b/irmp.c index a75e8d7..6297aa5 100644 --- a/irmp.c +++ b/irmp.c @@ -1,9 +1,9 @@ /*--------------------------------------------------------------------------------------------------------------------------------------------------- * irmp.c - infrared multi-protocol decoder, supports several remote control protocols * - * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de + * Copyright (c) 2009-2016 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.174 2015/05/28 06:48:19 fm Exp $ + * $Id: irmp.c,v 1.188 2016/09/14 06:31:48 fm Exp $ * * Supported AVR mikrocontrollers: * @@ -37,6 +37,7 @@ #endif #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \ + IRMP_SUPPORT_S100_PROTOCOL == 1 || \ IRMP_SUPPORT_RC6_PROTOCOL == 1 || \ IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \ IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \ @@ -60,6 +61,12 @@ #define MIN_TOLERANCE_00 1.0 // -0% #define MAX_TOLERANCE_00 1.0 // +0% +#define MIN_TOLERANCE_02 0.98 // -2% +#define MAX_TOLERANCE_02 1.02 // +2% + +#define MIN_TOLERANCE_03 0.97 // -3% +#define MAX_TOLERANCE_03 1.03 // +3% + #define MIN_TOLERANCE_05 0.95 // -5% #define MAX_TOLERANCE_05 1.05 // +5% @@ -148,12 +155,45 @@ #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define KASEIKYO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1) -#define KASEIKYO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1) -#define KASEIKYO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) -#define KASEIKYO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1) -#define KASEIKYO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1) -#define KASEIKYO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1) +#define KASEIKYO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) +#define KASEIKYO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define KASEIKYO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define KASEIKYO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define KASEIKYO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define KASEIKYO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) + +#define MITSU_HEAVY_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define MITSU_HEAVY_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define MITSU_HEAVY_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define MITSU_HEAVY_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define MITSU_HEAVY_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) +#define MITSU_HEAVY_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define MITSU_HEAVY_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define MITSU_HEAVY_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define MITSU_HEAVY_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define MITSU_HEAVY_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) + +#define VINCENT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define VINCENT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define VINCENT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define VINCENT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define VINCENT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) +#define VINCENT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define VINCENT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define VINCENT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define VINCENT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define VINCENT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) + +#define PANASONIC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define PANASONIC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define PANASONIC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define PANASONIC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define PANASONIC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) +#define PANASONIC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define PANASONIC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define PANASONIC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define PANASONIC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define PANASONIC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define RECS80_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define RECS80_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) @@ -178,6 +218,17 @@ #define RC5_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define RC5_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with S100, so keep tolerance for S100 minimal here: +#define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1) +#define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1) +#else +#define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#endif + +#define S100_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define S100_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) + #define DENON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define DENON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define DENON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) @@ -484,6 +535,17 @@ #define PENTAX_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define PENTAX_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define ACP24_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1) +#define ACP24_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1) +#define ACP24_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1) +#define ACP24_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1) +#define ACP24_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1) +#define ACP24_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1) +#define ACP24_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1) +#define ACP24_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1) +#define ACP24_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1) +#define ACP24_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1) + #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) @@ -579,6 +641,12 @@ static const char proto_samsung48[] PROGMEM = "SAMSG48"; static const char proto_merlin[] PROGMEM = "MERLIN"; static const char proto_pentax[] PROGMEM = "PENTAX"; static const char proto_fan[] PROGMEM = "FAN"; +static const char proto_s100[] PROGMEM = "S100"; +static const char proto_acp24[] PROGMEM = "ACP24"; +static const char proto_technics[] PROGMEM = "TECHNICS"; +static const char proto_panasonic[] PROGMEM = "PANASONIC"; +static const char proto_mitsu_heavy[] PROGMEM = "MITSU_HEAVY"; +static const char proto_vincent[] PROGMEM = "VINCENT"; static const char proto_radio1[] PROGMEM = "RADIO1"; @@ -630,6 +698,12 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM = proto_merlin, proto_pentax, proto_fan, + proto_s100, + proto_acp24, + proto_technics, + proto_panasonic, + proto_mitsu_heavy, + proto_vincent, proto_radio1 }; @@ -653,6 +727,12 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM = # include "stm32f4xx_usart.h" #elif defined(ARM_STM32F10X) # define STM32_UART_COM USART3 // UART3 on PB10 +#elif defined(ARDUINO) // Arduino Serial implementation +# if defined(USB_SERIAL) +# include "usb_serial.h" +# else +# error USB_SERIAL not defined in ARDUINO Environment +# endif #else # if IRMP_EXT_LOGGING == 1 // use external logging # include "irmpextlog.h" @@ -739,7 +819,7 @@ irmp_uart_init (void) // Oversampling USART_OverSampling8Cmd(STM32_UART_COM, ENABLE); - // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS + // init baud rate, 8 data bits, 1 stop bit, no parity, no RTS+CTS USART_InitStructure.USART_BaudRate = STM32_UART_BAUD; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; @@ -772,7 +852,7 @@ irmp_uart_init (void) // Oversampling USART_OverSampling8Cmd(STM32_UART_COM, ENABLE); - // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS + // init baud rate, 8 data bits, 1 stop bit, no parity, no RTS+CTS USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; @@ -784,18 +864,22 @@ irmp_uart_init (void) // UART enable USART_Cmd(STM32_UART_COM, ENABLE); +#elif defined(ARDUINO) + // we use the Arduino Serial Imlementation + // you have to call Serial.begin(SER_BAUD); in Arduino setup() function + #elif defined (__AVR_XMEGA__) - PMIC.CTRL |= PMIC_HILVLEN_bm; + PMIC.CTRL |= PMIC_HILVLEN_bm; + + USARTC1.BAUDCTRLB = 0; + USARTC1.BAUDCTRLA = F_CPU / 153600 - 1; + USARTC1.CTRLA = USART_RXCINTLVL_HI_gc; // high INT level (receive) + USARTC1.CTRLB = USART_TXEN_bm | USART_RXEN_bm; // activated RX and TX + USARTC1.CTRLC = USART_CHSIZE_8BIT_gc; // 8 Bit + PORTC.DIR |= (1<<7); // TXD is output + PORTC.DIR &= ~(1<<6); - USARTC1.BAUDCTRLB = 0; - USARTC1.BAUDCTRLA = F_CPU /153600-1; - USARTC1.CTRLA = USART_RXCINTLVL_HI_gc; // High Level (Empfangen) - USARTC1.CTRLB = USART_TXEN_bm | USART_RXEN_bm; //Aktiviert Senden und Empfangen - USARTC1.CTRLC = USART_CHSIZE_8BIT_gc; //Größe der Zeichen: 8 Bit - PORTC.DIR |= (1<<7); //TXD als Ausgang setzen - PORTC.DIR &= ~(1<<6); - #else #if (IRMP_EXT_LOGGING == 0) // use UART @@ -842,6 +926,10 @@ irmp_uart_putc (unsigned char ch) USART_SendData(STM32_UART_COM, '\r'); } +#elif defined(ARDUINO) + // we use the Arduino Serial Imlementation + usb_serial_putchar(ch); + #else #if (IRMP_EXT_LOGGING == 0) @@ -1211,6 +1299,81 @@ static const PROGMEM IRMP_PARAMETER kaseikyo_param = #endif +#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 + +static const PROGMEM IRMP_PARAMETER panasonic_param = +{ + IRMP_PANASONIC_PROTOCOL, // protocol: ir protocol + PANASONIC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + PANASONIC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + PANASONIC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + PANASONIC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + PANASONIC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + PANASONIC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + PANASONIC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + PANASONIC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + PANASONIC_ADDRESS_OFFSET, // address_offset: address offset + PANASONIC_ADDRESS_OFFSET + PANASONIC_ADDRESS_LEN, // address_end: end of address + PANASONIC_COMMAND_OFFSET, // command_offset: command offset + PANASONIC_COMMAND_OFFSET + PANASONIC_COMMAND_LEN, // command_end: end of command + PANASONIC_COMPLETE_DATA_LEN, // complete_len: complete length of frame + PANASONIC_STOP_BIT, // stop_bit: flag: frame has stop bit + PANASONIC_LSB, // lsb_first: flag: LSB first + PANASONIC_FLAGS // flags: some flags +}; + +#endif + +#if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 + +static const PROGMEM IRMP_PARAMETER mitsu_heavy_param = +{ + IRMP_MITSU_HEAVY_PROTOCOL, // protocol: ir protocol + MITSU_HEAVY_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + MITSU_HEAVY_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + MITSU_HEAVY_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + MITSU_HEAVY_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + MITSU_HEAVY_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + MITSU_HEAVY_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + MITSU_HEAVY_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + MITSU_HEAVY_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + MITSU_HEAVY_ADDRESS_OFFSET, // address_offset: address offset + MITSU_HEAVY_ADDRESS_OFFSET + MITSU_HEAVY_ADDRESS_LEN, // address_end: end of address + MITSU_HEAVY_COMMAND_OFFSET, // command_offset: command offset + MITSU_HEAVY_COMMAND_OFFSET + MITSU_HEAVY_COMMAND_LEN, // command_end: end of command + MITSU_HEAVY_COMPLETE_DATA_LEN, // complete_len: complete length of frame + MITSU_HEAVY_STOP_BIT, // stop_bit: flag: frame has stop bit + MITSU_HEAVY_LSB, // lsb_first: flag: LSB first + MITSU_HEAVY_FLAGS // flags: some flags +}; + +#endif + +#if IRMP_SUPPORT_VINCENT_PROTOCOL == 1 + +static const PROGMEM IRMP_PARAMETER vincent_param = +{ + IRMP_VINCENT_PROTOCOL, // protocol: ir protocol + VINCENT_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + VINCENT_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + VINCENT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + VINCENT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + VINCENT_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + VINCENT_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + VINCENT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + VINCENT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + VINCENT_ADDRESS_OFFSET, // address_offset: address offset + VINCENT_ADDRESS_OFFSET + VINCENT_ADDRESS_LEN, // address_end: end of address + VINCENT_COMMAND_OFFSET, // command_offset: command offset + VINCENT_COMMAND_OFFSET + VINCENT_COMMAND_LEN, // command_end: end of command + VINCENT_COMPLETE_DATA_LEN, // complete_len: complete length of frame + VINCENT_STOP_BIT, // stop_bit: flag: frame has stop bit + VINCENT_LSB, // lsb_first: flag: LSB first + VINCENT_FLAGS // flags: some flags +}; + +#endif + #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 static const PROGMEM IRMP_PARAMETER recs80_param = @@ -1261,6 +1424,31 @@ static const PROGMEM IRMP_PARAMETER rc5_param = #endif +#if IRMP_SUPPORT_S100_PROTOCOL == 1 + +static const PROGMEM IRMP_PARAMETER s100_param = +{ + IRMP_S100_PROTOCOL, // protocol: ir protocol + S100_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse + S100_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse + S100_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause + S100_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause + 0, // pulse_0_len_min: here: not used + 0, // pulse_0_len_max: here: not used + 0, // pause_0_len_min: here: not used + 0, // pause_0_len_max: here: not used + S100_ADDRESS_OFFSET, // address_offset: address offset + S100_ADDRESS_OFFSET + S100_ADDRESS_LEN, // address_end: end of address + S100_COMMAND_OFFSET, // command_offset: command offset + S100_COMMAND_OFFSET + S100_COMMAND_LEN, // command_end: end of command + S100_COMPLETE_DATA_LEN, // complete_len: complete length of frame + S100_STOP_BIT, // stop_bit: flag: frame has stop bit + S100_LSB, // lsb_first: flag: LSB first + S100_FLAGS // flags: some flags +}; + +#endif + #if IRMP_SUPPORT_DENON_PROTOCOL == 1 static const PROGMEM IRMP_PARAMETER denon_param = @@ -1844,6 +2032,31 @@ static const PROGMEM IRMP_PARAMETER pentax_param = #endif +#if IRMP_SUPPORT_ACP24_PROTOCOL == 1 + +static const PROGMEM IRMP_PARAMETER acp24_param = +{ + IRMP_ACP24_PROTOCOL, // protocol: ir protocol + ACP24_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1 + ACP24_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1 + ACP24_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1 + ACP24_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1 + ACP24_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0 + ACP24_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0 + ACP24_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0 + ACP24_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0 + ACP24_ADDRESS_OFFSET, // address_offset: address offset + ACP24_ADDRESS_OFFSET + ACP24_ADDRESS_LEN, // address_end: end of address + ACP24_COMMAND_OFFSET, // command_offset: command offset + ACP24_COMMAND_OFFSET + ACP24_COMMAND_LEN, // command_end: end of command + ACP24_COMPLETE_DATA_LEN, // complete_len: complete length of frame + ACP24_STOP_BIT, // stop_bit: flag: frame has stop bit + ACP24_LSB, // lsb_first: flag: LSB first + ACP24_FLAGS // flags: some flags +}; + +#endif + #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1 static const PROGMEM IRMP_PARAMETER radio1_param = @@ -1870,25 +2083,31 @@ static const PROGMEM IRMP_PARAMETER radio1_param = #endif -static uint_fast8_t irmp_bit; // current bit position -static IRMP_PARAMETER irmp_param; +static uint_fast8_t irmp_bit; // current bit position +static IRMP_PARAMETER irmp_param; #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) -static IRMP_PARAMETER irmp_param2; +static IRMP_PARAMETER irmp_param2; +#endif + +static volatile uint_fast8_t irmp_ir_detected = FALSE; +static volatile uint_fast8_t irmp_protocol; +static volatile uint_fast16_t irmp_address; +static volatile uint_fast16_t irmp_command; +static volatile uint_fast16_t irmp_id; // only used for SAMSUNG protocol +static volatile uint_fast8_t irmp_flags; +// static volatile uint_fast8_t irmp_busy_flag; + +#if defined(__MBED__) +// DigitalIn inputPin(IRMP_PIN, PullUp); // this requires mbed.h and source to be compiled as cpp +gpio_t gpioIRin; // use low level c function instead #endif -static volatile uint_fast8_t irmp_ir_detected = FALSE; -static volatile uint_fast8_t irmp_protocol; -static volatile uint_fast16_t irmp_address; -static volatile uint_fast16_t irmp_command; -static volatile uint_fast16_t irmp_id; // only used for SAMSUNG protocol -static volatile uint_fast8_t irmp_flags; -// static volatile uint_fast8_t irmp_busy_flag; #ifdef ANALYZE -#define input(x) (x) -static uint_fast8_t IRMP_PIN; -static uint_fast8_t radio; +#define input(x) (x) +static uint_fast8_t IRMP_PIN; +static uint_fast8_t radio; #endif /*--------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1902,38 +2121,60 @@ irmp_init (void) { #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing #elif defined (ARM_STM32) // STM32 - GPIO_InitTypeDef GPIO_InitStructure; - - /* GPIOx clock enable */ - #if defined (ARM_STM32L1XX) - RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE); - #elif defined (ARM_STM32F10X) - RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE); - #elif defined (ARM_STM32F4XX) - RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE); - #endif - - /* GPIO Configuration */ - GPIO_InitStructure.GPIO_Pin = IRMP_BIT; - #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX) - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - #elif defined (ARM_STM32F10X) - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - #endif - GPIO_Init(IRMP_PORT, &GPIO_InitStructure); + GPIO_InitTypeDef GPIO_InitStructure; + + /* GPIOx clock enable */ +# if defined (ARM_STM32L1XX) + RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE); +# elif defined (ARM_STM32F10X) + RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE); +# elif defined (ARM_STM32F4XX) + RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE); +# endif + + /* GPIO Configuration */ + GPIO_InitStructure.GPIO_Pin = IRMP_BIT; +# if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX) + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; +# elif defined (ARM_STM32F10X) + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; +# endif + GPIO_Init(IRMP_PORT, &GPIO_InitStructure); + #elif defined(STELLARIS_ARM_CORTEX_M4) - // Enable the GPIO port - ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH); - - // Set as an input - ROM_GPIODirModeSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_DIR_MODE_IN); - ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN, - GPIO_STRENGTH_2MA, - GPIO_PIN_TYPE_STD_WPU); + // Enable the GPIO port + ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH); + + // Set as an input + ROM_GPIODirModeSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_DIR_MODE_IN); + ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); + +#elif defined(__SDCC_stm8) // STM8 + IRMP_GPIO_STRUCT->DDR &= ~(1<CR1 |= (1<> 8) == (irmp_command & 0x00FF)) + { + irmp_command &= 0xff; + rtc = TRUE; + } + break; +#endif + #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 case IRMP_BOSE_PROTOCOL: if ((irmp_command >> 8) == (~irmp_command & 0x00FF)) @@ -2030,6 +2283,12 @@ irmp_get_data (IRMP_DATA * irmp_data_p) rtc = TRUE; break; #endif +#if IRMP_SUPPORT_S100_PROTOCOL == 1 + case IRMP_S100_PROTOCOL: + irmp_address &= ~0x20; // clear toggle bit + rtc = TRUE; + break; +#endif #if IRMP_SUPPORT_IR60_PROTOCOL == 1 case IRMP_IR60_PROTOCOL: if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame @@ -2167,6 +2426,11 @@ static uint_fast8_t genre2; // s static uint_fast8_t parity; // number of '1' of the first 14 bits, check if even. #endif +#if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 +static uint_fast8_t check; // number of '1' of the first 14 bits, check if even. +static uint_fast8_t mitsu_parity; // number of '1' of the first 14 bits, check if even. +#endif + /*--------------------------------------------------------------------------------------------------------------------------------------------------- * store bit * @details store bit in temp address or temp command @@ -2179,6 +2443,45 @@ static uint_fast8_t parity; // n static void irmp_store_bit (uint_fast8_t value) { +#if IRMP_SUPPORT_ACP24_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_ACP24_PROTOCOL) // squeeze 64 bits into 16 bits: + { + if (value) + { + // ACP24-Frame: + // 1 2 3 4 5 6 + // 0123456789012345678901234567890123456789012345678901234567890123456789 + // N VVMMM ? ??? t vmA x y TTTT + // + // irmp_data_p->command: + // + // 5432109876543210 + // NAVVvMMMmtxyTTTT + + switch (irmp_bit) + { + case 0: irmp_tmp_command |= (1<<15); break; // N + case 2: irmp_tmp_command |= (1<<13); break; // V + case 3: irmp_tmp_command |= (1<<12); break; // V + case 4: irmp_tmp_command |= (1<<10); break; // M + case 5: irmp_tmp_command |= (1<< 9); break; // M + case 6: irmp_tmp_command |= (1<< 8); break; // M + case 20: irmp_tmp_command |= (1<< 6); break; // t + case 22: irmp_tmp_command |= (1<<11); break; // v + case 23: irmp_tmp_command |= (1<< 7); break; // m + case 24: irmp_tmp_command |= (1<<14); break; // A + case 26: irmp_tmp_command |= (1<< 5); break; // x + case 44: irmp_tmp_command |= (1<< 4); break; // y + case 66: irmp_tmp_command |= (1<< 3); break; // T + case 67: irmp_tmp_command |= (1<< 2); break; // T + case 68: irmp_tmp_command |= (1<< 1); break; // T + case 69: irmp_tmp_command |= (1<< 0); break; // T + } + } + } + else +#endif // IRMP_SUPPORT_ACP24_PROTOCOL + #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL) { @@ -2215,7 +2518,11 @@ irmp_store_bit (uint_fast8_t value) } } } + else #endif + { + ; + } #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL) @@ -2297,11 +2604,11 @@ irmp_store_bit (uint_fast8_t value) { if (irmp_bit >= 20 && irmp_bit < 24) { - irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - 8)); // store 4 system bits (genre 1) in upper nibble with LSB first + irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - 8)); // store 4 system bits (genre 1) in upper nibble with LSB first } else if (irmp_bit >= 24 && irmp_bit < 28) { - genre2 |= (((uint_fast8_t) (value)) << (irmp_bit - 20)); // store 4 system bits (genre 2) in upper nibble with LSB first + genre2 |= (((uint_fast8_t) (value)) << (irmp_bit - 20)); // store 4 system bits (genre 2) in upper nibble with LSB first } if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN) @@ -2318,6 +2625,47 @@ irmp_store_bit (uint_fast8_t value) } else #endif + +#if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_MITSU_HEAVY_PROTOCOL) // squeeze 64 bits into 16 bits: + { + if (irmp_bit == 72 ) + { // irmp_tmp_address, irmp_tmp_command received: check parity & compress + mitsu_parity = PARITY_CHECK_OK; + + check = irmp_tmp_address >> 8; // inverted upper byte == lower byte? + check = ~ check; + + if (check == (irmp_tmp_address & 0xFF)) + { // ok: + irmp_tmp_address <<= 8; // throw away upper byte + } + else + { + mitsu_parity = PARITY_CHECK_FAILED; + } + + check = irmp_tmp_command >> 8; // inverted upper byte == lower byte? + check = ~ check; + if (check == (irmp_tmp_command & 0xFF)) + { // ok: pack together + irmp_tmp_address |= irmp_tmp_command & 0xFF; // byte 1, byte2 in irmp_tmp_address, irmp_tmp_command can be used for byte 3 + } + else + { + mitsu_parity = PARITY_CHECK_FAILED; + } + irmp_tmp_command = 0; + } + + if (irmp_bit >= 72 ) + { // receive 3. word in irmp_tmp_command + irmp_tmp_command <<= 1; + irmp_tmp_command |= value; + } + } + else +#endif // IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL { ; } @@ -2378,7 +2726,7 @@ irmp_ISR (void) static uint_fast16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition static uint_fast16_t denon_repetition_len = 0xFFFF; // denon repetition len of 2nd auto generated frame #endif -#if IRMP_SUPPORT_RC5_PROTOCOL == 1 +#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1 static uint_fast8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit #endif #if IRMP_SUPPORT_MANCHESTER == 1 @@ -2393,7 +2741,14 @@ irmp_ISR (void) time_counter++; #endif // ANALYZE +#if defined(__SDCC_stm8) + irmp_input = input(IRMP_GPIO_STRUCT->IDR) +#elif defined(__MBED__) + //irmp_input = inputPin; + irmp_input = gpio_read (&gpioIRin); +#else irmp_input = input(IRMP_PIN); +#endif #if IRMP_USE_CALLBACK == 1 if (irmp_callback_ptr) @@ -2451,7 +2806,7 @@ irmp_ISR (void) #endif irmp_bit = 0xff; irmp_pause_time = 1; // 1st pause: set to 1, not to 0! -#if IRMP_SUPPORT_RC5_PROTOCOL == 1 +#if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1 rc5_cmd_bit6 = 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame! #endif } @@ -2649,6 +3004,20 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1 +#if IRMP_SUPPORT_ACP24_PROTOCOL == 1 + if (irmp_pulse_time >= ACP24_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ACP24_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= ACP24_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ACP24_START_BIT_PAUSE_LEN_MAX) + { +#ifdef ANALYZE + ANALYZE_PRINTF ("protocol = ACP24, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + ACP24_START_BIT_PULSE_LEN_MIN, ACP24_START_BIT_PULSE_LEN_MAX, + ACP24_START_BIT_PAUSE_LEN_MIN, ACP24_START_BIT_PAUSE_LEN_MAX); +#endif // ANALYZE + irmp_param_p = (IRMP_PARAMETER *) &acp24_param; + } + else +#endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1 + #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1 if (irmp_pulse_time >= PENTAX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= PENTAX_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= PENTAX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= PENTAX_START_BIT_PAUSE_LEN_MAX) @@ -2719,6 +3088,48 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 +#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 + if (irmp_pulse_time >= PANASONIC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= PANASONIC_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= PANASONIC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= PANASONIC_START_BIT_PAUSE_LEN_MAX) + { // it's PANASONIC +#ifdef ANALYZE + ANALYZE_PRINTF ("protocol = PANASONIC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + PANASONIC_START_BIT_PULSE_LEN_MIN, PANASONIC_START_BIT_PULSE_LEN_MAX, + PANASONIC_START_BIT_PAUSE_LEN_MIN, PANASONIC_START_BIT_PAUSE_LEN_MAX); +#endif // ANALYZE + irmp_param_p = (IRMP_PARAMETER *) &panasonic_param; + } + else +#endif // IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 + +#if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 + if (irmp_pulse_time >= MITSU_HEAVY_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MITSU_HEAVY_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= MITSU_HEAVY_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MITSU_HEAVY_START_BIT_PAUSE_LEN_MAX) + { // it's MITSU_HEAVY +#ifdef ANALYZE + ANALYZE_PRINTF ("protocol = MITSU_HEAVY, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + MITSU_HEAVY_START_BIT_PULSE_LEN_MIN, MITSU_HEAVY_START_BIT_PULSE_LEN_MAX, + MITSU_HEAVY_START_BIT_PAUSE_LEN_MIN, MITSU_HEAVY_START_BIT_PAUSE_LEN_MAX); +#endif // ANALYZE + irmp_param_p = (IRMP_PARAMETER *) &mitsu_heavy_param; + } + else +#endif // IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 + +#if IRMP_SUPPORT_VINCENT_PROTOCOL == 1 + if (irmp_pulse_time >= VINCENT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= VINCENT_START_BIT_PULSE_LEN_MAX && + irmp_pause_time >= VINCENT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= VINCENT_START_BIT_PAUSE_LEN_MAX) + { // it's VINCENT +#ifdef ANALYZE + ANALYZE_PRINTF ("protocol = VINCENT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", + VINCENT_START_BIT_PULSE_LEN_MIN, VINCENT_START_BIT_PULSE_LEN_MAX, + VINCENT_START_BIT_PAUSE_LEN_MIN, VINCENT_START_BIT_PAUSE_LEN_MAX); +#endif // ANALYZE + irmp_param_p = (IRMP_PARAMETER *) &vincent_param; + } + else +#endif // IRMP_SUPPORT_VINCENT_PROTOCOL == 1 + #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1 if (irmp_pulse_time >= RADIO1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RADIO1_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RADIO1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RADIO1_START_BIT_PAUSE_LEN_MAX) @@ -2747,6 +3158,37 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1 +#if IRMP_SUPPORT_S100_PROTOCOL == 1 + if (((irmp_pulse_time >= S100_START_BIT_LEN_MIN && irmp_pulse_time <= S100_START_BIT_LEN_MAX) || + (irmp_pulse_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX)) && + ((irmp_pause_time >= S100_START_BIT_LEN_MIN && irmp_pause_time <= S100_START_BIT_LEN_MAX) || + (irmp_pause_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX))) + { // it's S100 +#ifdef ANALYZE + ANALYZE_PRINTF ("protocol = S100, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n", + S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX, + 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX, + S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX, + 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX); +#endif // ANALYZE + + irmp_param_p = (IRMP_PARAMETER *) &s100_param; + last_pause = irmp_pause_time; + + if ((irmp_pulse_time > S100_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX) || + (irmp_pause_time > S100_START_BIT_LEN_MAX && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX)) + { + last_value = 0; + rc5_cmd_bit6 = 1<<6; + } + else + { + last_value = 1; + } + } + else +#endif // IRMP_SUPPORT_S100_PROTOCOL == 1 + #if IRMP_SUPPORT_RC5_PROTOCOL == 1 if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) || (irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) && @@ -3421,7 +3863,7 @@ irmp_ISR (void) else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN) { #ifdef ANALYZE - ANALYZE_PRINTF ("Switching to NOKIA protocol\n"); + ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit); #endif // ANALYZE irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol irmp_param.address_offset = NOKIA_ADDRESS_OFFSET; @@ -3618,6 +4060,47 @@ irmp_ISR (void) irmp_param.complete_len = irmp_bit; // patch length } #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1 + +#if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 + else if (irmp_param.protocol == IRMP_MATSUSHITA_PROTOCOL && irmp_bit == 22) // it was a TECHNICS stop bit + { +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to TECHNICS protocol, irmp_bit = %d\n", irmp_bit); +#endif // ANALYZE + // Situation: + // The first 12 bits have been stored in irmp_tmp_command (LSB first) + // The following 10 bits have been stored in irmp_tmp_address (LSB first) + // The code of TECHNICS is: + // cccccccccccCCCCCCCCCCC (11 times c and 11 times C) + // ccccccccccccaaaaaaaaaa + // where C is inverted value of c + + irmp_tmp_address <<= 1; + if (irmp_tmp_command & (1<<11)) + { + irmp_tmp_address |= 1; + irmp_tmp_command &= ~(1<<11); + } + + if (irmp_tmp_command == ((~irmp_tmp_address) & 0x07FF)) + { + irmp_tmp_address = 0; + + irmp_param.protocol = IRMP_TECHNICS_PROTOCOL; // switch protocol + irmp_param.complete_len = irmp_bit; // patch length + } + else + { +#ifdef ANALYZE + ANALYZE_PRINTF ("error 8: TECHNICS frame error\n"); + ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // ANALYZE + irmp_start_bit_detected = 0; // wait for another start bit... + irmp_pulse_time = 0; + irmp_pause_time = 0; + } + } +#endif // IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 else { #ifdef ANALYZE @@ -4261,7 +4744,7 @@ irmp_ISR (void) else #endif -#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 +#if 0 && IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 // fm 2015-12-02: don't ignore every 2nd frame // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1) { @@ -4274,7 +4757,7 @@ irmp_ISR (void) else #endif -#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 +#if 0 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 // fm 2015-12-02: don't ignore every 2nd frame // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame if ((irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL || irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL) && (repetition_frame_number & 0x01)) { @@ -4453,6 +4936,25 @@ irmp_ISR (void) } #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1 +#if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_MITSU_HEAVY_PROTOCOL) + { + check = irmp_tmp_command >> 8; // inverted upper byte == lower byte? + check = ~ check; + if (check == (irmp_tmp_command & 0xFF)) { //ok: + irmp_tmp_command &= 0xFF; + } + else mitsu_parity = PARITY_CHECK_FAILED; + if (mitsu_parity == PARITY_CHECK_FAILED) + { +#ifdef ANALYZE + ANALYZE_PRINTF ("error 7: parity check failed\n"); +#endif // ANALYZE + irmp_ir_detected = FALSE; + } + } +#endif // IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL + #if IRMP_SUPPORT_RC6_PROTOCOL == 1 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode = 6? { @@ -4493,6 +4995,12 @@ irmp_ISR (void) { irmp_tmp_command |= rc5_cmd_bit6; // store bit 6 } +#endif +#if IRMP_SUPPORT_S100_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_S100_PROTOCOL) + { + irmp_tmp_command |= rc5_cmd_bit6; // store bit 6 + } #endif irmp_command = irmp_tmp_command; // store command @@ -4556,166 +5064,16 @@ irmp_ISR (void) * Compile it under linux with: * cc irmp.c -o irmp * - * usage: ./irmp [-v|-s|-a|-l|-p] < file + * usage: ./irmp [-v|-s|-a|-l] < file * * options: * -v verbose * -s silent * -a analyze * -l list pulse/pauses - * -p print timings *--------------------------------------------------------------------------------------------------------------------------------------------------- */ -static void -print_timings (void) -{ - printf ("IRMP_TIMEOUT_LEN: %d [%d byte(s)]\n", IRMP_TIMEOUT_LEN, sizeof (PAUSE_LEN)); - printf ("IRMP_KEY_REPETITION_LEN %d\n", IRMP_KEY_REPETITION_LEN); - puts (""); - printf ("PROTOCOL S S-PULSE S-PAUSE PULSE-0 PAUSE-0 PULSE-1 PAUSE-1\n"); - printf ("====================================================================================\n"); - printf ("SIRCS 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX, - SIRCS_0_PULSE_LEN_MIN, SIRCS_0_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX, - SIRCS_1_PULSE_LEN_MIN, SIRCS_1_PULSE_LEN_MAX, SIRCS_PAUSE_LEN_MIN, SIRCS_PAUSE_LEN_MAX); - - printf ("NEC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX, - NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX, - NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX); - - printf ("NEC (rep) 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX, - NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX, - NEC_PULSE_LEN_MIN, NEC_PULSE_LEN_MAX, NEC_1_PAUSE_LEN_MIN, NEC_1_PAUSE_LEN_MAX); - - printf ("SAMSUNG 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX, - SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_0_PAUSE_LEN_MIN, SAMSUNG_0_PAUSE_LEN_MAX, - SAMSUNG_PULSE_LEN_MIN, SAMSUNG_PULSE_LEN_MAX, SAMSUNG_1_PAUSE_LEN_MIN, SAMSUNG_1_PAUSE_LEN_MAX); - - printf ("MATSUSHITA 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX, - MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_0_PAUSE_LEN_MIN, MATSUSHITA_0_PAUSE_LEN_MAX, - MATSUSHITA_PULSE_LEN_MIN, MATSUSHITA_PULSE_LEN_MAX, MATSUSHITA_1_PAUSE_LEN_MIN, MATSUSHITA_1_PAUSE_LEN_MAX); - - printf ("KASEIKYO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX, - KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_0_PAUSE_LEN_MIN, KASEIKYO_0_PAUSE_LEN_MAX, - KASEIKYO_PULSE_LEN_MIN, KASEIKYO_PULSE_LEN_MAX, KASEIKYO_1_PAUSE_LEN_MIN, KASEIKYO_1_PAUSE_LEN_MAX); - - printf ("RECS80 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX, - RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_0_PAUSE_LEN_MIN, RECS80_0_PAUSE_LEN_MAX, - RECS80_PULSE_LEN_MIN, RECS80_PULSE_LEN_MAX, RECS80_1_PAUSE_LEN_MIN, RECS80_1_PAUSE_LEN_MAX); - - printf ("RC5 1 %3d - %3d %3d - %3d %3d - %3d\n", - RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, - RC5_BIT_LEN_MIN, RC5_BIT_LEN_MAX); - - printf ("DENON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, - DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX, - DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX); - - printf ("THOMSON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, - THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX, - THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX); - - printf ("RC6 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX, RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX, - RC6_BIT_PULSE_LEN_MIN, RC6_BIT_PULSE_LEN_MAX, RC6_BIT_PAUSE_LEN_MIN, RC6_BIT_PAUSE_LEN_MAX); - - printf ("RECS80EXT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX, RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX, - RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_0_PAUSE_LEN_MIN, RECS80EXT_0_PAUSE_LEN_MAX, - RECS80EXT_PULSE_LEN_MIN, RECS80EXT_PULSE_LEN_MAX, RECS80EXT_1_PAUSE_LEN_MIN, RECS80EXT_1_PAUSE_LEN_MAX); - - printf ("NUBERT 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX, - NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX, - NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX); - - printf ("FAN 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - FAN_START_BIT_PULSE_LEN_MIN, FAN_START_BIT_PULSE_LEN_MAX, FAN_START_BIT_PAUSE_LEN_MIN, FAN_START_BIT_PAUSE_LEN_MAX, - FAN_0_PULSE_LEN_MIN, FAN_0_PULSE_LEN_MAX, FAN_0_PAUSE_LEN_MIN, FAN_0_PAUSE_LEN_MAX, - FAN_1_PULSE_LEN_MIN, FAN_1_PULSE_LEN_MAX, FAN_1_PAUSE_LEN_MIN, FAN_1_PAUSE_LEN_MAX); - - printf ("SPEAKER 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - SPEAKER_START_BIT_PULSE_LEN_MIN, SPEAKER_START_BIT_PULSE_LEN_MAX, SPEAKER_START_BIT_PAUSE_LEN_MIN, SPEAKER_START_BIT_PAUSE_LEN_MAX, - SPEAKER_0_PULSE_LEN_MIN, SPEAKER_0_PULSE_LEN_MAX, SPEAKER_0_PAUSE_LEN_MIN, SPEAKER_0_PAUSE_LEN_MAX, - SPEAKER_1_PULSE_LEN_MIN, SPEAKER_1_PULSE_LEN_MAX, SPEAKER_1_PAUSE_LEN_MIN, SPEAKER_1_PAUSE_LEN_MAX); - - printf ("BANG_OLUFSEN 1 %3d - %3d %3d - %3d\n", - BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX, - BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX); - - printf ("BANG_OLUFSEN 2 %3d - %3d %3d - %3d\n", - BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX, - BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX); - - printf ("BANG_OLUFSEN 3 %3d - %3d %3d - %3d\n", - BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX, - BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX); - - printf ("BANG_OLUFSEN 4 %3d - %3d %3d - %3d\n", - BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX, - BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX); - - printf ("BANG_OLUFSEN - %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_0_PAUSE_LEN_MIN, BANG_OLUFSEN_0_PAUSE_LEN_MAX, - BANG_OLUFSEN_PULSE_LEN_MIN, BANG_OLUFSEN_PULSE_LEN_MAX, BANG_OLUFSEN_1_PAUSE_LEN_MIN, BANG_OLUFSEN_1_PAUSE_LEN_MAX); - - printf ("GRUNDIG/NOKIA 1 %3d - %3d %3d - %3d %3d - %3d\n", - GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX, - GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX, - GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_BIT_LEN_MAX); - - printf ("SIEMENS/RUWIDO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX, - SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX, - SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, - SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX, - 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, - 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX); - - printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX, - FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX, - FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_1_PAUSE_LEN_MIN, FDC_1_PAUSE_LEN_MAX); - - printf ("RCCAR 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX, - RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_0_PAUSE_LEN_MIN, RCCAR_0_PAUSE_LEN_MAX, - RCCAR_PULSE_LEN_MIN, RCCAR_PULSE_LEN_MAX, RCCAR_1_PAUSE_LEN_MIN, RCCAR_1_PAUSE_LEN_MAX); - - printf ("NIKON 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX, NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX, - NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_0_PAUSE_LEN_MIN, NIKON_0_PAUSE_LEN_MAX, - NIKON_PULSE_LEN_MIN, NIKON_PULSE_LEN_MAX, NIKON_1_PAUSE_LEN_MIN, NIKON_1_PAUSE_LEN_MAX); - - printf ("LEGO 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX, LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX, - LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_0_PAUSE_LEN_MIN, LEGO_0_PAUSE_LEN_MAX, - LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_1_PAUSE_LEN_MIN, LEGO_1_PAUSE_LEN_MAX); - - printf ("\n"); - printf ("PROTOCOL S S-PULSE S-PAUSE PULSE PAUSE-00 PAUSE-01 PAUSE-10 PAUSE-11\n"); - printf ("================================================================================================\n"); - printf ("RCMM 1 %3d %3d %3d %3d %3d %3d %3d\n", - (uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME), (uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME), - (uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME), - (uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME), (uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME), - (uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME), (uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME)); - printf ("RCMM 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - RCMM32_START_BIT_PULSE_LEN_MIN, RCMM32_START_BIT_PULSE_LEN_MAX, RCMM32_START_BIT_PAUSE_LEN_MIN, RCMM32_START_BIT_PAUSE_LEN_MAX, - RCMM32_BIT_PULSE_LEN_MIN, RCMM32_BIT_PULSE_LEN_MAX, RCMM32_BIT_00_PAUSE_LEN_MIN, RCMM32_BIT_00_PAUSE_LEN_MAX, - RCMM32_BIT_01_PAUSE_LEN_MIN, RCMM32_BIT_01_PAUSE_LEN_MAX, RCMM32_BIT_10_PAUSE_LEN_MIN, RCMM32_BIT_10_PAUSE_LEN_MAX, - RCMM32_BIT_11_PAUSE_LEN_MIN, RCMM32_BIT_11_PAUSE_LEN_MAX); -} - void print_spectrum (char * text, int * buf, int is_pulse) { @@ -4730,7 +5088,7 @@ print_spectrum (char * text, int * buf, int is_pulse) double average = 0; double tolerance; - puts ("-------------------------------------------------------------------------------"); + puts ("-----------------------------------------------------------------------------"); printf ("%s:\n", text); for (i = 0; i < 256; i++) @@ -4836,16 +5194,16 @@ get_fdc_key (uint_fast16_t cmd) { static uint8_t key_table[128] = { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'ß', '´', 0, '\b', - '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 'ü', '+', 0, 0, 'a', - 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ö', 'ä', '#', '\r', 0, '<', 'y', 'x', - 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0, - - 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b', - '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 'Ü', '*', 0, 0, 'A', - 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ö', 'Ä', '\'','\r', 0, '>', 'Y', 'X', - 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0 + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0xDF, '´', 0, '\b', + '\t', 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 0xFC, '+', 0, 0, 'a', + 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xF6, 0xE4, '#', '\r', 0, '<', 'y', 'x', + 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0, + + 0, '°', '!', '"', '§', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b', + '\t', 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', 0xDC, '*', 0, 0, 'A', + 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xD6, 0xC4, '\'', '\r', 0, '>', 'Y', 'X', + 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0 }; static uint_fast8_t state; @@ -4892,7 +5250,7 @@ get_fdc_key (uint_fast16_t cmd) { switch (cmd) { - case 0x0003: key = '²'; break; + case 0x0003: key = 0xB2; break; // upper 2 case 0x0008: key = '{'; break; case 0x0009: key = '['; break; case 0x000A: key = ']'; break; @@ -4958,7 +5316,14 @@ next_tick (void) printf ("%8.3fms ", (double) (time_counter * 1000) / F_INTERRUPTS); } - if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0) + if (irmp_data.protocol == IRMP_ACP24_PROTOCOL) + { + uint16_t temp = (irmp_data.command & 0x000F) + 15; + + printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, temp=%d", + irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, temp); + } + else if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0) { if ((key >= 0x20 && key < 0x7F) || key >= 0xA0) { @@ -5077,11 +5442,6 @@ main (int argc, char ** argv) { silent = TRUE; } - else if (! strcmp (argv[1], "-p")) - { - print_timings (); - return (0); - } else if (! strcmp (argv[1], "-r")) { radio = TRUE; @@ -5206,7 +5566,7 @@ main (int argc, char ** argv) char * p; int idx = -1; - puts ("-------------------------------------------------------------------"); + puts ("----------------------------------------------------------------------"); putchar (ch); @@ -5296,7 +5656,7 @@ main (int argc, char ** argv) print_spectrum ("START PAUSES", start_pauses, FALSE); print_spectrum ("PULSES", pulses, TRUE); print_spectrum ("PAUSES", pauses, FALSE); - puts ("-------------------------------------------------------------------------------"); + puts ("-----------------------------------------------------------------------------"); } return 0; }