Index: irmp.c
===================================================================
--- irmp.c	(Revision 191)
+++ irmp.c	(Arbeitskopie)
@@ -1,4 +1,6 @@
-/*---------------------------------------------------------------------------------------------------------------------------------------------------
+//#define __asm(...) (void) 0
+
+/*------------------------------------------------------------------------------
  * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
  *
  * Copyright (c) 2009-2019 Frank Meyer - frank(at)fli4l.de
@@ -17,7 +19,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- *---------------------------------------------------------------------------------------------------------------------------------------------------
+ *------------------------------------------------------------------------------
  */
 
 #include "irmp.h"
@@ -808,7 +810,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1
 #  if IRMP_EXT_LOGGING == 1                                             // use external logging
 #    include "irmpextlog.h"
 #  else                                                                 // normal UART log (IRMP_EXT_LOGGING == 0)
-#    define BAUD                                    9600L
+//#    define BAUD                                    9600L
 #  ifndef UNIX_OR_WINDOWS
 #    include <util/setbaud.h>
 #  endif
@@ -2292,23 +2294,62 @@ static const PROGMEM IRMP_PARAMETER radi
 
 #endif
 
-static uint_fast8_t                             irmp_bit;                   // current bit position
-static IRMP_PARAMETER                           irmp_param;
-
+typedef struct
+{
+    // Current bit position
+    uint_fast8_t   bit;
+    IRMP_PARAMETER param;
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
-static IRMP_PARAMETER                           irmp_param2;
+    IRMP_PARAMETER param2;
 #endif
+    volatile uint_fast8_t  ir_detected;
+    volatile uint_fast8_t  protocol;
+    volatile uint_fast16_t address;
+#if IRMP_32_BIT == 1
+    volatile uint_fast32_t command;
+#else
+    volatile uint_fast16_t command;
+#endif
+    volatile uint_fast16_t id;      // Only used for SAMSUNG protocol.
+    volatile uint_fast8_t  flags;
 
-static volatile uint_fast8_t                    irmp_ir_detected = FALSE;
-static volatile uint_fast8_t                    irmp_protocol;
-static volatile uint_fast16_t                   irmp_address;
+    // These statics must not be volatile, because they are only used by
+    // irmp_store_bit(), which is called by irmp_ISR().
+    uint_fast16_t tmp_address;
 #if IRMP_32_BIT == 1
-static volatile uint_fast32_t                   irmp_command;
+    uint_fast32_t tmp_command;
 #else
-static volatile uint_fast16_t                   irmp_command;
+    uint_fast16_t tmp_command;
+#endif
+
+#if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
+    uint_fast16_t tmp_address2;
+    uint_fast16_t tmp_command2;
+#endif
+
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
+    uint_fast16_t lgair_address;                            // ir address
+    uint_fast16_t lgair_command;                            // ir command
 #endif
-static volatile uint_fast16_t                   irmp_id;                // only used for SAMSUNG protocol
-static volatile uint_fast8_t                    irmp_flags;
+
+#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
+    uint_fast16_t tmp_id;                                   // ir id (only SAMSUNG)
+#endif
+
+    struct
+    {
+        uint_fast8_t     start_bit_detected;   // flag: start bit detected
+        uint_fast8_t     wait_for_space;       // flag: wait for data bit space
+        uint_fast8_t     wait_for_start_space; // flag: wait for start bit space
+        uint_fast8_t     pulse_time;           // count bit time for pulse
+        PAUSE_LEN        pause_time;           // count bit time for pause
+        uint_fast16_t    key_repetition_len;   // SIRCS repeats frame 2-5 times with 45 ms pause
+        uint_fast8_t     repetition_frame_number;
+    } isr;
+} irmp_t;
+
+static irmp_t irmp;
+
 // static volatile uint_fast8_t                 irmp_busy_flag;
 
 #if defined(__MBED__)
@@ -2368,8 +2409,8 @@ irmp_init (void)
     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<<IRMP_BIT);                            // pin is input
-    IRMP_GPIO_STRUCT->CR1 |= (1<<IRMP_BIT);                             // activate pullup
+    IRMP_GPIO_STRUCT->DDR &= ~(1 << IRMP_BIT);                            // pin is input
+    IRMP_GPIO_STRUCT->CR1 |= (1 << IRMP_BIT);                             // activate pullup
 
 #elif defined (TEENSY_ARM_CORTEX_M4)                                    // TEENSY
     pinMode(IRMP_PIN, INPUT);
@@ -2394,8 +2435,8 @@ irmp_init (void)
     // ChibiOS HAL automatically initializes all pins according to the board config file, no need to repeat here
 
 #else                                                                   // AVR
-    IRMP_PORT &= ~(1<<IRMP_BIT);                                        // deactivate pullup
-    IRMP_DDR &= ~(1<<IRMP_BIT);                                         // set pin to input
+    IRMP_PORT &= ~(1 << IRMP_BIT);                                        // deactivate pullup
+    IRMP_DDR &= ~(1 << IRMP_BIT);                                         // set pin to input
 #endif
 
 #if IRMP_LOGGING == 1
@@ -2413,28 +2454,31 @@ irmp_init (void)
 uint_fast8_t
 irmp_get_data (IRMP_DATA * irmp_data_p)
 {
+    irmp_t *ir = &irmp;
+    __asm ("" : "+r" (ir));
+
     uint_fast8_t   rtc = FALSE;
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
     uint_fast8_t   cmd_len = 0;
 #endif
 
-    if (irmp_ir_detected)
+    if (ir->ir_detected)
     {
-        switch (irmp_protocol)
+        switch (ir->protocol)
         {
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
             case IRMP_SAMSUNG_PROTOCOL:
-                if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
+                if ((ir->command >> 8) == (~ir->command & 0x00FF))
                 {
-                    irmp_command &= 0xff;
-                    irmp_command |= irmp_id << 8;
+                    ir->command &= 0xff;
+                    ir->command |= ir->id << 8;
                     rtc = TRUE;
                 }
                 break;
 
 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
             case IRMP_SAMSUNG48_PROTOCOL:
-                irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8);
+                ir->command = (ir->command & 0x00FF) | ((ir->id & 0x00FF) << 8);
                 rtc = TRUE;
                 break;
 #endif
@@ -2442,19 +2486,19 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
             case IRMP_NEC_PROTOCOL:
-                if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
+                if ((ir->command >> 8) == (~ir->command & 0x00FF))
                 {
-                    irmp_command &= 0xff;
+                    ir->command &= 0xff;
                     rtc = TRUE;
                 }
-                else if (irmp_address == 0x87EE)
+                else if (ir->address == 0x87EE)
                 {
 #ifdef ANALYZE
                     ANALYZE_PRINTF ("Switching to APPLE protocol\n");
 #endif // ANALYZE
-                    irmp_protocol = IRMP_APPLE_PROTOCOL;
-                    irmp_address = (irmp_command & 0xFF00) >> 8;
-                    irmp_command &= 0x00FF;
+                    ir->protocol = IRMP_APPLE_PROTOCOL;
+                    ir->address = (ir->command & 0xFF00) >> 8;
+                    ir->command &= 0x00FF;
                     rtc = TRUE;
                 }
                 else
@@ -2462,7 +2506,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 #ifdef ANALYZE
                     ANALYZE_PRINTF ("Switching to ONKYO protocol\n");
 #endif // ANALYZE
-                    irmp_protocol = IRMP_ONKYO_PROTOCOL;
+                    ir->protocol = IRMP_ONKYO_PROTOCOL;
                     rtc = TRUE;
                 }
                 break;
@@ -2471,9 +2515,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
             case IRMP_VINCENT_PROTOCOL:
-                if ((irmp_command >> 8) == (irmp_command & 0x00FF))
+                if ((ir->command >> 8) == (ir->command & 0x00FF))
                 {
-                    irmp_command &= 0xff;
+                    ir->command &= 0xff;
                     rtc = TRUE;
                 }
                 break;
@@ -2481,9 +2525,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
             case IRMP_BOSE_PROTOCOL:
-                if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
+                if ((ir->command >> 8) == (~ir->command & 0x00FF))
                 {
-                    irmp_command &= 0xff;
+                    ir->command &= 0xff;
                     rtc = TRUE;
                 }
                 break;
@@ -2491,18 +2535,18 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
             case IRMP_MERLIN_PROTOCOL:
-                if (irmp_bit == 10)
+                if (ir->bit == 10)
                 {
                     rtc = TRUE;
                 }
-                else if (irmp_bit >= 19 && ((irmp_bit - 3) % 8 == 0))
+                else if (ir->bit >= 19 && ((ir->bit - 3) % 8 == 0))
                 {
-                    if (((irmp_command >> 1) & 1) != (irmp_command & 1))
+                    if (((ir->command >> 1) & 1) != (ir->command & 1))
                     {
-                        irmp_command >>= 1;
-                        irmp_command |= ((irmp_address & 1) << (irmp_bit - 12));
-                        irmp_address >>= 1;
-                        cmd_len = (irmp_bit - 11) >> 3;
+                        ir->command >>= 1;
+                        ir->command |= ((ir->address & 1) << (ir->bit - 12));
+                        ir->address >>= 1;
+                        cmd_len = (ir->bit - 11) >> 3;
                         rtc = TRUE;
                     }
                 }
@@ -2512,16 +2556,16 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
             case IRMP_SIEMENS_PROTOCOL:
             case IRMP_RUWIDO_PROTOCOL:
-                if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001))
+                if (((ir->command >> 1) & 0x0001) == (~ir->command & 0x0001))
                 {
-                    irmp_command >>= 1;
+                    ir->command >>= 1;
                     rtc = TRUE;
                 }
                 break;
 #endif
 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
             case IRMP_KATHREIN_PROTOCOL:
-                if (irmp_command != 0x0000)
+                if (ir->command != 0x0000)
                 {
                     rtc = TRUE;
                 }
@@ -2529,19 +2573,19 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 #endif
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
             case IRMP_RC5_PROTOCOL:
-                irmp_address &= ~0x20;                              // clear toggle bit
+                ir->address &= ~0x20;                              // clear toggle bit
                 rtc = TRUE;
                 break;
 #endif
 #if IRMP_SUPPORT_S100_PROTOCOL == 1
             case IRMP_S100_PROTOCOL:
-                irmp_address &= ~0x20;                              // clear toggle bit
+                ir->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
+                if (ir->command != 0x007d)                         // 0x007d (== 62<<1 + 1) is start instruction frame
                 {
                     rtc = TRUE;
                 }
@@ -2558,28 +2602,28 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                 // frame in irmp_data:
                 // Bit 12 11 10 9  8  7  6  5  4  3  2  1  0
                 //     V  D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0   //         10 9  8  7  6  5  4  3  2  1  0
-                irmp_address = (irmp_command & 0x000C) >> 2;    // addr:   0  0  0  0  0  0  0  0  0  A1 A0
-                irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit:  V  0  0  0  0  0  0  0  0  0  0
-                               ((irmp_command & 0x0003) << 8) | // C-Bits: 0  C1 C0 0  0  0  0  0  0  0  0
-                               ((irmp_command & 0x0FF0) >> 4);  // D-Bits:          D7 D6 D5 D4 D3 D2 D1 D0
+                ir->address = (ir->command & 0x000C) >> 2;    // addr:   0  0  0  0  0  0  0  0  0  A1 A0
+                ir->command = ((ir->command & 0x1000) >> 2) | // V-Bit:  V  0  0  0  0  0  0  0  0  0  0
+                               ((ir->command & 0x0003) << 8) | // C-Bits: 0  C1 C0 0  0  0  0  0  0  0  0
+                               ((ir->command & 0x0FF0) >> 4);  // D-Bits:          D7 D6 D5 D4 D3 D2 D1 D0
                 rtc = TRUE;                                     // Summe:  V  C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
                 break;
 #endif
 
 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1                           // squeeze code to 8 bit, upper bit indicates release-key
             case IRMP_NETBOX_PROTOCOL:
