X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/645fbc6911bea54f2d607c945472bc9a369ea1c5..8aaafe9d1b78f92e33e2791a8aa5e0aa877975b9:/irmp.c diff --git a/irmp.c b/irmp.c index 9565a9c..018bb7f 100644 --- a/irmp.c +++ b/irmp.c @@ -1,13 +1,11 @@ /*--------------------------------------------------------------------------------------------------------------------------------------------------- * irmp.c - infrared multi-protocol decoder, supports several remote control protocols * - * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de + * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.151 2014/07/01 08:27:22 fm Exp $ + * $Id: irmp.c,v 1.164 2014/09/15 12:36:28 fm Exp $ * - * ATMEGA88 @ 8 MHz - * - * Supported mikrocontrollers: + * Supported AVR mikrocontrollers: * * ATtiny87, ATtiny167 * ATtiny45, ATtiny85 @@ -145,10 +143,10 @@ #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) -#define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define KASEIKYO_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1) #define KASEIKYO_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1) #define KASEIKYO_1_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1) @@ -479,12 +477,8 @@ static int verbose; #else # define ANALYZE_PUTCHAR(a) # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) -# if defined(__XC8) -# define ANALYZE_PRINTF(__VA_ARGS) -# define ANALYZE_ONLY_NORMAL_PRINTF(__VA_ARGS) -# else -# define ANALYZE_PRINTF(...) -# define ANALYZE_ONLY_NORMAL_PRINTF(...) +# define ANALYZE_PRINTF(...) +# define ANALYZE_ONLY_NORMAL_PRINTF(...) # endif # define ANALYZE_NEWLINE() *********************************/ @@ -502,51 +496,98 @@ static void (*irmp_callback_ptr) (uint8_t); *--------------------------------------------------------------------------------------------------------------------------------------------------- */ #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1 -char * -irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = +static const char proto_unknown[] PROGMEM = "UNKNOWN"; +static const char proto_sircs[] PROGMEM = "SIRCS"; +static const char proto_nec[] PROGMEM = "NEC"; +static const char proto_samsung[] PROGMEM = "SAMSUNG"; +static const char proto_matsushita[] PROGMEM = "MATSUSH"; +static const char proto_kaseikyo[] PROGMEM = "KASEIKYO"; +static const char proto_recs80[] PROGMEM = "RECS80"; +static const char proto_rc5[] PROGMEM = "RC5"; +static const char proto_denon[] PROGMEM = "DENON"; +static const char proto_rc6[] PROGMEM = "RC6"; +static const char proto_samsung32[] PROGMEM = "SAMSG32"; +static const char proto_apple[] PROGMEM = "APPLE"; +static const char proto_recs80ext[] PROGMEM = "RECS80EX"; +static const char proto_nubert[] PROGMEM = "NUBERT"; +static const char proto_bang_olufsen[] PROGMEM = "BANG OLU"; +static const char proto_grundig[] PROGMEM = "GRUNDIG"; +static const char proto_nokia[] PROGMEM = "NOKIA"; +static const char proto_siemens[] PROGMEM = "SIEMENS"; +static const char proto_fdc[] PROGMEM = "FDC"; +static const char proto_rccar[] PROGMEM = "RCCAR"; +static const char proto_jvc[] PROGMEM = "JVC"; +static const char proto_rc6a[] PROGMEM = "RC6A"; +static const char proto_nikon[] PROGMEM = "NIKON"; +static const char proto_ruwido[] PROGMEM = "RUWIDO"; +static const char proto_ir60[] PROGMEM = "IR60"; +static const char proto_kathrein[] PROGMEM = "KATHREIN"; +static const char proto_netbox[] PROGMEM = "NETBOX"; +static const char proto_nec16[] PROGMEM = "NEC16"; +static const char proto_nec42[] PROGMEM = "NEC42"; +static const char proto_lego[] PROGMEM = "LEGO"; +static const char proto_thomson[] PROGMEM = "THOMSON"; +static const char proto_bose[] PROGMEM = "BOSE"; +static const char proto_a1tvbox[] PROGMEM = "A1TVBOX"; +static const char proto_ortek[] PROGMEM = "ORTEK"; +static const char proto_telefunken[] PROGMEM = "TELEFUNKEN"; +static const char proto_roomba[] PROGMEM = "ROOMBA"; +static const char proto_rcmm32[] PROGMEM = "RCMM32"; +static const char proto_rcmm24[] PROGMEM = "RCMM24"; +static const char proto_rcmm12[] PROGMEM = "RCMM12"; +static const char proto_speaker[] PROGMEM = "SPEAKER"; +static const char proto_lgair[] PROGMEM = "LGAIR"; +static const char proto_samsung48[] PROGMEM = "SAMSG48"; + +static const char proto_radio1[] PROGMEM = "RADIO1"; + +const char * const +irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM = { - "UNKNOWN", - "SIRCS", - "NEC", - "SAMSUNG", - "MATSUSH", - "KASEIKYO", - "RECS80", - "RC5", - "DENON", - "RC6", - "SAMSG32", - "APPLE", - "RECS80EX", - "NUBERT", - "BANG OLU", - "GRUNDIG", - "NOKIA", - "SIEMENS", - "FDC", - "RCCAR", - "JVC", - "RC6A", - "NIKON", - "RUWIDO", - "IR60", - "KATHREIN", - "NETBOX", - "NEC16", - "NEC42", - "LEGO", - "THOMSON", - "BOSE", - "A1TVBOX", - "ORTEK", - "TELEFUNKEN", - "ROOMBA", - "RCMM32", - "RCMM24", - "RCMM12", - "SPEAKER", - "LGAIR", - "RADIO1" + proto_unknown, + proto_sircs, + proto_nec, + proto_samsung, + proto_matsushita, + proto_kaseikyo, + proto_recs80, + proto_rc5, + proto_denon, + proto_rc6, + proto_samsung32, + proto_apple, + proto_recs80ext, + proto_nubert, + proto_bang_olufsen, + proto_grundig, + proto_nokia, + proto_siemens, + proto_fdc, + proto_rccar, + proto_jvc, + proto_rc6a, + proto_nikon, + proto_ruwido, + proto_ir60, + proto_kathrein, + proto_netbox, + proto_nec16, + proto_nec42, + proto_lego, + proto_thomson, + proto_bose, + proto_a1tvbox, + proto_ortek, + proto_telefunken, + proto_roomba, + proto_rcmm32, + proto_rcmm24, + proto_rcmm12, + proto_speaker, + proto_lgair, + proto_samsung48, + + proto_radio1 }; #endif @@ -557,13 +598,24 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = */ #if IRMP_LOGGING == 1 // logging via UART -#if IRMP_EXT_LOGGING == 1 // use external logging -#include "irmpextlog.h" -#else // normal UART log (IRMP_EXT_LOGGING == 0) -#define BAUD 9600L -#ifndef UNIX_OR_WINDOWS -#include -#endif +#if defined(ARM_STM32F4XX) +# define STM32_GPIO_CLOCK RCC_AHB1Periph_GPIOA // per UART2 an PA2 +# define STM32_UART_CLOCK RCC_APB1Periph_USART2 +# define STM32_GPIO_PORT GPIOA +# define STM32_GPIO_PIN GPIO_Pin_2 +# define STM32_GPIO_SOURCE GPIO_PinSource2 +# define STM32_UART_AF GPIO_AF_USART2 +# define STM32_UART_COM USART2 +# define STM32_UART_BAUD 115200 // mit 115200 Baud +# include "stm32f4xx_usart.h" +#else +# if IRMP_EXT_LOGGING == 1 // use external logging +# include "irmpextlog.h" +# else // normal UART log (IRMP_EXT_LOGGING == 0) +# define BAUD 9600L +# ifndef UNIX_OR_WINDOWS +# include +# endif #ifdef UBRR0H @@ -605,6 +657,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = #endif //UBRR0H #endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX /*--------------------------------------------------------------------------------------------------------------------------------------------------- * Initialize UART @@ -615,6 +668,45 @@ void irmp_uart_init (void) { #ifndef UNIX_OR_WINDOWS +#if defined(ARM_STM32F4XX) + GPIO_InitTypeDef GPIO_InitStructure; + USART_InitTypeDef USART_InitStructure; + + // Clock enable vom TX Pin + RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK, ENABLE); + + // Clock enable der UART + RCC_APB1PeriphClockCmd(STM32_UART_CLOCK, ENABLE); + + // UART Alternative-Funktion mit dem IO-Pin verbinden + GPIO_PinAFConfig(STM32_GPIO_PORT,STM32_GPIO_SOURCE,STM32_UART_AF); + + // UART als Alternative-Funktion mit PushPull + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + + // TX-Pin + GPIO_InitStructure.GPIO_Pin = STM32_GPIO_PIN; + GPIO_Init(STM32_GPIO_PORT, &GPIO_InitStructure); + + // Oversampling + USART_OverSampling8Cmd(STM32_UART_COM, ENABLE); + + // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS + USART_InitStructure.USART_BaudRate = STM32_UART_BAUD; + USART_InitStructure.USART_WordLength = USART_WordLength_8b; + USART_InitStructure.USART_StopBits = USART_StopBits_1; + USART_InitStructure.USART_Parity = USART_Parity_No; + USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; + USART_InitStructure.USART_Mode = USART_Mode_Tx; + USART_Init(STM32_UART_COM, &USART_InitStructure); + + // UART enable + USART_Cmd(STM32_UART_COM, ENABLE); + +#else #if (IRMP_EXT_LOGGING == 0) // use UART UART0_UBRRH = UBRRH_VALUE; // set baud rate UART0_UBRRL = UBRRL_VALUE; @@ -628,8 +720,9 @@ irmp_uart_init (void) UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE; UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX #else // other log method - initextlog(); + initextlog(); #endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX #endif // UNIX_OR_WINDOWS } @@ -643,16 +736,37 @@ void irmp_uart_putc (unsigned char ch) { #ifndef UNIX_OR_WINDOWS +#if defined(ARM_STM32F4XX) + // warten bis altes Byte gesendet wurde + while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET) + { + ; + } + + USART_SendData(STM32_UART_COM, ch); + + if (ch == '\n') + { + while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET); + USART_SendData(STM32_UART_COM, '\r'); + } + +#else #if (IRMP_EXT_LOGGING == 0) + while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE)) { ; } UART0_UDR = ch; + #else - sendextlog(ch); //Use external log -#endif + + sendextlog(ch); // use external log + +#endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX #else fputc (ch, stderr); #endif // UNIX_OR_WINDOWS @@ -667,79 +781,6 @@ irmp_uart_putc (unsigned char ch) #define ENDBITS 1000 // number of sequenced highbits to detect end #define DATALEN 700 // log buffer size -#if 0 // old log routine - -static void -irmp_log (uint8_t val) -{ - static uint8_t buf[DATALEN]; // logging buffer - static uint16_t buf_idx; // number of written bits - static uint8_t startcycles; // current number of start-zeros - static uint16_t cnt; // counts sequenced highbits - to detect end - - if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging - { - startcycles++; - } - else - { - startcycles = 0; - - if (! val || (val && buf_idx != 0)) // start or continue logging on "0", "1" cannot init logging - { - if (buf_idx < DATALEN * 8) // index in range? - { // yes - if (val) - { - buf[(buf_idx / 8)] |= (1<<(buf_idx % 8)); // set bit - } - else - { - buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8)); // reset bit - } - - buf_idx++; - } - - if (val) - { // if high received then look at log-stop condition - cnt++; - - if (cnt > ENDBITS) - { // if stop condition is true, output on uart - uint16_t i; - - for (i = 0; i < STARTCYCLES; i++) - { - irmp_uart_putc ('0'); // the ignored starting zeros - } - - for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++) // transform bitset into uart chars - { - uint8_t d = buf[i]; - uint8_t j; - - for (j = 0; j < 8; j++) - { - irmp_uart_putc ((d & 1) + '0'); - d >>= 1; - } - } - - irmp_uart_putc ('\n'); - buf_idx = 0; - } - } - else - { - cnt = 0; - } - } - } -} - -#else // new log routine - static void irmp_log (uint8_t val) { @@ -828,8 +869,6 @@ irmp_log (uint8_t val) } } -#endif - #else #define irmp_log(val) #endif //IRMP_LOGGING @@ -1666,7 +1705,7 @@ static IRMP_PARAMETER irmp_param; static IRMP_PARAMETER irmp_param2; #endif -static volatile uint8_t irmp_ir_detected; +static volatile uint8_t irmp_ir_detected = FALSE; static volatile uint8_t irmp_protocol; static volatile uint16_t irmp_address; static volatile uint16_t irmp_command; @@ -1758,7 +1797,15 @@ irmp_get_data (IRMP_DATA * irmp_data_p) rtc = TRUE; } break; + +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + case IRMP_SAMSUNG48_PROTOCOL: + irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8); + rtc = TRUE; + break; #endif +#endif + #if IRMP_SUPPORT_NEC_PROTOCOL == 1 case IRMP_NEC_PROTOCOL: if ((irmp_command >> 8) == (~irmp_command & 0x00FF)) @@ -1770,7 +1817,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to APPLE protocol\n"); -#endif +#endif // ANALYZE irmp_protocol = IRMP_APPLE_PROTOCOL; irmp_address = (irmp_command & 0xFF00) >> 8; irmp_command &= 0x00FF; @@ -1821,7 +1868,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF("Info IR60: got start instruction frame\n"); -#endif +#endif // ANALYZE } break; #endif @@ -1858,14 +1905,14 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n"); -#endif +#endif // ANALYZE } } else { #ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: last bit not set\n"); -#endif +#endif // ANALYZE } break; #endif @@ -1883,7 +1930,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF ("CRC error in LEGO protocol\n"); -#endif +#endif // ANALYZE // rtc = TRUE; // don't accept codes with CRC errors } break; @@ -1932,7 +1979,7 @@ irmp_set_callback_ptr (void (*cb)(uint8_t)) static uint16_t irmp_tmp_address; // ir address static uint16_t irmp_tmp_command; // ir command -#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 +#if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 static uint16_t irmp_tmp_address2; // ir address static uint16_t irmp_tmp_command2; // ir command #endif @@ -2028,7 +2075,16 @@ irmp_store_bit (uint8_t value) { if (irmp_param.lsb_first) { - irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit >= 32) + { + irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - 32)); // CV wants cast + } + else +#endif + { + irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast + } } else { @@ -2169,7 +2225,7 @@ irmp_ISR (void) #ifdef ANALYZE time_counter++; -#endif +#endif // ANALYZE irmp_input = input(IRMP_PIN); @@ -2198,11 +2254,9 @@ irmp_ISR (void) #ifdef ANALYZE if (! irmp_pulse_time) { -#ifdef ANALYZE ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS); -#endif } -#endif +#endif // ANALYZE irmp_pulse_time++; // increment counter } else @@ -2217,6 +2271,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 genre2 = 0; #endif +#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 + irmp_tmp_id = 0; +#endif #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 irmp_tmp_command2 = 0; @@ -2247,8 +2304,8 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n", -#endif (double) (time_counter * 1000) / F_INTERRUPTS); +#endif // ANALYZE last_irmp_denon_command = 0; denon_repetition_len = 0xFFFF; } @@ -2284,9 +2341,9 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms error 1: pause after start bit pulse %d too long: %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif +#endif // ANALYZE } -// irmp_busy_flag = FALSE; + irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit irmp_pulse_time = 0; irmp_pause_time = 0; @@ -2294,7 +2351,8 @@ irmp_ISR (void) } else { // receiving first data pulse! - IRMP_PARAMETER * irmp_param_p = (IRMP_PARAMETER *) 0; + IRMP_PARAMETER * irmp_param_p; + irmp_param_p = (IRMP_PARAMETER *) 0; #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) irmp_param2.protocol = 0; @@ -2302,7 +2360,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time); -#endif +#endif // ANALYZE #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1 if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX && @@ -2312,7 +2370,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param; } else @@ -2327,7 +2385,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX, JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2342,14 +2400,14 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec42_param; #else #ifdef ANALYZE ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; #endif } @@ -2363,7 +2421,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2373,7 +2431,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param; } @@ -2389,7 +2447,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2405,7 +2463,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", TELEFUNKEN_START_BIT_PULSE_LEN_MIN, TELEFUNKEN_START_BIT_PULSE_LEN_MAX, TELEFUNKEN_START_BIT_PAUSE_LEN_MIN, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &telefunken_param; } else @@ -2419,7 +2477,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", ROOMBA_START_BIT_PULSE_LEN_MIN, ROOMBA_START_BIT_PULSE_LEN_MAX, ROOMBA_START_BIT_PAUSE_LEN_MIN, ROOMBA_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &roomba_param; } else @@ -2433,7 +2491,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nikon_param; } else @@ -2447,7 +2505,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &samsung_param; } else @@ -2461,7 +2519,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &matsushita_param; } else @@ -2475,7 +2533,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param; } else @@ -2489,7 +2547,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RADIO1_START_BIT_PULSE_LEN_MIN, RADIO1_START_BIT_PULSE_LEN_MAX, RADIO1_START_BIT_PAUSE_LEN_MIN, RADIO1_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &radio1_param; } else @@ -2503,7 +2561,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &recs80_param; } else @@ -2527,7 +2585,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX); -#endif +#endif // ANALYZE memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER)); } else @@ -2545,7 +2603,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX); -#endif +#endif // ANALYZE memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER)); } else @@ -2557,7 +2615,7 @@ irmp_ISR (void) 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX); -#endif +#endif // ANALYZE } irmp_param_p = (IRMP_PARAMETER *) &rc5_param; @@ -2587,7 +2645,7 @@ irmp_ISR (void) DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &denon_param; } else @@ -2603,7 +2661,7 @@ irmp_ISR (void) THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX, THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &thomson_param; } else @@ -2617,7 +2675,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX, BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &bose_param; } else @@ -2631,7 +2689,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rc6_param; last_pause = 0; last_value = 1; @@ -2647,7 +2705,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param; } else @@ -2661,7 +2719,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nubert_param; } else @@ -2675,7 +2733,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &speaker_param; } else @@ -2699,7 +2757,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param; last_value = 0; } @@ -2714,7 +2772,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &grundig_param; last_pause = irmp_pause_time; last_value = 1; @@ -2734,7 +2792,7 @@ irmp_ISR (void) 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &ruwido_param; last_pause = irmp_pause_time; last_value = 1; @@ -2750,7 +2808,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &fdc_param; } else @@ -2764,7 +2822,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rccar_param; } else @@ -2778,7 +2836,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX, KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &kathrein_param; } else @@ -2792,7 +2850,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX, NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &netbox_param; } else @@ -2806,7 +2864,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &lego_param; } else @@ -2820,7 +2878,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", A1TVBOX_START_BIT_PULSE_LEN_MIN, A1TVBOX_START_BIT_PULSE_LEN_MAX, A1TVBOX_START_BIT_PAUSE_LEN_MIN, A1TVBOX_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &a1tvbox_param; last_pause = 0; last_value = 1; @@ -2836,7 +2894,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", ORTEK_START_BIT_PULSE_LEN_MIN, ORTEK_START_BIT_PULSE_LEN_MAX, ORTEK_START_BIT_PAUSE_LEN_MIN, ORTEK_START_BIT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &ortek_param; last_pause = 0; last_value = 1; @@ -2853,7 +2911,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %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); -#endif +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rcmm_param; } else @@ -2861,8 +2919,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("protocol = UNKNOWN\n"); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... } @@ -2875,7 +2932,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max); ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max); -#endif +#endif // ANALYZE } else { @@ -2884,7 +2941,7 @@ irmp_ISR (void) 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max); ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max, 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max); -#endif +#endif // ANALYZE } #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) @@ -2895,7 +2952,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max); ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max); ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max); -#endif +#endif // ANALYZE } #endif @@ -2905,7 +2962,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX); -#endif +#endif // ANALYZE } #endif @@ -2914,7 +2971,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max); -#endif +#endif // ANALYZE } else { @@ -2923,20 +2980,18 @@ irmp_ISR (void) 2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max, 2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max); -#endif +#endif // ANALYZE } +#ifdef ANALYZE #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL) { -#ifdef ANALYZE ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX); -#endif } #endif -#ifdef ANALYZE ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset); ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset); ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len); @@ -2957,7 +3012,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1); } else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max) @@ -2966,7 +3021,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0); } } @@ -2987,14 +3042,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); -#endif +#endif // ANALYZE if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) { // pause timings correct for "1"? #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); // yes, store 1 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); } else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX) @@ -3002,7 +3057,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); // yes, store 0 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); } } @@ -3013,14 +3068,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); -#endif +#endif // ANALYZE if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) { // pause timings correct for "1"? #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); // yes, store 1 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); } else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX) @@ -3028,7 +3083,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); // yes, store 0 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); } } @@ -3063,21 +3118,17 @@ irmp_ISR (void) #ifdef ANALYZE if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) { -#ifdef ANALYZE ANALYZE_PRINTF ("stop bit detected\n"); -#endif } -#endif +#endif // ANALYZE irmp_param.stop_bit = 0; } else { #ifdef ANALYZE ANALYZE_PRINTF ("error: stop bit timing wrong, irmp_bit = %d, irmp_pulse_time = %d, pulse_0_len_min = %d, pulse_0_len_max = %d\n", -#endif irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); - -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... irmp_pulse_time = 0; irmp_pause_time = 0; @@ -3116,7 +3167,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to IR60 protocol\n"); -#endif +#endif // ANALYZE got_light = TRUE; // this is a lie, but generates a stop bit ;-) irmp_param.stop_bit = TRUE; // set flag @@ -3140,7 +3191,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NOKIA protocol\n"); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol irmp_param.address_offset = NOKIA_ADDRESS_OFFSET; irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN; @@ -3169,7 +3220,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to SIEMENS protocol\n"); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET; irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN; @@ -3225,7 +3276,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3239,7 +3290,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3255,7 +3306,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC protocol\n"); -#endif +#endif // ANALYZE irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_NEC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3272,7 +3323,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol\n"); -#endif +#endif // ANALYZE irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3285,7 +3336,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3298,6 +3349,20 @@ irmp_ISR (void) } #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1 + +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + else if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit == 32) // it was a SAMSUNG32 stop bit + { +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n"); +#endif // ANALYZE + irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL; + irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET; + irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN; + irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN; + } +#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 + #if IRMP_SUPPORT_RCMM_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL && (irmp_bit == 12 || irmp_bit == 24)) // it was a RCMM stop bit { @@ -3308,14 +3373,14 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_RCMM12_PROTOCOL; // switch protocol } else // if ((irmp_bit == 24) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_RCMM24_PROTOCOL; // switch protocol } irmp_param.stop_bit = TRUE; // set flag @@ -3327,9 +3392,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif - -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... irmp_pulse_time = 0; irmp_pause_time = 0; @@ -3346,7 +3409,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); -#endif +#endif // ANALYZE #if IRMP_SUPPORT_MANCHESTER == 1 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester @@ -3363,7 +3426,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('T'); -#endif +#endif // ANALYZE if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A { irmp_store_bit (1); @@ -3376,14 +3439,14 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { #ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1'); -#endif +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 ); #if IRMP_SUPPORT_RC6_PROTOCOL == 1 @@ -3391,7 +3454,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('T'); -#endif +#endif // ANALYZE irmp_store_bit (1); if (irmp_pause_time > 2 * irmp_param.pause_1_len_max) @@ -3404,14 +3467,14 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { #ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0'); -#endif +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 ); #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (! irmp_param2.protocol) @@ -3419,7 +3482,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0; } @@ -3442,7 +3505,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR (manchester_value + '0'); -#endif +#endif // ANALYZE #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (! irmp_param2.protocol) @@ -3450,7 +3513,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } #if IRMP_SUPPORT_RC6_PROTOCOL == 1 @@ -3458,7 +3521,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RC6A protocol\n"); -#endif +#endif // ANALYZE irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG; irmp_param.address_offset = 5; irmp_param.address_end = irmp_param.address_offset + 15; @@ -3480,7 +3543,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('?'); -#endif +#endif // ANALYZE irmp_param.protocol = 0; // switch to FDC, see below } else @@ -3493,7 +3556,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('?'); -#endif +#endif // ANALYZE irmp_param.protocol = 0; // switch to RCCAR, see below } else @@ -3504,8 +3567,7 @@ irmp_ISR (void) ANALYZE_NEWLINE (); ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3518,14 +3580,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF (" 1 (FDC)\n"); -#endif +#endif // ANALYZE irmp_store_bit2 (1); } else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX) { #ifdef ANALYZE ANALYZE_PRINTF (" 0 (FDC)\n"); -#endif +#endif // ANALYZE irmp_store_bit2 (0); } @@ -3533,7 +3595,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to FDC protocol\n"); -#endif +#endif // ANALYZE memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3548,14 +3610,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF (" 1 (RCCAR)\n"); -#endif +#endif // ANALYZE irmp_store_bit2 (1); } else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX) { #ifdef ANALYZE ANALYZE_PRINTF (" 0 (RCCAR)\n"); -#endif +#endif // ANALYZE irmp_store_bit2 (0); } @@ -3563,7 +3625,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCCAR protocol\n"); -#endif +#endif // ANALYZE memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3585,7 +3647,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (1); if (irmp_pulse_time >= irmp_param.pulse_1_len_min) @@ -3602,7 +3664,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (0); if (irmp_pause_time >= irmp_param.pause_1_len_min) @@ -3616,7 +3678,7 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE wait_for_space = 0; } else @@ -3630,24 +3692,35 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("SYNC\n"); -#endif +#endif // ANALYZE wait_for_space = 0; - irmp_tmp_id = 0; irmp_bit++; } else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX) { +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol "); +#endif // ANALYZE + irmp_param.protocol = IRMP_SAMSUNG48_PROTOCOL; + irmp_param.command_offset = SAMSUNG48_COMMAND_OFFSET; + irmp_param.command_end = SAMSUNG48_COMMAND_OFFSET + SAMSUNG48_COMMAND_LEN; + irmp_param.complete_len = SAMSUNG48_COMPLETE_DATA_LEN; +#else +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol "); +#endif // ANALYZE irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL; irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET; irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN; irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN; - +#endif if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX) { #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); wait_for_space = 0; } @@ -3656,22 +3729,17 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); wait_for_space = 0; } - -#ifdef ANALYZE - ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n"); -#endif } else { // timing incorrect! #ifdef ANALYZE ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3689,7 +3757,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC16 protocol\n"); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_NEC16_PROTOCOL; irmp_param.address_offset = NEC16_ADDRESS_OFFSET; irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN; @@ -3712,7 +3780,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("3rd start bit\n"); -#endif +#endif // ANALYZE wait_for_space = 0; irmp_bit++; } @@ -3721,8 +3789,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 3a B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3733,7 +3800,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("trailer bit\n"); -#endif +#endif // ANALYZE wait_for_space = 0; irmp_bit++; } @@ -3742,8 +3809,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 3b B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3755,7 +3821,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); last_value = 1; wait_for_space = 0; @@ -3765,7 +3831,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); last_value = 0; wait_for_space = 0; @@ -3775,7 +3841,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR (last_value + '0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (last_value); wait_for_space = 0; } @@ -3784,8 +3850,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 3c B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3796,8 +3861,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 3d B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3813,7 +3877,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (0); irmp_store_bit (0); } @@ -3822,7 +3886,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (0); irmp_store_bit (1); } @@ -3831,7 +3895,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (1); irmp_store_bit (0); } @@ -3840,13 +3904,13 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (1); irmp_store_bit (1); } #ifdef ANALYZE ANALYZE_PRINTF ("\n"); -#endif +#endif // ANALYZE wait_for_space = 0; } else @@ -3858,7 +3922,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); wait_for_space = 0; } @@ -3868,7 +3932,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); wait_for_space = 0; } @@ -3889,7 +3953,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_tmp_command <<= 1; } else @@ -3897,7 +3961,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); } wait_for_space = 0; @@ -3908,8 +3972,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3948,7 +4011,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -3961,7 +4024,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -3974,20 +4037,20 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else #endif #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 - // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame - if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01)) + // 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)) { #ifdef ANALYZE - ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n", + ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -4000,7 +4063,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -4013,7 +4076,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -4022,7 +4085,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit); -#endif +#endif // ANALYZE irmp_ir_detected = TRUE; #if IRMP_SUPPORT_DENON_PROTOCOL == 1 @@ -4043,7 +4106,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS); -#endif +#endif // ANALYZE last_irmp_denon_command = irmp_tmp_command; denon_repetition_len = 0; irmp_ir_detected = FALSE; @@ -4052,7 +4115,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS); -#endif +#endif // ANALYZE last_irmp_denon_command = 0; irmp_ir_detected = FALSE; } @@ -4066,7 +4129,7 @@ irmp_ISR (void) { // Grundig start frame? #ifdef ANALYZE ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } else @@ -4077,7 +4140,7 @@ irmp_ISR (void) { // Nokia start frame? #ifdef ANALYZE ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } else @@ -4091,7 +4154,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len); ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME "); -#endif +#endif // ANALYZE irmp_tmp_address = last_irmp_address; // address is last address irmp_tmp_command = last_irmp_command; // command is last command irmp_flags |= IRMP_FLAG_REPETITION; @@ -4101,8 +4164,8 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n", -#endif key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX); +#endif // ANALYZE irmp_ir_detected = FALSE; } } @@ -4119,7 +4182,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4129,7 +4192,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4144,7 +4207,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 6: parity check failed\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4152,7 +4215,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } irmp_tmp_address >>= 2; @@ -4226,10 +4289,9 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif +#endif // ANALYZE } -// irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // and wait for next start bit irmp_tmp_command = 0; irmp_pulse_time = 0; @@ -4653,9 +4715,7 @@ next_tick (void) { uint8_t key; -#ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR (' '); -#endif if (verbose) {