-                if (irmp_command & 0x1000)                      // last bit set?
+                if (ir->command & 0x1000)                      // last bit set?
                 {
-                    if ((irmp_command & 0x1f) == 0x15)          // key pressed: 101 01 (LSB)
+                    if ((ir->command & 0x1f) == 0x15)          // key pressed: 101 01 (LSB)
                     {
-                        irmp_command >>= 5;
-                        irmp_command &= 0x7F;
+                        ir->command >>= 5;
+                        ir->command &= 0x7F;
                         rtc = TRUE;
                     }
-                    else if ((irmp_command & 0x1f) == 0x10)     // key released: 000 01 (LSB)
+                    else if ((ir->command & 0x1f) == 0x10)     // key released: 000 01 (LSB)
                     {
-                        irmp_command >>= 5;
-                        irmp_command |= 0x80;
+                        ir->command >>= 5;
+                        ir->command |= 0x80;
                         rtc = TRUE;
                     }
                     else
@@ -2600,11 +2644,11 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
             case IRMP_LEGO_PROTOCOL:
             {
-                uint_fast8_t crc = 0x0F ^ ((irmp_command & 0xF000) >> 12) ^ ((irmp_command & 0x0F00) >> 8) ^ ((irmp_command & 0x00F0) >> 4);
+                uint_fast8_t crc = 0x0F ^ ((ir->command & 0xF000) >> 12) ^ ((ir->command & 0x0F00) >> 8) ^ ((ir->command & 0x00F0) >> 4);
 
-                if ((irmp_command & 0x000F) == crc)
+                if ((ir->command & 0x000F) == crc)
                 {
-                    irmp_command >>= 4;
+                    ir->command >>= 4;
                     rtc = TRUE;
                 }
                 else
@@ -2620,11 +2664,11 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
 #if IRMP_SUPPORT_METZ_PROTOCOL == 1
             case IRMP_METZ_PROTOCOL:
-                irmp_address &= ~0x40;                              // clear toggle bit
-                if (((~irmp_address) & 0x07) == (irmp_address >> 3) && ((~irmp_command) & 0x3f) == (irmp_command >> 6))
+                ir->address &= ~0x40;                              // clear toggle bit
+                if (((~ir->address) & 0x07) == (ir->address >> 3) && ((~ir->command) & 0x3f) == (ir->command >> 6))
                 {
-                    irmp_address >>= 3;
-                    irmp_command >>= 6;
+                    ir->address >>= 3;
+                    ir->command >>= 6;
                     rtc = TRUE;
                 }
                 break;
@@ -2638,24 +2682,24 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
 
         if (rtc)
         {
-            irmp_data_p->protocol = irmp_protocol;
-            irmp_data_p->address  = irmp_address;
-            irmp_data_p->command  = irmp_command;
-            irmp_data_p->flags    = irmp_flags;
+            irmp_data_p->protocol = ir->protocol;
+            irmp_data_p->address  = ir->address;
+            irmp_data_p->command  = ir->command;
+            irmp_data_p->flags    = ir->flags;
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
             irmp_data_p->flags   |= cmd_len;
 #endif
         }
         else
         {
-            irmp_protocol = IRMP_UNKNOWN_PROTOCOL;
+            ir->protocol = IRMP_UNKNOWN_PROTOCOL;
         }
 
-        irmp_command  = 0;                                      // don't reset irmp_protocol here, needed for detection of NEC & JVC repetition frames!
-        irmp_address  = 0;
-        irmp_flags    = 0;
+        ir->command  = 0;                                      // don't reset ir->protocol here, needed for detection of NEC & JVC repetition frames!
+        ir->address  = 0;
+        ir->flags    = 0;
 
-        irmp_ir_detected = FALSE;
+        ir->ir_detected = FALSE;
     }
 
     return rtc;
@@ -2669,27 +2713,6 @@ irmp_set_callback_ptr (void (*cb)(uint_f
 }
 #endif // IRMP_USE_CALLBACK == 1
 
-// these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
-static uint_fast16_t irmp_tmp_address;                                      // ir address
-#if IRMP_32_BIT == 1
-static uint_fast32_t irmp_tmp_command;                                      // ir command
-#else
-static uint_fast16_t irmp_tmp_command;                                      // ir command
-#endif
-
-#if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
-static uint_fast16_t irmp_tmp_address2;                                     // ir address
-static uint_fast16_t irmp_tmp_command2;                                     // ir command
-#endif
-
-#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
-static uint_fast16_t irmp_lgair_address;                                    // ir address
-static uint_fast16_t irmp_lgair_command;                                    // ir command
-#endif
-
-#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-static uint_fast16_t irmp_tmp_id;                                           // ir id (only SAMSUNG)
-#endif
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
 static uint8_t      xor_check[6];                                           // check kaseikyo "parity" bits
 static uint_fast8_t genre2;                                                 // save genre2 bits here, later copied to MSB in flags
@@ -2716,8 +2739,11 @@ static uint_fast8_t  mitsu_parity;      
 static void
 irmp_store_bit (uint_fast8_t value)
 {
+    irmp_t *ir = &irmp;
+    __asm ("" : "+r" (ir));
+
 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_ACP24_PROTOCOL)                                                 // squeeze 64 bits into 16 bits:
+    if (ir->param.protocol == IRMP_ACP24_PROTOCOL)                                                 // squeeze 64 bits into 16 bits:
     {
         if (value)
         {
@@ -2731,24 +2757,24 @@ irmp_store_bit (uint_fast8_t value)
             //         5432109876543210
             //         NAVVvMMMmtxyTTTT
 
-            switch (irmp_bit)
+            switch (ir->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
+                case  0: ir->tmp_command |= (1 << 15); break;             // N
+                case  2: ir->tmp_command |= (1 << 13); break;             // V
+                case  3: ir->tmp_command |= (1 << 12); break;             // V
+                case  4: ir->tmp_command |= (1 << 10); break;             // M
+                case  5: ir->tmp_command |= (1 <<  9); break;             // M
+                case  6: ir->tmp_command |= (1 <<  8); break;             // M
+                case 20: ir->tmp_command |= (1 <<  6); break;             // t
+                case 22: ir->tmp_command |= (1 << 11); break;             // v
+                case 23: ir->tmp_command |= (1 <<  7); break;             // m
+                case 24: ir->tmp_command |= (1 << 14); break;             // A
+                case 26: ir->tmp_command |= (1 <<  5); break;             // x
+                case 44: ir->tmp_command |= (1 <<  4); break;             // y
+                case 66: ir->tmp_command |= (1 <<  3); break;             // T
+                case 67: ir->tmp_command |= (1 <<  2); break;             // T
+                case 68: ir->tmp_command |= (1 <<  1); break;             // T
+                case 69: ir->tmp_command |= (1 <<  0); break;             // T
             }
         }
     }
@@ -2756,18 +2782,18 @@ irmp_store_bit (uint_fast8_t value)
 #endif // IRMP_SUPPORT_ACP24_PROTOCOL
 
 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)
+    if (ir->param.protocol == IRMP_ORTEK_PROTOCOL)
     {
-        if (irmp_bit < 14)
+        if (ir->bit < 14)
         {
             if (value)
             {
                 parity++;
             }
         }
-        else if (irmp_bit == 14)
+        else if (ir->bit == 14)
         {
-            if (value)                                                                                      // value == 1: even parity
+            if (value)                               // value == 1: even parity
             {
                 if (parity & 0x01)
                 {
@@ -2780,7 +2806,7 @@ irmp_store_bit (uint_fast8_t value)
             }
             else
             {
-                if (parity & 0x01)                                                                          // value == 0: odd parity
+                if (parity & 0x01)                   // value == 0: odd parity
                 {
                     parity = PARITY_CHECK_OK;
                 }
@@ -2798,101 +2824,101 @@ irmp_store_bit (uint_fast8_t value)
     }
 
 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
-    if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)
+    if (ir->bit == 0 && ir->param.protocol == IRMP_GRUNDIG_PROTOCOL)
     {
         first_bit = value;
     }
     else
 #endif
 
-    if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)
+    if (ir->bit >= ir->param.address_offset && ir->bit < ir->param.address_end)
     {
-        if (irmp_param.lsb_first)
+        if (ir->param.lsb_first)
         {
-            irmp_tmp_address |= (((uint_fast16_t) (value)) << (irmp_bit - irmp_param.address_offset));   // CV wants cast
+            ir->tmp_address |= (((uint_fast16_t) (value)) << (ir->bit - ir->param.address_offset));   // CV wants cast
         }
         else
         {
-            irmp_tmp_address <<= 1;
-            irmp_tmp_address |= value;
+            ir->tmp_address <<= 1;
+            ir->tmp_address |= value;
         }
     }
-    else if (irmp_bit >= irmp_param.command_offset && irmp_bit < irmp_param.command_end)
+    else if (ir->bit >= ir->param.command_offset && ir->bit < ir->param.command_end)
     {
-        if (irmp_param.lsb_first)
+        if (ir->param.lsb_first)
         {
 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
-            if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit >= 32)
+            if (ir->param.protocol == IRMP_SAMSUNG48_PROTOCOL && ir->bit >= 32)
             {
-                irmp_tmp_id |= (((uint_fast16_t) (value)) << (irmp_bit - 32));   // CV wants cast
+                ir->tmp_id |= (((uint_fast16_t) (value)) << (ir->bit - 32));   // CV wants cast
             }
             else
 #endif
             {
-                irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - irmp_param.command_offset));   // CV wants cast
+                ir->tmp_command |= (((uint_fast16_t) (value)) << (ir->bit - ir->param.command_offset));   // CV wants cast
             }
         }
         else
         {
-            irmp_tmp_command <<= 1;
-            irmp_tmp_command |= value;
+            ir->tmp_command <<= 1;
+            ir->tmp_command |= value;
         }
     }
 
 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_NEC_PROTOCOL || irmp_param.protocol == IRMP_NEC42_PROTOCOL)
+    if (ir->param.protocol == IRMP_NEC_PROTOCOL || ir->param.protocol == IRMP_NEC42_PROTOCOL)
     {
-        if (irmp_bit < 8)
+        if (ir->bit < 8)
         {
-            irmp_lgair_address <<= 1;                                                               // LGAIR uses MSB
-            irmp_lgair_address |= value;
+            ir->lgair_address <<= 1;                                                               // LGAIR uses MSB
+            ir->lgair_address |= value;
         }
-        else if (irmp_bit < 24)
+        else if (ir->bit < 24)
         {
-            irmp_lgair_command <<= 1;                                                               // LGAIR uses MSB
-            irmp_lgair_command |= value;
+            ir->lgair_command <<= 1;                                                               // LGAIR uses MSB
+            ir->lgair_command |= value;
         }
     }
     // NO else!
 #endif
 
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)
+    if (ir->param.protocol == IRMP_NEC42_PROTOCOL && ir->bit >= 13 && ir->bit < 26)
     {
-        irmp_tmp_address2 |= (((uint_fast16_t) (value)) << (irmp_bit - 13));                             // CV wants cast
+        ir->tmp_address2 |= (((uint_fast16_t) (value)) << (ir->bit - 13));                             // CV wants cast
     }
     else
 #endif
 
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)
+    if (ir->param.protocol == IRMP_SAMSUNG_PROTOCOL && ir->bit >= SAMSUNG_ID_OFFSET && ir->bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)
     {
-        irmp_tmp_id |= (((uint_fast16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET));                    // store with LSB first
+        ir->tmp_id |= (((uint_fast16_t) (value)) << (ir->bit - SAMSUNG_ID_OFFSET));                    // store with LSB first
     }
     else
 #endif
 
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)
+    if (ir->param.protocol == IRMP_KASEIKYO_PROTOCOL)
     {
-        if (irmp_bit >= 20 && irmp_bit < 24)
+        if (ir->bit >= 20 && ir->bit < 24)
         {
-            irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - 8));      // store 4 system bits (genre 1) in upper nibble with LSB first
+            ir->tmp_command |= (((uint_fast16_t) (value)) << (ir->bit - 8));      // store 4 system bits (genre 1) in upper nibble with LSB first
         }
-        else if (irmp_bit >= 24 && irmp_bit < 28)
+        else if (ir->bit >= 24 && ir->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)) << (ir->bit - 20));                // store 4 system bits (genre 2) in upper nibble with LSB first
         }
 
-        if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)
+        if (ir->bit < KASEIKYO_COMPLETE_DATA_LEN)
         {
             if (value)
             {
-                xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);
+                xor_check[ir->bit / 8] |= 1 << (ir->bit % 8);
             }
             else
             {
-                xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));
+                xor_check[ir->bit / 8] &= ~(1 << (ir->bit % 8));
             }
         }
     }
@@ -2900,41 +2926,41 @@ irmp_store_bit (uint_fast8_t value)
 #endif
 
 #if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1
-    if (irmp_param.protocol == IRMP_MITSU_HEAVY_PROTOCOL)                           // squeeze 64 bits into 16 bits:
+    if (ir->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
+        if (ir->bit == 72)
+        {                                                                           // ir->tmp_address, ir->tmp_command received: check parity & compress
             mitsu_parity = PARITY_CHECK_OK;
 
-            check = irmp_tmp_address >> 8;                                          // inverted upper byte == lower byte?
+            check = ir->tmp_address >> 8;                                          // inverted upper byte == lower byte?
             check = ~ check;
 
-            if (check == (irmp_tmp_address & 0xFF))
+            if (check == (ir->tmp_address & 0xFF))

             {                                                                       // ok:
-                irmp_tmp_address <<= 8;                                             // throw away upper byte
+                ir->tmp_address <<= 8;                                             // throw away upper byte
             }
             else
             {
                 mitsu_parity = PARITY_CHECK_FAILED;
             }
 
-            check = irmp_tmp_command >> 8;                                          // inverted upper byte == lower byte?
+            check = ir->tmp_command >> 8;                                          // inverted upper byte == lower byte?
             check = ~ check;
-            if (check == (irmp_tmp_command & 0xFF))
+            if (check == (ir->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
+                ir->tmp_address |= ir->tmp_command & 0xFF;                        // byte 1, byte2 in ir->tmp_address, ir->tmp_command can be used for byte 3
             }
             else
             {
                 mitsu_parity = PARITY_CHECK_FAILED;
             }
-            irmp_tmp_command = 0;
+            ir->tmp_command = 0;
         }
 
-        if (irmp_bit >= 72 )
-        {                                                                           // receive 3. word in irmp_tmp_command
-            irmp_tmp_command <<= 1;
-            irmp_tmp_command |= value;
+        if (ir->bit >= 72)
+        {                                                                           // receive 3. word in ir->tmp_command
+            ir->tmp_command <<= 1;
+            ir->tmp_command |= value;
         }
     }
     else
@@ -2943,14 +2969,14 @@ irmp_store_bit (uint_fast8_t value)
         ;
     }
 
-    irmp_bit++;
+    ir->bit++;
 }
 
-/*---------------------------------------------------------------------------------------------------------------------------------------------------
+/*------------------------------------------------------------------------------
  *  store bit
  *  @details  store bit in temp address or temp command
  *  @param    value to store: 0 or 1
- *---------------------------------------------------------------------------------------------------------------------------------------------------
+ *------------------------------------------------------------------------------
  */
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
 static void
@@ -2958,22 +2984,22 @@ irmp_store_bit2 (uint_fast8_t value)
 {
     uint_fast8_t irmp_bit2;
 
-    if (irmp_param.protocol)
+    if (irmp.param.protocol)
     {
-        irmp_bit2 = irmp_bit - 2;
+        irmp_bit2 = irmp.bit - 2;
     }
     else
     {
-        irmp_bit2 = irmp_bit - 1;
+        irmp_bit2 = irmp.bit - 1;
     }
 
-    if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)
+    if (irmp_bit2 >= irmp.param2.address_offset && irmp_bit2 < irmp.param2.address_end)
     {
-        irmp_tmp_address2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset));   // CV wants cast
+        irmp.tmp_address2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp.param2.address_offset));   // CV wants cast
     }
-    else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)
+    else if (irmp_bit2 >= irmp.param2.command_offset && irmp_bit2 < irmp.param2.command_end)
     {
-        irmp_tmp_command2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset));   // CV wants cast
+        irmp.tmp_command2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp.param2.command_offset));   // CV wants cast
     }
 }
 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
@@ -2986,19 +3012,15 @@ irmp_store_bit2 (uint_fast8_t value)
 uint_fast8_t
 irmp_ISR (void)
 {
-    static uint_fast8_t     irmp_start_bit_detected;                                // flag: start bit detected
-    static uint_fast8_t     wait_for_space;                                         // flag: wait for data bit space
-    static uint_fast8_t     wait_for_start_space;                                   // flag: wait for start bit space
-    static uint_fast8_t     irmp_pulse_time;                                        // count bit time for pulse
-    static PAUSE_LEN        irmp_pause_time;                                        // count bit time for pause
+    irmp_t *ir = &irmp;
+    __asm ("" : "+r" (ir));
+
     static uint_fast16_t    last_irmp_address = 0xFFFF;                             // save last irmp address to recognize key repetition
 #if IRMP_32_BIT == 1
     static uint_fast32_t    last_irmp_command = 0xFFFFFFFF;                         // save last irmp command to recognize key repetition
 #else
     static uint_fast16_t    last_irmp_command = 0xFFFF;                             // save last irmp command to recognize key repetition
 #endif
-    static uint_fast16_t    key_repetition_len;                                     // SIRCS repeats frame 2-5 times with 45 ms pause
-    static uint_fast8_t     repetition_frame_number;
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
     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
@@ -3023,12 +3045,13 @@ irmp_ISR (void)
     static uint_fast8_t     last_irmp_start_bit_detected = 0xFF;
     static uint_fast8_t     last_irmp_pulse_time = 0xFF;
 
-    if (last_irmp_start_bit_detected != irmp_start_bit_detected || last_irmp_pulse_time != irmp_pulse_time)
+    if (last_irmp_start_bit_detected != ir->isr.start_bit_detected
+        || last_irmp_pulse_time != ir->isr.pulse_time)
     {
-        last_irmp_start_bit_detected    = irmp_start_bit_detected;
-        last_irmp_pulse_time            = irmp_pulse_time;
+        last_irmp_start_bit_detected    = ir->isr.start_bit_detected;
+        last_irmp_pulse_time            = ir->isr.pulse_time;
 
-        printf ("%d %d %d\n", time_counter, irmp_start_bit_detected, irmp_pulse_time);
+        printf ("%d %d %d\n", time_counter, ir->isr.start_bit_detected, ir->isr.pulse_time);
     }
 #endif // 0
 
@@ -3059,56 +3082,56 @@ irmp_ISR (void)
 
     irmp_log(irmp_input);                                                       // log ir signal, if IRMP_LOGGING defined
 
-    if (! irmp_ir_detected)                                                     // ir code already detected?
+    if (! ir->ir_detected)                                                     // ir code already detected?
     {                                                                           // no...
-        if (! irmp_start_bit_detected)                                          // start bit detected?
+        if (! ir->isr.start_bit_detected)                                          // start bit detected?
         {                                                                       // no...
             if (! irmp_input)                                                   // receiving burst?
             {                                                                   // yes...
 //              irmp_busy_flag = TRUE;
 #ifdef ANALYZE
-                if (! irmp_pulse_time)
+                if (! ir->isr.pulse_time)
                 {
                     ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);
                 }
 #endif // ANALYZE
-                irmp_pulse_time++;                                              // increment counter
+                ir->isr.pulse_time++;                                              // increment counter
             }
             else
             {                                                                   // no...
-                if (irmp_pulse_time)                                            // it's dark....
+                if (ir->isr.pulse_time)                                            // it's dark....
                 {                                                               // set flags for counting the time of darkness...
-                    irmp_start_bit_detected = 1;
-                    wait_for_start_space    = 1;
-                    wait_for_space          = 0;
-                    irmp_tmp_command        = 0;
-                    irmp_tmp_address        = 0;
+                    ir->isr.start_bit_detected = 1;
+                    ir->isr.wait_for_start_space    = 1;
+                    ir->isr.wait_for_space          = 0;
+                    ir->tmp_command        = 0;
+                    ir->tmp_address        = 0;
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
                     genre2                  = 0;
 #endif
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-                    irmp_tmp_id = 0;
+                    ir->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;
-                    irmp_tmp_address2       = 0;
+                    ir->tmp_command2       = 0;
+                    ir->tmp_address2       = 0;
 #endif
 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
-                    irmp_lgair_command      = 0;
-                    irmp_lgair_address      = 0;
+                    ir->lgair_command      = 0;
+                    ir->lgair_address      = 0;
 #endif
-                    irmp_bit                = 0xff;
-                    irmp_pause_time         = 1;                                // 1st pause: set to 1, not to 0!
+                    ir->bit                = 0xff;
+                    ir->isr.pause_time         = 1;                                // 1st pause: set to 1, not to 0!
 #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
                 }
                 else
                 {
-                    if (key_repetition_len < 0xFFFF)                            // avoid overflow of counter
+                    if (ir->isr.key_repetition_len < 0xFFFF)                            // avoid overflow of counter
                     {
-                        key_repetition_len++;
+                        ir->isr.key_repetition_len++;
 
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
                         if (denon_repetition_len < 0xFFFF)                      // avoid overflow of counter
@@ -3132,21 +3155,21 @@ irmp_ISR (void)
         }
         else
         {
-            if (wait_for_start_space)                                           // we have received start bit...
+            if (ir->isr.wait_for_start_space)                                           // we have received start bit...
             {                                                                   // ...and are counting the time of darkness
                 if (irmp_input)                                                 // still dark?
                 {                                                               // yes
-                    irmp_pause_time++;                                          // increment counter
+                    ir->isr.pause_time++;                                          // increment counter
 
 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
-                    if (((irmp_pulse_time < NIKON_START_BIT_PULSE_LEN_MIN || irmp_pulse_time > NIKON_START_BIT_PULSE_LEN_MAX) && irmp_pause_time > IRMP_TIMEOUT_LEN) ||
-                         irmp_pause_time > IRMP_TIMEOUT_NIKON_LEN)
+                    if (((ir->isr.pulse_time < NIKON_START_BIT_PULSE_LEN_MIN || ir->isr.pulse_time > NIKON_START_BIT_PULSE_LEN_MAX) && ir->isr.pause_time > IRMP_TIMEOUT_LEN) ||
+                         ir->isr.pause_time > IRMP_TIMEOUT_NIKON_LEN)
 #else
-                    if (irmp_pause_time > IRMP_TIMEOUT_LEN)                     // timeout?
+                    if (ir->isr.pause_time > IRMP_TIMEOUT_LEN)                     // timeout?
 #endif
                     {                                                           // yes...
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                        if (irmp_protocol == IRMP_JVC_PROTOCOL)                 // don't show eror if JVC protocol, irmp_pulse_time has been set below!
+                        if (ir->protocol == IRMP_JVC_PROTOCOL)                 // don't show eror if JVC protocol, ir->isr.pulse_time has been set below!
                         {
                             ;
                         }
@@ -3154,14 +3177,14 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
                         {
 #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_PRINTF ("%8.3fms error 1: pause after start bit pulse %d too long: %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, ir->isr.pulse_time, ir->isr.pause_time);
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
                         }
 
-                        irmp_start_bit_detected = 0;                            // reset flags, let's wait for another start bit
-                        irmp_pulse_time         = 0;
-                        irmp_pause_time         = 0;
+                        ir->isr.start_bit_detected = 0;                            // reset flags, let's wait for another start bit
+                        ir->isr.pulse_time         = 0;
+                        ir->isr.pause_time         = 0;
                     }
                 }
                 else
@@ -3170,16 +3193,16 @@ irmp_ISR (void)
                     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;
+                    ir->param2.protocol = 0;
 #endif
 
 #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);
+                    ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, ir->isr.pulse_time, ir->isr.pause_time);
 #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 &&
-                        irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's SIRCS
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3192,9 +3215,9 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
 
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                    if (irmp_protocol == IRMP_JVC_PROTOCOL &&                                                       // last protocol was JVC, awaiting repeat frame
-                        irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->protocol == IRMP_JVC_PROTOCOL &&                                                       // last protocol was JVC, awaiting repeat frame
+                        ir->isr.pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3207,8 +3230,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
 
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
-                    if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
                     {
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
 #ifdef ANALYZE
@@ -3226,11 +3249,11 @@ irmp_ISR (void)
                         irmp_param_p = (IRMP_PARAMETER *) &nec_param;
 #endif
                     }
-                    else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN        && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
-                             irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)
+                    else if (ir->isr.pulse_time >= NEC_START_BIT_PULSE_LEN_MIN        && ir->isr.pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
+                             ir->isr.pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's NEC
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                        if (irmp_protocol == IRMP_JVC_PROTOCOL)                 // last protocol was JVC, awaiting repeat frame
+                        if (ir->protocol == IRMP_JVC_PROTOCOL)                 // last protocol was JVC, awaiting repeat frame
                         {                                                       // some jvc remote controls use nec repetition frame for jvc repetition frame
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3254,9 +3277,9 @@ irmp_ISR (void)
                     else
 
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                    if (irmp_protocol == IRMP_JVC_PROTOCOL &&                   // last protocol was JVC, awaiting repeat frame
-                        irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= NEC_0_PAUSE_LEN_MIN         && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX)
+                    if (ir->protocol == IRMP_JVC_PROTOCOL &&                   // last protocol was JVC, awaiting repeat frame
+                        ir->isr.pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= NEC_0_PAUSE_LEN_MIN         && ir->isr.pause_time <= NEC_0_PAUSE_LEN_MAX)
                     {                                                           // it's JVC repetition type 3
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3271,8 +3294,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
 
 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
-                    if (irmp_pulse_time >= TELEFUNKEN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= TELEFUNKEN_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= TELEFUNKEN_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= TELEFUNKEN_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3285,8 +3308,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
 
 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
-                    if (irmp_pulse_time >= ROOMBA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= ROOMBA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ROOMBA_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= ROOMBA_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= ROOMBA_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= ROOMBA_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= ROOMBA_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3299,8 +3322,8 @@ irmp_ISR (void)
 #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)
+                    if (ir->isr.pulse_time >= ACP24_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= ACP24_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= ACP24_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= ACP24_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = ACP24, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3313,8 +3336,8 @@ irmp_ISR (void)
 #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)
+                    if (ir->isr.pulse_time >= PENTAX_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= PENTAX_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= PENTAX_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= PENTAX_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = PENTAX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3327,8 +3350,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_PENTAX_PROTOCOL == 1
 
 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
-                    if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3341,8 +3364,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
 
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-                    if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's SAMSUNG
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3355,8 +3378,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
 
 #if IRMP_SUPPORT_SAMSUNGAH_PROTOCOL == 1
-                    if (irmp_pulse_time >= SAMSUNGAH_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNGAH_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= SAMSUNGAH_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNGAH_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= SAMSUNGAH_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= SAMSUNGAH_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= SAMSUNGAH_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SAMSUNGAH_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's SAMSUNGAH
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = SAMSUNGAH, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3369,8 +3392,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_SAMSUNGAH_PROTOCOL == 1
 
 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
-                    if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's MATSUSHITA
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3383,8 +3406,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
 
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
-                    if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's KASEIKYO
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3397,8 +3420,8 @@ irmp_ISR (void)
 #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)
+                    if (ir->isr.pulse_time >= PANASONIC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= PANASONIC_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= PANASONIC_START_BIT_PAUSE_LEN_MIN && ir->isr.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",
@@ -3411,8 +3434,8 @@ irmp_ISR (void)
 #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)
+                    if (ir->isr.pulse_time >= MITSU_HEAVY_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= MITSU_HEAVY_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= MITSU_HEAVY_START_BIT_PAUSE_LEN_MIN && ir->isr.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",
@@ -3425,8 +3448,8 @@ irmp_ISR (void)
 #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)
+                    if (ir->isr.pulse_time >= VINCENT_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= VINCENT_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= VINCENT_START_BIT_PAUSE_LEN_MIN && ir->isr.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",
@@ -3439,8 +3462,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_VINCENT_PROTOCOL == 1
 
 #if IRMP_SUPPORT_METZ_PROTOCOL == 1
-                    if (irmp_pulse_time >= METZ_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= METZ_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= METZ_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= METZ_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= METZ_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= METZ_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= METZ_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= METZ_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = METZ, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3453,8 +3476,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_METZ_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)
+                    if (ir->isr.pulse_time >= RADIO1_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RADIO1_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RADIO1_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RADIO1_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3467,8 +3490,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
-                    if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's RECS80
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3481,10 +3504,10 @@ irmp_ISR (void)
 #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)))
+                    if (((ir->isr.pulse_time >= S100_START_BIT_LEN_MIN     && ir->isr.pulse_time <= S100_START_BIT_LEN_MAX) ||
+                         (ir->isr.pulse_time >= 2 * S100_START_BIT_LEN_MIN && ir->isr.pulse_time <= 2 * S100_START_BIT_LEN_MAX)) &&
+                        ((ir->isr.pause_time >= S100_START_BIT_LEN_MIN     && ir->isr.pause_time <= S100_START_BIT_LEN_MAX) ||
+                         (ir->isr.pause_time >= 2 * S100_START_BIT_LEN_MIN && ir->isr.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",
@@ -3495,10 +3518,10 @@ irmp_ISR (void)
 #endif // ANALYZE
 
                         irmp_param_p = (IRMP_PARAMETER *) &s100_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.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))
+                        if ((ir->isr.pulse_time > S100_START_BIT_LEN_MAX && ir->isr.pulse_time <= 2 * S100_START_BIT_LEN_MAX) ||
+                            (ir->isr.pause_time > S100_START_BIT_LEN_MAX && ir->isr.pause_time <= 2 * S100_START_BIT_LEN_MAX))
                         {
                           last_value  = 0;
                           rc5_cmd_bit6 = 1<<6;
@@ -3512,14 +3535,14 @@ irmp_ISR (void)
 #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)) &&
-                        ((irmp_pause_time >= RC5_START_BIT_LEN_MIN     && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||
-                         (irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))
+                    if (((ir->isr.pulse_time >= RC5_START_BIT_LEN_MIN     && ir->isr.pulse_time <= RC5_START_BIT_LEN_MAX) ||
+                         (ir->isr.pulse_time >= 2 * RC5_START_BIT_LEN_MIN && ir->isr.pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&
+                        ((ir->isr.pause_time >= RC5_START_BIT_LEN_MIN     && ir->isr.pause_time <= RC5_START_BIT_LEN_MAX) ||
+                         (ir->isr.pause_time >= 2 * RC5_START_BIT_LEN_MIN && ir->isr.pause_time <= 2 * RC5_START_BIT_LEN_MAX)))
                     {                                                           // it's RC5
 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
-                        if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
-                            irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
+                        if (ir->isr.pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
+                            ir->isr.pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
@@ -3530,14 +3553,14 @@ irmp_ISR (void)
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);
 #endif // ANALYZE
-                            memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));
+                            memcpy_P (&irmp.param2, &fdc_param, sizeof (IRMP_PARAMETER));
                         }
                         else
 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
-                        if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
-                            irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
+                        if (ir->isr.pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
+                            ir->isr.pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
@@ -3548,7 +3571,7 @@ irmp_ISR (void)
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);
 #endif // ANALYZE
-                            memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));
+                            memcpy_P (&irmp.param2, &rccar_param, sizeof (IRMP_PARAMETER));
                         }
                         else
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
@@ -3563,10 +3586,10 @@ irmp_ISR (void)
                         }
 
                         irmp_param_p = (IRMP_PARAMETER *) &rc5_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.pause_time;
 
-                        if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||
-                            (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))
+                        if ((ir->isr.pulse_time > RC5_START_BIT_LEN_MAX && ir->isr.pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||
+                            (ir->isr.pause_time > RC5_START_BIT_LEN_MAX && ir->isr.pause_time <= 2 * RC5_START_BIT_LEN_MAX))
                         {
                             last_value  = 0;
                             rc5_cmd_bit6 = 1<<6;
@@ -3580,8 +3603,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RCII_PROTOCOL == 1
-                    if ((irmp_pulse_time >= RCII_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCII_START_BIT_PULSE_LEN_MAX) &&
-                        (irmp_pause_time >= RCII_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCII_START_BIT_PAUSE_LEN_MAX))
+                    if ((ir->isr.pulse_time >= RCII_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RCII_START_BIT_PULSE_LEN_MAX) &&
+                        (ir->isr.pause_time >= RCII_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RCII_START_BIT_PAUSE_LEN_MAX))
                     {                                                           // it's RCII
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RCII, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3589,7 +3612,7 @@ irmp_ISR (void)
                                         RCII_START_BIT_PAUSE_LEN_MIN, RCII_START_BIT_PAUSE_LEN_MAX)
 #endif // ANALYZE
                         irmp_param_p = (IRMP_PARAMETER *) &rcii_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.pause_time;
                         waiting_for_2nd_pulse = 1;
                         last_value  = 1;
                     }
@@ -3597,9 +3620,9 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RCII_PROTOCOL == 1
 
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
-                    if ( (irmp_pulse_time >= DENON_PULSE_LEN_MIN && irmp_pulse_time <= DENON_PULSE_LEN_MAX) &&
-                        ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||
-                         (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))
+                    if ( (ir->isr.pulse_time >= DENON_PULSE_LEN_MIN && ir->isr.pulse_time <= DENON_PULSE_LEN_MAX) &&
+                        ((ir->isr.pause_time >= DENON_1_PAUSE_LEN_MIN && ir->isr.pause_time <= DENON_1_PAUSE_LEN_MAX) ||
+                         (ir->isr.pause_time >= DENON_0_PAUSE_LEN_MIN && ir->isr.pause_time <= DENON_0_PAUSE_LEN_MAX)))
                     {                                                           // it's DENON
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
@@ -3613,9 +3636,9 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
 
 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
-                    if ( (irmp_pulse_time >= THOMSON_PULSE_LEN_MIN && irmp_pulse_time <= THOMSON_PULSE_LEN_MAX) &&
-                        ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||
-                         (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)))
+                    if ( (ir->isr.pulse_time >= THOMSON_PULSE_LEN_MIN && ir->isr.pulse_time <= THOMSON_PULSE_LEN_MAX) &&
+                        ((ir->isr.pause_time >= THOMSON_1_PAUSE_LEN_MIN && ir->isr.pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||
+                         (ir->isr.pause_time >= THOMSON_0_PAUSE_LEN_MIN && ir->isr.pause_time <= THOMSON_0_PAUSE_LEN_MAX)))
                     {                                                           // it's THOMSON
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
@@ -3629,8 +3652,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
 
 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
-                    if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3643,8 +3666,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
-                    if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's RC6
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3659,8 +3682,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
-                    if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's RECS80EXT
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3673,8 +3696,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
 
 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
-                    if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's NUBERT
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3687,8 +3710,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
 
 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
-                    if (irmp_pulse_time >= FAN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FAN_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= FAN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FAN_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= FAN_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= FAN_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= FAN_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= FAN_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's FAN
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = FAN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3701,8 +3724,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_FAN_PROTOCOL == 1
 
 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
-                    if (irmp_pulse_time >= SPEAKER_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SPEAKER_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= SPEAKER_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SPEAKER_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= SPEAKER_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= SPEAKER_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= SPEAKER_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SPEAKER_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's SPEAKER
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3715,8 +3738,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
 
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
-                    if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&
-                        irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && ir->isr.pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)
                     {                                                           // it's BANG_OLUFSEN
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
@@ -3740,8 +3763,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
 
 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
-                    if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&
-                        irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && ir->isr.pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&
+                        ir->isr.pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && ir->isr.pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)
                     {                                                           // it's GRUNDIG
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3749,15 +3772,15 @@ irmp_ISR (void)
                                         GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);
 #endif // ANALYZE
                         irmp_param_p = (IRMP_PARAMETER *) &grundig_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.pause_time;
                         last_value  = 1;
                     }
                     else
 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
 
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 // check MERLIN before RUWIDO!
-                    if (irmp_pulse_time >= MERLIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MERLIN_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= MERLIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MERLIN_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= MERLIN_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= MERLIN_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= MERLIN_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= MERLIN_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's MERLIN
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3765,17 +3788,17 @@ irmp_ISR (void)
                                         MERLIN_START_BIT_PAUSE_LEN_MIN, MERLIN_START_BIT_PAUSE_LEN_MAX);
 #endif // ANALYZE
                         irmp_param_p = (IRMP_PARAMETER *) &merlin_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.pause_time;
                         last_value = 1;
                     }
                     else
 #endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1
 
 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
-                    if (((irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||
-                         (irmp_pulse_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX)) &&
-                        ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) ||
-                         (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))
+                    if (((ir->isr.pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||
+                         (ir->isr.pulse_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX)) &&
+                        ((ir->isr.pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) ||
+                         (ir->isr.pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))
                     {                                                           // it's RUWIDO or SIEMENS
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
@@ -3785,15 +3808,15 @@ irmp_ISR (void)
                                         2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX);
 #endif // ANALYZE
                         irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;
-                        last_pause = irmp_pause_time;
+                        last_pause = ir->isr.pause_time;
                         last_value  = 1;
                     }
                     else
 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
 
 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
-                    if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3806,8 +3829,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
-                    if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3820,8 +3843,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
 
 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
-                    if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's KATHREIN
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3834,8 +3857,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
 
 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
-                    if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's NETBOX
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3848,8 +3871,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
 
 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
-                    if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3862,8 +3885,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
 
 #if IRMP_SUPPORT_IRMP16_PROTOCOL == 1
-                    if (irmp_pulse_time >= IRMP16_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= IRMP16_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= IRMP16_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= IRMP16_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= IRMP16_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= IRMP16_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= IRMP16_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= IRMP16_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = IRMP16, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3876,8 +3899,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_IRMP16_PROTOCOL == 1
 
 #if IRMP_SUPPORT_GREE_PROTOCOL == 1
-                    if (irmp_pulse_time >= GREE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= GREE_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= GREE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= GREE_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= GREE_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= GREE_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= GREE_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= GREE_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = GREE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3890,8 +3913,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_GREE_PROTOCOL == 1
 
 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
-                    if (irmp_pulse_time >= A1TVBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= A1TVBOX_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= A1TVBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= A1TVBOX_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= A1TVBOX_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= A1TVBOX_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= A1TVBOX_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= A1TVBOX_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's A1TVBOX
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3906,8 +3929,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
 
 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
-                    if (irmp_pulse_time >= ORTEK_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ORTEK_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= ORTEK_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ORTEK_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= ORTEK_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= ORTEK_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= ORTEK_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= ORTEK_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's ORTEK (Hama)
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3923,8 +3946,8 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
 
 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
-                    if (irmp_pulse_time >= RCMM32_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCMM32_START_BIT_PULSE_LEN_MAX &&
-                        irmp_pause_time >= RCMM32_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_START_BIT_PAUSE_LEN_MAX)
+                    if (ir->isr.pulse_time >= RCMM32_START_BIT_PULSE_LEN_MIN && ir->isr.pulse_time <= RCMM32_START_BIT_PULSE_LEN_MAX &&
+                        ir->isr.pause_time >= RCMM32_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= RCMM32_START_BIT_PAUSE_LEN_MAX)
                     {                                                           // it's RCMM
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
@@ -3939,32 +3962,32 @@ irmp_ISR (void)
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = UNKNOWN\n");
 #endif // ANALYZE
-                        irmp_start_bit_detected = 0;                            // wait for another start bit...
+                        ir->isr.start_bit_detected = 0;                            // wait for another start bit...
                     }
 
-                    if (irmp_start_bit_detected)
+                    if (ir->isr.start_bit_detected)
                     {
-                        memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));
+                        memcpy_P (&irmp.param, irmp_param_p, sizeof (IRMP_PARAMETER));
 
-                        if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
+                        if (! (ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
                         {
 #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);
+                            ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", ir->param.pulse_1_len_min, ir->param.pulse_1_len_max);
+                            ANALYZE_PRINTF ("pause_1: %3d - %3d\n", ir->param.pause_1_len_min, ir->param.pause_1_len_max);
 #endif // ANALYZE
                         }
                         else
                         {
 #ifdef ANALYZE
-                            ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,
-                                            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);
+                            ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", ir->param.pulse_1_len_min, ir->param.pulse_1_len_max,
+                                            2 * ir->param.pulse_1_len_min, 2 * ir->param.pulse_1_len_max);
+                            ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", ir->param.pause_1_len_min, ir->param.pause_1_len_max,
+                                            2 * ir->param.pause_1_len_min, 2 * ir->param.pause_1_len_max);
 #endif // ANALYZE
                         }
 
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
-                        if (irmp_param2.protocol)
+                        if (ir->param2.protocol)
                         {
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);
@@ -3977,7 +4000,7 @@ irmp_ISR (void)
 
 
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_RC6_PROTOCOL)
+                        if (ir->param.protocol == IRMP_RC6_PROTOCOL)
                         {
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);
@@ -3985,71 +4008,71 @@ irmp_ISR (void)
                         }
 #endif
 
-                        if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
+                        if (! (ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
                         {
 #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);
+                            ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", ir->param.pulse_0_len_min, ir->param.pulse_0_len_max);
+                            ANALYZE_PRINTF ("pause_0: %3d - %3d\n", ir->param.pause_0_len_min, ir->param.pause_0_len_max);
 #endif // ANALYZE
                         }
                         else
                         {
 #ifdef ANALYZE
-                            ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max,
-                                            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);
+                            ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", ir->param.pulse_0_len_min, ir->param.pulse_0_len_max,
+                                            2 * ir->param.pulse_0_len_min, 2 * ir->param.pulse_0_len_max);
+                            ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", ir->param.pause_0_len_min, ir->param.pause_0_len_max,
+                                            2 * ir->param.pause_0_len_min, 2 * ir->param.pause_0_len_max);
 #endif // ANALYZE
                         }
 
 #ifdef ANALYZE
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
+                        if (ir->param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
                         {
-                            ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);
+                            ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", ir->param.pulse_0_len_min, ir->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
 
-                        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);
-                        ANALYZE_PRINTF ("stop_bit:       %3d\n", irmp_param.stop_bit);
+                        ANALYZE_PRINTF ("command_offset: %2d\n", ir->param.command_offset);
+                        ANALYZE_PRINTF ("command_len:    %3d\n", ir->param.command_end - ir->param.command_offset);
+                        ANALYZE_PRINTF ("complete_len:   %3d\n", ir->param.complete_len);
+                        ANALYZE_PRINTF ("stop_bit:       %3d\n", ir->param.stop_bit);
 #endif // ANALYZE
                     }
 
-                    irmp_bit = 0;
+                    ir->bit = 0;
 
 #if IRMP_SUPPORT_MANCHESTER == 1
-                    if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
-                         irmp_param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO
-                         irmp_param.protocol != IRMP_RC6_PROTOCOL /*** &&    // Manchester, but not RC6
-                         irmp_param.protocol != IRMP_RCII_PROTOCOL ****/)     // Manchester, but not RCII
+                    if ((ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
+                         ir->param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO
+                         ir->param.protocol != IRMP_RC6_PROTOCOL /*** &&    // Manchester, but not RC6
+                         ir->param.protocol != IRMP_RCII_PROTOCOL ****/)     // Manchester, but not RCII
                     {
-                        if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)
+                        if (ir->isr.pause_time > ir->param.pulse_1_len_max && ir->isr.pause_time <= 2 * ir->param.pulse_1_len_max)
                         {
 #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);
-                            ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
+                            ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
+                            ANALYZE_PUTCHAR ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
                             ANALYZE_NEWLINE ();
 #endif // ANALYZE
-                            irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);
+                            irmp_store_bit ((ir->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)
+                        else if (! last_value)  // && ir->isr.pause_time >= ir->param.pause_1_len_min && ir->isr.pause_time <= ir->param.pause_1_len_max)
                         {
 #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);
-                            ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
+                            ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
+                            ANALYZE_PUTCHAR ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
                             ANALYZE_NEWLINE ();
 #endif // ANALYZE
-                            irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);
+                            irmp_store_bit ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);
                         }
                     }
                     else
 #endif // IRMP_SUPPORT_MANCHESTER == 1
 
 #if IRMP_SUPPORT_SERIAL == 1
-                    if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
+                    if (ir->param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
                     {
                         ; // do nothing
                     }
@@ -4058,13 +4081,13 @@ irmp_ISR (void)
 
 
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_DENON_PROTOCOL)
+                    if (ir->param.protocol == IRMP_DENON_PROTOCOL)
                     {
 #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);
+                        ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
 #endif // ANALYZE
 
-                        if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)
+                        if (ir->isr.pause_time >= DENON_1_PAUSE_LEN_MIN && ir->isr.pause_time <= DENON_1_PAUSE_LEN_MAX)
                         {                                                       // pause timings correct for "1"?
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('1');                                  // yes, store 1
@@ -4072,7 +4095,7 @@ irmp_ISR (void)
 #endif // ANALYZE
                             irmp_store_bit (1);
                         }
-                        else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
+                        else // if (ir->isr.pause_time >= DENON_0_PAUSE_LEN_MIN && ir->isr.pause_time <= DENON_0_PAUSE_LEN_MAX)
                         {                                                       // pause timings correct for "0"?
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('0');                                  // yes, store 0
@@ -4084,13 +4107,13 @@ irmp_ISR (void)
                     else
 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL)
+                    if (ir->param.protocol == IRMP_THOMSON_PROTOCOL)
                     {
 #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);
+                        ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
 #endif // ANALYZE
 
-                        if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX)
+                        if (ir->isr.pause_time >= THOMSON_1_PAUSE_LEN_MIN && ir->isr.pause_time <= THOMSON_1_PAUSE_LEN_MAX)
                         {                                                       // pause timings correct for "1"?
 #ifdef ANALYZE
                           ANALYZE_PUTCHAR ('1');                                  // yes, store 1
@@ -4098,7 +4121,7 @@ irmp_ISR (void)
 #endif // ANALYZE
                           irmp_store_bit (1);
                         }
-                        else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
+                        else // if (ir->isr.pause_time >= THOMSON_0_PAUSE_LEN_MIN && ir->isr.pause_time <= THOMSON_0_PAUSE_LEN_MAX)
                         {                                                       // pause timings correct for "0"?
 #ifdef ANALYZE
                           ANALYZE_PUTCHAR ('0');                                  // yes, store 0
@@ -4113,87 +4136,88 @@ irmp_ISR (void)
                         ;                                                       // else do nothing
                     }
 
-                    irmp_pulse_time = 1;                                        // set counter to 1, not 0
-                    irmp_pause_time = 0;
-                    wait_for_start_space = 0;
+                    ir->isr.pulse_time = 1;                                        // set counter to 1, not 0
+                    ir->isr.pause_time = 0;
+                    ir->isr.wait_for_start_space = 0;
                 }
             }
-            else if (wait_for_space)                                            // the data section....
+            else if (ir->isr.wait_for_space)                                            // the data section....
             {                                                                   // counting the time of darkness....
                 uint_fast8_t got_light = FALSE;
 
                 if (irmp_input)                                                 // still dark?
                 {                                                               // yes...
-                    if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1)
+                    if (ir->bit == ir->param.complete_len && ir->param.stop_bit == 1)
                     {
                         if (
 #if IRMP_SUPPORT_MANCHESTER == 1
-                            (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||
+                            (ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||
 #endif
 #if IRMP_SUPPORT_SERIAL == 1
-                            (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||
+                            (ir->param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||
 #endif
-                            (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max))
+                            (ir->isr.pulse_time >= ir->param.pulse_0_len_min
+                             && ir->isr.pulse_time <= ir->param.pulse_0_len_max))
                         {
 #ifdef ANALYZE
-                            if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
+                            if (! (ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
                             {
                                 ANALYZE_PRINTF ("stop bit detected\n");
                             }
 #endif // ANALYZE
-                            irmp_param.stop_bit = 0;
+                            ir->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",
-                                            irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);
+                            ANALYZE_PRINTF ("error: stop bit timing wrong, ir->bit = %d, ir->isr.pulse_time = %d, pulse_0_len_min = %d, pulse_0_len_max = %d\n",
+                                            ir->bit, ir->isr.pulse_time, ir->param.pulse_0_len_min, ir->param.pulse_0_len_max);
 #endif // ANALYZE
-                            irmp_start_bit_detected = 0;                        // wait for another start bit...
-                            irmp_pulse_time         = 0;
-                            irmp_pause_time         = 0;
+                            ir->isr.start_bit_detected = 0;                        // wait for another start bit...
+                            ir->isr.pulse_time         = 0;
+                            ir->isr.pause_time         = 0;
                         }
                     }
                     else
                     {
-                        irmp_pause_time++;                                                          // increment counter
+                        ir->isr.pause_time++;                                                          // increment counter
 
 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL &&                           // Sony has a variable number of bits:
-                            irmp_pause_time > SIRCS_PAUSE_LEN_MAX &&                                // minimum is 12
-                            irmp_bit >= 12 - 1)                                                     // pause too long?
+                        if (ir->param.protocol == IRMP_SIRCS_PROTOCOL &&                           // Sony has a variable number of bits:
+                            ir->isr.pause_time > SIRCS_PAUSE_LEN_MAX &&                                // minimum is 12
+                            ir->bit >= 12 - 1)                                                     // pause too long?
                         {                                                                           // yes, break and close this frame
-                            irmp_param.complete_len = irmp_bit + 1;                                 // set new complete length
+                            ir->param.complete_len = ir->bit + 1;                                 // set new complete length
                             got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)
-                            irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8;       // new: store number of additional bits in upper byte of address!
-                            irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1;      // correct command length
-                            irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1;                              // correct pause length
+                            ir->tmp_address |= (ir->bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8;       // new: store number of additional bits in upper byte of address!
+                            ir->param.command_end = ir->param.command_offset + ir->bit + 1;      // correct command length
+                            ir->isr.pause_time = SIRCS_PAUSE_LEN_MAX - 1;                              // correct pause length
                         }
                         else
 #endif
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_MERLIN_PROTOCOL &&                          // Merlin has a variable number of bits:
-                            irmp_pause_time > MERLIN_START_BIT_PAUSE_LEN_MAX &&                     // minimum is 8
-                            irmp_bit >= 8 - 1)                                                      // pause too long?
+                        if (ir->param.protocol == IRMP_MERLIN_PROTOCOL &&                          // Merlin has a variable number of bits:
+                            ir->isr.pause_time > MERLIN_START_BIT_PAUSE_LEN_MAX &&                     // minimum is 8
+                            ir->bit >= 8 - 1)                                                      // pause too long?
                         {                                                                           // yes, break and close this frame
-                            irmp_param.complete_len = irmp_bit;                                     // set new complete length
+                            ir->param.complete_len = ir->bit;                                     // set new complete length
                             got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)
-                            irmp_pause_time = MERLIN_BIT_PAUSE_LEN_MAX - 1;                         // correct pause length
+                            ir->isr.pause_time = MERLIN_BIT_PAUSE_LEN_MAX - 1;                         // correct pause length
                         }
                         else
 #endif
 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_FAN_PROTOCOL &&                             // FAN has no stop bit.
-                            irmp_bit >= FAN_COMPLETE_DATA_LEN - 1)                                  // last bit in frame
+                        if (ir->param.protocol == IRMP_FAN_PROTOCOL &&                             // FAN has no stop bit.
+                            ir->bit >= FAN_COMPLETE_DATA_LEN - 1)                                  // last bit in frame
                         {                                                                           // yes, break and close this frame
-                            if (irmp_pulse_time <= FAN_0_PULSE_LEN_MAX && irmp_pause_time >= FAN_0_PAUSE_LEN_MIN)
+                            if (ir->isr.pulse_time <= FAN_0_PULSE_LEN_MAX && ir->isr.pause_time >= FAN_0_PAUSE_LEN_MIN)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Generating virtual stop bit\n");
 #endif // ANALYZE
                                 got_light = TRUE;                                                   // this is a lie, but helps (generates stop bit)
                             }
-                            else if (irmp_pulse_time >= FAN_1_PULSE_LEN_MIN && irmp_pause_time >= FAN_1_PAUSE_LEN_MIN)
+                            else if (ir->isr.pulse_time >= FAN_1_PULSE_LEN_MIN && ir->isr.pause_time >= FAN_1_PAUSE_LEN_MIN)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Generating virtual stop bit\n");
@@ -4205,103 +4229,103 @@ irmp_ISR (void)
 #endif
 #if IRMP_SUPPORT_SERIAL == 1
                         // NETBOX generates no stop bit, here is the timeout condition:
-                        if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL &&
-                            irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit))
+                        if ((ir->param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && ir->param.protocol == IRMP_NETBOX_PROTOCOL &&
+                            ir->isr.pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - ir->bit))
                         {
                             got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)
                         }
                         else
 #endif
 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)
+                        if (ir->param.protocol == IRMP_GRUNDIG_PROTOCOL && !ir->param.stop_bit)
                         {
-                            if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6))
+                            if (ir->isr.pause_time > IR60_TIMEOUT_LEN && (ir->bit == 5 || ir->bit == 6))
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
 #endif // ANALYZE
                                 got_light = TRUE;                                       // this is a lie, but generates a stop bit ;-)
-                                irmp_param.stop_bit = TRUE;                             // set flag
+                                ir->param.stop_bit = TRUE;                             // set flag
 
-                                irmp_param.protocol         = IRMP_IR60_PROTOCOL;       // change protocol
-                                irmp_param.complete_len     = IR60_COMPLETE_DATA_LEN;   // correct complete len
-                                irmp_param.address_offset   = IR60_ADDRESS_OFFSET;
-                                irmp_param.address_end      = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;
-                                irmp_param.command_offset   = IR60_COMMAND_OFFSET;
-                                irmp_param.command_end      = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;
+                                ir->param.protocol         = IRMP_IR60_PROTOCOL;       // change protocol
+                                ir->param.complete_len     = IR60_COMPLETE_DATA_LEN;   // correct complete len
+                                ir->param.address_offset   = IR60_ADDRESS_OFFSET;
+                                ir->param.address_end      = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;
+                                ir->param.command_offset   = IR60_COMMAND_OFFSET;
+                                ir->param.command_end      = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;
 
-                                irmp_tmp_command <<= 1;
-                                irmp_tmp_command |= first_bit;
+                                ir->tmp_command <<= 1;
+                                ir->tmp_command |= first_bit;
                             }
-                            else if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)
+                            else if (ir->isr.pause_time >= 2 * ir->param.pause_1_len_max && ir->bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)
                             {                                                           // special manchester decoder
-                                irmp_param.complete_len = GRUNDIG_COMPLETE_DATA_LEN;    // correct complete len
+                                ir->param.complete_len = GRUNDIG_COMPLETE_DATA_LEN;    // correct complete len
                                 got_light = TRUE;                                       // this is a lie, but generates a stop bit ;-)
-                                irmp_param.stop_bit = TRUE;                             // set flag
+                                ir->param.stop_bit = TRUE;                             // set flag
                             }
-                            else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)
+                            else if (ir->bit >= GRUNDIG_COMPLETE_DATA_LEN)
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit);
+                                ANALYZE_PRINTF ("Switching to NOKIA protocol, ir->bit = %d\n", ir->bit);
 #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;
-                                irmp_param.command_offset   = NOKIA_COMMAND_OFFSET;
-                                irmp_param.command_end      = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;
+                                ir->param.protocol         = IRMP_NOKIA_PROTOCOL;      // change protocol
+                                ir->param.address_offset   = NOKIA_ADDRESS_OFFSET;
+                                ir->param.address_end      = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;
+                                ir->param.command_offset   = NOKIA_COMMAND_OFFSET;
+                                ir->param.command_end      = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;
 
-                                if (irmp_tmp_command & 0x300)
+                                if (ir->tmp_command & 0x300)
                                 {
-                                    irmp_tmp_address = (irmp_tmp_command >> 8);
-                                    irmp_tmp_command &= 0xFF;
+                                    ir->tmp_address = (ir->tmp_command >> 8);
+                                    ir->tmp_command &= 0xFF;
                                 }
                             }
                         }
                         else
 #endif
 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_RUWIDO_PROTOCOL && !irmp_param.stop_bit)
+                        if (ir->param.protocol == IRMP_RUWIDO_PROTOCOL && !ir->param.stop_bit)
                         {
-                            if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= RUWIDO_COMPLETE_DATA_LEN - 2)
+                            if (ir->isr.pause_time >= 2 * ir->param.pause_1_len_max && ir->bit >= RUWIDO_COMPLETE_DATA_LEN - 2)
                             {                                                           // special manchester decoder
-                                irmp_param.complete_len = RUWIDO_COMPLETE_DATA_LEN;     // correct complete len
+                                ir->param.complete_len = RUWIDO_COMPLETE_DATA_LEN;     // correct complete len
                                 got_light = TRUE;                                       // this is a lie, but generates a stop bit ;-)
-                                irmp_param.stop_bit = TRUE;                             // set flag
+                                ir->param.stop_bit = TRUE;                             // set flag
                             }
-                            else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)
+                            else if (ir->bit >= RUWIDO_COMPLETE_DATA_LEN)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
 #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;
-                                irmp_param.command_offset   = SIEMENS_COMMAND_OFFSET;
-                                irmp_param.command_end      = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;
+                                ir->param.protocol         = IRMP_SIEMENS_PROTOCOL;    // change protocol
+                                ir->param.address_offset   = SIEMENS_ADDRESS_OFFSET;
+                                ir->param.address_end      = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;
+                                ir->param.command_offset   = SIEMENS_COMMAND_OFFSET;
+                                ir->param.command_end      = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;
 
                                 //                   76543210
                                 // RUWIDO:  AAAAAAAAACCCCCCCp
                                 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
-                                irmp_tmp_address <<= 2;
-                                irmp_tmp_address |= (irmp_tmp_command >> 6);
-                                irmp_tmp_command &= 0x003F;
-//                              irmp_tmp_command <<= 4;
-                                irmp_tmp_command |= last_value;
+                                ir->tmp_address <<= 2;
+                                ir->tmp_address |= (ir->tmp_command >> 6);
+                                ir->tmp_command &= 0x003F;
+//                              ir->tmp_command <<= 4;
+                                ir->tmp_command |= last_value;
                             }
                         }
                         else
 #endif
 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_ROOMBA_PROTOCOL &&                          // Roomba has no stop bit
-                            irmp_bit >= ROOMBA_COMPLETE_DATA_LEN - 1)                               // it's the last data bit...
+                        if (ir->param.protocol == IRMP_ROOMBA_PROTOCOL &&                          // Roomba has no stop bit
+                            ir->bit >= ROOMBA_COMPLETE_DATA_LEN - 1)                               // it's the last data bit...
                         {                                                                           // break and close this frame
-                            if (irmp_pulse_time >= ROOMBA_1_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_1_PULSE_LEN_MAX)
+                            if (ir->isr.pulse_time >= ROOMBA_1_PULSE_LEN_MIN && ir->isr.pulse_time <= ROOMBA_1_PULSE_LEN_MAX)
                             {
-                                irmp_pause_time = ROOMBA_1_PAUSE_LEN_EXACT;
+                                ir->isr.pause_time = ROOMBA_1_PAUSE_LEN_EXACT;
                             }
-                            else if (irmp_pulse_time >= ROOMBA_0_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_0_PULSE_LEN_MAX)
+                            else if (ir->isr.pulse_time >= ROOMBA_0_PULSE_LEN_MIN && ir->isr.pulse_time <= ROOMBA_0_PULSE_LEN_MAX)
                             {
-                                irmp_pause_time = ROOMBA_0_PAUSE_LEN;
+                                ir->isr.pause_time = ROOMBA_0_PAUSE_LEN;
                             }
 
                             got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)
@@ -4309,190 +4333,193 @@ irmp_ISR (void)
                         else
 #endif
 #if IRMP_SUPPORT_MANCHESTER == 1
-                        if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
-                            irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)
+                        if ((ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
+                            ir->isr.pause_time >= 2 * ir->param.pause_1_len_max && ir->bit >= ir->param.complete_len - 2 && !ir->param.stop_bit)
                         {                                                       // special manchester decoder
                             got_light = TRUE;                                   // this is a lie, but generates a stop bit ;-)
-                            irmp_param.stop_bit = TRUE;                         // set flag
+                            ir->param.stop_bit = TRUE;                         // set flag
                         }
                         else
 #endif // IRMP_SUPPORT_MANCHESTER == 1
-                        if (irmp_pause_time > IRMP_TIMEOUT_LEN)                 // timeout?
+                        if (ir->isr.pause_time > IRMP_TIMEOUT_LEN)                 // timeout?
                         {                                                       // yes...
-                            if (irmp_bit == irmp_param.complete_len - 1 && irmp_param.stop_bit == 0)
+                            if (ir->bit == ir->param.complete_len - 1 && ir->param.stop_bit == 0)
                             {
-                                irmp_bit++;
+                                ir->bit++;
                             }
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
-                            else if ((irmp_param.protocol == IRMP_NEC_PROTOCOL || irmp_param.protocol == IRMP_NEC42_PROTOCOL) && irmp_bit == 0)
+                            else if ((ir->param.protocol == IRMP_NEC_PROTOCOL
+                                      || ir->param.protocol == IRMP_NEC42_PROTOCOL)
+                                     && ir->bit == 0)
                             {                                                               // it was a non-standard repetition frame
 #ifdef ANALYZE                                                                              // with 4500us pause instead of 2250us
                                 ANALYZE_PRINTF ("Detected non-standard repetition frame, switching to NEC repetition\n");
 #endif // ANALYZE
-                                if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
+                                if (ir->isr.key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
                                 {
-                                    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
-                                    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;
-                                    key_repetition_len = 0;
+                                    ir->param.stop_bit     = TRUE;                         // set flag
+                                    ir->param.protocol     = IRMP_NEC_PROTOCOL;            // switch protocol
+                                    ir->param.complete_len = ir->bit;                     // patch length: 16 or 17
+                                    ir->tmp_address = last_irmp_address;                   // address is last address
+                                    ir->tmp_command = last_irmp_command;                   // command is last command
+                                    ir->flags |= IRMP_FLAG_REPETITION;
+                                    ir->isr.key_repetition_len = 0;
                                 }
                                 else
                                 {
 #ifdef ANALYZE
-                                    ANALYZE_PRINTF ("ignoring NEC repetition frame: timeout occured, key_repetition_len = %d > %d\n",
-                                                    key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
+                                    ANALYZE_PRINTF ("ignoring NEC repetition frame: timeout occured, ir->isr.key_repetition_len = %d > %d\n",
+                                                    ir->isr.key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
 #endif // ANALYZE
-                                    irmp_ir_detected = FALSE;
+                                    ir->ir_detected = FALSE;
                                 }
                             }
 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                            else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17))      // it was a JVC stop bit
+                            else if (ir->param.protocol == IRMP_NEC_PROTOCOL
+                                     && (ir->bit == 16 || ir->bit == 17))      // it was a JVC stop bit
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);
+                                ANALYZE_PRINTF ("Switching to JVC protocol, ir->bit = %d\n", ir->bit);
 #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
-                                irmp_tmp_command        = (irmp_tmp_address >> 4);                  // set command: upper 12 bits are command bits
-                                irmp_tmp_address        = irmp_tmp_address & 0x000F;                // lower 4 bits are address bits
-                                irmp_start_bit_detected = 1;                                        // tricky: don't wait for another start bit...
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.protocol     = IRMP_JVC_PROTOCOL;                        // switch protocol
+                                ir->param.complete_len = ir->bit;                                 // patch length: 16 or 17
+                                ir->tmp_command        = (ir->tmp_address >> 4);                  // set command: upper 12 bits are command bits
+                                ir->tmp_address        = ir->tmp_address & 0x000F;                // lower 4 bits are address bits
+                                ir->isr.start_bit_detected = 1;                                        // tricky: don't wait for another start bit...
                             }
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
-                            else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 28 || irmp_bit == 29))      // it was a LGAIR stop bit
+                            else if (ir->param.protocol == IRMP_NEC_PROTOCOL && (ir->bit == 28 || ir->bit == 29))      // it was a LGAIR stop bit
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit);
+                                ANALYZE_PRINTF ("Switching to LGAIR protocol, ir->bit = %d\n", ir->bit);
 #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
-                                irmp_tmp_command        = irmp_lgair_command;                       // set command: upper 8 bits are command bits
-                                irmp_tmp_address        = irmp_lgair_address;                       // lower 4 bits are address bits
-                                irmp_start_bit_detected = 1;                                        // tricky: don't wait for another start bit...
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.protocol     = IRMP_LGAIR_PROTOCOL;                      // switch protocol
+                                ir->param.complete_len = ir->bit;                                 // patch length: 16 or 17
+                                ir->tmp_command        = ir->lgair_command;                       // set command: upper 8 bits are command bits
+                                ir->tmp_address        = ir->lgair_address;                       // lower 4 bits are address bits
+                                ir->isr.start_bit_detected = 1;                                        // tricky: don't wait for another start bit...
                             }
 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
 
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
-                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32)      // it was a NEC stop bit
+                            else if (ir->param.protocol == IRMP_NEC42_PROTOCOL && ir->bit == 32)      // it was a NEC stop bit
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to NEC protocol\n");
 #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
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.protocol     = IRMP_NEC_PROTOCOL;                        // switch protocol
+                                ir->param.complete_len = ir->bit;                                 // patch length: 16 or 17
 
                                 //        0123456789ABC0123456789ABC0123456701234567
                                 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
                                 // NEC:   AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
-                                irmp_tmp_address        |= (irmp_tmp_address2 & 0x0007) << 13;      // fm 2012-02-13: 12 -> 13
-                                irmp_tmp_command        = (irmp_tmp_address2 >> 3) | (irmp_tmp_command << 10);
+                                ir->tmp_address        |= (ir->tmp_address2 & 0x0007) << 13;      // fm 2012-02-13: 12 -> 13
+                                ir->tmp_command        = (ir->tmp_address2 >> 3) | (ir->tmp_command << 10);
                             }
 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
-                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 28)      // it was a NEC stop bit
+                            else if (ir->param.protocol == IRMP_NEC42_PROTOCOL && ir->bit == 28)      // it was a NEC stop bit
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
 #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
-                                irmp_tmp_address        = irmp_lgair_address;
-                                irmp_tmp_command        = irmp_lgair_command;
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.protocol     = IRMP_LGAIR_PROTOCOL;                      // switch protocol
+                                ir->param.complete_len = ir->bit;                                 // patch length: 16 or 17
+                                ir->tmp_address        = ir->lgair_address;
+                                ir->tmp_command        = ir->lgair_command;
                             }
 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17))  // it was a JVC stop bit
+                            else if (ir->param.protocol == IRMP_NEC42_PROTOCOL && (ir->bit == 16 || ir->bit == 17))  // it was a JVC stop bit
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);
+                                ANALYZE_PRINTF ("Switching to JVC protocol, ir->bit = %d\n", ir->bit);
 #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
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.protocol     = IRMP_JVC_PROTOCOL;                        // switch protocol
+                                ir->param.complete_len = ir->bit;                                 // patch length: 16 or 17
 
                                 //        0123456789ABC0123456789ABC0123456701234567
                                 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
                                 // JVC:   AAAACCCCCCCCCCCC
-                                irmp_tmp_command        = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9);   // set command: upper 12 bits are command bits
-                                irmp_tmp_address        = irmp_tmp_address & 0x000F;                            // lower 4 bits are address bits
+                                ir->tmp_command        = (ir->tmp_address >> 4) | (ir->tmp_address2 << 9);   // set command: upper 12 bits are command bits
+                                ir->tmp_address        = ir->tmp_address & 0x000F;                            // lower 4 bits are address bits
                             }
 #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
+                            else if (ir->param.protocol == IRMP_SAMSUNG48_PROTOCOL && ir->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;
+                                ir->param.protocol         = IRMP_SAMSUNG32_PROTOCOL;
+                                ir->param.command_offset   = SAMSUNG32_COMMAND_OFFSET;
+                                ir->param.command_end      = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;
+                                ir->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
+                            else if (ir->param.protocol == IRMP_RCMM32_PROTOCOL && (ir->bit == 12 || ir->bit == 24))  // it was a RCMM stop bit
                             {
-                                if (irmp_bit == 12)
+                                if (ir->bit == 12)
                                 {
-                                    irmp_tmp_command = (irmp_tmp_address & 0xFF);                   // set command: lower 8 bits are command bits
-                                    irmp_tmp_address >>= 8;                                         // upper 4 bits are address bits
+                                    ir->tmp_command = (ir->tmp_address & 0xFF);                   // set command: lower 8 bits are command bits
+                                    ir->tmp_address >>= 8;                                         // upper 4 bits are address bits
 
 #ifdef ANALYZE
-                                    ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit);
+                                    ANALYZE_PRINTF ("Switching to RCMM12 protocol, ir->bit = %d\n", ir->bit);
 #endif // ANALYZE
-                                    irmp_param.protocol     = IRMP_RCMM12_PROTOCOL;                 // switch protocol
+                                    ir->param.protocol     = IRMP_RCMM12_PROTOCOL;                 // switch protocol
                                 }
-                                else // if ((irmp_bit == 24)
+                                else // if ((ir->bit == 24)
                                 {
 #ifdef ANALYZE
-                                    ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit);
+                                    ANALYZE_PRINTF ("Switching to RCMM24 protocol, ir->bit = %d\n", ir->bit);
 #endif // ANALYZE
-                                    irmp_param.protocol     = IRMP_RCMM24_PROTOCOL;                 // switch protocol
+                                    ir->param.protocol     = IRMP_RCMM24_PROTOCOL;                 // switch protocol
                                 }
-                                irmp_param.stop_bit     = TRUE;                                     // set flag
-                                irmp_param.complete_len = irmp_bit;                                 // patch length
+                                ir->param.stop_bit     = TRUE;                                     // set flag
+                                ir->param.complete_len = ir->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
+                            else if (ir->param.protocol == IRMP_MATSUSHITA_PROTOCOL && ir->bit == 22)  // it was a TECHNICS stop bit
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Switching to TECHNICS protocol, irmp_bit = %d\n", irmp_bit);
+                                ANALYZE_PRINTF ("Switching to TECHNICS protocol, ir->bit = %d\n", ir->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 first 12 bits have been stored in ir->tmp_command (LSB first)
+                                // The following 10 bits have been stored in ir->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))
+                                ir->tmp_address <<= 1;
+                                if (ir->tmp_command & (1<<11))
                                 {
-                                    irmp_tmp_address |= 1;
-                                    irmp_tmp_command &= ~(1<<11);
+                                    ir->tmp_address |= 1;
+                                    ir->tmp_command &= ~(1<<11);
                                 }
 
-                                if (irmp_tmp_command == ((~irmp_tmp_address) & 0x07FF))
+                                if (ir->tmp_command == ((~ir->tmp_address) & 0x07FF))
                                 {
-                                    irmp_tmp_address = 0;
+                                    ir->tmp_address = 0;
 
-                                    irmp_param.protocol     = IRMP_TECHNICS_PROTOCOL;                   // switch protocol
-                                    irmp_param.complete_len = irmp_bit;                                 // patch length
+                                    ir->param.protocol     = IRMP_TECHNICS_PROTOCOL;                   // switch protocol
+                                    ir->param.complete_len = ir->bit;                                 // patch length
                                 }
                                 else
                                 {
@@ -4500,21 +4527,21 @@ irmp_ISR (void)
                                     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;
+                                    ir->isr.start_bit_detected = 0;                    // wait for another start bit...
+                                    ir->isr.pulse_time         = 0;
+                                    ir->isr.pause_time         = 0;
                                 }
                             }
 #endif // IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
                             else
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);
+                                ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", ir->isr.pause_time, ir->bit);
                                 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;
+                                ir->isr.start_bit_detected = 0;                    // wait for another start bit...
+                                ir->isr.pulse_time         = 0;
+                                ir->isr.pause_time         = 0;
                             }
                         }
                     }
@@ -4527,37 +4554,37 @@ irmp_ISR (void)
                 if (got_light)
                 {
 #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);
+                    ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
 #endif // ANALYZE
 
 #if IRMP_SUPPORT_MANCHESTER == 1
-                    if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))                                     // Manchester
+                    if ((ir->param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))                                     // Manchester
                     {
 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
-                        if (irmp_param.complete_len == irmp_bit && irmp_param.protocol == IRMP_MERLIN_PROTOCOL)
+                        if (ir->param.complete_len == ir->bit && ir->param.protocol == IRMP_MERLIN_PROTOCOL)
                         {
                             if (last_value == 0)
                             {
-                                if (irmp_pulse_time >= 2 * irmp_param.pulse_1_len_min && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max &&
-                                    last_pause >= irmp_param.pause_1_len_min && last_pause <= irmp_param.pulse_1_len_max)
+                                if (ir->isr.pulse_time >= 2 * ir->param.pulse_1_len_min && ir->isr.pulse_time <= 2 * ir->param.pulse_1_len_max &&
+                                    last_pause >= ir->param.pause_1_len_min && last_pause <= ir->param.pulse_1_len_max)
                                 {
-                                    irmp_param.complete_len += 2;
+                                    ir->param.complete_len += 2;
                                     irmp_store_bit(0);
                                     irmp_store_bit(1);
                                 }
                             }
                             else
                             {
-                                if (last_pause >= 2 * irmp_param.pause_1_len_min && last_pause <= 2 * irmp_param.pulse_1_len_max)
+                                if (last_pause >= 2 * ir->param.pause_1_len_min && last_pause <= 2 * ir->param.pulse_1_len_max)
                                 {
-                                    if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max)
+                                    if (ir->isr.pulse_time >= ir->param.pulse_1_len_min && ir->isr.pulse_time <= ir->param.pulse_1_len_max)
                                     {
-                                        irmp_param.complete_len++;
+                                        ir->param.complete_len++;
                                         irmp_store_bit(0);
                                     }
-                                    else if (irmp_pulse_time >= 2 * irmp_param.pulse_1_len_min && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max)
+                                    else if (ir->isr.pulse_time >= 2 * ir->param.pulse_1_len_min && ir->isr.pulse_time <= 2 * ir->param.pulse_1_len_max)
                                     {
-                                        irmp_param.complete_len += 2;
+                                        ir->param.complete_len += 2;
                                         irmp_store_bit(0);
                                         irmp_store_bit(1);
                                     }
@@ -4567,19 +4594,19 @@ irmp_ISR (void)
                         else
 #endif
 #if 1
-                        if (irmp_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
+                        if (ir->isr.pulse_time > ir->param.pulse_1_len_max /* && ir->isr.pulse_time <= 2 * ir->param.pulse_1_len_max */)
 #else // better, but some IR-RCs use asymmetric timings :-/
-                        if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max &&
-                            irmp_pause_time <= 2 * irmp_param.pause_1_len_max)
+                        if (ir->isr.pulse_time > ir->param.pulse_1_len_max && ir->isr.pulse_time <= 2 * ir->param.pulse_1_len_max &&
+                            ir->isr.pause_time <= 2 * ir->param.pause_1_len_max)
 #endif
                         {
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
-                            if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)         // RC6 toggle bit
+                            if (ir->param.protocol == IRMP_RC6_PROTOCOL && ir->bit == 4 && ir->isr.pulse_time > RC6_TOGGLE_BIT_LEN_MIN)         // RC6 toggle bit
                             {
 #ifdef ANALYZE
                                 ANALYZE_PUTCHAR ('T');
 #endif // ANALYZE
-                                if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)                      // RC6 mode 6A
+                                if (ir->param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)                      // RC6 mode 6A
                                 {
                                     irmp_store_bit (1);
                                     last_value = 1;
@@ -4597,19 +4624,19 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
                             {
 #ifdef ANALYZE
-                                ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
+                                ANALYZE_PUTCHAR ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
 #endif // ANALYZE
-                                irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0  :  1 );
+                                irmp_store_bit ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0  :  1 );
 
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
-                                if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)      // RC6 toggle bit
+                                if (ir->param.protocol == IRMP_RC6_PROTOCOL && ir->bit == 4 && ir->isr.pulse_time > RC6_TOGGLE_BIT_LEN_MIN)      // RC6 toggle bit
                                 {
 #ifdef ANALYZE
                                     ANALYZE_PUTCHAR ('T');
 #endif // ANALYZE
                                     irmp_store_bit (1);
 
-                                    if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)
+                                    if (ir->isr.pause_time > 2 * ir->param.pause_1_len_max)
                                     {
                                         last_value = 0;
                                     }
@@ -4625,9 +4652,9 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
                                 {
 #ifdef ANALYZE
-                                    ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
+                                    ANALYZE_PUTCHAR ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
 #endif // ANALYZE
-                                    irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 :   0 );
+                                    irmp_store_bit ((ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 :   0 );
 
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCII_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
                                     if (! irmp_param2.protocol)
@@ -4637,16 +4664,16 @@ irmp_ISR (void)
                                         ANALYZE_NEWLINE ();
 #endif // ANALYZE
                                     }
-                                    last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;
+                                    last_value = (ir->param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;
                                 }
                             }
                         }
-                        else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max
-                                 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
+                        else if (ir->isr.pulse_time >= ir->param.pulse_1_len_min && ir->isr.pulse_time <= ir->param.pulse_1_len_max
+                                 /* && ir->isr.pause_time <= 2 * ir->param.pause_1_len_max */)
                         {
                             uint_fast8_t manchester_value;
 
-                            if (last_pause > irmp_param.pause_1_len_max && last_pause <= 2 * irmp_param.pause_1_len_max)
+                            if (last_pause > ir->param.pause_1_len_max && last_pause <= 2 * ir->param.pause_1_len_max)
                             {
                                 manchester_value = last_value ? 0 : 1;
                                 last_value  = manchester_value;
@@ -4661,7 +4688,7 @@ irmp_ISR (void)
 #endif // ANALYZE
 
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
-                            if (! irmp_param2.protocol)
+                            if (! ir->param2.protocol)
 #endif
                             {
 #ifdef ANALYZE
@@ -4670,17 +4697,17 @@ irmp_ISR (void)
                             }
 
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
-                            if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1)     // RC6 mode != 0 ???
+                            if (ir->param.protocol == IRMP_RC6_PROTOCOL && ir->bit == 1 && manchester_value == 1)     // RC6 mode != 0 ???
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
 #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;
-                                irmp_param.command_offset = irmp_param.address_end + 1;                                 // skip 1 system bit, changes like a toggle bit
-                                irmp_param.command_end = irmp_param.command_offset + 16 - 1;
-                                irmp_tmp_address = 0;
+                                ir->param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;
+                                ir->param.address_offset = 5;
+                                ir->param.address_end = ir->param.address_offset + 15;
+                                ir->param.command_offset = ir->param.address_end + 1;                                 // skip 1 system bit, changes like a toggle bit
+                                ir->param.command_end = ir->param.command_offset + 16 - 1;
+                                ir->tmp_address = 0;
                             }
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
 
@@ -4689,28 +4716,28 @@ irmp_ISR (void)
                         else
                         {
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
-                            if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&
-                                irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&
-                                ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||
-                                 (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))
+                            if (ir->param2.protocol == IRMP_FDC_PROTOCOL &&
+                                ir->isr.pulse_time >= FDC_PULSE_LEN_MIN && ir->isr.pulse_time <= FDC_PULSE_LEN_MAX &&
+                                ((ir->isr.pause_time >= FDC_1_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_1_PAUSE_LEN_MAX) ||
+                                 (ir->isr.pause_time >= FDC_0_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_0_PAUSE_LEN_MAX)))
                             {
 #ifdef ANALYZE
                                 ANALYZE_PUTCHAR ('?');
 #endif // ANALYZE
-                                irmp_param.protocol = 0;                // switch to FDC, see below
+                                ir->param.protocol = 0;                // switch to FDC, see below
                             }
                             else
 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
-                            if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&
-                                irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&
-                                ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||
-                                 (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))
+                            if (ir->param2.protocol == IRMP_RCCAR_PROTOCOL &&
+                                ir->isr.pulse_time >= RCCAR_PULSE_LEN_MIN && ir->isr.pulse_time <= RCCAR_PULSE_LEN_MAX &&
+                                ((ir->isr.pause_time >= RCCAR_1_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||
+                                 (ir->isr.pause_time >= RCCAR_0_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_0_PAUSE_LEN_MAX)))
                             {
 #ifdef ANALYZE
                                 ANALYZE_PUTCHAR ('?');
 #endif // ANALYZE
-                                irmp_param.protocol = 0;                // switch to RCCAR, see below
+                                ir->param.protocol = 0;                // switch to RCCAR, see below
                             }
                             else
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
@@ -4718,25 +4745,25 @@ irmp_ISR (void)
 #ifdef ANALYZE
                                 ANALYZE_PUTCHAR ('?');
                                 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_PRINTF ("error 3 manchester: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                                 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                                irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit
-                                irmp_pause_time         = 0;
+                                ir->isr.start_bit_detected = 0;                            // reset flags and wait for next start bit
+                                ir->isr.pause_time         = 0;
                             }
                         }
 
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
-                        if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)
+                        if (ir->param2.protocol == IRMP_FDC_PROTOCOL && ir->isr.pulse_time >= FDC_PULSE_LEN_MIN && ir->isr.pulse_time <= FDC_PULSE_LEN_MAX)
                         {
-                            if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)
+                            if (ir->isr.pause_time >= FDC_1_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_1_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("   1 (FDC)\n");
 #endif // ANALYZE
                                 irmp_store_bit2 (1);
                             }
-                            else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)
+                            else if (ir->isr.pause_time >= FDC_0_PAUSE_LEN_MIN && ir->isr.pause_time <= FDC_0_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("   0 (FDC)\n");
@@ -4744,29 +4771,29 @@ irmp_ISR (void)
                                 irmp_store_bit2 (0);
                             }
 
-                            if (! irmp_param.protocol)
+                            if (! ir->param.protocol)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to FDC protocol\n");
 #endif // ANALYZE
-                                memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));
-                                irmp_param2.protocol = 0;
-                                irmp_tmp_address = irmp_tmp_address2;
-                                irmp_tmp_command = irmp_tmp_command2;
+                                memcpy (&irmp.param, &irmp.param2, sizeof (IRMP_PARAMETER));
+                                ir->param2.protocol = 0;
+                                ir->tmp_address = ir->tmp_address2;
+                                ir->tmp_command = ir->tmp_command2;
                             }
                         }
 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
-                        if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)
+                        if (ir->param2.protocol == IRMP_RCCAR_PROTOCOL && ir->isr.pulse_time >= RCCAR_PULSE_LEN_MIN && ir->isr.pulse_time <= RCCAR_PULSE_LEN_MAX)
                         {
-                            if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)
+                            if (ir->isr.pause_time >= RCCAR_1_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_1_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("   1 (RCCAR)\n");
 #endif // ANALYZE
                                 irmp_store_bit2 (1);
                             }
-                            else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)
+                            else if (ir->isr.pause_time >= RCCAR_0_PAUSE_LEN_MIN && ir->isr.pause_time <= RCCAR_0_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("   0 (RCCAR)\n");
@@ -4774,108 +4801,108 @@ irmp_ISR (void)
                                 irmp_store_bit2 (0);
                             }
 
-                            if (! irmp_param.protocol)
+                            if (! ir->param.protocol)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
 #endif // ANALYZE
-                                memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));
-                                irmp_param2.protocol = 0;
-                                irmp_tmp_address = irmp_tmp_address2;
-                                irmp_tmp_command = irmp_tmp_command2;
+                                memcpy (&irmp.param, &irmp.param2, sizeof (IRMP_PARAMETER));
+                                ir->param2.protocol = 0;
+                                ir->tmp_address = ir->tmp_address2;
+                                ir->tmp_command = ir->tmp_command2;
                             }
                         }
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
 
-                        last_pause      = irmp_pause_time;
-                        wait_for_space  = 0;
+                        last_pause      = ir->isr.pause_time;
+                        ir->isr.wait_for_space  = 0;
                     }
                     else
 #endif // IRMP_SUPPORT_MANCHESTER == 1
 
 #if IRMP_SUPPORT_SERIAL == 1
-                    if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
+                    if (ir->param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
                     {
-                        while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)
+                        while (ir->bit < ir->param.complete_len && ir->isr.pulse_time > ir->param.pulse_1_len_max)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('1');
 #endif // ANALYZE
                             irmp_store_bit (1);
 
-                            if (irmp_pulse_time >= irmp_param.pulse_1_len_min)
+                            if (ir->isr.pulse_time >= ir->param.pulse_1_len_min)
                             {
-                                irmp_pulse_time -= irmp_param.pulse_1_len_min;
+                                ir->isr.pulse_time -= ir->param.pulse_1_len_min;
                             }
                             else
                             {
-                                irmp_pulse_time = 0;
+                                ir->isr.pulse_time = 0;
                             }
                         }
 
-                        while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)
+                        while (ir->bit < ir->param.complete_len && ir->isr.pause_time > ir->param.pause_1_len_max)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('0');
 #endif // ANALYZE
                             irmp_store_bit (0);
 
-                            if (irmp_pause_time >= irmp_param.pause_1_len_min)
+                            if (ir->isr.pause_time >= ir->param.pause_1_len_min)
                             {
-                                irmp_pause_time -= irmp_param.pause_1_len_min;
+                                ir->isr.pause_time -= ir->param.pause_1_len_min;
                             }
                             else
                             {
-                                irmp_pause_time = 0;
+                                ir->isr.pause_time = 0;
                             }
                         }
 #ifdef ANALYZE
                         ANALYZE_NEWLINE ();
 #endif // ANALYZE
-                        wait_for_space = 0;
+                        ir->isr.wait_for_space = 0;
                     }
                     else
 #endif // IRMP_SUPPORT_SERIAL == 1
 
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit == 16)       // Samsung: 16th bit
+                    if (ir->param.protocol == IRMP_SAMSUNG_PROTOCOL && ir->bit == 16)       // Samsung: 16th bit
                     {
-                        if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&
-                            irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
+                        if (ir->isr.pulse_time >= SAMSUNG_PULSE_LEN_MIN && ir->isr.pulse_time <= SAMSUNG_PULSE_LEN_MAX &&
+                            ir->isr.pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PRINTF ("SYNC\n");
 #endif // ANALYZE
-                            wait_for_space = 0;
-                            irmp_bit++;
+                            ir->isr.wait_for_space = 0;
+                            ir->bit++;
                         }
-                        else  if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)
+                        else  if (ir->isr.pulse_time >= SAMSUNG_PULSE_LEN_MIN && ir->isr.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;
+                            ir->param.protocol         = IRMP_SAMSUNG48_PROTOCOL;
+                            ir->param.command_offset   = SAMSUNG48_COMMAND_OFFSET;
+                            ir->param.command_end      = SAMSUNG48_COMMAND_OFFSET + SAMSUNG48_COMMAND_LEN;
+                            ir->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;
+                            ir->param.protocol         = IRMP_SAMSUNG32_PROTOCOL;
+                            ir->param.command_offset   = SAMSUNG32_COMMAND_OFFSET;
+                            ir->param.command_end      = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;
+                            ir->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)
+                            if (ir->isr.pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && ir->isr.pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PUTCHAR ('1');
                                 ANALYZE_NEWLINE ();
 #endif // ANALYZE
                                 irmp_store_bit (1);
-                                wait_for_space = 0;
+                                ir->isr.wait_for_space = 0;
                             }
                             else
                             {
@@ -4884,17 +4911,17 @@ irmp_ISR (void)
                                 ANALYZE_NEWLINE ();
 #endif // ANALYZE
                                 irmp_store_bit (0);
-                                wait_for_space = 0;
+                                ir->isr.wait_for_space = 0;
                             }
                         }
                         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_PRINTF ("error 3 Samsung: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                            irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit
-                            irmp_pause_time         = 0;
+                            ir->isr.start_bit_detected = 0;                            // reset flags and wait for next start bit
+                            ir->isr.pause_time         = 0;
                         }
                     }
                     else
@@ -4902,74 +4929,74 @@ irmp_ISR (void)
 
 #if IRMP_SUPPORT_NEC16_PROTOCOL
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_NEC42_PROTOCOL &&
+                    if (ir->param.protocol == IRMP_NEC42_PROTOCOL &&
 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
-                    if (irmp_param.protocol == IRMP_NEC_PROTOCOL &&
+                    if (ir->param.protocol == IRMP_NEC_PROTOCOL &&
 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
-                        irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
+                        ir->bit == 8 && ir->isr.pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
                     {
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
 #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;
-                        irmp_param.command_offset   = NEC16_COMMAND_OFFSET;
-                        irmp_param.command_end      = NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN;
-                        irmp_param.complete_len     = NEC16_COMPLETE_DATA_LEN;
-                        wait_for_space = 0;
+                        ir->param.protocol         = IRMP_NEC16_PROTOCOL;

+                        ir->param.address_offset   = NEC16_ADDRESS_OFFSET;
+                        ir->param.address_end      = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN;
+                        ir->param.command_offset   = NEC16_COMMAND_OFFSET;
+                        ir->param.command_end      = NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN;
+                        ir->param.complete_len     = NEC16_COMPLETE_DATA_LEN;
+                        ir->isr.wait_for_space = 0;
                     }
                     else
 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
 
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
+                    if (ir->param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
                     {
-                        if (irmp_pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)
+                        if (ir->isr.pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && ir->isr.pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)
                         {
-                            if (irmp_bit == 1)                                      // Bang & Olufsen: 3rd bit
+                            if (ir->bit == 1)                                      // Bang & Olufsen: 3rd bit
                             {
-                                if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)
+                                if (ir->isr.pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)
                                 {
 #ifdef ANALYZE
                                     ANALYZE_PRINTF ("3rd start bit\n");
 #endif // ANALYZE
-                                    wait_for_space = 0;
-                                    irmp_bit++;
+                                    ir->isr.wait_for_space = 0;
+                                    ir->bit++;
                                 }
                                 else
                                 {                                                   // timing incorrect!
 #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_PRINTF ("error 3a B&O: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                                    irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit
-                                    irmp_pause_time         = 0;
+                                    ir->isr.start_bit_detected = 0;                    // reset flags and wait for next start bit
+                                    ir->isr.pause_time         = 0;

                                 }
                             }
-                            else if (irmp_bit == 19)                                // Bang & Olufsen: trailer bit
+                            else if (ir->bit == 19)                                // Bang & Olufsen: trailer bit
                             {
-                                if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)
+                                if (ir->isr.pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)
                                 {
 #ifdef ANALYZE
                                     ANALYZE_PRINTF ("trailer bit\n");
 #endif // ANALYZE
-                                    wait_for_space = 0;
-                                    irmp_bit++;
+                                    ir->isr.wait_for_space = 0;
+                                    ir->bit++;
                                 }
                                 else
                                 {                                                   // timing incorrect!
 #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_PRINTF ("error 3b B&O: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                                    irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit
-                                    irmp_pause_time         = 0;
+                                    ir->isr.start_bit_detected = 0;                    // reset flags and wait for next start bit
+                                    ir->isr.pause_time         = 0;
                                 }
                             }
                             else
                             {
-                                if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)
+                                if (ir->isr.pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)
                                 {                                                   // pulse & pause timings correct for "1"?
 #ifdef ANALYZE
                                     ANALYZE_PUTCHAR ('1');
@@ -4977,9 +5004,9 @@ irmp_ISR (void)
 #endif // ANALYZE
                                     irmp_store_bit (1);
                                     last_value = 1;
-                                    wait_for_space = 0;
+                                    ir->isr.wait_for_space = 0;
                                 }
-                                else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)
+                                else if (ir->isr.pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)
                                 {                                                   // pulse & pause timings correct for "0"?
 #ifdef ANALYZE
                                     ANALYZE_PUTCHAR ('0');
@@ -4987,45 +5014,45 @@ irmp_ISR (void)
 #endif // ANALYZE
                                     irmp_store_bit (0);
                                     last_value = 0;
-                                    wait_for_space = 0;
+                                    ir->isr.wait_for_space = 0;
                                 }
-                                else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)
+                                else if (ir->isr.pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && ir->isr.pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)
                                 {
 #ifdef ANALYZE
                                     ANALYZE_PUTCHAR (last_value + '0');
                                     ANALYZE_NEWLINE ();
 #endif // ANALYZE
                                     irmp_store_bit (last_value);
-                                    wait_for_space = 0;
+                                    ir->isr.wait_for_space = 0;
                                 }
                                 else
                                 {                                                   // timing incorrect!
 #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_PRINTF ("error 3c B&O: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                                    irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit
-                                    irmp_pause_time         = 0;
+                                    ir->isr.start_bit_detected = 0;                    // reset flags and wait for next start bit
+                                    ir->isr.pause_time         = 0;
                                 }
                             }
                         }
                         else
                         {                                                           // timing incorrect!
 #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_PRINTF ("error 3d B&O: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                            irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit
-                            irmp_pause_time         = 0;
+                            ir->isr.start_bit_detected = 0;                            // reset flags and wait for next start bit
+                            ir->isr.pause_time         = 0;
                         }
                     }
                     else
 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
 
 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL)
+                    if (ir->param.protocol == IRMP_RCMM32_PROTOCOL)
                     {
-                        if (irmp_pause_time >= RCMM32_BIT_00_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_00_PAUSE_LEN_MAX)
+                        if (ir->isr.pause_time >= RCMM32_BIT_00_PAUSE_LEN_MIN && ir->isr.pause_time <= RCMM32_BIT_00_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('0');
@@ -5034,7 +5061,7 @@ irmp_ISR (void)
                             irmp_store_bit (0);
                             irmp_store_bit (0);
                         }
-                        else if (irmp_pause_time >= RCMM32_BIT_01_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_01_PAUSE_LEN_MAX)
+                        else if (ir->isr.pause_time >= RCMM32_BIT_01_PAUSE_LEN_MIN && ir->isr.pause_time <= RCMM32_BIT_01_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('0');
@@ -5043,7 +5070,7 @@ irmp_ISR (void)
                             irmp_store_bit (0);
                             irmp_store_bit (1);
                         }
-                        else if (irmp_pause_time >= RCMM32_BIT_10_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_10_PAUSE_LEN_MAX)
+                        else if (ir->isr.pause_time >= RCMM32_BIT_10_PAUSE_LEN_MIN && ir->isr.pause_time <= RCMM32_BIT_10_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('1');
@@ -5052,7 +5079,7 @@ irmp_ISR (void)
                             irmp_store_bit (1);
                             irmp_store_bit (0);
                         }
-                        else if (irmp_pause_time >= RCMM32_BIT_11_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_11_PAUSE_LEN_MAX)
+                        else if (ir->isr.pause_time >= RCMM32_BIT_11_PAUSE_LEN_MIN && ir->isr.pause_time <= RCMM32_BIT_11_PAUSE_LEN_MAX)
                         {
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('1');
@@ -5064,50 +5091,54 @@ irmp_ISR (void)
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("\n");
 #endif // ANALYZE
-                        wait_for_space = 0;
+                        ir->isr.wait_for_space = 0;
                     }
                     else
 #endif
 
-                    if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&
-                        irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
+                    if (ir->isr.pulse_time >= ir->param.pulse_1_len_min
+                        && ir->isr.pulse_time <= ir->param.pulse_1_len_max
+                        && ir->isr.pause_time >= ir->param.pause_1_len_min
+                        && ir->isr.pause_time <= ir->param.pause_1_len_max)
                     {                                                               // pulse & pause timings correct for "1"?
 #ifdef ANALYZE
                         ANALYZE_PUTCHAR ('1');
                         ANALYZE_NEWLINE ();
 #endif // ANALYZE
                         irmp_store_bit (1);
-                        wait_for_space = 0;
+                        ir->isr.wait_for_space = 0;
                     }
-                    else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&
-                             irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)
+                    else if (ir->isr.pulse_time >= ir->param.pulse_0_len_min
+                             && ir->isr.pulse_time <= ir->param.pulse_0_len_max
+                             && ir->isr.pause_time >= ir->param.pause_0_len_min
+                             && ir->isr.pause_time <= ir->param.pause_0_len_max)
                     {                                                               // pulse & pause timings correct for "0"?
 #ifdef ANALYZE
                         ANALYZE_PUTCHAR ('0');
                         ANALYZE_NEWLINE ();
 #endif // ANALYZE
                         irmp_store_bit (0);
-                        wait_for_space = 0;
+                        ir->isr.wait_for_space = 0;
                     }
                     else
 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
 
-                    if (irmp_param.protocol == IRMP_KATHREIN_PROTOCOL &&
-                        irmp_pulse_time >= KATHREIN_1_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&
-                        (((irmp_bit == 8 || irmp_bit == 6) &&
-                                irmp_pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||
-                         (irmp_bit == 12 &&
-                                irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))
+                    if (ir->param.protocol == IRMP_KATHREIN_PROTOCOL &&
+                        ir->isr.pulse_time >= KATHREIN_1_PULSE_LEN_MIN && ir->isr.pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&
+                        (((ir->bit == 8 || ir->bit == 6) &&
+                                ir->isr.pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||
+                         (ir->bit == 12 &&
+                                ir->isr.pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && ir->isr.pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))
 
                     {
-                        if (irmp_bit == 8)
+                        if (ir->bit == 8)
                         {
-                            irmp_bit++;
+                            ir->bit++;
 #ifdef ANALYZE
                             ANALYZE_PUTCHAR ('S');
                             ANALYZE_NEWLINE ();
 #endif // ANALYZE
-                            irmp_tmp_command <<= 1;
+                            ir->tmp_command <<= 1;
                         }
                         else
                         {
@@ -5117,41 +5148,41 @@ irmp_ISR (void)
 #endif // ANALYZE
                             irmp_store_bit (1);
                         }
-                        wait_for_space = 0;
+                        ir->isr.wait_for_space = 0;
                     }
                     else
 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
                     {                                                               // timing incorrect!
 #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_PRINTF ("error 3: timing not correct: data bit %d,  pulse: %d, pause: %d\n", ir->bit, ir->isr.pulse_time, ir->isr.pause_time);
                         ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
 #endif // ANALYZE
-                        irmp_start_bit_detected = 0;                                // reset flags and wait for next start bit
-                        irmp_pause_time         = 0;
+                        ir->isr.start_bit_detected = 0;                                // reset flags and wait for next start bit
+                        ir->isr.pause_time         = 0;
                     }
 
-                    irmp_pulse_time = 1;                                            // set counter to 1, not 0
+                    ir->isr.pulse_time = 1;                                            // set counter to 1, not 0
                 }
             }
             else
             {                                                                       // counting the pulse length ...
                 if (! irmp_input)                                                   // still light?
                 {                                                                   // yes...
-                    irmp_pulse_time++;                                              // increment counter
+                    ir->isr.pulse_time++;                                              // increment counter
                 }
                 else
                 {                                                                   // now it's dark!
-                    wait_for_space  = 1;                                            // let's count the time (see above)
-                    irmp_pause_time = 1;                                            // set pause counter to 1, not 0
+                    ir->isr.wait_for_space  = 1;                                            // let's count the time (see above)
+                    ir->isr.pause_time = 1;                                            // set pause counter to 1, not 0
 
 #if IRMP_SUPPORT_RCII_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_RCII_PROTOCOL && waiting_for_2nd_pulse)
+                    if (ir->param.protocol == IRMP_RCII_PROTOCOL && waiting_for_2nd_pulse)
                     {
-printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN * 1000000 / F_INTERRUPTS); // fm: Ausgabe ist "1000 466" oder "1533 466"
+printf ("fm: %d %d\n", ir->isr.pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN * 1000000 / F_INTERRUPTS); // fm: Ausgabe ist "1000 466" oder "1533 466"
 #if 0
-                        if (irmp_pulse_time >= RCII_BIT_LEN)
+                        if (ir->isr.pulse_time >= RCII_BIT_LEN)
                         {
-                            irmp_pulse_time -= RCII_BIT_LEN;
+                            ir->isr.pulse_time -= RCII_BIT_LEN;
                             last_value = 0;
                         }
                         else
@@ -5159,12 +5190,12 @@ printf ("fm: %d %d\n", irmp_pulse_time *
                             last_value = 1;
                         }
 #else // fm: das reicht für RCII
-                            irmp_pulse_time -= RCII_BIT_LEN;
+                            ir->isr.pulse_time -= RCII_BIT_LEN;
                             last_value = 0;
 #endif
 
 #ifdef ANALYZE
-                        ANALYZE_PRINTF ("RCII: got 2nd pulse, irmp_pulse_time = %d\n", irmp_pulse_time);
+                        ANALYZE_PRINTF ("RCII: got 2nd pulse, ir->isr.pulse_time = %d\n", ir->isr.pulse_time);
 #endif
                         waiting_for_2nd_pulse = 0;
                     }
@@ -5172,123 +5203,123 @@ printf ("fm: %d %d\n", irmp_pulse_time *
                 }
             }
 
-            if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0)    // enough bits received?
+            if (ir->isr.start_bit_detected && ir->bit == ir->param.complete_len && ir->param.stop_bit == 0)    // enough bits received?
             {
-                if (last_irmp_command == irmp_tmp_command && key_repetition_len < AUTO_FRAME_REPETITION_LEN)
+                if (last_irmp_command == ir->tmp_command && ir->isr.key_repetition_len < AUTO_FRAME_REPETITION_LEN)
                 {
-                    repetition_frame_number++;
+                    ir->isr.repetition_frame_number++;
                 }
                 else
                 {
-                    repetition_frame_number = 0;
+                    ir->isr.repetition_frame_number = 0;
                 }
 
 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
                 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
-                if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))
+                if (ir->param.protocol == IRMP_SIRCS_PROTOCOL && (ir->isr.repetition_frame_number == 1 || ir->isr.repetition_frame_number == 2))
                 {
 #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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
                 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
-                if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL && repetition_frame_number == 1)
+                if (ir->param.protocol == IRMP_ORTEK_PROTOCOL && ir->isr.repetition_frame_number == 1)
                 {
 #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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
 #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)
+                if (ir->param.protocol == IRMP_KASEIKYO_PROTOCOL && ir->isr.repetition_frame_number == 1)
                 {
 #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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
 #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))
+                if ((ir->param.protocol == IRMP_SAMSUNG32_PROTOCOL || ir->param.protocol == IRMP_SAMSUNG48_PROTOCOL) && (ir->isr.repetition_frame_number & 0x01))
                 {
 #ifdef ANALYZE
                     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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
                 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
-                if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))
+                if (ir->param.protocol == IRMP_NUBERT_PROTOCOL && (ir->isr.repetition_frame_number & 0x01))
                 {
 #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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
                 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
-                if (irmp_param.protocol == IRMP_SPEAKER_PROTOCOL && (repetition_frame_number & 0x01))
+                if (ir->param.protocol == IRMP_SPEAKER_PROTOCOL && (ir->isr.repetition_frame_number & 0x01))
                 {
 #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);
+                                    ir->isr.repetition_frame_number + 1, ir->isr.key_repetition_len, AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
 #endif
 
                 {
 #ifdef ANALYZE
-                    ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit);
+                    ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, ir->bit);
 #endif // ANALYZE
-                    irmp_ir_detected = TRUE;
+                    ir->ir_detected = TRUE;
 
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_DENON_PROTOCOL)
+                    if (ir->param.protocol == IRMP_DENON_PROTOCOL)
                     {                                                               // check for repetition frame
-                        if ((~irmp_tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted
+                        if ((~ir->tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted
                         {
-                            irmp_tmp_command = last_irmp_denon_command;             // use command received before!
+                            ir->tmp_command = last_irmp_denon_command;             // use command received before!
                             last_irmp_denon_command = 0;
 
-                            irmp_protocol = irmp_param.protocol;                    // store protocol
-                            irmp_address = irmp_tmp_address;                        // store address
-                            irmp_command = irmp_tmp_command;                        // store command
+                            ir->protocol = ir->param.protocol;                    // store protocol
+                            ir->address = ir->tmp_address;                        // store address
+                            ir->command = ir->tmp_command;                        // store command
                         }
                         else
                         {
-                            if ((irmp_tmp_command & 0x01) == 0x00)
+                            if ((ir->tmp_command & 0x01) == 0x00)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);
 #endif // ANALYZE
-                                last_irmp_denon_command = irmp_tmp_command;
+                                last_irmp_denon_command = ir->tmp_command;
                                 denon_repetition_len = 0;
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
                             else
                             {
@@ -5296,7 +5327,7 @@ printf ("fm: %d %d\n", irmp_pulse_time *
                                 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS);
 #endif // ANALYZE
                                 last_irmp_denon_command = 0;
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
                         }
                     }
@@ -5304,54 +5335,54 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #endif // IRMP_SUPPORT_DENON_PROTOCOL
 
 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)
+                    if (ir->param.protocol == IRMP_GRUNDIG_PROTOCOL && ir->tmp_command == 0x01ff)
                     {                                                               // Grundig start frame?
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
 #endif // ANALYZE
-                        irmp_ir_detected = FALSE;
+                        ir->ir_detected = FALSE;
                     }
                     else
 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
 
 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
-                    if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)
+                    if (ir->param.protocol == IRMP_NOKIA_PROTOCOL && ir->tmp_address == 0x00ff && ir->tmp_command == 0x00fe)
                     {                                                               // Nokia start frame?
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
 #endif // ANALYZE
-                        irmp_ir_detected = FALSE;
+                        ir->ir_detected = FALSE;
                     }
                     else
 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
                     {
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0)  // repetition frame
+                        if (ir->param.protocol == IRMP_NEC_PROTOCOL && ir->bit == 0)  // repetition frame
                         {
-                            if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
+                            if (ir->isr.key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len);
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, ir->isr.key_repetition_len = %d\n", ir->isr.key_repetition_len);
                                 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME                ");
 #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;
-                                key_repetition_len = 0;
+                                ir->tmp_address = last_irmp_address;                   // address is last address
+                                ir->tmp_command = last_irmp_command;                   // command is last command
+                                ir->flags |= IRMP_FLAG_REPETITION;
+                                ir->isr.key_repetition_len = 0;
                             }
                             else
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
-                                                key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, ir->isr.key_repetition_len = %d > %d\n",
+                                                ir->isr.key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
                         }
 #endif // IRMP_SUPPORT_NEC_PROTOCOL
 
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)
+                        if (ir->param.protocol == IRMP_KASEIKYO_PROTOCOL)
                         {
                             uint_fast8_t xor_value;
 
@@ -5362,7 +5393,7 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F);
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
 
                             xor_value = xor_check[2] ^ xor_check[3] ^ xor_check[4];
@@ -5372,42 +5403,42 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]);
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
 
-                            irmp_flags |= genre2;       // write the genre2 bits into MSB of the flag byte
+                            ir->flags |= genre2;       // write the genre2 bits into MSB of the flag byte
                         }
 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
 
 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)
+                        if (ir->param.protocol == IRMP_ORTEK_PROTOCOL)
                         {
                             if (parity == PARITY_CHECK_FAILED)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("error 6: parity check failed\n");
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
 
-                            if ((irmp_tmp_address & 0x03) == 0x02)
+                            if ((ir->tmp_address & 0x03) == 0x02)
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->ir_detected = FALSE;
                             }
-                            irmp_tmp_address >>= 2;
+                            ir->tmp_address >>= 2;
                         }
 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
 
 #if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_MITSU_HEAVY_PROTOCOL)
+                        if (ir->param.protocol == IRMP_MITSU_HEAVY_PROTOCOL)
                         {
-                            check = irmp_tmp_command >> 8;                    // inverted upper byte == lower byte?
+                            check = ir->tmp_command >> 8;                    // inverted upper byte == lower byte?
                             check = ~ check;
-                            if (check == (irmp_tmp_command & 0xFF)) {         //ok:
-                              irmp_tmp_command &= 0xFF;
+                            if (check == (ir->tmp_command & 0xFF)) {         //ok:
+                              ir->tmp_command &= 0xFF;
                             }
                             else  mitsu_parity = PARITY_CHECK_FAILED;
                             if (mitsu_parity == PARITY_CHECK_FAILED)
@@ -5415,79 +5446,79 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("error 7: parity check failed\n");
 #endif // ANALYZE
-                                irmp_ir_detected = FALSE;
+                                ir->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?
+                        if (ir->param.protocol == IRMP_RC6_PROTOCOL && ir->param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)     // RC6 mode = 6?
                         {
-                            irmp_protocol = IRMP_RC6A_PROTOCOL;
+                            ir->protocol = IRMP_RC6A_PROTOCOL;
                         }
                         else
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
                         {
-                            irmp_protocol = irmp_param.protocol;
+                            ir->protocol = ir->param.protocol;
                         }
 
 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_FDC_PROTOCOL)
+                        if (ir->param.protocol == IRMP_FDC_PROTOCOL)
                         {
-                            if (irmp_tmp_command & 0x000F)                          // released key?
+                            if (ir->tmp_command & 0x000F)                          // released key?
                             {
-                                irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80;  // yes, set bit 7
+                                ir->tmp_command = (ir->tmp_command >> 4) | 0x80;  // yes, set bit 7
                             }
                             else
                             {
-                                irmp_tmp_command >>= 4;                             // no, it's a pressed key
+                                ir->tmp_command >>= 4;                             // no, it's a pressed key
                             }
-                            irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00;   // 000000CCCCAAAAAA -> 0000CCCC00000000
-                            irmp_tmp_address &= 0x003F;
+                            ir->tmp_command |= (ir->tmp_address << 2) & 0x0F00;   // 000000CCCCAAAAAA -> 0000CCCC00000000
+                            ir->tmp_address &= 0x003F;
                         }
 #endif
 
-                        irmp_address = irmp_tmp_address;                            // store address
+                        ir->address = ir->tmp_address;                            // store address
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_NEC_PROTOCOL)
+                        if (ir->param.protocol == IRMP_NEC_PROTOCOL)
                         {
-                            last_irmp_address = irmp_tmp_address;                   // store as last address, too
+                            last_irmp_address = ir->tmp_address;                   // store as last address, too
                         }
 #endif
 
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_RC5_PROTOCOL)
+                        if (ir->param.protocol == IRMP_RC5_PROTOCOL)
                         {
-                            irmp_tmp_command |= rc5_cmd_bit6;                       // store bit 6
+                            ir->tmp_command |= rc5_cmd_bit6;                       // store bit 6
                         }
 #endif
 #if IRMP_SUPPORT_S100_PROTOCOL == 1
-                        if (irmp_param.protocol == IRMP_S100_PROTOCOL)
+                        if (ir->param.protocol == IRMP_S100_PROTOCOL)
                         {
-                            irmp_tmp_command |= rc5_cmd_bit6;                       // store bit 6
+                            ir->tmp_command |= rc5_cmd_bit6;                       // store bit 6
                         }
 #endif
-                        irmp_command = irmp_tmp_command;                            // store command
+                        ir->command = ir->tmp_command;                            // store command
 
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
-                        irmp_id = irmp_tmp_id;
+                        ir->id = ir->tmp_id;
 #endif
                     }
                 }
 
-                if (irmp_ir_detected)
+                if (ir->ir_detected)
                 {
-                    if (last_irmp_command == irmp_tmp_command &&
-                        last_irmp_address == irmp_tmp_address &&
-                        key_repetition_len < IRMP_KEY_REPETITION_LEN)
+                    if (last_irmp_command == ir->tmp_command &&
+                        last_irmp_address == ir->tmp_address &&
+                        ir->isr.key_repetition_len < IRMP_KEY_REPETITION_LEN)
                     {
-                        irmp_flags |= IRMP_FLAG_REPETITION;
+                        ir->flags |= IRMP_FLAG_REPETITION;
                     }
 
-                    last_irmp_address = irmp_tmp_address;                           // store as last address, too
-                    last_irmp_command = irmp_tmp_command;                           // store as last command, too
+                    last_irmp_address = ir->tmp_address;                           // store as last address, too
+                    last_irmp_command = ir->tmp_command;                           // store as last command, too
 
-                    key_repetition_len = 0;
+                    ir->isr.key_repetition_len = 0;
                 }
                 else
                 {
@@ -5496,15 +5527,15 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #endif // ANALYZE
                 }
 
-                irmp_start_bit_detected = 0;                                        // and wait for next start bit
-                irmp_tmp_command        = 0;
-                irmp_pulse_time         = 0;
-                irmp_pause_time         = 0;
+                ir->isr.start_bit_detected = 0;                                        // and wait for next start bit
+                ir->tmp_command        = 0;
+                ir->isr.pulse_time         = 0;
+                ir->isr.pause_time         = 0;
 
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
-                if (irmp_protocol == IRMP_JVC_PROTOCOL)                             // the stop bit of JVC frame is also start bit of next frame
+                if (ir->protocol == IRMP_JVC_PROTOCOL)                             // the stop bit of JVC frame is also start bit of next frame
                 {                                                                   // set pulse time here!
-                    irmp_pulse_time = ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));
+                    ir->isr.pulse_time = ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));
                 }
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
             }
@@ -5517,14 +5548,14 @@ printf ("fm: %d %d\n", irmp_pulse_time *
 #endif
 
 #if (defined(_CHIBIOS_RT_) || defined(_CHIBIOS_NIL_)) && IRMP_USE_EVENT == 1
-    if (IRMP_EVENT_THREAD_PTR != NULL && irmp_ir_detected)
+    if (IRMP_EVENT_THREAD_PTR != NULL && ir->ir_detected)
         chEvtSignalI(IRMP_EVENT_THREAD_PTR,IRMP_EVENT_BIT);
 #endif
 
 #if IRMP_USE_IDLE_CALL == 1
     // check if there is no ongoing transmission or repetition
-    if (!irmp_start_bit_detected && !irmp_pulse_time
-        && key_repetition_len > IRMP_KEY_REPETITION_LEN)
+    if (!ir->isr.start_bit_detected && !ir->isr.pulse_time
+        && ir->isr.key_repetition_len > IRMP_KEY_REPETITION_LEN)
     {
         // no ongoing transmission
         // enough time passed since last decoded signal that a repetition won't affect our output
@@ -5533,7 +5564,7 @@ printf ("fm: %d %d\n", irmp_pulse_time *
     }
 #endif // IRMP_USE_IDLE_CALL
 
-    return (irmp_ir_detected);
+    return (ir->ir_detected);
 }
 
 #ifdef ANALYZE
