First release of porting 'Infrared Multiprotocol' library from mikrocontroller.net

Dependents:   IRMP_Receiver

IRMP - Infrared Multiprotocol Decoder

This library is a mbed version of the famous IRMP code, developed by members of the german forum http://mikrocontroller.net. It can receive and analyze a large number of infrared remote codes. In the original version there is also code for an IR transmitter, this will be added to this lib soon.

Base for this initial release is version 2.9.7 from 2015/11. A detailed description for this lib can be found here : https://www.mikrocontroller.net/articles/IRMP_-_english.

The code was originally written for AVR mikrocontrollers and has been ported to different platforms already. It works also great with the mbed target as it can use the unique I/O and ticker code.

Actually, the code uses the static C functions and is not ported to C++ yet to maintain compatibility to the original library. This requres the DigitalIn Pinname setting in the irmpconfig.h.

The required hardware is e.g. just an TSOP31238 (for 38 kHz modulated IR) or similar.

Information

How to use

  • import this library
  • edit irmpconfig.h and turn on the desired protocols
  • change F_INTERRUPTS if necessary, check the protocol table for the minimum necessary frequency
  • search for 'IRMP_PIN' in the irmpconfig and replace with your hardware input

The irmp_ISR() must be called cyclic with a fixed frequency, a simple task for the mbed ticker. In the main program the result is checked by calling irmp_get_data(). This function returns the decoded protocol, address, command and flags like key pressed or released.

Information

Tested platforms

  • simple LPC1347 board, works fine
  • EA LPC4088 QuickStart Board works fine
  • LPCXpresso1549 bad, there is a (known?) issue with slow Ticker ISR processing, ISR consumes >30µs instead of 3 µs
  • STM32F103 board: bad, also known problems with Ticker implementation
  • Test results with other boards are welcome.

Sample code

prints the information about decoded signals to stdout. The ISR contains additional code for performance mesuring which can be omitted in controlling applications.

Import programIRMP_Receiver

Sample code for IRMP library

Sample for decoding and performance test

#include "mbed.h"
#include "irmp.h"

#define LED_ON  0
#define LED_OFF 1

// LED as test output
DigitalOut led(LED1, LED_OFF);
DigitalOut flash(LED2, LED_OFF);

// cyclic interrupt for IRMP ISR worker
Ticker t;

// only for performance test
Timer   timerPerfTest;
int     timeISRMax = 0;
float   timeISRAvg;
int     timeISRAvgSum = 0;
int     countISRCalls = 0;

// this ISR must be called cyclic
void irmpISR(void)
{
    int t1 = timerPerfTest.read_us();               // read performance timer

    irmp_ISR();                                     // call irmp ISR

    int timeISR = timerPerfTest.read_us() - t1;     // calc time spent in worker ISR
    if (timeISR > timeISRMax)                       // store maximum
        timeISRMax = timeISR;
    timeISRAvgSum += timeISR;                       // sum for avg
    countISRCalls++;
}

int main() {
    printf("IRMP on mbed\n");

    led = LED_OFF;
    timerPerfTest.start();

    // irmp_data holds result of received IR code
    IRMP_DATA irmp_data;

    irmp_init();                                                            // initialize irmp
    t.attach_us(&irmpISR, 1E6 / F_INTERRUPTS);                              // call ISR 15.000 / s

    // infinite loop, interrupts will blink PORTD pins and handle UART communications.
    while (1)
    {
        flash = !flash;     // test output. flashes at 15/2 kHz, you will not see it blinking

        // check for received IR commands
        if (irmp_get_data (&irmp_data))
        {
            // ir signal decoded, do something here...
            // irmp_data.protocol is the protocol, see irmp.h
            // irmp_data.address is the address/manufacturer code of ir sender
            // irmp_data.command is the command code
            // irm_data.flags is press/release information
            // irmp_protocol_names[irmp_data.protocol] is the protocol name (if enabled, see irmpconfig.h)
            // printf("proto %d addr %d cmd %d\n", irmp_data.protocol, irmp_data.address, irmp_data.command );

            // sample decoding, turn LED on / off
            if (irmp_data.protocol == IRMP_RC5_PROTOCOL && irmp_data.address == 5)      // old RC5 VCR Remote. TV uses address 0
            {
                if (irmp_data.flags == 0)       // switch only on button press
                {
                    switch (irmp_data.command)
                    {
                    case 0:     // Key '0'
                        led = LED_OFF;
                        break;
                    case 1:     // Key '1'
                        led = LED_ON;
                        break;
                    case 53:        // Key 'play'
                        printf("bring me a beer!\n");
                        break;
                    case 54:        // Key 'stop'
                        timeISRAvg = (float)timeISRAvgSum / countISRCalls;
                        timeISRAvgSum = 0;
                        countISRCalls = 0;
                        printf("ISR max / avg runtime [microseconds] : %d / %5.2f\n", timeISRMax, timeISRAvg);
                        timeISRMax = 0;
                        break;
                    }
                }
            }

            // log to stdout
            printf("proto %d addr %d cmd %d flags %x name %s\n", irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, irmp_protocol_names[irmp_data.protocol] );
        }
    }

}
Committer:
JojoS
Date:
Sat Jan 09 14:15:56 2016 +0000
Revision:
0:a0715ea739cb
First release of 'Infrared Receiver Multi Protocol'  IRMP porting from mikrocontroller.net

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JojoS 0:a0715ea739cb 1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2 * irmp.c - infrared multi-protocol decoder, supports several remote control protocols
JojoS 0:a0715ea739cb 3 *
JojoS 0:a0715ea739cb 4 * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
JojoS 0:a0715ea739cb 5 *
JojoS 0:a0715ea739cb 6 * $Id: irmp.c,v 1.183 2015/12/03 18:13:45 fm Exp $
JojoS 0:a0715ea739cb 7 *
JojoS 0:a0715ea739cb 8 * Supported AVR mikrocontrollers:
JojoS 0:a0715ea739cb 9 *
JojoS 0:a0715ea739cb 10 * ATtiny87, ATtiny167
JojoS 0:a0715ea739cb 11 * ATtiny45, ATtiny85
JojoS 0:a0715ea739cb 12 * ATtiny44, ATtiny84
JojoS 0:a0715ea739cb 13 * ATmega8, ATmega16, ATmega32
JojoS 0:a0715ea739cb 14 * ATmega162
JojoS 0:a0715ea739cb 15 * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284, ATmega1284P
JojoS 0:a0715ea739cb 16 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
JojoS 0:a0715ea739cb 17 *
JojoS 0:a0715ea739cb 18 * This program is free software; you can redistribute it and/or modify
JojoS 0:a0715ea739cb 19 * it under the terms of the GNU General Public License as published by
JojoS 0:a0715ea739cb 20 * the Free Software Foundation; either version 2 of the License, or
JojoS 0:a0715ea739cb 21 * (at your option) any later version.
JojoS 0:a0715ea739cb 22 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 23 */
JojoS 0:a0715ea739cb 24
JojoS 0:a0715ea739cb 25 #include "irmp.h"
JojoS 0:a0715ea739cb 26
JojoS 0:a0715ea739cb 27 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 28 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 1
JojoS 0:a0715ea739cb 29 #else
JojoS 0:a0715ea739cb 30 # define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL 0
JojoS 0:a0715ea739cb 31 #endif
JojoS 0:a0715ea739cb 32
JojoS 0:a0715ea739cb 33 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 34 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1
JojoS 0:a0715ea739cb 35 #else
JojoS 0:a0715ea739cb 36 # define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0
JojoS 0:a0715ea739cb 37 #endif
JojoS 0:a0715ea739cb 38
JojoS 0:a0715ea739cb 39 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 40 IRMP_SUPPORT_S100_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 41 IRMP_SUPPORT_RC6_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 42 IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 43 IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 44 IRMP_SUPPORT_IR60_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 45 IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 46 IRMP_SUPPORT_MERLIN_PROTOCOL == 1 || \
JojoS 0:a0715ea739cb 47 IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 48 # define IRMP_SUPPORT_MANCHESTER 1
JojoS 0:a0715ea739cb 49 #else
JojoS 0:a0715ea739cb 50 # define IRMP_SUPPORT_MANCHESTER 0
JojoS 0:a0715ea739cb 51 #endif
JojoS 0:a0715ea739cb 52
JojoS 0:a0715ea739cb 53 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 54 # define IRMP_SUPPORT_SERIAL 1
JojoS 0:a0715ea739cb 55 #else
JojoS 0:a0715ea739cb 56 # define IRMP_SUPPORT_SERIAL 0
JojoS 0:a0715ea739cb 57 #endif
JojoS 0:a0715ea739cb 58
JojoS 0:a0715ea739cb 59 #define IRMP_KEY_REPETITION_LEN (uint_fast16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
JojoS 0:a0715ea739cb 60
JojoS 0:a0715ea739cb 61 #define MIN_TOLERANCE_00 1.0 // -0%
JojoS 0:a0715ea739cb 62 #define MAX_TOLERANCE_00 1.0 // +0%
JojoS 0:a0715ea739cb 63
JojoS 0:a0715ea739cb 64 #define MIN_TOLERANCE_02 0.98 // -2%
JojoS 0:a0715ea739cb 65 #define MAX_TOLERANCE_02 1.02 // +2%
JojoS 0:a0715ea739cb 66
JojoS 0:a0715ea739cb 67 #define MIN_TOLERANCE_03 0.97 // -3%
JojoS 0:a0715ea739cb 68 #define MAX_TOLERANCE_03 1.03 // +3%
JojoS 0:a0715ea739cb 69
JojoS 0:a0715ea739cb 70 #define MIN_TOLERANCE_05 0.95 // -5%
JojoS 0:a0715ea739cb 71 #define MAX_TOLERANCE_05 1.05 // +5%
JojoS 0:a0715ea739cb 72
JojoS 0:a0715ea739cb 73 #define MIN_TOLERANCE_10 0.9 // -10%
JojoS 0:a0715ea739cb 74 #define MAX_TOLERANCE_10 1.1 // +10%
JojoS 0:a0715ea739cb 75
JojoS 0:a0715ea739cb 76 #define MIN_TOLERANCE_15 0.85 // -15%
JojoS 0:a0715ea739cb 77 #define MAX_TOLERANCE_15 1.15 // +15%
JojoS 0:a0715ea739cb 78
JojoS 0:a0715ea739cb 79 #define MIN_TOLERANCE_20 0.8 // -20%
JojoS 0:a0715ea739cb 80 #define MAX_TOLERANCE_20 1.2 // +20%
JojoS 0:a0715ea739cb 81
JojoS 0:a0715ea739cb 82 #define MIN_TOLERANCE_30 0.7 // -30%
JojoS 0:a0715ea739cb 83 #define MAX_TOLERANCE_30 1.3 // +30%
JojoS 0:a0715ea739cb 84
JojoS 0:a0715ea739cb 85 #define MIN_TOLERANCE_40 0.6 // -40%
JojoS 0:a0715ea739cb 86 #define MAX_TOLERANCE_40 1.4 // +40%
JojoS 0:a0715ea739cb 87
JojoS 0:a0715ea739cb 88 #define MIN_TOLERANCE_50 0.5 // -50%
JojoS 0:a0715ea739cb 89 #define MAX_TOLERANCE_50 1.5 // +50%
JojoS 0:a0715ea739cb 90
JojoS 0:a0715ea739cb 91 #define MIN_TOLERANCE_60 0.4 // -60%
JojoS 0:a0715ea739cb 92 #define MAX_TOLERANCE_60 1.6 // +60%
JojoS 0:a0715ea739cb 93
JojoS 0:a0715ea739cb 94 #define MIN_TOLERANCE_70 0.3 // -70%
JojoS 0:a0715ea739cb 95 #define MAX_TOLERANCE_70 1.7 // +70%
JojoS 0:a0715ea739cb 96
JojoS 0:a0715ea739cb 97 #define SIRCS_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 98 #define SIRCS_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 99 #define SIRCS_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 100 #if IRMP_SUPPORT_NETBOX_PROTOCOL // only 5% to avoid conflict with NETBOX:
JojoS 0:a0715ea739cb 101 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
JojoS 0:a0715ea739cb 102 #else // only 5% + 1 to avoid conflict with RC6:
JojoS 0:a0715ea739cb 103 # define SIRCS_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 104 #endif
JojoS 0:a0715ea739cb 105 #define SIRCS_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 106 #define SIRCS_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 107 #define SIRCS_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 108 #define SIRCS_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 109 #define SIRCS_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 110 #define SIRCS_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 111
JojoS 0:a0715ea739cb 112 #define NEC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 113 #define NEC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 114 #define NEC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 115 #define NEC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 116 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 117 #define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 118 #define NEC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 119 #define NEC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 120 #define NEC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 121 #define NEC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 122 #define NEC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 123 #define NEC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 124 // autodetect nec repetition frame within 50 msec:
JojoS 0:a0715ea739cb 125 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
JojoS 0:a0715ea739cb 126 #if 0
JojoS 0:a0715ea739cb 127 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 128 #else
JojoS 0:a0715ea739cb 129 #define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 130 #endif
JojoS 0:a0715ea739cb 131
JojoS 0:a0715ea739cb 132 #define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 133 #define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 134 #define SAMSUNG_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 135 #define SAMSUNG_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 136 #define SAMSUNG_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 137 #define SAMSUNG_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 138 #define SAMSUNG_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 139 #define SAMSUNG_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 140 #define SAMSUNG_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 141 #define SAMSUNG_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SAMSUNG_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 142
JojoS 0:a0715ea739cb 143 #define MATSUSHITA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 144 #define MATSUSHITA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 145 #define MATSUSHITA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 146 #define MATSUSHITA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 147 #define MATSUSHITA_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 148 #define MATSUSHITA_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 149 #define MATSUSHITA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 150 #define MATSUSHITA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 151 #define MATSUSHITA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 152 #define MATSUSHITA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MATSUSHITA_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 153
JojoS 0:a0715ea739cb 154 #define KASEIKYO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 155 #define KASEIKYO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 156 #define KASEIKYO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 157 #define KASEIKYO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 158 #define KASEIKYO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 159 #define KASEIKYO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 160 #define KASEIKYO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 161 #define KASEIKYO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 162 #define KASEIKYO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 163 #define KASEIKYO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 164
JojoS 0:a0715ea739cb 165 #define PANASONIC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 166 #define PANASONIC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 167 #define PANASONIC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 168 #define PANASONIC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 169 #define PANASONIC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 170 #define PANASONIC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 171 #define PANASONIC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 172 #define PANASONIC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 173 #define PANASONIC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 174 #define PANASONIC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 175
JojoS 0:a0715ea739cb 176 #define RECS80_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 177 #define RECS80_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 178 #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 179 #define RECS80_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 180 #define RECS80_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 181 #define RECS80_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 182 #define RECS80_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 183 #define RECS80_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 184 #define RECS80_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 185 #define RECS80_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 186
JojoS 0:a0715ea739cb 187
JojoS 0:a0715ea739cb 188 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:
JojoS 0:a0715ea739cb 189 #define RC5_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 190 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 191 #else
JojoS 0:a0715ea739cb 192 #define RC5_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 193 #define RC5_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 194 #endif
JojoS 0:a0715ea739cb 195
JojoS 0:a0715ea739cb 196 #define RC5_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 197 #define RC5_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 198
JojoS 0:a0715ea739cb 199 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with S100, so keep tolerance for S100 minimal here:
JojoS 0:a0715ea739cb 200 #define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 201 #define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 202 #else
JojoS 0:a0715ea739cb 203 #define S100_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 204 #define S100_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 205 #endif
JojoS 0:a0715ea739cb 206
JojoS 0:a0715ea739cb 207 #define S100_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 208 #define S100_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * S100_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 209
JojoS 0:a0715ea739cb 210 #define DENON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 211 #define DENON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 212 #define DENON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 213 #define DENON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 214 // RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON
JojoS 0:a0715ea739cb 215 #define DENON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 216 #define DENON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 217 #define DENON_AUTO_REPETITION_PAUSE_LEN ((uint_fast16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 218
JojoS 0:a0715ea739cb 219 #define THOMSON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 220 #define THOMSON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 221 #define THOMSON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 222 #define THOMSON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 223 #define THOMSON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 224 #define THOMSON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * THOMSON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 225
JojoS 0:a0715ea739cb 226 #define RC6_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 227 #define RC6_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 228 #define RC6_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 229 #define RC6_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 230 #define RC6_TOGGLE_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 231 #define RC6_TOGGLE_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_TOGGLE_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 232 #define RC6_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 233 #define RC6_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_60 + 0.5) + 1) // pulses: 300 - 800
JojoS 0:a0715ea739cb 234 #define RC6_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 235 #define RC6_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) // pauses: 300 - 600
JojoS 0:a0715ea739cb 236
JojoS 0:a0715ea739cb 237 #define RECS80EXT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 238 #define RECS80EXT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 239 #define RECS80EXT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 240 #define RECS80EXT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 241 #define RECS80EXT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 242 #define RECS80EXT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 243 #define RECS80EXT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 244 #define RECS80EXT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 245 #define RECS80EXT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 246 #define RECS80EXT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 247
JojoS 0:a0715ea739cb 248 #define NUBERT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 249 #define NUBERT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 250 #define NUBERT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 251 #define NUBERT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 252 #define NUBERT_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 253 #define NUBERT_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 254 #define NUBERT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 255 #define NUBERT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 256 #define NUBERT_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 257 #define NUBERT_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 258 #define NUBERT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 259 #define NUBERT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 260
JojoS 0:a0715ea739cb 261 #define FAN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 262 #define FAN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 263 #define FAN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 264 #define FAN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 265 #define FAN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 266 #define FAN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 267 #define FAN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 268 #define FAN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 269 #define FAN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 270 #define FAN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 271 #define FAN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 272 #define FAN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FAN_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 273
JojoS 0:a0715ea739cb 274 #define SPEAKER_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 275 #define SPEAKER_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 276 #define SPEAKER_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 277 #define SPEAKER_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 278 #define SPEAKER_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 279 #define SPEAKER_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 280 #define SPEAKER_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 281 #define SPEAKER_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 282 #define SPEAKER_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 283 #define SPEAKER_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 284 #define SPEAKER_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 285 #define SPEAKER_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 286
JojoS 0:a0715ea739cb 287 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 288 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 289 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 290 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 291 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 292 #define BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 293 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 294 #define BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT2_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 295 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 296 #define BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 297 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 298 #define BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX ((PAUSE_LEN)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT3_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1) // value must be below IRMP_TIMEOUT
JojoS 0:a0715ea739cb 299 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 300 #define BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 301 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 302 #define BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT4_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 303 #define BANG_OLUFSEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 304 #define BANG_OLUFSEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 305 #define BANG_OLUFSEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 306 #define BANG_OLUFSEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 307 #define BANG_OLUFSEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 308 #define BANG_OLUFSEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 309 #define BANG_OLUFSEN_R_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 310 #define BANG_OLUFSEN_R_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_R_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 311 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 312 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 313
JojoS 0:a0715ea739cb 314 #define IR60_TIMEOUT_LEN ((uint_fast8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))
JojoS 0:a0715ea739cb 315 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 316 #define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 317 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 318 #define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 319 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 320 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 321
JojoS 0:a0715ea739cb 322 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 323 #define SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 324 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 325 #define SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 326 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 327 #define SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 328 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 329 #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 330
JojoS 0:a0715ea739cb 331 #define FDC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX
JojoS 0:a0715ea739cb 332 #define FDC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5))
JojoS 0:a0715ea739cb 333 #define FDC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 334 #define FDC_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))
JojoS 0:a0715ea739cb 335 #define FDC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 336 #define FDC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_PULSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)
JojoS 0:a0715ea739cb 337 #define FDC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 338 #define FDC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 339 #if 0
JojoS 0:a0715ea739cb 340 #define FDC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) // could be negative: 255
JojoS 0:a0715ea739cb 341 #else
JojoS 0:a0715ea739cb 342 #define FDC_0_PAUSE_LEN_MIN (1) // simply use 1
JojoS 0:a0715ea739cb 343 #endif
JojoS 0:a0715ea739cb 344 #define FDC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * FDC_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 345
JojoS 0:a0715ea739cb 346 #define RCCAR_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 347 #define RCCAR_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 348 #define RCCAR_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 349 #define RCCAR_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 350 #define RCCAR_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 351 #define RCCAR_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 352 #define RCCAR_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 353 #define RCCAR_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 354 #define RCCAR_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 355 #define RCCAR_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCCAR_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 356
JojoS 0:a0715ea739cb 357 #define JVC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 358 #define JVC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 359 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MIN_TOLERANCE_40 + 0.5) - 1) // HACK!
JojoS 0:a0715ea739cb 360 #define JVC_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * (JVC_FRAME_REPEAT_PAUSE_TIME - IRMP_TIMEOUT_TIME) * MAX_TOLERANCE_70 + 0.5) - 1) // HACK!
JojoS 0:a0715ea739cb 361 #define JVC_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 362 #define JVC_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 363 #define JVC_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 364 #define JVC_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 365 #define JVC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 366 #define JVC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * JVC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 367 // autodetect JVC repetition frame within 50 msec:
JojoS 0:a0715ea739cb 368 #define JVC_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * JVC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 369
JojoS 0:a0715ea739cb 370 #define NIKON_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 371 #define NIKON_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 372 #define NIKON_START_BIT_PAUSE_LEN_MIN ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 373 #define NIKON_START_BIT_PAUSE_LEN_MAX ((uint_fast16_t)(F_INTERRUPTS * NIKON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 374 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 375 #define NIKON_REPEAT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 376 #define NIKON_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 377 #define NIKON_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 378 #define NIKON_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 379 #define NIKON_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 380 #define NIKON_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 381 #define NIKON_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NIKON_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 382 #define NIKON_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * NIKON_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 383
JojoS 0:a0715ea739cb 384 #define KATHREIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 385 #define KATHREIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 386 #define KATHREIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 387 #define KATHREIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 388 #define KATHREIN_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 389 #define KATHREIN_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 390 #define KATHREIN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 391 #define KATHREIN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 392 #define KATHREIN_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 393 #define KATHREIN_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 394 #define KATHREIN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 395 #define KATHREIN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 396 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 397 #define KATHREIN_SYNC_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * KATHREIN_SYNC_BIT_PAUSE_LEN_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 398
JojoS 0:a0715ea739cb 399 #define NETBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 400 #define NETBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 401 #define NETBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 402 #define NETBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * NETBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 403 #define NETBOX_PULSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME))
JojoS 0:a0715ea739cb 404 #define NETBOX_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME))
JojoS 0:a0715ea739cb 405 #define NETBOX_PULSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PULSE_TIME / 4))
JojoS 0:a0715ea739cb 406 #define NETBOX_PAUSE_REST_LEN ((uint_fast8_t)(F_INTERRUPTS * NETBOX_PAUSE_TIME / 4))
JojoS 0:a0715ea739cb 407
JojoS 0:a0715ea739cb 408 #define LEGO_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 409 #define LEGO_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 410 #define LEGO_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 411 #define LEGO_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 412 #define LEGO_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 413 #define LEGO_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 414 #define LEGO_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 415 #define LEGO_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 416 #define LEGO_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
JojoS 0:a0715ea739cb 417 #define LEGO_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
JojoS 0:a0715ea739cb 418
JojoS 0:a0715ea739cb 419 #define BOSE_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 420 #define BOSE_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 421 #define BOSE_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 422 #define BOSE_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 423 #define BOSE_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 424 #define BOSE_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 425 #define BOSE_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 426 #define BOSE_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 427 #define BOSE_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 428 #define BOSE_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 429 #define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 430
JojoS 0:a0715ea739cb 431 #define A1TVBOX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 432 #define A1TVBOX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 433 #define A1TVBOX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 434 #define A1TVBOX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 435 #define A1TVBOX_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 436 #define A1TVBOX_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 437 #define A1TVBOX_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 438 #define A1TVBOX_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 439
JojoS 0:a0715ea739cb 440 #define MERLIN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 441 #define MERLIN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 442 #define MERLIN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 443 #define MERLIN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 444 #define MERLIN_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 445 #define MERLIN_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 446 #define MERLIN_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 447 #define MERLIN_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MERLIN_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 448
JojoS 0:a0715ea739cb 449 #define ORTEK_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 450 #define ORTEK_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 451 #define ORTEK_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 452 #define ORTEK_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 453 #define ORTEK_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 454 #define ORTEK_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 455 #define ORTEK_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 456 #define ORTEK_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 457
JojoS 0:a0715ea739cb 458 #define TELEFUNKEN_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 459 #define TELEFUNKEN_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 460 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 461 #define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 462 #define TELEFUNKEN_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 463 #define TELEFUNKEN_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 464 #define TELEFUNKEN_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 465 #define TELEFUNKEN_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 466 #define TELEFUNKEN_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)
JojoS 0:a0715ea739cb 467 #define TELEFUNKEN_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)
JojoS 0:a0715ea739cb 468 // autodetect TELEFUNKEN repetition frame within 50 msec:
JojoS 0:a0715ea739cb 469 // #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX (uint_fast16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
JojoS 0:a0715ea739cb 470
JojoS 0:a0715ea739cb 471 #define ROOMBA_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 472 #define ROOMBA_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 473 #define ROOMBA_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 474 #define ROOMBA_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 475 #define ROOMBA_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))
JojoS 0:a0715ea739cb 476 #define ROOMBA_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 477 #define ROOMBA_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 478 #define ROOMBA_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 479 #define ROOMBA_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 480 #define ROOMBA_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))
JojoS 0:a0715ea739cb 481 #define ROOMBA_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 482 #define ROOMBA_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 483 #define ROOMBA_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 484 #define ROOMBA_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 485
JojoS 0:a0715ea739cb 486 #define RCMM32_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 487 #define RCMM32_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 488 #define RCMM32_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 489 #define RCMM32_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 490 #define RCMM32_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 491 #define RCMM32_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 492 #define RCMM32_BIT_00_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 493 #define RCMM32_BIT_00_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 494 #define RCMM32_BIT_01_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 495 #define RCMM32_BIT_01_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 496 #define RCMM32_BIT_10_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 497 #define RCMM32_BIT_10_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 498 #define RCMM32_BIT_11_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)
JojoS 0:a0715ea739cb 499 #define RCMM32_BIT_11_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)
JojoS 0:a0715ea739cb 500
JojoS 0:a0715ea739cb 501 #define PENTAX_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 502 #define PENTAX_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 503 #define PENTAX_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 504 #define PENTAX_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 505 #define PENTAX_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME + 0.5))
JojoS 0:a0715ea739cb 506 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 507 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 508 #define PENTAX_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 509 #define PENTAX_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 510 #define PENTAX_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME))
JojoS 0:a0715ea739cb 511 #define PENTAX_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 512 #define PENTAX_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 513 #define PENTAX_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 514 #define PENTAX_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PENTAX_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 515
JojoS 0:a0715ea739cb 516 #define ACP24_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
JojoS 0:a0715ea739cb 517 #define ACP24_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
JojoS 0:a0715ea739cb 518 #define ACP24_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
JojoS 0:a0715ea739cb 519 #define ACP24_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_START_BIT_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
JojoS 0:a0715ea739cb 520 #define ACP24_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
JojoS 0:a0715ea739cb 521 #define ACP24_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_PULSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
JojoS 0:a0715ea739cb 522 #define ACP24_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
JojoS 0:a0715ea739cb 523 #define ACP24_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_1_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
JojoS 0:a0715ea739cb 524 #define ACP24_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MIN_TOLERANCE_15 + 0.5) - 1)
JojoS 0:a0715ea739cb 525 #define ACP24_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * ACP24_0_PAUSE_TIME * MAX_TOLERANCE_15 + 0.5) + 1)
JojoS 0:a0715ea739cb 526
JojoS 0:a0715ea739cb 527 #define RADIO1_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 528 #define RADIO1_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 529 #define RADIO1_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
JojoS 0:a0715ea739cb 530 #define RADIO1_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
JojoS 0:a0715ea739cb 531 #define RADIO1_1_PAUSE_LEN_EXACT ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))
JojoS 0:a0715ea739cb 532 #define RADIO1_1_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 533 #define RADIO1_1_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 534 #define RADIO1_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 535 #define RADIO1_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 536 #define RADIO1_0_PAUSE_LEN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))
JojoS 0:a0715ea739cb 537 #define RADIO1_0_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 538 #define RADIO1_0_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 539 #define RADIO1_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)
JojoS 0:a0715ea739cb 540 #define RADIO1_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)
JojoS 0:a0715ea739cb 541
JojoS 0:a0715ea739cb 542 #define AUTO_FRAME_REPETITION_LEN (uint_fast16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5) // use uint_fast16_t!
JojoS 0:a0715ea739cb 543
JojoS 0:a0715ea739cb 544 #ifdef ANALYZE
JojoS 0:a0715ea739cb 545 # define ANALYZE_PUTCHAR(a) { if (! silent) { putchar (a); } }
JojoS 0:a0715ea739cb 546 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) { if (! silent && !verbose) { putchar (a); } }
JojoS 0:a0715ea739cb 547 # define ANALYZE_PRINTF(...) { if (verbose) { printf (__VA_ARGS__); } }
JojoS 0:a0715ea739cb 548 # define ANALYZE_ONLY_NORMAL_PRINTF(...) { if (! silent && !verbose) { printf (__VA_ARGS__); } }
JojoS 0:a0715ea739cb 549 # define ANALYZE_NEWLINE() { if (verbose) { putchar ('\n'); } }
JojoS 0:a0715ea739cb 550 static int silent;
JojoS 0:a0715ea739cb 551 static int time_counter;
JojoS 0:a0715ea739cb 552 static int verbose;
JojoS 0:a0715ea739cb 553
JojoS 0:a0715ea739cb 554 /******************************* not every PIC compiler knows variadic macros :-(
JojoS 0:a0715ea739cb 555 #else
JojoS 0:a0715ea739cb 556 # define ANALYZE_PUTCHAR(a)
JojoS 0:a0715ea739cb 557 # define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
JojoS 0:a0715ea739cb 558 # define ANALYZE_PRINTF(...)
JojoS 0:a0715ea739cb 559 # define ANALYZE_ONLY_NORMAL_PRINTF(...)
JojoS 0:a0715ea739cb 560 # endif
JojoS 0:a0715ea739cb 561 # define ANALYZE_NEWLINE()
JojoS 0:a0715ea739cb 562 *********************************/
JojoS 0:a0715ea739cb 563 #endif
JojoS 0:a0715ea739cb 564
JojoS 0:a0715ea739cb 565 #if IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 566 static void (*irmp_callback_ptr) (uint_fast8_t);
JojoS 0:a0715ea739cb 567 #endif // IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 568
JojoS 0:a0715ea739cb 569 #define PARITY_CHECK_OK 1
JojoS 0:a0715ea739cb 570 #define PARITY_CHECK_FAILED 0
JojoS 0:a0715ea739cb 571
JojoS 0:a0715ea739cb 572 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 573 * Protocol names
JojoS 0:a0715ea739cb 574 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 575 */
JojoS 0:a0715ea739cb 576 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1
JojoS 0:a0715ea739cb 577 static const char proto_unknown[] PROGMEM = "UNKNOWN";
JojoS 0:a0715ea739cb 578 static const char proto_sircs[] PROGMEM = "SIRCS";
JojoS 0:a0715ea739cb 579 static const char proto_nec[] PROGMEM = "NEC";
JojoS 0:a0715ea739cb 580 static const char proto_samsung[] PROGMEM = "SAMSUNG";
JojoS 0:a0715ea739cb 581 static const char proto_matsushita[] PROGMEM = "MATSUSH";
JojoS 0:a0715ea739cb 582 static const char proto_kaseikyo[] PROGMEM = "KASEIKYO";
JojoS 0:a0715ea739cb 583 static const char proto_recs80[] PROGMEM = "RECS80";
JojoS 0:a0715ea739cb 584 static const char proto_rc5[] PROGMEM = "RC5";
JojoS 0:a0715ea739cb 585 static const char proto_denon[] PROGMEM = "DENON";
JojoS 0:a0715ea739cb 586 static const char proto_rc6[] PROGMEM = "RC6";
JojoS 0:a0715ea739cb 587 static const char proto_samsung32[] PROGMEM = "SAMSG32";
JojoS 0:a0715ea739cb 588 static const char proto_apple[] PROGMEM = "APPLE";
JojoS 0:a0715ea739cb 589 static const char proto_recs80ext[] PROGMEM = "RECS80EX";
JojoS 0:a0715ea739cb 590 static const char proto_nubert[] PROGMEM = "NUBERT";
JojoS 0:a0715ea739cb 591 static const char proto_bang_olufsen[] PROGMEM = "BANG OLU";
JojoS 0:a0715ea739cb 592 static const char proto_grundig[] PROGMEM = "GRUNDIG";
JojoS 0:a0715ea739cb 593 static const char proto_nokia[] PROGMEM = "NOKIA";
JojoS 0:a0715ea739cb 594 static const char proto_siemens[] PROGMEM = "SIEMENS";
JojoS 0:a0715ea739cb 595 static const char proto_fdc[] PROGMEM = "FDC";
JojoS 0:a0715ea739cb 596 static const char proto_rccar[] PROGMEM = "RCCAR";
JojoS 0:a0715ea739cb 597 static const char proto_jvc[] PROGMEM = "JVC";
JojoS 0:a0715ea739cb 598 static const char proto_rc6a[] PROGMEM = "RC6A";
JojoS 0:a0715ea739cb 599 static const char proto_nikon[] PROGMEM = "NIKON";
JojoS 0:a0715ea739cb 600 static const char proto_ruwido[] PROGMEM = "RUWIDO";
JojoS 0:a0715ea739cb 601 static const char proto_ir60[] PROGMEM = "IR60";
JojoS 0:a0715ea739cb 602 static const char proto_kathrein[] PROGMEM = "KATHREIN";
JojoS 0:a0715ea739cb 603 static const char proto_netbox[] PROGMEM = "NETBOX";
JojoS 0:a0715ea739cb 604 static const char proto_nec16[] PROGMEM = "NEC16";
JojoS 0:a0715ea739cb 605 static const char proto_nec42[] PROGMEM = "NEC42";
JojoS 0:a0715ea739cb 606 static const char proto_lego[] PROGMEM = "LEGO";
JojoS 0:a0715ea739cb 607 static const char proto_thomson[] PROGMEM = "THOMSON";
JojoS 0:a0715ea739cb 608 static const char proto_bose[] PROGMEM = "BOSE";
JojoS 0:a0715ea739cb 609 static const char proto_a1tvbox[] PROGMEM = "A1TVBOX";
JojoS 0:a0715ea739cb 610 static const char proto_ortek[] PROGMEM = "ORTEK";
JojoS 0:a0715ea739cb 611 static const char proto_telefunken[] PROGMEM = "TELEFUNKEN";
JojoS 0:a0715ea739cb 612 static const char proto_roomba[] PROGMEM = "ROOMBA";
JojoS 0:a0715ea739cb 613 static const char proto_rcmm32[] PROGMEM = "RCMM32";
JojoS 0:a0715ea739cb 614 static const char proto_rcmm24[] PROGMEM = "RCMM24";
JojoS 0:a0715ea739cb 615 static const char proto_rcmm12[] PROGMEM = "RCMM12";
JojoS 0:a0715ea739cb 616 static const char proto_speaker[] PROGMEM = "SPEAKER";
JojoS 0:a0715ea739cb 617 static const char proto_lgair[] PROGMEM = "LGAIR";
JojoS 0:a0715ea739cb 618 static const char proto_samsung48[] PROGMEM = "SAMSG48";
JojoS 0:a0715ea739cb 619 static const char proto_merlin[] PROGMEM = "MERLIN";
JojoS 0:a0715ea739cb 620 static const char proto_pentax[] PROGMEM = "PENTAX";
JojoS 0:a0715ea739cb 621 static const char proto_fan[] PROGMEM = "FAN";
JojoS 0:a0715ea739cb 622 static const char proto_s100[] PROGMEM = "S100";
JojoS 0:a0715ea739cb 623 static const char proto_acp24[] PROGMEM = "ACP24";
JojoS 0:a0715ea739cb 624 static const char proto_technics[] PROGMEM = "TECHNICS";
JojoS 0:a0715ea739cb 625 static const char proto_panasonic[] PROGMEM = "PANASONIC";
JojoS 0:a0715ea739cb 626
JojoS 0:a0715ea739cb 627 static const char proto_radio1[] PROGMEM = "RADIO1";
JojoS 0:a0715ea739cb 628
JojoS 0:a0715ea739cb 629 const char * const
JojoS 0:a0715ea739cb 630 irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM =
JojoS 0:a0715ea739cb 631 {
JojoS 0:a0715ea739cb 632 proto_unknown,
JojoS 0:a0715ea739cb 633 proto_sircs,
JojoS 0:a0715ea739cb 634 proto_nec,
JojoS 0:a0715ea739cb 635 proto_samsung,
JojoS 0:a0715ea739cb 636 proto_matsushita,
JojoS 0:a0715ea739cb 637 proto_kaseikyo,
JojoS 0:a0715ea739cb 638 proto_recs80,
JojoS 0:a0715ea739cb 639 proto_rc5,
JojoS 0:a0715ea739cb 640 proto_denon,
JojoS 0:a0715ea739cb 641 proto_rc6,
JojoS 0:a0715ea739cb 642 proto_samsung32,
JojoS 0:a0715ea739cb 643 proto_apple,
JojoS 0:a0715ea739cb 644 proto_recs80ext,
JojoS 0:a0715ea739cb 645 proto_nubert,
JojoS 0:a0715ea739cb 646 proto_bang_olufsen,
JojoS 0:a0715ea739cb 647 proto_grundig,
JojoS 0:a0715ea739cb 648 proto_nokia,
JojoS 0:a0715ea739cb 649 proto_siemens,
JojoS 0:a0715ea739cb 650 proto_fdc,
JojoS 0:a0715ea739cb 651 proto_rccar,
JojoS 0:a0715ea739cb 652 proto_jvc,
JojoS 0:a0715ea739cb 653 proto_rc6a,
JojoS 0:a0715ea739cb 654 proto_nikon,
JojoS 0:a0715ea739cb 655 proto_ruwido,
JojoS 0:a0715ea739cb 656 proto_ir60,
JojoS 0:a0715ea739cb 657 proto_kathrein,
JojoS 0:a0715ea739cb 658 proto_netbox,
JojoS 0:a0715ea739cb 659 proto_nec16,
JojoS 0:a0715ea739cb 660 proto_nec42,
JojoS 0:a0715ea739cb 661 proto_lego,
JojoS 0:a0715ea739cb 662 proto_thomson,
JojoS 0:a0715ea739cb 663 proto_bose,
JojoS 0:a0715ea739cb 664 proto_a1tvbox,
JojoS 0:a0715ea739cb 665 proto_ortek,
JojoS 0:a0715ea739cb 666 proto_telefunken,
JojoS 0:a0715ea739cb 667 proto_roomba,
JojoS 0:a0715ea739cb 668 proto_rcmm32,
JojoS 0:a0715ea739cb 669 proto_rcmm24,
JojoS 0:a0715ea739cb 670 proto_rcmm12,
JojoS 0:a0715ea739cb 671 proto_speaker,
JojoS 0:a0715ea739cb 672 proto_lgair,
JojoS 0:a0715ea739cb 673 proto_samsung48,
JojoS 0:a0715ea739cb 674 proto_merlin,
JojoS 0:a0715ea739cb 675 proto_pentax,
JojoS 0:a0715ea739cb 676 proto_fan,
JojoS 0:a0715ea739cb 677 proto_s100,
JojoS 0:a0715ea739cb 678 proto_acp24,
JojoS 0:a0715ea739cb 679 proto_technics,
JojoS 0:a0715ea739cb 680 proto_panasonic,
JojoS 0:a0715ea739cb 681 proto_radio1
JojoS 0:a0715ea739cb 682 };
JojoS 0:a0715ea739cb 683
JojoS 0:a0715ea739cb 684 #endif
JojoS 0:a0715ea739cb 685
JojoS 0:a0715ea739cb 686 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 687 * Logging
JojoS 0:a0715ea739cb 688 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 689 */
JojoS 0:a0715ea739cb 690 #if IRMP_LOGGING == 1 // logging via UART
JojoS 0:a0715ea739cb 691
JojoS 0:a0715ea739cb 692 #if defined(ARM_STM32F4XX)
JojoS 0:a0715ea739cb 693 # define STM32_GPIO_CLOCK RCC_AHB1Periph_GPIOA // UART2 on PA2
JojoS 0:a0715ea739cb 694 # define STM32_UART_CLOCK RCC_APB1Periph_USART2
JojoS 0:a0715ea739cb 695 # define STM32_GPIO_PORT GPIOA
JojoS 0:a0715ea739cb 696 # define STM32_GPIO_PIN GPIO_Pin_2
JojoS 0:a0715ea739cb 697 # define STM32_GPIO_SOURCE GPIO_PinSource2
JojoS 0:a0715ea739cb 698 # define STM32_UART_AF GPIO_AF_USART2
JojoS 0:a0715ea739cb 699 # define STM32_UART_COM USART2
JojoS 0:a0715ea739cb 700 # define STM32_UART_BAUD 115200 // 115200 Baud
JojoS 0:a0715ea739cb 701 # include "stm32f4xx_usart.h"
JojoS 0:a0715ea739cb 702 #elif defined(ARM_STM32F10X)
JojoS 0:a0715ea739cb 703 # define STM32_UART_COM USART3 // UART3 on PB10
JojoS 0:a0715ea739cb 704 #elif defined(ARDUINO) // Arduino Serial implementation
JojoS 0:a0715ea739cb 705 # if defined(USB_SERIAL)
JojoS 0:a0715ea739cb 706 # include "usb_serial.h"
JojoS 0:a0715ea739cb 707 # else
JojoS 0:a0715ea739cb 708 # error USB_SERIAL not defined in ARDUINO Environment
JojoS 0:a0715ea739cb 709 # endif
JojoS 0:a0715ea739cb 710 #else
JojoS 0:a0715ea739cb 711 # if IRMP_EXT_LOGGING == 1 // use external logging
JojoS 0:a0715ea739cb 712 # include "../irmp/irmpextlog.h"
JojoS 0:a0715ea739cb 713 # else // normal UART log (IRMP_EXT_LOGGING == 0)
JojoS 0:a0715ea739cb 714 # define BAUD 9600L
JojoS 0:a0715ea739cb 715 # ifndef UNIX_OR_WINDOWS
JojoS 0:a0715ea739cb 716 # include <util/setbaud.h>
JojoS 0:a0715ea739cb 717 # endif
JojoS 0:a0715ea739cb 718
JojoS 0:a0715ea739cb 719 #ifdef UBRR0H
JojoS 0:a0715ea739cb 720
JojoS 0:a0715ea739cb 721 #define UART0_UBRRH UBRR0H
JojoS 0:a0715ea739cb 722 #define UART0_UBRRL UBRR0L
JojoS 0:a0715ea739cb 723 #define UART0_UCSRA UCSR0A
JojoS 0:a0715ea739cb 724 #define UART0_UCSRB UCSR0B
JojoS 0:a0715ea739cb 725 #define UART0_UCSRC UCSR0C
JojoS 0:a0715ea739cb 726 #define UART0_UDRE_BIT_VALUE (1<<UDRE0)
JojoS 0:a0715ea739cb 727 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ01)
JojoS 0:a0715ea739cb 728 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ00)
JojoS 0:a0715ea739cb 729 #ifdef URSEL0
JojoS 0:a0715ea739cb 730 #define UART0_URSEL_BIT_VALUE (1<<URSEL0)
JojoS 0:a0715ea739cb 731 #else
JojoS 0:a0715ea739cb 732 #define UART0_URSEL_BIT_VALUE (0)
JojoS 0:a0715ea739cb 733 #endif
JojoS 0:a0715ea739cb 734 #define UART0_TXEN_BIT_VALUE (1<<TXEN0)
JojoS 0:a0715ea739cb 735 #define UART0_UDR UDR0
JojoS 0:a0715ea739cb 736 #define UART0_U2X U2X0
JojoS 0:a0715ea739cb 737
JojoS 0:a0715ea739cb 738 #else
JojoS 0:a0715ea739cb 739
JojoS 0:a0715ea739cb 740 #define UART0_UBRRH UBRRH
JojoS 0:a0715ea739cb 741 #define UART0_UBRRL UBRRL
JojoS 0:a0715ea739cb 742 #define UART0_UCSRA UCSRA
JojoS 0:a0715ea739cb 743 #define UART0_UCSRB UCSRB
JojoS 0:a0715ea739cb 744 #define UART0_UCSRC UCSRC
JojoS 0:a0715ea739cb 745 #define UART0_UDRE_BIT_VALUE (1<<UDRE)
JojoS 0:a0715ea739cb 746 #define UART0_UCSZ1_BIT_VALUE (1<<UCSZ1)
JojoS 0:a0715ea739cb 747 #define UART0_UCSZ0_BIT_VALUE (1<<UCSZ0)
JojoS 0:a0715ea739cb 748 #ifdef URSEL
JojoS 0:a0715ea739cb 749 #define UART0_URSEL_BIT_VALUE (1<<URSEL)
JojoS 0:a0715ea739cb 750 #else
JojoS 0:a0715ea739cb 751 #define UART0_URSEL_BIT_VALUE (0)
JojoS 0:a0715ea739cb 752 #endif
JojoS 0:a0715ea739cb 753 #define UART0_TXEN_BIT_VALUE (1<<TXEN)
JojoS 0:a0715ea739cb 754 #define UART0_UDR UDR
JojoS 0:a0715ea739cb 755 #define UART0_U2X U2X
JojoS 0:a0715ea739cb 756
JojoS 0:a0715ea739cb 757 #endif //UBRR0H
JojoS 0:a0715ea739cb 758 #endif //IRMP_EXT_LOGGING
JojoS 0:a0715ea739cb 759 #endif //ARM_STM32F4XX
JojoS 0:a0715ea739cb 760
JojoS 0:a0715ea739cb 761 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 762 * Initialize UART
JojoS 0:a0715ea739cb 763 * @details Initializes UART
JojoS 0:a0715ea739cb 764 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 765 */
JojoS 0:a0715ea739cb 766 void
JojoS 0:a0715ea739cb 767 irmp_uart_init (void)
JojoS 0:a0715ea739cb 768 {
JojoS 0:a0715ea739cb 769 #ifndef UNIX_OR_WINDOWS
JojoS 0:a0715ea739cb 770 #if defined(ARM_STM32F4XX)
JojoS 0:a0715ea739cb 771 GPIO_InitTypeDef GPIO_InitStructure;
JojoS 0:a0715ea739cb 772 USART_InitTypeDef USART_InitStructure;
JojoS 0:a0715ea739cb 773
JojoS 0:a0715ea739cb 774 // Clock enable vom TX Pin
JojoS 0:a0715ea739cb 775 RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK, ENABLE);
JojoS 0:a0715ea739cb 776
JojoS 0:a0715ea739cb 777 // Clock enable der UART
JojoS 0:a0715ea739cb 778 RCC_APB1PeriphClockCmd(STM32_UART_CLOCK, ENABLE);
JojoS 0:a0715ea739cb 779
JojoS 0:a0715ea739cb 780 // UART Alternative-Funktion mit dem IO-Pin verbinden
JojoS 0:a0715ea739cb 781 GPIO_PinAFConfig(STM32_GPIO_PORT,STM32_GPIO_SOURCE,STM32_UART_AF);
JojoS 0:a0715ea739cb 782
JojoS 0:a0715ea739cb 783 // UART als Alternative-Funktion mit PushPull
JojoS 0:a0715ea739cb 784 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
JojoS 0:a0715ea739cb 785 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
JojoS 0:a0715ea739cb 786 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
JojoS 0:a0715ea739cb 787 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
JojoS 0:a0715ea739cb 788
JojoS 0:a0715ea739cb 789 // TX-Pin
JojoS 0:a0715ea739cb 790 GPIO_InitStructure.GPIO_Pin = STM32_GPIO_PIN;
JojoS 0:a0715ea739cb 791 GPIO_Init(STM32_GPIO_PORT, &GPIO_InitStructure);
JojoS 0:a0715ea739cb 792
JojoS 0:a0715ea739cb 793 // Oversampling
JojoS 0:a0715ea739cb 794 USART_OverSampling8Cmd(STM32_UART_COM, ENABLE);
JojoS 0:a0715ea739cb 795
JojoS 0:a0715ea739cb 796 // init mit Baudrate, 8Databits, 1Stopbit, keine Parit�t, kein RTS+CTS
JojoS 0:a0715ea739cb 797 USART_InitStructure.USART_BaudRate = STM32_UART_BAUD;
JojoS 0:a0715ea739cb 798 USART_InitStructure.USART_WordLength = USART_WordLength_8b;
JojoS 0:a0715ea739cb 799 USART_InitStructure.USART_StopBits = USART_StopBits_1;
JojoS 0:a0715ea739cb 800 USART_InitStructure.USART_Parity = USART_Parity_No;
JojoS 0:a0715ea739cb 801 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
JojoS 0:a0715ea739cb 802 USART_InitStructure.USART_Mode = USART_Mode_Tx;
JojoS 0:a0715ea739cb 803 USART_Init(STM32_UART_COM, &USART_InitStructure);
JojoS 0:a0715ea739cb 804
JojoS 0:a0715ea739cb 805 // UART enable
JojoS 0:a0715ea739cb 806 USART_Cmd(STM32_UART_COM, ENABLE);
JojoS 0:a0715ea739cb 807
JojoS 0:a0715ea739cb 808 #elif defined(ARM_STM32F10X)
JojoS 0:a0715ea739cb 809 GPIO_InitTypeDef GPIO_InitStructure;
JojoS 0:a0715ea739cb 810 USART_InitTypeDef USART_InitStructure;
JojoS 0:a0715ea739cb 811
JojoS 0:a0715ea739cb 812 // Clock enable vom TX Pin
JojoS 0:a0715ea739cb 813 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); // UART3 an PB10
JojoS 0:a0715ea739cb 814
JojoS 0:a0715ea739cb 815 // Clock enable der UART
JojoS 0:a0715ea739cb 816 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
JojoS 0:a0715ea739cb 817
JojoS 0:a0715ea739cb 818 // UART als Alternative-Funktion mit PushPull
JojoS 0:a0715ea739cb 819 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
JojoS 0:a0715ea739cb 820 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
JojoS 0:a0715ea739cb 821
JojoS 0:a0715ea739cb 822 // TX-Pin
JojoS 0:a0715ea739cb 823 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
JojoS 0:a0715ea739cb 824 GPIO_Init(GPIOB, &GPIO_InitStructure);
JojoS 0:a0715ea739cb 825
JojoS 0:a0715ea739cb 826 // Oversampling
JojoS 0:a0715ea739cb 827 USART_OverSampling8Cmd(STM32_UART_COM, ENABLE);
JojoS 0:a0715ea739cb 828
JojoS 0:a0715ea739cb 829 // init mit Baudrate, 8Databits, 1Stopbit, keine Parit�t, kein RTS+CTS
JojoS 0:a0715ea739cb 830 USART_InitStructure.USART_BaudRate = 115200;
JojoS 0:a0715ea739cb 831 USART_InitStructure.USART_WordLength = USART_WordLength_8b;
JojoS 0:a0715ea739cb 832 USART_InitStructure.USART_StopBits = USART_StopBits_1;
JojoS 0:a0715ea739cb 833 USART_InitStructure.USART_Parity = USART_Parity_No;
JojoS 0:a0715ea739cb 834 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
JojoS 0:a0715ea739cb 835 USART_InitStructure.USART_Mode = USART_Mode_Tx;
JojoS 0:a0715ea739cb 836 USART_Init(STM32_UART_COM, &USART_InitStructure);
JojoS 0:a0715ea739cb 837
JojoS 0:a0715ea739cb 838 // UART enable
JojoS 0:a0715ea739cb 839 USART_Cmd(STM32_UART_COM, ENABLE);
JojoS 0:a0715ea739cb 840
JojoS 0:a0715ea739cb 841 #elif defined(ARDUINO)
JojoS 0:a0715ea739cb 842 // we use the Arduino Serial Imlementation
JojoS 0:a0715ea739cb 843 // you have to call Serial.begin(SER_BAUD); in Arduino setup() function
JojoS 0:a0715ea739cb 844
JojoS 0:a0715ea739cb 845 #elif defined (__AVR_XMEGA__)
JojoS 0:a0715ea739cb 846
JojoS 0:a0715ea739cb 847 PMIC.CTRL |= PMIC_HILVLEN_bm;
JojoS 0:a0715ea739cb 848
JojoS 0:a0715ea739cb 849 USARTC1.BAUDCTRLB = 0;
JojoS 0:a0715ea739cb 850 USARTC1.BAUDCTRLA = F_CPU / 153600 - 1;
JojoS 0:a0715ea739cb 851 USARTC1.CTRLA = USART_RXCINTLVL_HI_gc; // High Level (Empfangen)
JojoS 0:a0715ea739cb 852 USARTC1.CTRLB = USART_TXEN_bm | USART_RXEN_bm; //Aktiviert Senden und Empfangen
JojoS 0:a0715ea739cb 853 USARTC1.CTRLC = USART_CHSIZE_8BIT_gc; //Gr��e der Zeichen: 8 Bit
JojoS 0:a0715ea739cb 854 PORTC.DIR |= (1<<7); //TXD als Ausgang setzen
JojoS 0:a0715ea739cb 855 PORTC.DIR &= ~(1<<6);
JojoS 0:a0715ea739cb 856
JojoS 0:a0715ea739cb 857 #else
JojoS 0:a0715ea739cb 858
JojoS 0:a0715ea739cb 859 #if (IRMP_EXT_LOGGING == 0) // use UART
JojoS 0:a0715ea739cb 860 UART0_UBRRH = UBRRH_VALUE; // set baud rate
JojoS 0:a0715ea739cb 861 UART0_UBRRL = UBRRL_VALUE;
JojoS 0:a0715ea739cb 862
JojoS 0:a0715ea739cb 863 #if USE_2X
JojoS 0:a0715ea739cb 864 UART0_UCSRA |= (1<<UART0_U2X);
JojoS 0:a0715ea739cb 865 #else
JojoS 0:a0715ea739cb 866 UART0_UCSRA &= ~(1<<UART0_U2X);
JojoS 0:a0715ea739cb 867 #endif
JojoS 0:a0715ea739cb 868
JojoS 0:a0715ea739cb 869 UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;
JojoS 0:a0715ea739cb 870 UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX
JojoS 0:a0715ea739cb 871 #else // other log method
JojoS 0:a0715ea739cb 872 initextlog();
JojoS 0:a0715ea739cb 873 #endif //IRMP_EXT_LOGGING
JojoS 0:a0715ea739cb 874 #endif //ARM_STM32F4XX
JojoS 0:a0715ea739cb 875 #endif // UNIX_OR_WINDOWS
JojoS 0:a0715ea739cb 876 }
JojoS 0:a0715ea739cb 877
JojoS 0:a0715ea739cb 878 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 879 * Send character
JojoS 0:a0715ea739cb 880 * @details Sends character
JojoS 0:a0715ea739cb 881 * @param ch character to be transmitted
JojoS 0:a0715ea739cb 882 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 883 */
JojoS 0:a0715ea739cb 884 void
JojoS 0:a0715ea739cb 885 irmp_uart_putc (unsigned char ch)
JojoS 0:a0715ea739cb 886 {
JojoS 0:a0715ea739cb 887 #ifndef UNIX_OR_WINDOWS
JojoS 0:a0715ea739cb 888 #if defined(ARM_STM32F4XX) || defined(ARM_STM32F10X)
JojoS 0:a0715ea739cb 889 // warten bis altes Byte gesendet wurde
JojoS 0:a0715ea739cb 890 while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET)
JojoS 0:a0715ea739cb 891 {
JojoS 0:a0715ea739cb 892 ;
JojoS 0:a0715ea739cb 893 }
JojoS 0:a0715ea739cb 894
JojoS 0:a0715ea739cb 895 USART_SendData(STM32_UART_COM, ch);
JojoS 0:a0715ea739cb 896
JojoS 0:a0715ea739cb 897 if (ch == '\n')
JojoS 0:a0715ea739cb 898 {
JojoS 0:a0715ea739cb 899 while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET);
JojoS 0:a0715ea739cb 900 USART_SendData(STM32_UART_COM, '\r');
JojoS 0:a0715ea739cb 901 }
JojoS 0:a0715ea739cb 902
JojoS 0:a0715ea739cb 903 #elif defined(ARDUINO)
JojoS 0:a0715ea739cb 904 // we use the Arduino Serial Imlementation
JojoS 0:a0715ea739cb 905 usb_serial_putchar(ch);
JojoS 0:a0715ea739cb 906
JojoS 0:a0715ea739cb 907 #else
JojoS 0:a0715ea739cb 908 #if (IRMP_EXT_LOGGING == 0)
JojoS 0:a0715ea739cb 909
JojoS 0:a0715ea739cb 910 # if defined (__AVR_XMEGA__)
JojoS 0:a0715ea739cb 911 while (!(USARTC1.STATUS & USART_DREIF_bm));
JojoS 0:a0715ea739cb 912 USARTC1.DATA = ch;
JojoS 0:a0715ea739cb 913
JojoS 0:a0715ea739cb 914 # else //AVR_MEGA
JojoS 0:a0715ea739cb 915 while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))
JojoS 0:a0715ea739cb 916 {
JojoS 0:a0715ea739cb 917 ;
JojoS 0:a0715ea739cb 918 }
JojoS 0:a0715ea739cb 919
JojoS 0:a0715ea739cb 920 UART0_UDR = ch;
JojoS 0:a0715ea739cb 921 #endif //__AVR_XMEGA__
JojoS 0:a0715ea739cb 922 #else
JojoS 0:a0715ea739cb 923
JojoS 0:a0715ea739cb 924 sendextlog(ch); // use external log
JojoS 0:a0715ea739cb 925
JojoS 0:a0715ea739cb 926 #endif //IRMP_EXT_LOGGING
JojoS 0:a0715ea739cb 927 #endif //ARM_STM32F4XX
JojoS 0:a0715ea739cb 928 #else
JojoS 0:a0715ea739cb 929 fputc (ch, stderr);
JojoS 0:a0715ea739cb 930 #endif // UNIX_OR_WINDOWS
JojoS 0:a0715ea739cb 931 }
JojoS 0:a0715ea739cb 932
JojoS 0:a0715ea739cb 933 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 934 * Log IR signal
JojoS 0:a0715ea739cb 935 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 936 */
JojoS 0:a0715ea739cb 937
JojoS 0:a0715ea739cb 938 #define STARTCYCLES 2 // min count of zeros before start of logging
JojoS 0:a0715ea739cb 939 #define ENDBITS 1000 // number of sequenced highbits to detect end
JojoS 0:a0715ea739cb 940 #define DATALEN 700 // log buffer size
JojoS 0:a0715ea739cb 941
JojoS 0:a0715ea739cb 942 static void
JojoS 0:a0715ea739cb 943 irmp_log (uint_fast8_t val)
JojoS 0:a0715ea739cb 944 {
JojoS 0:a0715ea739cb 945 static uint8_t buf[DATALEN]; // logging buffer
JojoS 0:a0715ea739cb 946 static uint_fast16_t buf_idx; // index
JojoS 0:a0715ea739cb 947 static uint_fast8_t startcycles; // current number of start-zeros
JojoS 0:a0715ea739cb 948 static uint_fast16_t cnt; // counts sequenced highbits - to detect end
JojoS 0:a0715ea739cb 949 static uint_fast8_t last_val = 1;
JojoS 0:a0715ea739cb 950
JojoS 0:a0715ea739cb 951 if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging
JojoS 0:a0715ea739cb 952 {
JojoS 0:a0715ea739cb 953 startcycles++;
JojoS 0:a0715ea739cb 954 }
JojoS 0:a0715ea739cb 955 else
JojoS 0:a0715ea739cb 956 {
JojoS 0:a0715ea739cb 957 startcycles = 0;
JojoS 0:a0715ea739cb 958
JojoS 0:a0715ea739cb 959 if (! val || buf_idx != 0) // start or continue logging on "0", "1" cannot init logging
JojoS 0:a0715ea739cb 960 {
JojoS 0:a0715ea739cb 961 if (last_val == val)
JojoS 0:a0715ea739cb 962 {
JojoS 0:a0715ea739cb 963 cnt++;
JojoS 0:a0715ea739cb 964
JojoS 0:a0715ea739cb 965 if (val && cnt > ENDBITS) // if high received then look at log-stop condition
JojoS 0:a0715ea739cb 966 { // if stop condition is true, output on uart
JojoS 0:a0715ea739cb 967 uint_fast8_t i8;
JojoS 0:a0715ea739cb 968 uint_fast16_t i;
JojoS 0:a0715ea739cb 969 uint_fast16_t j;
JojoS 0:a0715ea739cb 970 uint_fast8_t v = '1';
JojoS 0:a0715ea739cb 971 uint_fast16_t d;
JojoS 0:a0715ea739cb 972
JojoS 0:a0715ea739cb 973 for (i8 = 0; i8 < STARTCYCLES; i8++)
JojoS 0:a0715ea739cb 974 {
JojoS 0:a0715ea739cb 975 irmp_uart_putc ('0'); // the ignored starting zeros
JojoS 0:a0715ea739cb 976 }
JojoS 0:a0715ea739cb 977
JojoS 0:a0715ea739cb 978 for (i = 0; i < buf_idx; i++)
JojoS 0:a0715ea739cb 979 {
JojoS 0:a0715ea739cb 980 d = buf[i];
JojoS 0:a0715ea739cb 981
JojoS 0:a0715ea739cb 982 if (d == 0xff)
JojoS 0:a0715ea739cb 983 {
JojoS 0:a0715ea739cb 984 i++;
JojoS 0:a0715ea739cb 985 d = buf[i];
JojoS 0:a0715ea739cb 986 i++;
JojoS 0:a0715ea739cb 987 d |= ((uint_fast16_t) buf[i] << 8);
JojoS 0:a0715ea739cb 988 }
JojoS 0:a0715ea739cb 989
JojoS 0:a0715ea739cb 990 for (j = 0; j < d; j++)
JojoS 0:a0715ea739cb 991 {
JojoS 0:a0715ea739cb 992 irmp_uart_putc (v);
JojoS 0:a0715ea739cb 993 }
JojoS 0:a0715ea739cb 994
JojoS 0:a0715ea739cb 995 v = (v == '1') ? '0' : '1';
JojoS 0:a0715ea739cb 996 }
JojoS 0:a0715ea739cb 997
JojoS 0:a0715ea739cb 998 for (i8 = 0; i8 < 20; i8++)
JojoS 0:a0715ea739cb 999 {
JojoS 0:a0715ea739cb 1000 irmp_uart_putc ('1');
JojoS 0:a0715ea739cb 1001 }
JojoS 0:a0715ea739cb 1002
JojoS 0:a0715ea739cb 1003 irmp_uart_putc ('\n');
JojoS 0:a0715ea739cb 1004 buf_idx = 0;
JojoS 0:a0715ea739cb 1005 last_val = 1;
JojoS 0:a0715ea739cb 1006 cnt = 0;
JojoS 0:a0715ea739cb 1007 }
JojoS 0:a0715ea739cb 1008 }
JojoS 0:a0715ea739cb 1009 else if (buf_idx < DATALEN - 3)
JojoS 0:a0715ea739cb 1010 {
JojoS 0:a0715ea739cb 1011 if (cnt >= 0xff)
JojoS 0:a0715ea739cb 1012 {
JojoS 0:a0715ea739cb 1013 buf[buf_idx++] = 0xff;
JojoS 0:a0715ea739cb 1014 buf[buf_idx++] = (cnt & 0xff);
JojoS 0:a0715ea739cb 1015 buf[buf_idx] = (cnt >> 8);
JojoS 0:a0715ea739cb 1016 }
JojoS 0:a0715ea739cb 1017 else
JojoS 0:a0715ea739cb 1018 {
JojoS 0:a0715ea739cb 1019 buf[buf_idx] = cnt;
JojoS 0:a0715ea739cb 1020 }
JojoS 0:a0715ea739cb 1021
JojoS 0:a0715ea739cb 1022 buf_idx++;
JojoS 0:a0715ea739cb 1023 cnt = 1;
JojoS 0:a0715ea739cb 1024 last_val = val;
JojoS 0:a0715ea739cb 1025 }
JojoS 0:a0715ea739cb 1026 }
JojoS 0:a0715ea739cb 1027 }
JojoS 0:a0715ea739cb 1028 }
JojoS 0:a0715ea739cb 1029
JojoS 0:a0715ea739cb 1030 #else
JojoS 0:a0715ea739cb 1031 #define irmp_log(val)
JojoS 0:a0715ea739cb 1032 #endif //IRMP_LOGGING
JojoS 0:a0715ea739cb 1033
JojoS 0:a0715ea739cb 1034 typedef struct
JojoS 0:a0715ea739cb 1035 {
JojoS 0:a0715ea739cb 1036 uint_fast8_t protocol; // ir protocol
JojoS 0:a0715ea739cb 1037 uint_fast8_t pulse_1_len_min; // minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1038 uint_fast8_t pulse_1_len_max; // maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1039 uint_fast8_t pause_1_len_min; // minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1040 uint_fast8_t pause_1_len_max; // maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1041 uint_fast8_t pulse_0_len_min; // minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1042 uint_fast8_t pulse_0_len_max; // maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1043 uint_fast8_t pause_0_len_min; // minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1044 uint_fast8_t pause_0_len_max; // maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1045 uint_fast8_t address_offset; // address offset
JojoS 0:a0715ea739cb 1046 uint_fast8_t address_end; // end of address
JojoS 0:a0715ea739cb 1047 uint_fast8_t command_offset; // command offset
JojoS 0:a0715ea739cb 1048 uint_fast8_t command_end; // end of command
JojoS 0:a0715ea739cb 1049 uint_fast8_t complete_len; // complete length of frame
JojoS 0:a0715ea739cb 1050 uint_fast8_t stop_bit; // flag: frame has stop bit
JojoS 0:a0715ea739cb 1051 uint_fast8_t lsb_first; // flag: LSB first
JojoS 0:a0715ea739cb 1052 uint_fast8_t flags; // some flags
JojoS 0:a0715ea739cb 1053 } IRMP_PARAMETER;
JojoS 0:a0715ea739cb 1054
JojoS 0:a0715ea739cb 1055 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
JojoS 0:a0715ea739cb 1056
JojoS 0:a0715ea739cb 1057 static const PROGMEM IRMP_PARAMETER sircs_param =
JojoS 0:a0715ea739cb 1058 {
JojoS 0:a0715ea739cb 1059 IRMP_SIRCS_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1060 SIRCS_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1061 SIRCS_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1062 SIRCS_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1063 SIRCS_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1064 SIRCS_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1065 SIRCS_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1066 SIRCS_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1067 SIRCS_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1068 SIRCS_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1069 SIRCS_ADDRESS_OFFSET + SIRCS_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1070 SIRCS_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1071 SIRCS_COMMAND_OFFSET + SIRCS_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1072 SIRCS_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1073 SIRCS_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1074 SIRCS_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1075 SIRCS_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1076 };
JojoS 0:a0715ea739cb 1077
JojoS 0:a0715ea739cb 1078 #endif
JojoS 0:a0715ea739cb 1079
JojoS 0:a0715ea739cb 1080 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 1081
JojoS 0:a0715ea739cb 1082 static const PROGMEM IRMP_PARAMETER nec_param =
JojoS 0:a0715ea739cb 1083 {
JojoS 0:a0715ea739cb 1084 IRMP_NEC_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1085 NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1086 NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1087 NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1088 NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1089 NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1090 NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1091 NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1092 NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1093 NEC_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1094 NEC_ADDRESS_OFFSET + NEC_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1095 NEC_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1096 NEC_COMMAND_OFFSET + NEC_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1097 NEC_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1098 NEC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1099 NEC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1100 NEC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1101 };
JojoS 0:a0715ea739cb 1102
JojoS 0:a0715ea739cb 1103 static const PROGMEM IRMP_PARAMETER nec_rep_param =
JojoS 0:a0715ea739cb 1104 {
JojoS 0:a0715ea739cb 1105 IRMP_NEC_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1106 NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1107 NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1108 NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1109 NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1110 NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1111 NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1112 NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1113 NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1114 0, // address_offset: address offset
JojoS 0:a0715ea739cb 1115 0, // address_end: end of address
JojoS 0:a0715ea739cb 1116 0, // command_offset: command offset
JojoS 0:a0715ea739cb 1117 0, // command_end: end of command
JojoS 0:a0715ea739cb 1118 0, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1119 NEC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1120 NEC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1121 NEC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1122 };
JojoS 0:a0715ea739cb 1123
JojoS 0:a0715ea739cb 1124 #endif
JojoS 0:a0715ea739cb 1125
JojoS 0:a0715ea739cb 1126 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 1127
JojoS 0:a0715ea739cb 1128 static const PROGMEM IRMP_PARAMETER nec42_param =
JojoS 0:a0715ea739cb 1129 {
JojoS 0:a0715ea739cb 1130 IRMP_NEC42_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1131 NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1132 NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1133 NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1134 NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1135 NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1136 NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1137 NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1138 NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1139 NEC42_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1140 NEC42_ADDRESS_OFFSET + NEC42_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1141 NEC42_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1142 NEC42_COMMAND_OFFSET + NEC42_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1143 NEC42_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1144 NEC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1145 NEC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1146 NEC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1147 };
JojoS 0:a0715ea739cb 1148
JojoS 0:a0715ea739cb 1149 #endif
JojoS 0:a0715ea739cb 1150
JojoS 0:a0715ea739cb 1151 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 1152
JojoS 0:a0715ea739cb 1153 static const PROGMEM IRMP_PARAMETER lgair_param =
JojoS 0:a0715ea739cb 1154 {
JojoS 0:a0715ea739cb 1155 IRMP_LGAIR_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1156 NEC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1157 NEC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1158 NEC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1159 NEC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1160 NEC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1161 NEC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1162 NEC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1163 NEC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1164 LGAIR_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1165 LGAIR_ADDRESS_OFFSET + LGAIR_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1166 LGAIR_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1167 LGAIR_COMMAND_OFFSET + LGAIR_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1168 LGAIR_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1169 NEC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1170 NEC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1171 NEC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1172 };
JojoS 0:a0715ea739cb 1173
JojoS 0:a0715ea739cb 1174 #endif
JojoS 0:a0715ea739cb 1175
JojoS 0:a0715ea739cb 1176 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 1177
JojoS 0:a0715ea739cb 1178 static const PROGMEM IRMP_PARAMETER samsung_param =
JojoS 0:a0715ea739cb 1179 {
JojoS 0:a0715ea739cb 1180 IRMP_SAMSUNG_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1181 SAMSUNG_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1182 SAMSUNG_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1183 SAMSUNG_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1184 SAMSUNG_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1185 SAMSUNG_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1186 SAMSUNG_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1187 SAMSUNG_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1188 SAMSUNG_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1189 SAMSUNG_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1190 SAMSUNG_ADDRESS_OFFSET + SAMSUNG_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1191 SAMSUNG_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1192 SAMSUNG_COMMAND_OFFSET + SAMSUNG_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1193 SAMSUNG_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1194 SAMSUNG_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1195 SAMSUNG_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1196 SAMSUNG_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1197 };
JojoS 0:a0715ea739cb 1198
JojoS 0:a0715ea739cb 1199 #endif
JojoS 0:a0715ea739cb 1200
JojoS 0:a0715ea739cb 1201 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 1202
JojoS 0:a0715ea739cb 1203 static const PROGMEM IRMP_PARAMETER telefunken_param =
JojoS 0:a0715ea739cb 1204 {
JojoS 0:a0715ea739cb 1205 IRMP_TELEFUNKEN_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1206 TELEFUNKEN_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1207 TELEFUNKEN_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1208 TELEFUNKEN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1209 TELEFUNKEN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1210 TELEFUNKEN_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1211 TELEFUNKEN_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1212 TELEFUNKEN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1213 TELEFUNKEN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1214 TELEFUNKEN_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1215 TELEFUNKEN_ADDRESS_OFFSET + TELEFUNKEN_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1216 TELEFUNKEN_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1217 TELEFUNKEN_COMMAND_OFFSET + TELEFUNKEN_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1218 TELEFUNKEN_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1219 TELEFUNKEN_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1220 TELEFUNKEN_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1221 TELEFUNKEN_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1222 };
JojoS 0:a0715ea739cb 1223
JojoS 0:a0715ea739cb 1224 #endif
JojoS 0:a0715ea739cb 1225
JojoS 0:a0715ea739cb 1226 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
JojoS 0:a0715ea739cb 1227
JojoS 0:a0715ea739cb 1228 static const PROGMEM IRMP_PARAMETER matsushita_param =
JojoS 0:a0715ea739cb 1229 {
JojoS 0:a0715ea739cb 1230 IRMP_MATSUSHITA_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1231 MATSUSHITA_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1232 MATSUSHITA_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1233 MATSUSHITA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1234 MATSUSHITA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1235 MATSUSHITA_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1236 MATSUSHITA_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1237 MATSUSHITA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1238 MATSUSHITA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1239 MATSUSHITA_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1240 MATSUSHITA_ADDRESS_OFFSET + MATSUSHITA_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1241 MATSUSHITA_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1242 MATSUSHITA_COMMAND_OFFSET + MATSUSHITA_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1243 MATSUSHITA_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1244 MATSUSHITA_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1245 MATSUSHITA_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1246 MATSUSHITA_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1247 };
JojoS 0:a0715ea739cb 1248
JojoS 0:a0715ea739cb 1249 #endif
JojoS 0:a0715ea739cb 1250
JojoS 0:a0715ea739cb 1251 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 1252
JojoS 0:a0715ea739cb 1253 static const PROGMEM IRMP_PARAMETER kaseikyo_param =
JojoS 0:a0715ea739cb 1254 {
JojoS 0:a0715ea739cb 1255 IRMP_KASEIKYO_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1256 KASEIKYO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1257 KASEIKYO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1258 KASEIKYO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1259 KASEIKYO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1260 KASEIKYO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1261 KASEIKYO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1262 KASEIKYO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1263 KASEIKYO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1264 KASEIKYO_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1265 KASEIKYO_ADDRESS_OFFSET + KASEIKYO_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1266 KASEIKYO_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1267 KASEIKYO_COMMAND_OFFSET + KASEIKYO_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1268 KASEIKYO_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1269 KASEIKYO_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1270 KASEIKYO_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1271 KASEIKYO_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1272 };
JojoS 0:a0715ea739cb 1273
JojoS 0:a0715ea739cb 1274 #endif
JojoS 0:a0715ea739cb 1275
JojoS 0:a0715ea739cb 1276 #if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1
JojoS 0:a0715ea739cb 1277
JojoS 0:a0715ea739cb 1278 static const PROGMEM IRMP_PARAMETER panasonic_param =
JojoS 0:a0715ea739cb 1279 {
JojoS 0:a0715ea739cb 1280 IRMP_PANASONIC_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1281 PANASONIC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1282 PANASONIC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1283 PANASONIC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1284 PANASONIC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1285 PANASONIC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1286 PANASONIC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1287 PANASONIC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1288 PANASONIC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1289 PANASONIC_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1290 PANASONIC_ADDRESS_OFFSET + PANASONIC_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1291 PANASONIC_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1292 PANASONIC_COMMAND_OFFSET + PANASONIC_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1293 PANASONIC_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1294 PANASONIC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1295 PANASONIC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1296 PANASONIC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1297 };
JojoS 0:a0715ea739cb 1298
JojoS 0:a0715ea739cb 1299 #endif
JojoS 0:a0715ea739cb 1300
JojoS 0:a0715ea739cb 1301 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
JojoS 0:a0715ea739cb 1302
JojoS 0:a0715ea739cb 1303 static const PROGMEM IRMP_PARAMETER recs80_param =
JojoS 0:a0715ea739cb 1304 {
JojoS 0:a0715ea739cb 1305 IRMP_RECS80_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1306 RECS80_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1307 RECS80_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1308 RECS80_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1309 RECS80_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1310 RECS80_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1311 RECS80_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1312 RECS80_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1313 RECS80_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1314 RECS80_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1315 RECS80_ADDRESS_OFFSET + RECS80_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1316 RECS80_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1317 RECS80_COMMAND_OFFSET + RECS80_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1318 RECS80_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1319 RECS80_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1320 RECS80_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1321 RECS80_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1322 };
JojoS 0:a0715ea739cb 1323
JojoS 0:a0715ea739cb 1324 #endif
JojoS 0:a0715ea739cb 1325
JojoS 0:a0715ea739cb 1326 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
JojoS 0:a0715ea739cb 1327
JojoS 0:a0715ea739cb 1328 static const PROGMEM IRMP_PARAMETER rc5_param =
JojoS 0:a0715ea739cb 1329 {
JojoS 0:a0715ea739cb 1330 IRMP_RC5_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1331 RC5_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1332 RC5_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1333 RC5_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1334 RC5_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1335 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1336 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1337 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1338 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1339 RC5_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1340 RC5_ADDRESS_OFFSET + RC5_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1341 RC5_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1342 RC5_COMMAND_OFFSET + RC5_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1343 RC5_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1344 RC5_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1345 RC5_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1346 RC5_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1347 };
JojoS 0:a0715ea739cb 1348
JojoS 0:a0715ea739cb 1349 #endif
JojoS 0:a0715ea739cb 1350
JojoS 0:a0715ea739cb 1351 #if IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 1352
JojoS 0:a0715ea739cb 1353 static const PROGMEM IRMP_PARAMETER s100_param =
JojoS 0:a0715ea739cb 1354 {
JojoS 0:a0715ea739cb 1355 IRMP_S100_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1356 S100_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1357 S100_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1358 S100_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1359 S100_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1360 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1361 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1362 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1363 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1364 S100_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1365 S100_ADDRESS_OFFSET + S100_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1366 S100_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1367 S100_COMMAND_OFFSET + S100_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1368 S100_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1369 S100_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1370 S100_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1371 S100_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1372 };
JojoS 0:a0715ea739cb 1373
JojoS 0:a0715ea739cb 1374 #endif
JojoS 0:a0715ea739cb 1375
JojoS 0:a0715ea739cb 1376 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 1377
JojoS 0:a0715ea739cb 1378 static const PROGMEM IRMP_PARAMETER denon_param =
JojoS 0:a0715ea739cb 1379 {
JojoS 0:a0715ea739cb 1380 IRMP_DENON_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1381 DENON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1382 DENON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1383 DENON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1384 DENON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1385 DENON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1386 DENON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1387 DENON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1388 DENON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1389 DENON_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1390 DENON_ADDRESS_OFFSET + DENON_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1391 DENON_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1392 DENON_COMMAND_OFFSET + DENON_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1393 DENON_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1394 DENON_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1395 DENON_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1396 DENON_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1397 };
JojoS 0:a0715ea739cb 1398
JojoS 0:a0715ea739cb 1399 #endif
JojoS 0:a0715ea739cb 1400
JojoS 0:a0715ea739cb 1401 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 1402
JojoS 0:a0715ea739cb 1403 static const PROGMEM IRMP_PARAMETER rc6_param =
JojoS 0:a0715ea739cb 1404 {
JojoS 0:a0715ea739cb 1405 IRMP_RC6_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1406
JojoS 0:a0715ea739cb 1407 RC6_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1408 RC6_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1409 RC6_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1410 RC6_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1411 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1412 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1413 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1414 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1415 RC6_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1416 RC6_ADDRESS_OFFSET + RC6_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1417 RC6_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1418 RC6_COMMAND_OFFSET + RC6_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1419 RC6_COMPLETE_DATA_LEN_SHORT, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1420 RC6_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1421 RC6_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1422 RC6_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1423 };
JojoS 0:a0715ea739cb 1424
JojoS 0:a0715ea739cb 1425 #endif
JojoS 0:a0715ea739cb 1426
JojoS 0:a0715ea739cb 1427 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
JojoS 0:a0715ea739cb 1428
JojoS 0:a0715ea739cb 1429 static const PROGMEM IRMP_PARAMETER recs80ext_param =
JojoS 0:a0715ea739cb 1430 {
JojoS 0:a0715ea739cb 1431 IRMP_RECS80EXT_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1432 RECS80EXT_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1433 RECS80EXT_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1434 RECS80EXT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1435 RECS80EXT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1436 RECS80EXT_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1437 RECS80EXT_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1438 RECS80EXT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1439 RECS80EXT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1440 RECS80EXT_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1441 RECS80EXT_ADDRESS_OFFSET + RECS80EXT_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1442 RECS80EXT_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1443 RECS80EXT_COMMAND_OFFSET + RECS80EXT_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1444 RECS80EXT_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1445 RECS80EXT_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1446 RECS80EXT_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1447 RECS80EXT_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1448 };
JojoS 0:a0715ea739cb 1449
JojoS 0:a0715ea739cb 1450 #endif
JojoS 0:a0715ea739cb 1451
JojoS 0:a0715ea739cb 1452 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
JojoS 0:a0715ea739cb 1453
JojoS 0:a0715ea739cb 1454 static const PROGMEM IRMP_PARAMETER nubert_param =
JojoS 0:a0715ea739cb 1455 {
JojoS 0:a0715ea739cb 1456 IRMP_NUBERT_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1457 NUBERT_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1458 NUBERT_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1459 NUBERT_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1460 NUBERT_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1461 NUBERT_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1462 NUBERT_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1463 NUBERT_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1464 NUBERT_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1465 NUBERT_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1466 NUBERT_ADDRESS_OFFSET + NUBERT_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1467 NUBERT_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1468 NUBERT_COMMAND_OFFSET + NUBERT_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1469 NUBERT_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1470 NUBERT_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1471 NUBERT_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1472 NUBERT_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1473 };
JojoS 0:a0715ea739cb 1474
JojoS 0:a0715ea739cb 1475 #endif
JojoS 0:a0715ea739cb 1476
JojoS 0:a0715ea739cb 1477 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
JojoS 0:a0715ea739cb 1478
JojoS 0:a0715ea739cb 1479 static const PROGMEM IRMP_PARAMETER fan_param =
JojoS 0:a0715ea739cb 1480 {
JojoS 0:a0715ea739cb 1481 IRMP_FAN_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1482 FAN_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1483 FAN_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1484 FAN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1485 FAN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1486 FAN_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1487 FAN_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1488 FAN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1489 FAN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1490 FAN_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1491 FAN_ADDRESS_OFFSET + FAN_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1492 FAN_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1493 FAN_COMMAND_OFFSET + FAN_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1494 FAN_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1495 FAN_STOP_BIT, // stop_bit: flag: frame has NO stop bit
JojoS 0:a0715ea739cb 1496 FAN_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1497 FAN_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1498 };
JojoS 0:a0715ea739cb 1499
JojoS 0:a0715ea739cb 1500 #endif
JojoS 0:a0715ea739cb 1501
JojoS 0:a0715ea739cb 1502 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
JojoS 0:a0715ea739cb 1503
JojoS 0:a0715ea739cb 1504 static const PROGMEM IRMP_PARAMETER speaker_param =
JojoS 0:a0715ea739cb 1505 {
JojoS 0:a0715ea739cb 1506 IRMP_SPEAKER_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1507 SPEAKER_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1508 SPEAKER_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1509 SPEAKER_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1510 SPEAKER_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1511 SPEAKER_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1512 SPEAKER_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1513 SPEAKER_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1514 SPEAKER_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1515 SPEAKER_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1516 SPEAKER_ADDRESS_OFFSET + SPEAKER_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1517 SPEAKER_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1518 SPEAKER_COMMAND_OFFSET + SPEAKER_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1519 SPEAKER_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1520 SPEAKER_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1521 SPEAKER_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1522 SPEAKER_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1523 };
JojoS 0:a0715ea739cb 1524
JojoS 0:a0715ea739cb 1525 #endif
JojoS 0:a0715ea739cb 1526
JojoS 0:a0715ea739cb 1527 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 1528
JojoS 0:a0715ea739cb 1529 static const PROGMEM IRMP_PARAMETER bang_olufsen_param =
JojoS 0:a0715ea739cb 1530 {
JojoS 0:a0715ea739cb 1531 IRMP_BANG_OLUFSEN_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1532 BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1533 BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1534 BANG_OLUFSEN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1535 BANG_OLUFSEN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1536 BANG_OLUFSEN_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1537 BANG_OLUFSEN_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1538 BANG_OLUFSEN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1539 BANG_OLUFSEN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1540 BANG_OLUFSEN_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1541 BANG_OLUFSEN_ADDRESS_OFFSET + BANG_OLUFSEN_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1542 BANG_OLUFSEN_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1543 BANG_OLUFSEN_COMMAND_OFFSET + BANG_OLUFSEN_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1544 BANG_OLUFSEN_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1545 BANG_OLUFSEN_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1546 BANG_OLUFSEN_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1547 BANG_OLUFSEN_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1548 };
JojoS 0:a0715ea739cb 1549
JojoS 0:a0715ea739cb 1550 #endif
JojoS 0:a0715ea739cb 1551
JojoS 0:a0715ea739cb 1552 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 1553
JojoS 0:a0715ea739cb 1554 static uint_fast8_t first_bit;
JojoS 0:a0715ea739cb 1555
JojoS 0:a0715ea739cb 1556 static const PROGMEM IRMP_PARAMETER grundig_param =
JojoS 0:a0715ea739cb 1557 {
JojoS 0:a0715ea739cb 1558 IRMP_GRUNDIG_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1559
JojoS 0:a0715ea739cb 1560 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1561 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1562 GRUNDIG_NOKIA_IR60_BIT_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1563 GRUNDIG_NOKIA_IR60_BIT_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1564 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1565 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1566 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1567 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1568 GRUNDIG_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1569 GRUNDIG_ADDRESS_OFFSET + GRUNDIG_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1570 GRUNDIG_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1571 GRUNDIG_COMMAND_OFFSET + GRUNDIG_COMMAND_LEN + 1, // command_end: end of command (USE 1 bit MORE to STORE NOKIA DATA!)
JojoS 0:a0715ea739cb 1572 NOKIA_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: NOKIA instead of GRUNDIG!
JojoS 0:a0715ea739cb 1573 GRUNDIG_NOKIA_IR60_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1574 GRUNDIG_NOKIA_IR60_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1575 GRUNDIG_NOKIA_IR60_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1576 };
JojoS 0:a0715ea739cb 1577
JojoS 0:a0715ea739cb 1578 #endif
JojoS 0:a0715ea739cb 1579
JojoS 0:a0715ea739cb 1580 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 1581
JojoS 0:a0715ea739cb 1582 static const PROGMEM IRMP_PARAMETER ruwido_param =
JojoS 0:a0715ea739cb 1583 {
JojoS 0:a0715ea739cb 1584 IRMP_RUWIDO_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1585 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1586 SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1587 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1588 SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1589 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1590 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1591 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1592 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1593 RUWIDO_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1594 RUWIDO_ADDRESS_OFFSET + RUWIDO_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1595 RUWIDO_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1596 RUWIDO_COMMAND_OFFSET + RUWIDO_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1597 SIEMENS_COMPLETE_DATA_LEN, // complete_len: complete length of frame, here: SIEMENS instead of RUWIDO!
JojoS 0:a0715ea739cb 1598 SIEMENS_OR_RUWIDO_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1599 SIEMENS_OR_RUWIDO_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1600 SIEMENS_OR_RUWIDO_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1601 };
JojoS 0:a0715ea739cb 1602
JojoS 0:a0715ea739cb 1603 #endif
JojoS 0:a0715ea739cb 1604
JojoS 0:a0715ea739cb 1605 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 1606
JojoS 0:a0715ea739cb 1607 static const PROGMEM IRMP_PARAMETER fdc_param =
JojoS 0:a0715ea739cb 1608 {
JojoS 0:a0715ea739cb 1609 IRMP_FDC_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1610 FDC_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1611 FDC_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1612 FDC_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1613 FDC_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1614 FDC_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1615 FDC_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1616 FDC_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1617 FDC_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1618 FDC_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1619 FDC_ADDRESS_OFFSET + FDC_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1620 FDC_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1621 FDC_COMMAND_OFFSET + FDC_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1622 FDC_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1623 FDC_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1624 FDC_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1625 FDC_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1626 };
JojoS 0:a0715ea739cb 1627
JojoS 0:a0715ea739cb 1628 #endif
JojoS 0:a0715ea739cb 1629
JojoS 0:a0715ea739cb 1630 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 1631
JojoS 0:a0715ea739cb 1632 static const PROGMEM IRMP_PARAMETER rccar_param =
JojoS 0:a0715ea739cb 1633 {
JojoS 0:a0715ea739cb 1634 IRMP_RCCAR_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1635 RCCAR_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1636 RCCAR_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1637 RCCAR_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1638 RCCAR_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1639 RCCAR_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1640 RCCAR_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1641 RCCAR_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1642 RCCAR_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1643 RCCAR_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1644 RCCAR_ADDRESS_OFFSET + RCCAR_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1645 RCCAR_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1646 RCCAR_COMMAND_OFFSET + RCCAR_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1647 RCCAR_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1648 RCCAR_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1649 RCCAR_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1650 RCCAR_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1651 };
JojoS 0:a0715ea739cb 1652
JojoS 0:a0715ea739cb 1653 #endif
JojoS 0:a0715ea739cb 1654
JojoS 0:a0715ea739cb 1655 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
JojoS 0:a0715ea739cb 1656
JojoS 0:a0715ea739cb 1657 static const PROGMEM IRMP_PARAMETER nikon_param =
JojoS 0:a0715ea739cb 1658 {
JojoS 0:a0715ea739cb 1659 IRMP_NIKON_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1660 NIKON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1661 NIKON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1662 NIKON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1663 NIKON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1664 NIKON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1665 NIKON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1666 NIKON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1667 NIKON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1668 NIKON_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1669 NIKON_ADDRESS_OFFSET + NIKON_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1670 NIKON_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1671 NIKON_COMMAND_OFFSET + NIKON_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1672 NIKON_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1673 NIKON_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1674 NIKON_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1675 NIKON_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1676 };
JojoS 0:a0715ea739cb 1677
JojoS 0:a0715ea739cb 1678 #endif
JojoS 0:a0715ea739cb 1679
JojoS 0:a0715ea739cb 1680 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 1681
JojoS 0:a0715ea739cb 1682 static const PROGMEM IRMP_PARAMETER kathrein_param =
JojoS 0:a0715ea739cb 1683 {
JojoS 0:a0715ea739cb 1684 IRMP_KATHREIN_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1685 KATHREIN_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1686 KATHREIN_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1687 KATHREIN_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1688 KATHREIN_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1689 KATHREIN_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1690 KATHREIN_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1691 KATHREIN_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1692 KATHREIN_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1693 KATHREIN_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1694 KATHREIN_ADDRESS_OFFSET + KATHREIN_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1695 KATHREIN_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1696 KATHREIN_COMMAND_OFFSET + KATHREIN_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1697 KATHREIN_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1698 KATHREIN_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1699 KATHREIN_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1700 KATHREIN_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1701 };
JojoS 0:a0715ea739cb 1702
JojoS 0:a0715ea739cb 1703 #endif
JojoS 0:a0715ea739cb 1704
JojoS 0:a0715ea739cb 1705 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 1706
JojoS 0:a0715ea739cb 1707 static const PROGMEM IRMP_PARAMETER netbox_param =
JojoS 0:a0715ea739cb 1708 {
JojoS 0:a0715ea739cb 1709 IRMP_NETBOX_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1710 NETBOX_PULSE_LEN, // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value
JojoS 0:a0715ea739cb 1711 NETBOX_PULSE_REST_LEN, // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value
JojoS 0:a0715ea739cb 1712 NETBOX_PAUSE_LEN, // pause_1_len_min: minimum length of pause with bit value 1, here: exact value
JojoS 0:a0715ea739cb 1713 NETBOX_PAUSE_REST_LEN, // pause_1_len_max: maximum length of pause with bit value 1, here: rest value
JojoS 0:a0715ea739cb 1714 NETBOX_PULSE_LEN, // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value
JojoS 0:a0715ea739cb 1715 NETBOX_PULSE_REST_LEN, // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value
JojoS 0:a0715ea739cb 1716 NETBOX_PAUSE_LEN, // pause_0_len_min: minimum length of pause with bit value 0, here: exact value
JojoS 0:a0715ea739cb 1717 NETBOX_PAUSE_REST_LEN, // pause_0_len_max: maximum length of pause with bit value 0, here: rest value
JojoS 0:a0715ea739cb 1718 NETBOX_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1719 NETBOX_ADDRESS_OFFSET + NETBOX_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1720 NETBOX_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1721 NETBOX_COMMAND_OFFSET + NETBOX_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1722 NETBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1723 NETBOX_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1724 NETBOX_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1725 NETBOX_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1726 };
JojoS 0:a0715ea739cb 1727
JojoS 0:a0715ea739cb 1728 #endif
JojoS 0:a0715ea739cb 1729
JojoS 0:a0715ea739cb 1730 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
JojoS 0:a0715ea739cb 1731
JojoS 0:a0715ea739cb 1732 static const PROGMEM IRMP_PARAMETER lego_param =
JojoS 0:a0715ea739cb 1733 {
JojoS 0:a0715ea739cb 1734 IRMP_LEGO_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1735 LEGO_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1736 LEGO_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1737 LEGO_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1738 LEGO_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1739 LEGO_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1740 LEGO_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1741 LEGO_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1742 LEGO_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1743 LEGO_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1744 LEGO_ADDRESS_OFFSET + LEGO_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1745 LEGO_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1746 LEGO_COMMAND_OFFSET + LEGO_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1747 LEGO_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1748 LEGO_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1749 LEGO_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1750 LEGO_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1751 };
JojoS 0:a0715ea739cb 1752
JojoS 0:a0715ea739cb 1753 #endif
JojoS 0:a0715ea739cb 1754
JojoS 0:a0715ea739cb 1755 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
JojoS 0:a0715ea739cb 1756
JojoS 0:a0715ea739cb 1757 static const PROGMEM IRMP_PARAMETER thomson_param =
JojoS 0:a0715ea739cb 1758 {
JojoS 0:a0715ea739cb 1759 IRMP_THOMSON_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1760 THOMSON_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1761 THOMSON_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1762 THOMSON_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1763 THOMSON_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1764 THOMSON_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1765 THOMSON_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1766 THOMSON_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1767 THOMSON_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1768 THOMSON_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1769 THOMSON_ADDRESS_OFFSET + THOMSON_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1770 THOMSON_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1771 THOMSON_COMMAND_OFFSET + THOMSON_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1772 THOMSON_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1773 THOMSON_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1774 THOMSON_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1775 THOMSON_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1776 };
JojoS 0:a0715ea739cb 1777
JojoS 0:a0715ea739cb 1778 #endif
JojoS 0:a0715ea739cb 1779
JojoS 0:a0715ea739cb 1780 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
JojoS 0:a0715ea739cb 1781
JojoS 0:a0715ea739cb 1782 static const PROGMEM IRMP_PARAMETER bose_param =
JojoS 0:a0715ea739cb 1783 {
JojoS 0:a0715ea739cb 1784 IRMP_BOSE_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1785 BOSE_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1786 BOSE_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1787 BOSE_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1788 BOSE_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1789 BOSE_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1790 BOSE_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1791 BOSE_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1792 BOSE_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1793 BOSE_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1794 BOSE_ADDRESS_OFFSET + BOSE_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1795 BOSE_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1796 BOSE_COMMAND_OFFSET + BOSE_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1797 BOSE_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1798 BOSE_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1799 BOSE_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1800 BOSE_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1801 };
JojoS 0:a0715ea739cb 1802
JojoS 0:a0715ea739cb 1803 #endif
JojoS 0:a0715ea739cb 1804
JojoS 0:a0715ea739cb 1805 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 1806
JojoS 0:a0715ea739cb 1807 static const PROGMEM IRMP_PARAMETER a1tvbox_param =
JojoS 0:a0715ea739cb 1808 {
JojoS 0:a0715ea739cb 1809 IRMP_A1TVBOX_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1810
JojoS 0:a0715ea739cb 1811 A1TVBOX_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1812 A1TVBOX_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1813 A1TVBOX_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1814 A1TVBOX_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1815 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1816 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1817 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1818 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1819 A1TVBOX_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1820 A1TVBOX_ADDRESS_OFFSET + A1TVBOX_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1821 A1TVBOX_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1822 A1TVBOX_COMMAND_OFFSET + A1TVBOX_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1823 A1TVBOX_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1824 A1TVBOX_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1825 A1TVBOX_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1826 A1TVBOX_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1827 };
JojoS 0:a0715ea739cb 1828
JojoS 0:a0715ea739cb 1829 #endif
JojoS 0:a0715ea739cb 1830
JojoS 0:a0715ea739cb 1831 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 1832
JojoS 0:a0715ea739cb 1833 static const PROGMEM IRMP_PARAMETER merlin_param =
JojoS 0:a0715ea739cb 1834 {
JojoS 0:a0715ea739cb 1835 IRMP_MERLIN_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1836
JojoS 0:a0715ea739cb 1837 MERLIN_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1838 MERLIN_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1839 MERLIN_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1840 MERLIN_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1841 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1842 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1843 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1844 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1845 MERLIN_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1846 MERLIN_ADDRESS_OFFSET + MERLIN_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1847 MERLIN_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1848 MERLIN_COMMAND_OFFSET + MERLIN_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1849 MERLIN_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1850 MERLIN_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1851 MERLIN_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1852 MERLIN_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1853 };
JojoS 0:a0715ea739cb 1854
JojoS 0:a0715ea739cb 1855 #endif
JojoS 0:a0715ea739cb 1856
JojoS 0:a0715ea739cb 1857 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 1858
JojoS 0:a0715ea739cb 1859 static const PROGMEM IRMP_PARAMETER ortek_param =
JojoS 0:a0715ea739cb 1860 {
JojoS 0:a0715ea739cb 1861 IRMP_ORTEK_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1862
JojoS 0:a0715ea739cb 1863 ORTEK_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1864 ORTEK_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1865 ORTEK_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1866 ORTEK_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1867 0, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1868 0, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1869 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1870 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1871 ORTEK_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1872 ORTEK_ADDRESS_OFFSET + ORTEK_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1873 ORTEK_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1874 ORTEK_COMMAND_OFFSET + ORTEK_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1875 ORTEK_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1876 ORTEK_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1877 ORTEK_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1878 ORTEK_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1879 };
JojoS 0:a0715ea739cb 1880
JojoS 0:a0715ea739cb 1881 #endif
JojoS 0:a0715ea739cb 1882
JojoS 0:a0715ea739cb 1883 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
JojoS 0:a0715ea739cb 1884
JojoS 0:a0715ea739cb 1885 static const PROGMEM IRMP_PARAMETER roomba_param =
JojoS 0:a0715ea739cb 1886 {
JojoS 0:a0715ea739cb 1887 IRMP_ROOMBA_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1888 ROOMBA_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1889 ROOMBA_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1890 ROOMBA_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1891 ROOMBA_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1892 ROOMBA_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1893 ROOMBA_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1894 ROOMBA_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1895 ROOMBA_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1896 ROOMBA_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1897 ROOMBA_ADDRESS_OFFSET + ROOMBA_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1898 ROOMBA_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1899 ROOMBA_COMMAND_OFFSET + ROOMBA_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1900 ROOMBA_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1901 ROOMBA_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1902 ROOMBA_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1903 ROOMBA_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1904 };
JojoS 0:a0715ea739cb 1905
JojoS 0:a0715ea739cb 1906 #endif
JojoS 0:a0715ea739cb 1907
JojoS 0:a0715ea739cb 1908 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 1909
JojoS 0:a0715ea739cb 1910 static const PROGMEM IRMP_PARAMETER rcmm_param =
JojoS 0:a0715ea739cb 1911 {
JojoS 0:a0715ea739cb 1912 IRMP_RCMM32_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1913
JojoS 0:a0715ea739cb 1914 RCMM32_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse
JojoS 0:a0715ea739cb 1915 RCMM32_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse
JojoS 0:a0715ea739cb 1916 0, // pause_1_len_min: here: minimum length of short pause
JojoS 0:a0715ea739cb 1917 0, // pause_1_len_max: here: maximum length of short pause
JojoS 0:a0715ea739cb 1918 RCMM32_BIT_PULSE_LEN_MIN, // pulse_0_len_min: here: not used
JojoS 0:a0715ea739cb 1919 RCMM32_BIT_PULSE_LEN_MAX, // pulse_0_len_max: here: not used
JojoS 0:a0715ea739cb 1920 0, // pause_0_len_min: here: not used
JojoS 0:a0715ea739cb 1921 0, // pause_0_len_max: here: not used
JojoS 0:a0715ea739cb 1922 RCMM32_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1923 RCMM32_ADDRESS_OFFSET + RCMM32_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1924 RCMM32_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1925 RCMM32_COMMAND_OFFSET + RCMM32_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1926 RCMM32_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1927 RCMM32_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1928 RCMM32_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1929 RCMM32_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1930 };
JojoS 0:a0715ea739cb 1931
JojoS 0:a0715ea739cb 1932 #endif
JojoS 0:a0715ea739cb 1933
JojoS 0:a0715ea739cb 1934 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
JojoS 0:a0715ea739cb 1935
JojoS 0:a0715ea739cb 1936 static const PROGMEM IRMP_PARAMETER pentax_param =
JojoS 0:a0715ea739cb 1937 {
JojoS 0:a0715ea739cb 1938 IRMP_PENTAX_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1939 PENTAX_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1940 PENTAX_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1941 PENTAX_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1942 PENTAX_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1943 PENTAX_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1944 PENTAX_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1945 PENTAX_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1946 PENTAX_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1947 PENTAX_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1948 PENTAX_ADDRESS_OFFSET + PENTAX_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1949 PENTAX_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1950 PENTAX_COMMAND_OFFSET + PENTAX_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1951 PENTAX_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1952 PENTAX_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1953 PENTAX_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1954 PENTAX_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1955 };
JojoS 0:a0715ea739cb 1956
JojoS 0:a0715ea739cb 1957 #endif
JojoS 0:a0715ea739cb 1958
JojoS 0:a0715ea739cb 1959 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
JojoS 0:a0715ea739cb 1960
JojoS 0:a0715ea739cb 1961 static const PROGMEM IRMP_PARAMETER acp24_param =
JojoS 0:a0715ea739cb 1962 {
JojoS 0:a0715ea739cb 1963 IRMP_ACP24_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1964 ACP24_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1965 ACP24_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1966 ACP24_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1967 ACP24_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1968 ACP24_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1969 ACP24_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1970 ACP24_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1971 ACP24_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1972 ACP24_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1973 ACP24_ADDRESS_OFFSET + ACP24_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 1974 ACP24_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 1975 ACP24_COMMAND_OFFSET + ACP24_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 1976 ACP24_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 1977 ACP24_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 1978 ACP24_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 1979 ACP24_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 1980 };
JojoS 0:a0715ea739cb 1981
JojoS 0:a0715ea739cb 1982 #endif
JojoS 0:a0715ea739cb 1983
JojoS 0:a0715ea739cb 1984 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
JojoS 0:a0715ea739cb 1985
JojoS 0:a0715ea739cb 1986 static const PROGMEM IRMP_PARAMETER radio1_param =
JojoS 0:a0715ea739cb 1987 {
JojoS 0:a0715ea739cb 1988 IRMP_RADIO1_PROTOCOL, // protocol: ir protocol
JojoS 0:a0715ea739cb 1989
JojoS 0:a0715ea739cb 1990 RADIO1_1_PULSE_LEN_MIN, // pulse_1_len_min: minimum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1991 RADIO1_1_PULSE_LEN_MAX, // pulse_1_len_max: maximum length of pulse with bit value 1
JojoS 0:a0715ea739cb 1992 RADIO1_1_PAUSE_LEN_MIN, // pause_1_len_min: minimum length of pause with bit value 1
JojoS 0:a0715ea739cb 1993 RADIO1_1_PAUSE_LEN_MAX, // pause_1_len_max: maximum length of pause with bit value 1
JojoS 0:a0715ea739cb 1994 RADIO1_0_PULSE_LEN_MIN, // pulse_0_len_min: minimum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1995 RADIO1_0_PULSE_LEN_MAX, // pulse_0_len_max: maximum length of pulse with bit value 0
JojoS 0:a0715ea739cb 1996 RADIO1_0_PAUSE_LEN_MIN, // pause_0_len_min: minimum length of pause with bit value 0
JojoS 0:a0715ea739cb 1997 RADIO1_0_PAUSE_LEN_MAX, // pause_0_len_max: maximum length of pause with bit value 0
JojoS 0:a0715ea739cb 1998 RADIO1_ADDRESS_OFFSET, // address_offset: address offset
JojoS 0:a0715ea739cb 1999 RADIO1_ADDRESS_OFFSET + RADIO1_ADDRESS_LEN, // address_end: end of address
JojoS 0:a0715ea739cb 2000 RADIO1_COMMAND_OFFSET, // command_offset: command offset
JojoS 0:a0715ea739cb 2001 RADIO1_COMMAND_OFFSET + RADIO1_COMMAND_LEN, // command_end: end of command
JojoS 0:a0715ea739cb 2002 RADIO1_COMPLETE_DATA_LEN, // complete_len: complete length of frame
JojoS 0:a0715ea739cb 2003 RADIO1_STOP_BIT, // stop_bit: flag: frame has stop bit
JojoS 0:a0715ea739cb 2004 RADIO1_LSB, // lsb_first: flag: LSB first
JojoS 0:a0715ea739cb 2005 RADIO1_FLAGS // flags: some flags
JojoS 0:a0715ea739cb 2006 };
JojoS 0:a0715ea739cb 2007
JojoS 0:a0715ea739cb 2008 #endif
JojoS 0:a0715ea739cb 2009
JojoS 0:a0715ea739cb 2010 static uint_fast8_t irmp_bit; // current bit position
JojoS 0:a0715ea739cb 2011 static IRMP_PARAMETER irmp_param;
JojoS 0:a0715ea739cb 2012
JojoS 0:a0715ea739cb 2013 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 2014 static IRMP_PARAMETER irmp_param2;
JojoS 0:a0715ea739cb 2015 #endif
JojoS 0:a0715ea739cb 2016
JojoS 0:a0715ea739cb 2017 static volatile uint_fast8_t irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 2018 static volatile uint_fast8_t irmp_protocol;
JojoS 0:a0715ea739cb 2019 static volatile uint_fast16_t irmp_address;
JojoS 0:a0715ea739cb 2020 static volatile uint_fast16_t irmp_command;
JojoS 0:a0715ea739cb 2021 static volatile uint_fast16_t irmp_id; // only used for SAMSUNG protocol
JojoS 0:a0715ea739cb 2022 static volatile uint_fast8_t irmp_flags;
JojoS 0:a0715ea739cb 2023 // static volatile uint_fast8_t irmp_busy_flag;
JojoS 0:a0715ea739cb 2024
JojoS 0:a0715ea739cb 2025 #if defined(__MBED__)
JojoS 0:a0715ea739cb 2026 // DigitalIn inputPin(IRMP_PIN, PullUp); // this requires mbed.h and source to be compiled as cpp
JojoS 0:a0715ea739cb 2027 gpio_t gpioIRin; // use low level c function instead
JojoS 0:a0715ea739cb 2028 #endif
JojoS 0:a0715ea739cb 2029
JojoS 0:a0715ea739cb 2030
JojoS 0:a0715ea739cb 2031 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2032 #define input(x) (x)
JojoS 0:a0715ea739cb 2033 static uint_fast8_t IRMP_PIN;
JojoS 0:a0715ea739cb 2034 static uint_fast8_t radio;
JojoS 0:a0715ea739cb 2035 #endif
JojoS 0:a0715ea739cb 2036
JojoS 0:a0715ea739cb 2037 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2038 * Initialize IRMP decoder
JojoS 0:a0715ea739cb 2039 * @details Configures IRMP input pin
JojoS 0:a0715ea739cb 2040 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2041 */
JojoS 0:a0715ea739cb 2042 #ifndef ANALYZE
JojoS 0:a0715ea739cb 2043 void
JojoS 0:a0715ea739cb 2044 irmp_init (void)
JojoS 0:a0715ea739cb 2045 {
JojoS 0:a0715ea739cb 2046 #if defined(PIC_CCS) || defined(PIC_C18) // PIC: do nothing
JojoS 0:a0715ea739cb 2047 #elif defined (ARM_STM32) // STM32
JojoS 0:a0715ea739cb 2048 GPIO_InitTypeDef GPIO_InitStructure;
JojoS 0:a0715ea739cb 2049
JojoS 0:a0715ea739cb 2050 /* GPIOx clock enable */
JojoS 0:a0715ea739cb 2051 # if defined (ARM_STM32L1XX)
JojoS 0:a0715ea739cb 2052 RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE);
JojoS 0:a0715ea739cb 2053 # elif defined (ARM_STM32F10X)
JojoS 0:a0715ea739cb 2054 RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE);
JojoS 0:a0715ea739cb 2055 # elif defined (ARM_STM32F4XX)
JojoS 0:a0715ea739cb 2056 RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE);
JojoS 0:a0715ea739cb 2057 # endif
JojoS 0:a0715ea739cb 2058
JojoS 0:a0715ea739cb 2059 /* GPIO Configuration */
JojoS 0:a0715ea739cb 2060 GPIO_InitStructure.GPIO_Pin = IRMP_BIT;
JojoS 0:a0715ea739cb 2061 # if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)
JojoS 0:a0715ea739cb 2062 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
JojoS 0:a0715ea739cb 2063 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
JojoS 0:a0715ea739cb 2064 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
JojoS 0:a0715ea739cb 2065 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
JojoS 0:a0715ea739cb 2066 # elif defined (ARM_STM32F10X)
JojoS 0:a0715ea739cb 2067 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
JojoS 0:a0715ea739cb 2068 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
JojoS 0:a0715ea739cb 2069 # endif
JojoS 0:a0715ea739cb 2070 GPIO_Init(IRMP_PORT, &GPIO_InitStructure);
JojoS 0:a0715ea739cb 2071
JojoS 0:a0715ea739cb 2072 #elif defined(STELLARIS_ARM_CORTEX_M4)
JojoS 0:a0715ea739cb 2073 // Enable the GPIO port
JojoS 0:a0715ea739cb 2074 ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH);
JojoS 0:a0715ea739cb 2075
JojoS 0:a0715ea739cb 2076 // Set as an input
JojoS 0:a0715ea739cb 2077 ROM_GPIODirModeSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_DIR_MODE_IN);
JojoS 0:a0715ea739cb 2078 ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
JojoS 0:a0715ea739cb 2079
JojoS 0:a0715ea739cb 2080 #elif defined(__SDCC_stm8) // STM8
JojoS 0:a0715ea739cb 2081 IRMP_GPIO_STRUCT->DDR &= ~(1<<IRMP_BIT); // pin is input
JojoS 0:a0715ea739cb 2082 IRMP_GPIO_STRUCT->CR1 |= (1<<IRMP_BIT); // activate pullup
JojoS 0:a0715ea739cb 2083
JojoS 0:a0715ea739cb 2084 #elif defined (TEENSY_ARM_CORTEX_M4) // TEENSY
JojoS 0:a0715ea739cb 2085 pinMode(IRMP_PIN, INPUT);
JojoS 0:a0715ea739cb 2086
JojoS 0:a0715ea739cb 2087 #elif defined(__MBED__)
JojoS 0:a0715ea739cb 2088 gpio_init_in_ex(&gpioIRin, IRMP_PIN, IRMP_PINMODE); // initialize input for IR diode
JojoS 0:a0715ea739cb 2089
JojoS 0:a0715ea739cb 2090 #else // AVR
JojoS 0:a0715ea739cb 2091 IRMP_PORT &= ~(1<<IRMP_BIT); // deactivate pullup
JojoS 0:a0715ea739cb 2092 IRMP_DDR &= ~(1<<IRMP_BIT); // set pin to input
JojoS 0:a0715ea739cb 2093 #endif
JojoS 0:a0715ea739cb 2094
JojoS 0:a0715ea739cb 2095 #if IRMP_LOGGING == 1
JojoS 0:a0715ea739cb 2096 irmp_uart_init ();
JojoS 0:a0715ea739cb 2097 #endif
JojoS 0:a0715ea739cb 2098 }
JojoS 0:a0715ea739cb 2099 #endif
JojoS 0:a0715ea739cb 2100 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2101 * Get IRMP data
JojoS 0:a0715ea739cb 2102 * @details gets decoded IRMP data
JojoS 0:a0715ea739cb 2103 * @param pointer in order to store IRMP data
JojoS 0:a0715ea739cb 2104 * @return TRUE: successful, FALSE: failed
JojoS 0:a0715ea739cb 2105 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2106 */
JojoS 0:a0715ea739cb 2107 uint_fast8_t
JojoS 0:a0715ea739cb 2108 irmp_get_data (IRMP_DATA * irmp_data_p)
JojoS 0:a0715ea739cb 2109 {
JojoS 0:a0715ea739cb 2110 uint_fast8_t rtc = FALSE;
JojoS 0:a0715ea739cb 2111
JojoS 0:a0715ea739cb 2112 if (irmp_ir_detected)
JojoS 0:a0715ea739cb 2113 {
JojoS 0:a0715ea739cb 2114 switch (irmp_protocol)
JojoS 0:a0715ea739cb 2115 {
JojoS 0:a0715ea739cb 2116 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2117 case IRMP_SAMSUNG_PROTOCOL:
JojoS 0:a0715ea739cb 2118 if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
JojoS 0:a0715ea739cb 2119 {
JojoS 0:a0715ea739cb 2120 irmp_command &= 0xff;
JojoS 0:a0715ea739cb 2121 irmp_command |= irmp_id << 8;
JojoS 0:a0715ea739cb 2122 rtc = TRUE;
JojoS 0:a0715ea739cb 2123 }
JojoS 0:a0715ea739cb 2124 break;
JojoS 0:a0715ea739cb 2125
JojoS 0:a0715ea739cb 2126 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
JojoS 0:a0715ea739cb 2127 case IRMP_SAMSUNG48_PROTOCOL:
JojoS 0:a0715ea739cb 2128 irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8);
JojoS 0:a0715ea739cb 2129 rtc = TRUE;
JojoS 0:a0715ea739cb 2130 break;
JojoS 0:a0715ea739cb 2131 #endif
JojoS 0:a0715ea739cb 2132 #endif
JojoS 0:a0715ea739cb 2133
JojoS 0:a0715ea739cb 2134 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2135 case IRMP_NEC_PROTOCOL:
JojoS 0:a0715ea739cb 2136 if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
JojoS 0:a0715ea739cb 2137 {
JojoS 0:a0715ea739cb 2138 irmp_command &= 0xff;
JojoS 0:a0715ea739cb 2139 rtc = TRUE;
JojoS 0:a0715ea739cb 2140 }
JojoS 0:a0715ea739cb 2141 else if (irmp_address == 0x87EE)
JojoS 0:a0715ea739cb 2142 {
JojoS 0:a0715ea739cb 2143 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2144 ANALYZE_PRINTF ("Switching to APPLE protocol\n");
JojoS 0:a0715ea739cb 2145 #endif // ANALYZE
JojoS 0:a0715ea739cb 2146 irmp_protocol = IRMP_APPLE_PROTOCOL;
JojoS 0:a0715ea739cb 2147 irmp_address = (irmp_command & 0xFF00) >> 8;
JojoS 0:a0715ea739cb 2148 irmp_command &= 0x00FF;
JojoS 0:a0715ea739cb 2149 rtc = TRUE;
JojoS 0:a0715ea739cb 2150 }
JojoS 0:a0715ea739cb 2151 break;
JojoS 0:a0715ea739cb 2152 #endif
JojoS 0:a0715ea739cb 2153 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
JojoS 0:a0715ea739cb 2154 case IRMP_BOSE_PROTOCOL:
JojoS 0:a0715ea739cb 2155 if ((irmp_command >> 8) == (~irmp_command & 0x00FF))
JojoS 0:a0715ea739cb 2156 {
JojoS 0:a0715ea739cb 2157 irmp_command &= 0xff;
JojoS 0:a0715ea739cb 2158 rtc = TRUE;
JojoS 0:a0715ea739cb 2159 }
JojoS 0:a0715ea739cb 2160 break;
JojoS 0:a0715ea739cb 2161 #endif
JojoS 0:a0715ea739cb 2162 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2163 case IRMP_SIEMENS_PROTOCOL:
JojoS 0:a0715ea739cb 2164 case IRMP_RUWIDO_PROTOCOL:
JojoS 0:a0715ea739cb 2165 if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001))
JojoS 0:a0715ea739cb 2166 {
JojoS 0:a0715ea739cb 2167 irmp_command >>= 1;
JojoS 0:a0715ea739cb 2168 rtc = TRUE;
JojoS 0:a0715ea739cb 2169 }
JojoS 0:a0715ea739cb 2170 break;
JojoS 0:a0715ea739cb 2171 #endif
JojoS 0:a0715ea739cb 2172 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 2173 case IRMP_KATHREIN_PROTOCOL:
JojoS 0:a0715ea739cb 2174 if (irmp_command != 0x0000)
JojoS 0:a0715ea739cb 2175 {
JojoS 0:a0715ea739cb 2176 rtc = TRUE;
JojoS 0:a0715ea739cb 2177 }
JojoS 0:a0715ea739cb 2178 break;
JojoS 0:a0715ea739cb 2179 #endif
JojoS 0:a0715ea739cb 2180 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
JojoS 0:a0715ea739cb 2181 case IRMP_RC5_PROTOCOL:
JojoS 0:a0715ea739cb 2182 irmp_address &= ~0x20; // clear toggle bit
JojoS 0:a0715ea739cb 2183 rtc = TRUE;
JojoS 0:a0715ea739cb 2184 break;
JojoS 0:a0715ea739cb 2185 #endif
JojoS 0:a0715ea739cb 2186 #if IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 2187 case IRMP_S100_PROTOCOL:
JojoS 0:a0715ea739cb 2188 irmp_address &= ~0x20; // clear toggle bit
JojoS 0:a0715ea739cb 2189 rtc = TRUE;
JojoS 0:a0715ea739cb 2190 break;
JojoS 0:a0715ea739cb 2191 #endif
JojoS 0:a0715ea739cb 2192 #if IRMP_SUPPORT_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 2193 case IRMP_IR60_PROTOCOL:
JojoS 0:a0715ea739cb 2194 if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame
JojoS 0:a0715ea739cb 2195 {
JojoS 0:a0715ea739cb 2196 rtc = TRUE;
JojoS 0:a0715ea739cb 2197 }
JojoS 0:a0715ea739cb 2198 else
JojoS 0:a0715ea739cb 2199 {
JojoS 0:a0715ea739cb 2200 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2201 ANALYZE_PRINTF("Info IR60: got start instruction frame\n");
JojoS 0:a0715ea739cb 2202 #endif // ANALYZE
JojoS 0:a0715ea739cb 2203 }
JojoS 0:a0715ea739cb 2204 break;
JojoS 0:a0715ea739cb 2205 #endif
JojoS 0:a0715ea739cb 2206 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 2207 case IRMP_RCCAR_PROTOCOL:
JojoS 0:a0715ea739cb 2208 // frame in irmp_data:
JojoS 0:a0715ea739cb 2209 // Bit 12 11 10 9 8 7 6 5 4 3 2 1 0
JojoS 0:a0715ea739cb 2210 // V D7 D6 D5 D4 D3 D2 D1 D0 A1 A0 C1 C0 // 10 9 8 7 6 5 4 3 2 1 0
JojoS 0:a0715ea739cb 2211 irmp_address = (irmp_command & 0x000C) >> 2; // addr: 0 0 0 0 0 0 0 0 0 A1 A0
JojoS 0:a0715ea739cb 2212 irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0
JojoS 0:a0715ea739cb 2213 ((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0
JojoS 0:a0715ea739cb 2214 ((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0
JojoS 0:a0715ea739cb 2215 rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0
JojoS 0:a0715ea739cb 2216 break;
JojoS 0:a0715ea739cb 2217 #endif
JojoS 0:a0715ea739cb 2218
JojoS 0:a0715ea739cb 2219 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 // squeeze code to 8 bit, upper bit indicates release-key
JojoS 0:a0715ea739cb 2220 case IRMP_NETBOX_PROTOCOL:
JojoS 0:a0715ea739cb 2221 if (irmp_command & 0x1000) // last bit set?
JojoS 0:a0715ea739cb 2222 {
JojoS 0:a0715ea739cb 2223 if ((irmp_command & 0x1f) == 0x15) // key pressed: 101 01 (LSB)
JojoS 0:a0715ea739cb 2224 {
JojoS 0:a0715ea739cb 2225 irmp_command >>= 5;
JojoS 0:a0715ea739cb 2226 irmp_command &= 0x7F;
JojoS 0:a0715ea739cb 2227 rtc = TRUE;
JojoS 0:a0715ea739cb 2228 }
JojoS 0:a0715ea739cb 2229 else if ((irmp_command & 0x1f) == 0x10) // key released: 000 01 (LSB)
JojoS 0:a0715ea739cb 2230 {
JojoS 0:a0715ea739cb 2231 irmp_command >>= 5;
JojoS 0:a0715ea739cb 2232 irmp_command |= 0x80;
JojoS 0:a0715ea739cb 2233 rtc = TRUE;
JojoS 0:a0715ea739cb 2234 }
JojoS 0:a0715ea739cb 2235 else
JojoS 0:a0715ea739cb 2236 {
JojoS 0:a0715ea739cb 2237 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2238 ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");
JojoS 0:a0715ea739cb 2239 #endif // ANALYZE
JojoS 0:a0715ea739cb 2240 }
JojoS 0:a0715ea739cb 2241 }
JojoS 0:a0715ea739cb 2242 else
JojoS 0:a0715ea739cb 2243 {
JojoS 0:a0715ea739cb 2244 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2245 ANALYZE_PRINTF("error NETBOX: last bit not set\n");
JojoS 0:a0715ea739cb 2246 #endif // ANALYZE
JojoS 0:a0715ea739cb 2247 }
JojoS 0:a0715ea739cb 2248 break;
JojoS 0:a0715ea739cb 2249 #endif
JojoS 0:a0715ea739cb 2250 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2251 case IRMP_LEGO_PROTOCOL:
JojoS 0:a0715ea739cb 2252 {
JojoS 0:a0715ea739cb 2253 uint_fast8_t crc = 0x0F ^ ((irmp_command & 0xF000) >> 12) ^ ((irmp_command & 0x0F00) >> 8) ^ ((irmp_command & 0x00F0) >> 4);
JojoS 0:a0715ea739cb 2254
JojoS 0:a0715ea739cb 2255 if ((irmp_command & 0x000F) == crc)
JojoS 0:a0715ea739cb 2256 {
JojoS 0:a0715ea739cb 2257 irmp_command >>= 4;
JojoS 0:a0715ea739cb 2258 rtc = TRUE;
JojoS 0:a0715ea739cb 2259 }
JojoS 0:a0715ea739cb 2260 else
JojoS 0:a0715ea739cb 2261 {
JojoS 0:a0715ea739cb 2262 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2263 ANALYZE_PRINTF ("CRC error in LEGO protocol\n");
JojoS 0:a0715ea739cb 2264 #endif // ANALYZE
JojoS 0:a0715ea739cb 2265 // rtc = TRUE; // don't accept codes with CRC errors
JojoS 0:a0715ea739cb 2266 }
JojoS 0:a0715ea739cb 2267 break;
JojoS 0:a0715ea739cb 2268 }
JojoS 0:a0715ea739cb 2269 #endif
JojoS 0:a0715ea739cb 2270
JojoS 0:a0715ea739cb 2271 default:
JojoS 0:a0715ea739cb 2272 {
JojoS 0:a0715ea739cb 2273 rtc = TRUE;
JojoS 0:a0715ea739cb 2274 break;
JojoS 0:a0715ea739cb 2275 }
JojoS 0:a0715ea739cb 2276 }
JojoS 0:a0715ea739cb 2277
JojoS 0:a0715ea739cb 2278 if (rtc)
JojoS 0:a0715ea739cb 2279 {
JojoS 0:a0715ea739cb 2280 irmp_data_p->protocol = irmp_protocol;
JojoS 0:a0715ea739cb 2281 irmp_data_p->address = irmp_address;
JojoS 0:a0715ea739cb 2282 irmp_data_p->command = irmp_command;
JojoS 0:a0715ea739cb 2283 irmp_data_p->flags = irmp_flags;
JojoS 0:a0715ea739cb 2284 irmp_command = 0;
JojoS 0:a0715ea739cb 2285 irmp_address = 0;
JojoS 0:a0715ea739cb 2286 irmp_flags = 0;
JojoS 0:a0715ea739cb 2287 }
JojoS 0:a0715ea739cb 2288
JojoS 0:a0715ea739cb 2289 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 2290 }
JojoS 0:a0715ea739cb 2291
JojoS 0:a0715ea739cb 2292 return rtc;
JojoS 0:a0715ea739cb 2293 }
JojoS 0:a0715ea739cb 2294
JojoS 0:a0715ea739cb 2295 #if IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 2296 void
JojoS 0:a0715ea739cb 2297 irmp_set_callback_ptr (void (*cb)(uint_fast8_t))
JojoS 0:a0715ea739cb 2298 {
JojoS 0:a0715ea739cb 2299 irmp_callback_ptr = cb;
JojoS 0:a0715ea739cb 2300 }
JojoS 0:a0715ea739cb 2301 #endif // IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 2302
JojoS 0:a0715ea739cb 2303 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()
JojoS 0:a0715ea739cb 2304 static uint_fast16_t irmp_tmp_address; // ir address
JojoS 0:a0715ea739cb 2305 static uint_fast16_t irmp_tmp_command; // ir command
JojoS 0:a0715ea739cb 2306
JojoS 0:a0715ea739cb 2307 #if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 2308 static uint_fast16_t irmp_tmp_address2; // ir address
JojoS 0:a0715ea739cb 2309 static uint_fast16_t irmp_tmp_command2; // ir command
JojoS 0:a0715ea739cb 2310 #endif
JojoS 0:a0715ea739cb 2311
JojoS 0:a0715ea739cb 2312 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 2313 static uint_fast16_t irmp_lgair_address; // ir address
JojoS 0:a0715ea739cb 2314 static uint_fast16_t irmp_lgair_command; // ir command
JojoS 0:a0715ea739cb 2315 #endif
JojoS 0:a0715ea739cb 2316
JojoS 0:a0715ea739cb 2317 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2318 static uint_fast16_t irmp_tmp_id; // ir id (only SAMSUNG)
JojoS 0:a0715ea739cb 2319 #endif
JojoS 0:a0715ea739cb 2320 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2321 static uint8_t xor_check[6]; // check kaseikyo "parity" bits
JojoS 0:a0715ea739cb 2322 static uint_fast8_t genre2; // save genre2 bits here, later copied to MSB in flags
JojoS 0:a0715ea739cb 2323 #endif
JojoS 0:a0715ea739cb 2324
JojoS 0:a0715ea739cb 2325 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 2326 static uint_fast8_t parity; // number of '1' of the first 14 bits, check if even.
JojoS 0:a0715ea739cb 2327 #endif
JojoS 0:a0715ea739cb 2328
JojoS 0:a0715ea739cb 2329 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2330 * store bit
JojoS 0:a0715ea739cb 2331 * @details store bit in temp address or temp command
JojoS 0:a0715ea739cb 2332 * @param value to store: 0 or 1
JojoS 0:a0715ea739cb 2333 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2334 */
JojoS 0:a0715ea739cb 2335 // verhindert, dass irmp_store_bit() inline compiliert wird:
JojoS 0:a0715ea739cb 2336 // static void irmp_store_bit (uint_fast8_t) __attribute__ ((noinline));
JojoS 0:a0715ea739cb 2337
JojoS 0:a0715ea739cb 2338 static void
JojoS 0:a0715ea739cb 2339 irmp_store_bit (uint_fast8_t value)
JojoS 0:a0715ea739cb 2340 {
JojoS 0:a0715ea739cb 2341 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
JojoS 0:a0715ea739cb 2342 if (irmp_param.protocol == IRMP_ACP24_PROTOCOL) // squeeze 64 bits into 16 bits:
JojoS 0:a0715ea739cb 2343 {
JojoS 0:a0715ea739cb 2344 if (value)
JojoS 0:a0715ea739cb 2345 {
JojoS 0:a0715ea739cb 2346 // ACP24-Frame:
JojoS 0:a0715ea739cb 2347 // 1 2 3 4 5 6
JojoS 0:a0715ea739cb 2348 // 0123456789012345678901234567890123456789012345678901234567890123456789
JojoS 0:a0715ea739cb 2349 // N VVMMM ? ??? t vmA x y TTTT
JojoS 0:a0715ea739cb 2350 //
JojoS 0:a0715ea739cb 2351 // irmp_data_p->command:
JojoS 0:a0715ea739cb 2352 //
JojoS 0:a0715ea739cb 2353 // 5432109876543210
JojoS 0:a0715ea739cb 2354 // NAVVvMMMmtxyTTTT
JojoS 0:a0715ea739cb 2355
JojoS 0:a0715ea739cb 2356 switch (irmp_bit)
JojoS 0:a0715ea739cb 2357 {
JojoS 0:a0715ea739cb 2358 case 0: irmp_tmp_command |= (1<<15); break; // N
JojoS 0:a0715ea739cb 2359 case 2: irmp_tmp_command |= (1<<13); break; // V
JojoS 0:a0715ea739cb 2360 case 3: irmp_tmp_command |= (1<<12); break; // V
JojoS 0:a0715ea739cb 2361 case 4: irmp_tmp_command |= (1<<10); break; // M
JojoS 0:a0715ea739cb 2362 case 5: irmp_tmp_command |= (1<< 9); break; // M
JojoS 0:a0715ea739cb 2363 case 6: irmp_tmp_command |= (1<< 8); break; // M
JojoS 0:a0715ea739cb 2364 case 20: irmp_tmp_command |= (1<< 6); break; // t
JojoS 0:a0715ea739cb 2365 case 22: irmp_tmp_command |= (1<<11); break; // v
JojoS 0:a0715ea739cb 2366 case 23: irmp_tmp_command |= (1<< 7); break; // m
JojoS 0:a0715ea739cb 2367 case 24: irmp_tmp_command |= (1<<14); break; // A
JojoS 0:a0715ea739cb 2368 case 26: irmp_tmp_command |= (1<< 5); break; // x
JojoS 0:a0715ea739cb 2369 case 44: irmp_tmp_command |= (1<< 4); break; // y
JojoS 0:a0715ea739cb 2370 case 66: irmp_tmp_command |= (1<< 3); break; // T
JojoS 0:a0715ea739cb 2371 case 67: irmp_tmp_command |= (1<< 2); break; // T
JojoS 0:a0715ea739cb 2372 case 68: irmp_tmp_command |= (1<< 1); break; // T
JojoS 0:a0715ea739cb 2373 case 69: irmp_tmp_command |= (1<< 0); break; // T
JojoS 0:a0715ea739cb 2374 }
JojoS 0:a0715ea739cb 2375 }
JojoS 0:a0715ea739cb 2376 }
JojoS 0:a0715ea739cb 2377 else
JojoS 0:a0715ea739cb 2378 #endif // IRMP_SUPPORT_ACP24_PROTOCOL
JojoS 0:a0715ea739cb 2379
JojoS 0:a0715ea739cb 2380 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 2381 if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)
JojoS 0:a0715ea739cb 2382 {
JojoS 0:a0715ea739cb 2383 if (irmp_bit < 14)
JojoS 0:a0715ea739cb 2384 {
JojoS 0:a0715ea739cb 2385 if (value)
JojoS 0:a0715ea739cb 2386 {
JojoS 0:a0715ea739cb 2387 parity++;
JojoS 0:a0715ea739cb 2388 }
JojoS 0:a0715ea739cb 2389 }
JojoS 0:a0715ea739cb 2390 else if (irmp_bit == 14)
JojoS 0:a0715ea739cb 2391 {
JojoS 0:a0715ea739cb 2392 if (value) // value == 1: even parity
JojoS 0:a0715ea739cb 2393 {
JojoS 0:a0715ea739cb 2394 if (parity & 0x01)
JojoS 0:a0715ea739cb 2395 {
JojoS 0:a0715ea739cb 2396 parity = PARITY_CHECK_FAILED;
JojoS 0:a0715ea739cb 2397 }
JojoS 0:a0715ea739cb 2398 else
JojoS 0:a0715ea739cb 2399 {
JojoS 0:a0715ea739cb 2400 parity = PARITY_CHECK_OK;
JojoS 0:a0715ea739cb 2401 }
JojoS 0:a0715ea739cb 2402 }
JojoS 0:a0715ea739cb 2403 else
JojoS 0:a0715ea739cb 2404 {
JojoS 0:a0715ea739cb 2405 if (parity & 0x01) // value == 0: odd parity
JojoS 0:a0715ea739cb 2406 {
JojoS 0:a0715ea739cb 2407 parity = PARITY_CHECK_OK;
JojoS 0:a0715ea739cb 2408 }
JojoS 0:a0715ea739cb 2409 else
JojoS 0:a0715ea739cb 2410 {
JojoS 0:a0715ea739cb 2411 parity = PARITY_CHECK_FAILED;
JojoS 0:a0715ea739cb 2412 }
JojoS 0:a0715ea739cb 2413 }
JojoS 0:a0715ea739cb 2414 }
JojoS 0:a0715ea739cb 2415 }
JojoS 0:a0715ea739cb 2416 else
JojoS 0:a0715ea739cb 2417 #endif
JojoS 0:a0715ea739cb 2418 {
JojoS 0:a0715ea739cb 2419 ;
JojoS 0:a0715ea739cb 2420 }
JojoS 0:a0715ea739cb 2421
JojoS 0:a0715ea739cb 2422 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 2423 if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)
JojoS 0:a0715ea739cb 2424 {
JojoS 0:a0715ea739cb 2425 first_bit = value;
JojoS 0:a0715ea739cb 2426 }
JojoS 0:a0715ea739cb 2427 else
JojoS 0:a0715ea739cb 2428 #endif
JojoS 0:a0715ea739cb 2429
JojoS 0:a0715ea739cb 2430 if (irmp_bit >= irmp_param.address_offset && irmp_bit < irmp_param.address_end)
JojoS 0:a0715ea739cb 2431 {
JojoS 0:a0715ea739cb 2432 if (irmp_param.lsb_first)
JojoS 0:a0715ea739cb 2433 {
JojoS 0:a0715ea739cb 2434 irmp_tmp_address |= (((uint_fast16_t) (value)) << (irmp_bit - irmp_param.address_offset)); // CV wants cast
JojoS 0:a0715ea739cb 2435 }
JojoS 0:a0715ea739cb 2436 else
JojoS 0:a0715ea739cb 2437 {
JojoS 0:a0715ea739cb 2438 irmp_tmp_address <<= 1;
JojoS 0:a0715ea739cb 2439 irmp_tmp_address |= value;
JojoS 0:a0715ea739cb 2440 }
JojoS 0:a0715ea739cb 2441 }
JojoS 0:a0715ea739cb 2442 else if (irmp_bit >= irmp_param.command_offset && irmp_bit < irmp_param.command_end)
JojoS 0:a0715ea739cb 2443 {
JojoS 0:a0715ea739cb 2444 if (irmp_param.lsb_first)
JojoS 0:a0715ea739cb 2445 {
JojoS 0:a0715ea739cb 2446 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
JojoS 0:a0715ea739cb 2447 if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit >= 32)
JojoS 0:a0715ea739cb 2448 {
JojoS 0:a0715ea739cb 2449 irmp_tmp_id |= (((uint_fast16_t) (value)) << (irmp_bit - 32)); // CV wants cast
JojoS 0:a0715ea739cb 2450 }
JojoS 0:a0715ea739cb 2451 else
JojoS 0:a0715ea739cb 2452 #endif
JojoS 0:a0715ea739cb 2453 {
JojoS 0:a0715ea739cb 2454 irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast
JojoS 0:a0715ea739cb 2455 }
JojoS 0:a0715ea739cb 2456 }
JojoS 0:a0715ea739cb 2457 else
JojoS 0:a0715ea739cb 2458 {
JojoS 0:a0715ea739cb 2459 irmp_tmp_command <<= 1;
JojoS 0:a0715ea739cb 2460 irmp_tmp_command |= value;
JojoS 0:a0715ea739cb 2461 }
JojoS 0:a0715ea739cb 2462 }
JojoS 0:a0715ea739cb 2463
JojoS 0:a0715ea739cb 2464 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 2465 if (irmp_param.protocol == IRMP_NEC_PROTOCOL || irmp_param.protocol == IRMP_NEC42_PROTOCOL)
JojoS 0:a0715ea739cb 2466 {
JojoS 0:a0715ea739cb 2467 if (irmp_bit < 8)
JojoS 0:a0715ea739cb 2468 {
JojoS 0:a0715ea739cb 2469 irmp_lgair_address <<= 1; // LGAIR uses MSB
JojoS 0:a0715ea739cb 2470 irmp_lgair_address |= value;
JojoS 0:a0715ea739cb 2471 }
JojoS 0:a0715ea739cb 2472 else if (irmp_bit < 24)
JojoS 0:a0715ea739cb 2473 {
JojoS 0:a0715ea739cb 2474 irmp_lgair_command <<= 1; // LGAIR uses MSB
JojoS 0:a0715ea739cb 2475 irmp_lgair_command |= value;
JojoS 0:a0715ea739cb 2476 }
JojoS 0:a0715ea739cb 2477 }
JojoS 0:a0715ea739cb 2478 // NO else!
JojoS 0:a0715ea739cb 2479 #endif
JojoS 0:a0715ea739cb 2480
JojoS 0:a0715ea739cb 2481 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 2482 if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)
JojoS 0:a0715ea739cb 2483 {
JojoS 0:a0715ea739cb 2484 irmp_tmp_address2 |= (((uint_fast16_t) (value)) << (irmp_bit - 13)); // CV wants cast
JojoS 0:a0715ea739cb 2485 }
JojoS 0:a0715ea739cb 2486 else
JojoS 0:a0715ea739cb 2487 #endif
JojoS 0:a0715ea739cb 2488
JojoS 0:a0715ea739cb 2489 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2490 if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)
JojoS 0:a0715ea739cb 2491 {
JojoS 0:a0715ea739cb 2492 irmp_tmp_id |= (((uint_fast16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first
JojoS 0:a0715ea739cb 2493 }
JojoS 0:a0715ea739cb 2494 else
JojoS 0:a0715ea739cb 2495 #endif
JojoS 0:a0715ea739cb 2496
JojoS 0:a0715ea739cb 2497 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2498 if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)
JojoS 0:a0715ea739cb 2499 {
JojoS 0:a0715ea739cb 2500 if (irmp_bit >= 20 && irmp_bit < 24)
JojoS 0:a0715ea739cb 2501 {
JojoS 0:a0715ea739cb 2502 irmp_tmp_command |= (((uint_fast16_t) (value)) << (irmp_bit - 8)); // store 4 system bits (genre 1) in upper nibble with LSB first
JojoS 0:a0715ea739cb 2503 }
JojoS 0:a0715ea739cb 2504 else if (irmp_bit >= 24 && irmp_bit < 28)
JojoS 0:a0715ea739cb 2505 {
JojoS 0:a0715ea739cb 2506 genre2 |= (((uint_fast8_t) (value)) << (irmp_bit - 20)); // store 4 system bits (genre 2) in upper nibble with LSB first
JojoS 0:a0715ea739cb 2507 }
JojoS 0:a0715ea739cb 2508
JojoS 0:a0715ea739cb 2509 if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)
JojoS 0:a0715ea739cb 2510 {
JojoS 0:a0715ea739cb 2511 if (value)
JojoS 0:a0715ea739cb 2512 {
JojoS 0:a0715ea739cb 2513 xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);
JojoS 0:a0715ea739cb 2514 }
JojoS 0:a0715ea739cb 2515 else
JojoS 0:a0715ea739cb 2516 {
JojoS 0:a0715ea739cb 2517 xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));
JojoS 0:a0715ea739cb 2518 }
JojoS 0:a0715ea739cb 2519 }
JojoS 0:a0715ea739cb 2520 }
JojoS 0:a0715ea739cb 2521 else
JojoS 0:a0715ea739cb 2522 #endif
JojoS 0:a0715ea739cb 2523 {
JojoS 0:a0715ea739cb 2524 ;
JojoS 0:a0715ea739cb 2525 }
JojoS 0:a0715ea739cb 2526
JojoS 0:a0715ea739cb 2527 irmp_bit++;
JojoS 0:a0715ea739cb 2528 }
JojoS 0:a0715ea739cb 2529
JojoS 0:a0715ea739cb 2530 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2531 * store bit
JojoS 0:a0715ea739cb 2532 * @details store bit in temp address or temp command
JojoS 0:a0715ea739cb 2533 * @param value to store: 0 or 1
JojoS 0:a0715ea739cb 2534 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2535 */
JojoS 0:a0715ea739cb 2536 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 2537 static void
JojoS 0:a0715ea739cb 2538 irmp_store_bit2 (uint_fast8_t value)
JojoS 0:a0715ea739cb 2539 {
JojoS 0:a0715ea739cb 2540 uint_fast8_t irmp_bit2;
JojoS 0:a0715ea739cb 2541
JojoS 0:a0715ea739cb 2542 if (irmp_param.protocol)
JojoS 0:a0715ea739cb 2543 {
JojoS 0:a0715ea739cb 2544 irmp_bit2 = irmp_bit - 2;
JojoS 0:a0715ea739cb 2545 }
JojoS 0:a0715ea739cb 2546 else
JojoS 0:a0715ea739cb 2547 {
JojoS 0:a0715ea739cb 2548 irmp_bit2 = irmp_bit - 1;
JojoS 0:a0715ea739cb 2549 }
JojoS 0:a0715ea739cb 2550
JojoS 0:a0715ea739cb 2551 if (irmp_bit2 >= irmp_param2.address_offset && irmp_bit2 < irmp_param2.address_end)
JojoS 0:a0715ea739cb 2552 {
JojoS 0:a0715ea739cb 2553 irmp_tmp_address2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp_param2.address_offset)); // CV wants cast
JojoS 0:a0715ea739cb 2554 }
JojoS 0:a0715ea739cb 2555 else if (irmp_bit2 >= irmp_param2.command_offset && irmp_bit2 < irmp_param2.command_end)
JojoS 0:a0715ea739cb 2556 {
JojoS 0:a0715ea739cb 2557 irmp_tmp_command2 |= (((uint_fast16_t) (value)) << (irmp_bit2 - irmp_param2.command_offset)); // CV wants cast
JojoS 0:a0715ea739cb 2558 }
JojoS 0:a0715ea739cb 2559 }
JojoS 0:a0715ea739cb 2560 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 2561
JojoS 0:a0715ea739cb 2562 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2563 * ISR routine
JojoS 0:a0715ea739cb 2564 * @details ISR routine, called 10000 times per second
JojoS 0:a0715ea739cb 2565 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 2566 */
JojoS 0:a0715ea739cb 2567 uint_fast8_t
JojoS 0:a0715ea739cb 2568 irmp_ISR (void)
JojoS 0:a0715ea739cb 2569 {
JojoS 0:a0715ea739cb 2570 static uint_fast8_t irmp_start_bit_detected; // flag: start bit detected
JojoS 0:a0715ea739cb 2571 static uint_fast8_t wait_for_space; // flag: wait for data bit space
JojoS 0:a0715ea739cb 2572 static uint_fast8_t wait_for_start_space; // flag: wait for start bit space
JojoS 0:a0715ea739cb 2573 static uint_fast8_t irmp_pulse_time; // count bit time for pulse
JojoS 0:a0715ea739cb 2574 static PAUSE_LEN irmp_pause_time; // count bit time for pause
JojoS 0:a0715ea739cb 2575 static uint_fast16_t last_irmp_address = 0xFFFF; // save last irmp address to recognize key repetition
JojoS 0:a0715ea739cb 2576 static uint_fast16_t last_irmp_command = 0xFFFF; // save last irmp command to recognize key repetition
JojoS 0:a0715ea739cb 2577 static uint_fast16_t key_repetition_len; // SIRCS repeats frame 2-5 times with 45 ms pause
JojoS 0:a0715ea739cb 2578 static uint_fast8_t repetition_frame_number;
JojoS 0:a0715ea739cb 2579 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2580 static uint_fast16_t last_irmp_denon_command; // save last irmp command to recognize DENON frame repetition
JojoS 0:a0715ea739cb 2581 static uint_fast16_t denon_repetition_len = 0xFFFF; // denon repetition len of 2nd auto generated frame
JojoS 0:a0715ea739cb 2582 #endif
JojoS 0:a0715ea739cb 2583 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 2584 static uint_fast8_t rc5_cmd_bit6; // bit 6 of RC5 command is the inverted 2nd start bit
JojoS 0:a0715ea739cb 2585 #endif
JojoS 0:a0715ea739cb 2586 #if IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 2587 static PAUSE_LEN last_pause; // last pause value
JojoS 0:a0715ea739cb 2588 #endif
JojoS 0:a0715ea739cb 2589 #if IRMP_SUPPORT_MANCHESTER == 1 || IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 2590 static uint_fast8_t last_value; // last bit value
JojoS 0:a0715ea739cb 2591 #endif
JojoS 0:a0715ea739cb 2592 uint_fast8_t irmp_input; // input value
JojoS 0:a0715ea739cb 2593
JojoS 0:a0715ea739cb 2594 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2595 time_counter++;
JojoS 0:a0715ea739cb 2596 #endif // ANALYZE
JojoS 0:a0715ea739cb 2597
JojoS 0:a0715ea739cb 2598 #if defined(__SDCC_stm8)
JojoS 0:a0715ea739cb 2599 irmp_input = input(IRMP_GPIO_STRUCT->IDR)
JojoS 0:a0715ea739cb 2600 #elif defined(__MBED__)
JojoS 0:a0715ea739cb 2601 //irmp_input = inputPin;
JojoS 0:a0715ea739cb 2602 irmp_input = gpio_read (&gpioIRin);
JojoS 0:a0715ea739cb 2603 #else
JojoS 0:a0715ea739cb 2604 irmp_input = input(IRMP_PIN);
JojoS 0:a0715ea739cb 2605 #endif
JojoS 0:a0715ea739cb 2606
JojoS 0:a0715ea739cb 2607 #if IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 2608 if (irmp_callback_ptr)
JojoS 0:a0715ea739cb 2609 {
JojoS 0:a0715ea739cb 2610 static uint_fast8_t last_inverted_input;
JojoS 0:a0715ea739cb 2611
JojoS 0:a0715ea739cb 2612 if (last_inverted_input != !irmp_input)
JojoS 0:a0715ea739cb 2613 {
JojoS 0:a0715ea739cb 2614 (*irmp_callback_ptr) (! irmp_input);
JojoS 0:a0715ea739cb 2615 last_inverted_input = !irmp_input;
JojoS 0:a0715ea739cb 2616 }
JojoS 0:a0715ea739cb 2617 }
JojoS 0:a0715ea739cb 2618 #endif // IRMP_USE_CALLBACK == 1
JojoS 0:a0715ea739cb 2619
JojoS 0:a0715ea739cb 2620 irmp_log(irmp_input); // log ir signal, if IRMP_LOGGING defined
JojoS 0:a0715ea739cb 2621
JojoS 0:a0715ea739cb 2622 if (! irmp_ir_detected) // ir code already detected?
JojoS 0:a0715ea739cb 2623 { // no...
JojoS 0:a0715ea739cb 2624 if (! irmp_start_bit_detected) // start bit detected?
JojoS 0:a0715ea739cb 2625 { // no...
JojoS 0:a0715ea739cb 2626 if (! irmp_input) // receiving burst?
JojoS 0:a0715ea739cb 2627 { // yes...
JojoS 0:a0715ea739cb 2628 // irmp_busy_flag = TRUE;
JojoS 0:a0715ea739cb 2629 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2630 if (! irmp_pulse_time)
JojoS 0:a0715ea739cb 2631 {
JojoS 0:a0715ea739cb 2632 ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);
JojoS 0:a0715ea739cb 2633 }
JojoS 0:a0715ea739cb 2634 #endif // ANALYZE
JojoS 0:a0715ea739cb 2635 irmp_pulse_time++; // increment counter
JojoS 0:a0715ea739cb 2636 }
JojoS 0:a0715ea739cb 2637 else
JojoS 0:a0715ea739cb 2638 { // no...
JojoS 0:a0715ea739cb 2639 if (irmp_pulse_time) // it's dark....
JojoS 0:a0715ea739cb 2640 { // set flags for counting the time of darkness...
JojoS 0:a0715ea739cb 2641 irmp_start_bit_detected = 1;
JojoS 0:a0715ea739cb 2642 wait_for_start_space = 1;
JojoS 0:a0715ea739cb 2643 wait_for_space = 0;
JojoS 0:a0715ea739cb 2644 irmp_tmp_command = 0;
JojoS 0:a0715ea739cb 2645 irmp_tmp_address = 0;
JojoS 0:a0715ea739cb 2646 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2647 genre2 = 0;
JojoS 0:a0715ea739cb 2648 #endif
JojoS 0:a0715ea739cb 2649 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2650 irmp_tmp_id = 0;
JojoS 0:a0715ea739cb 2651 #endif
JojoS 0:a0715ea739cb 2652
JojoS 0:a0715ea739cb 2653 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 2654 irmp_tmp_command2 = 0;
JojoS 0:a0715ea739cb 2655 irmp_tmp_address2 = 0;
JojoS 0:a0715ea739cb 2656 #endif
JojoS 0:a0715ea739cb 2657 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 2658 irmp_lgair_command = 0;
JojoS 0:a0715ea739cb 2659 irmp_lgair_address = 0;
JojoS 0:a0715ea739cb 2660 #endif
JojoS 0:a0715ea739cb 2661 irmp_bit = 0xff;
JojoS 0:a0715ea739cb 2662 irmp_pause_time = 1; // 1st pause: set to 1, not to 0!
JojoS 0:a0715ea739cb 2663 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 || IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 2664 rc5_cmd_bit6 = 0; // fm 2010-03-07: bugfix: reset it after incomplete RC5 frame!
JojoS 0:a0715ea739cb 2665 #endif
JojoS 0:a0715ea739cb 2666 }
JojoS 0:a0715ea739cb 2667 else
JojoS 0:a0715ea739cb 2668 {
JojoS 0:a0715ea739cb 2669 if (key_repetition_len < 0xFFFF) // avoid overflow of counter
JojoS 0:a0715ea739cb 2670 {
JojoS 0:a0715ea739cb 2671 key_repetition_len++;
JojoS 0:a0715ea739cb 2672
JojoS 0:a0715ea739cb 2673 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2674 if (denon_repetition_len < 0xFFFF) // avoid overflow of counter
JojoS 0:a0715ea739cb 2675 {
JojoS 0:a0715ea739cb 2676 denon_repetition_len++;
JojoS 0:a0715ea739cb 2677
JojoS 0:a0715ea739cb 2678 if (denon_repetition_len >= DENON_AUTO_REPETITION_PAUSE_LEN && last_irmp_denon_command != 0)
JojoS 0:a0715ea739cb 2679 {
JojoS 0:a0715ea739cb 2680 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2681 ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",
JojoS 0:a0715ea739cb 2682 (double) (time_counter * 1000) / F_INTERRUPTS);
JojoS 0:a0715ea739cb 2683 #endif // ANALYZE
JojoS 0:a0715ea739cb 2684 last_irmp_denon_command = 0;
JojoS 0:a0715ea739cb 2685 denon_repetition_len = 0xFFFF;
JojoS 0:a0715ea739cb 2686 }
JojoS 0:a0715ea739cb 2687 }
JojoS 0:a0715ea739cb 2688 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2689 }
JojoS 0:a0715ea739cb 2690 }
JojoS 0:a0715ea739cb 2691 }
JojoS 0:a0715ea739cb 2692 }
JojoS 0:a0715ea739cb 2693 else
JojoS 0:a0715ea739cb 2694 {
JojoS 0:a0715ea739cb 2695 if (wait_for_start_space) // we have received start bit...
JojoS 0:a0715ea739cb 2696 { // ...and are counting the time of darkness
JojoS 0:a0715ea739cb 2697 if (irmp_input) // still dark?
JojoS 0:a0715ea739cb 2698 { // yes
JojoS 0:a0715ea739cb 2699 irmp_pause_time++; // increment counter
JojoS 0:a0715ea739cb 2700
JojoS 0:a0715ea739cb 2701 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2702 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) ||
JojoS 0:a0715ea739cb 2703 irmp_pause_time > IRMP_TIMEOUT_NIKON_LEN)
JojoS 0:a0715ea739cb 2704 #else
JojoS 0:a0715ea739cb 2705 if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?
JojoS 0:a0715ea739cb 2706 #endif
JojoS 0:a0715ea739cb 2707 { // yes...
JojoS 0:a0715ea739cb 2708 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2709 if (irmp_protocol == IRMP_JVC_PROTOCOL) // don't show eror if JVC protocol, irmp_pulse_time has been set below!
JojoS 0:a0715ea739cb 2710 {
JojoS 0:a0715ea739cb 2711 ;
JojoS 0:a0715ea739cb 2712 }
JojoS 0:a0715ea739cb 2713 else
JojoS 0:a0715ea739cb 2714 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2715 {
JojoS 0:a0715ea739cb 2716 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2717 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);
JojoS 0:a0715ea739cb 2718 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 2719 #endif // ANALYZE
JojoS 0:a0715ea739cb 2720 }
JojoS 0:a0715ea739cb 2721
JojoS 0:a0715ea739cb 2722 irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit
JojoS 0:a0715ea739cb 2723 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 2724 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 2725 }
JojoS 0:a0715ea739cb 2726 }
JojoS 0:a0715ea739cb 2727 else
JojoS 0:a0715ea739cb 2728 { // receiving first data pulse!
JojoS 0:a0715ea739cb 2729 IRMP_PARAMETER * irmp_param_p;
JojoS 0:a0715ea739cb 2730 irmp_param_p = (IRMP_PARAMETER *) 0;
JojoS 0:a0715ea739cb 2731
JojoS 0:a0715ea739cb 2732 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 2733 irmp_param2.protocol = 0;
JojoS 0:a0715ea739cb 2734 #endif
JojoS 0:a0715ea739cb 2735
JojoS 0:a0715ea739cb 2736 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2737 ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 2738 #endif // ANALYZE
JojoS 0:a0715ea739cb 2739
JojoS 0:a0715ea739cb 2740 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
JojoS 0:a0715ea739cb 2741 if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2742 irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2743 { // it's SIRCS
JojoS 0:a0715ea739cb 2744 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2745 ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2746 SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2747 SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2748 #endif // ANALYZE
JojoS 0:a0715ea739cb 2749 irmp_param_p = (IRMP_PARAMETER *) &sircs_param;
JojoS 0:a0715ea739cb 2750 }
JojoS 0:a0715ea739cb 2751 else
JojoS 0:a0715ea739cb 2752 #endif // IRMP_SUPPORT_SIRCS_PROTOCOL == 1
JojoS 0:a0715ea739cb 2753
JojoS 0:a0715ea739cb 2754 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2755 if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame
JojoS 0:a0715ea739cb 2756 irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2757 irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2758 {
JojoS 0:a0715ea739cb 2759 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2760 ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2761 JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2762 JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2763 #endif // ANALYZE
JojoS 0:a0715ea739cb 2764 irmp_param_p = (IRMP_PARAMETER *) &nec_param;
JojoS 0:a0715ea739cb 2765 }
JojoS 0:a0715ea739cb 2766 else
JojoS 0:a0715ea739cb 2767 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2768
JojoS 0:a0715ea739cb 2769 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2770 if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2771 irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2772 {
JojoS 0:a0715ea739cb 2773 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 2774 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2775 ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2776 NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2777 NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2778 #endif // ANALYZE
JojoS 0:a0715ea739cb 2779 irmp_param_p = (IRMP_PARAMETER *) &nec42_param;
JojoS 0:a0715ea739cb 2780 #else
JojoS 0:a0715ea739cb 2781 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2782 ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2783 NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2784 NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2785 #endif // ANALYZE
JojoS 0:a0715ea739cb 2786 irmp_param_p = (IRMP_PARAMETER *) &nec_param;
JojoS 0:a0715ea739cb 2787 #endif
JojoS 0:a0715ea739cb 2788 }
JojoS 0:a0715ea739cb 2789 else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2790 irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2791 { // it's NEC
JojoS 0:a0715ea739cb 2792 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2793 if (irmp_protocol == IRMP_JVC_PROTOCOL) // last protocol was JVC, awaiting repeat frame
JojoS 0:a0715ea739cb 2794 { // some jvc remote controls use nec repetition frame for jvc repetition frame
JojoS 0:a0715ea739cb 2795 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2796 ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2797 NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2798 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2799 #endif // ANALYZE
JojoS 0:a0715ea739cb 2800 irmp_param_p = (IRMP_PARAMETER *) &nec_param;
JojoS 0:a0715ea739cb 2801 }
JojoS 0:a0715ea739cb 2802 else
JojoS 0:a0715ea739cb 2803 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2804 {
JojoS 0:a0715ea739cb 2805 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2806 ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2807 NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2808 NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2809 #endif // ANALYZE
JojoS 0:a0715ea739cb 2810
JojoS 0:a0715ea739cb 2811 irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;
JojoS 0:a0715ea739cb 2812 }
JojoS 0:a0715ea739cb 2813 }
JojoS 0:a0715ea739cb 2814 else
JojoS 0:a0715ea739cb 2815
JojoS 0:a0715ea739cb 2816 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2817 if (irmp_protocol == IRMP_JVC_PROTOCOL && // last protocol was JVC, awaiting repeat frame
JojoS 0:a0715ea739cb 2818 irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2819 irmp_pause_time >= NEC_0_PAUSE_LEN_MIN && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2820 { // it's JVC repetition type 3
JojoS 0:a0715ea739cb 2821 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2822 ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2823 NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2824 NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2825 #endif // ANALYZE
JojoS 0:a0715ea739cb 2826 irmp_param_p = (IRMP_PARAMETER *) &nec_param;
JojoS 0:a0715ea739cb 2827 }
JojoS 0:a0715ea739cb 2828 else
JojoS 0:a0715ea739cb 2829 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2830
JojoS 0:a0715ea739cb 2831 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2832
JojoS 0:a0715ea739cb 2833 #if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 2834 if (irmp_pulse_time >= TELEFUNKEN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= TELEFUNKEN_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2835 irmp_pause_time >= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2836 {
JojoS 0:a0715ea739cb 2837 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2838 ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2839 TELEFUNKEN_START_BIT_PULSE_LEN_MIN, TELEFUNKEN_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2840 TELEFUNKEN_START_BIT_PAUSE_LEN_MIN, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2841 #endif // ANALYZE
JojoS 0:a0715ea739cb 2842 irmp_param_p = (IRMP_PARAMETER *) &telefunken_param;
JojoS 0:a0715ea739cb 2843 }
JojoS 0:a0715ea739cb 2844 else
JojoS 0:a0715ea739cb 2845 #endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 2846
JojoS 0:a0715ea739cb 2847 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
JojoS 0:a0715ea739cb 2848 if (irmp_pulse_time >= ROOMBA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2849 irmp_pause_time >= ROOMBA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ROOMBA_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2850 {
JojoS 0:a0715ea739cb 2851 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2852 ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2853 ROOMBA_START_BIT_PULSE_LEN_MIN, ROOMBA_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2854 ROOMBA_START_BIT_PAUSE_LEN_MIN, ROOMBA_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2855 #endif // ANALYZE
JojoS 0:a0715ea739cb 2856 irmp_param_p = (IRMP_PARAMETER *) &roomba_param;
JojoS 0:a0715ea739cb 2857 }
JojoS 0:a0715ea739cb 2858 else
JojoS 0:a0715ea739cb 2859 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
JojoS 0:a0715ea739cb 2860
JojoS 0:a0715ea739cb 2861 #if IRMP_SUPPORT_ACP24_PROTOCOL == 1
JojoS 0:a0715ea739cb 2862 if (irmp_pulse_time >= ACP24_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ACP24_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2863 irmp_pause_time >= ACP24_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ACP24_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2864 {
JojoS 0:a0715ea739cb 2865 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2866 ANALYZE_PRINTF ("protocol = ACP24, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2867 ACP24_START_BIT_PULSE_LEN_MIN, ACP24_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2868 ACP24_START_BIT_PAUSE_LEN_MIN, ACP24_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2869 #endif // ANALYZE
JojoS 0:a0715ea739cb 2870 irmp_param_p = (IRMP_PARAMETER *) &acp24_param;
JojoS 0:a0715ea739cb 2871 }
JojoS 0:a0715ea739cb 2872 else
JojoS 0:a0715ea739cb 2873 #endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
JojoS 0:a0715ea739cb 2874
JojoS 0:a0715ea739cb 2875 #if IRMP_SUPPORT_PENTAX_PROTOCOL == 1
JojoS 0:a0715ea739cb 2876 if (irmp_pulse_time >= PENTAX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= PENTAX_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2877 irmp_pause_time >= PENTAX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= PENTAX_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2878 {
JojoS 0:a0715ea739cb 2879 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2880 ANALYZE_PRINTF ("protocol = PENTAX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2881 PENTAX_START_BIT_PULSE_LEN_MIN, PENTAX_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2882 PENTAX_START_BIT_PAUSE_LEN_MIN, PENTAX_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2883 #endif // ANALYZE
JojoS 0:a0715ea739cb 2884 irmp_param_p = (IRMP_PARAMETER *) &pentax_param;
JojoS 0:a0715ea739cb 2885 }
JojoS 0:a0715ea739cb 2886 else
JojoS 0:a0715ea739cb 2887 #endif // IRMP_SUPPORT_PENTAX_PROTOCOL == 1
JojoS 0:a0715ea739cb 2888
JojoS 0:a0715ea739cb 2889 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2890 if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2891 irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2892 {
JojoS 0:a0715ea739cb 2893 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2894 ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2895 NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2896 NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2897 #endif // ANALYZE
JojoS 0:a0715ea739cb 2898 irmp_param_p = (IRMP_PARAMETER *) &nikon_param;
JojoS 0:a0715ea739cb 2899 }
JojoS 0:a0715ea739cb 2900 else
JojoS 0:a0715ea739cb 2901 #endif // IRMP_SUPPORT_NIKON_PROTOCOL == 1
JojoS 0:a0715ea739cb 2902
JojoS 0:a0715ea739cb 2903 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2904 if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2905 irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2906 { // it's SAMSUNG
JojoS 0:a0715ea739cb 2907 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2908 ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2909 SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2910 SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2911 #endif // ANALYZE
JojoS 0:a0715ea739cb 2912 irmp_param_p = (IRMP_PARAMETER *) &samsung_param;
JojoS 0:a0715ea739cb 2913 }
JojoS 0:a0715ea739cb 2914 else
JojoS 0:a0715ea739cb 2915 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 2916
JojoS 0:a0715ea739cb 2917 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
JojoS 0:a0715ea739cb 2918 if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2919 irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2920 { // it's MATSUSHITA
JojoS 0:a0715ea739cb 2921 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2922 ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2923 MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2924 MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2925 #endif // ANALYZE
JojoS 0:a0715ea739cb 2926 irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;
JojoS 0:a0715ea739cb 2927 }
JojoS 0:a0715ea739cb 2928 else
JojoS 0:a0715ea739cb 2929 #endif // IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1
JojoS 0:a0715ea739cb 2930
JojoS 0:a0715ea739cb 2931 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2932 if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2933 irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2934 { // it's KASEIKYO
JojoS 0:a0715ea739cb 2935 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2936 ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2937 KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2938 KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2939 #endif // ANALYZE
JojoS 0:a0715ea739cb 2940 irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;
JojoS 0:a0715ea739cb 2941 }
JojoS 0:a0715ea739cb 2942 else
JojoS 0:a0715ea739cb 2943 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 2944
JojoS 0:a0715ea739cb 2945 #if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2946 if (irmp_pulse_time >= PANASONIC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= PANASONIC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2947 irmp_pause_time >= PANASONIC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= PANASONIC_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2948 { // it's PANASONIC
JojoS 0:a0715ea739cb 2949 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2950 ANALYZE_PRINTF ("protocol = PANASONIC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2951 PANASONIC_START_BIT_PULSE_LEN_MIN, PANASONIC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2952 PANASONIC_START_BIT_PAUSE_LEN_MIN, PANASONIC_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2953 #endif // ANALYZE
JojoS 0:a0715ea739cb 2954 irmp_param_p = (IRMP_PARAMETER *) &panasonic_param;
JojoS 0:a0715ea739cb 2955 }
JojoS 0:a0715ea739cb 2956 else
JojoS 0:a0715ea739cb 2957 #endif // IRMP_SUPPORT_PANASONIC_PROTOCOL == 1
JojoS 0:a0715ea739cb 2958
JojoS 0:a0715ea739cb 2959 #if IRMP_SUPPORT_RADIO1_PROTOCOL == 1
JojoS 0:a0715ea739cb 2960 if (irmp_pulse_time >= RADIO1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RADIO1_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2961 irmp_pause_time >= RADIO1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RADIO1_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2962 {
JojoS 0:a0715ea739cb 2963 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2964 ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2965 RADIO1_START_BIT_PULSE_LEN_MIN, RADIO1_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2966 RADIO1_START_BIT_PAUSE_LEN_MIN, RADIO1_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2967 #endif // ANALYZE
JojoS 0:a0715ea739cb 2968 irmp_param_p = (IRMP_PARAMETER *) &radio1_param;
JojoS 0:a0715ea739cb 2969 }
JojoS 0:a0715ea739cb 2970 else
JojoS 0:a0715ea739cb 2971 #endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1
JojoS 0:a0715ea739cb 2972
JojoS 0:a0715ea739cb 2973 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1
JojoS 0:a0715ea739cb 2974 if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 2975 irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 2976 { // it's RECS80
JojoS 0:a0715ea739cb 2977 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2978 ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2979 RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 2980 RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 2981 #endif // ANALYZE
JojoS 0:a0715ea739cb 2982 irmp_param_p = (IRMP_PARAMETER *) &recs80_param;
JojoS 0:a0715ea739cb 2983 }
JojoS 0:a0715ea739cb 2984 else
JojoS 0:a0715ea739cb 2985 #endif // IRMP_SUPPORT_RECS80_PROTOCOL == 1
JojoS 0:a0715ea739cb 2986
JojoS 0:a0715ea739cb 2987 #if IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 2988 if (((irmp_pulse_time >= S100_START_BIT_LEN_MIN && irmp_pulse_time <= S100_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 2989 (irmp_pulse_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX)) &&
JojoS 0:a0715ea739cb 2990 ((irmp_pause_time >= S100_START_BIT_LEN_MIN && irmp_pause_time <= S100_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 2991 (irmp_pause_time >= 2 * S100_START_BIT_LEN_MIN && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX)))
JojoS 0:a0715ea739cb 2992 { // it's S100
JojoS 0:a0715ea739cb 2993 #ifdef ANALYZE
JojoS 0:a0715ea739cb 2994 ANALYZE_PRINTF ("protocol = S100, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 2995 S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 2996 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 2997 S100_START_BIT_LEN_MIN, S100_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 2998 2 * S100_START_BIT_LEN_MIN, 2 * S100_START_BIT_LEN_MAX);
JojoS 0:a0715ea739cb 2999 #endif // ANALYZE
JojoS 0:a0715ea739cb 3000
JojoS 0:a0715ea739cb 3001 irmp_param_p = (IRMP_PARAMETER *) &s100_param;
JojoS 0:a0715ea739cb 3002 last_pause = irmp_pause_time;
JojoS 0:a0715ea739cb 3003
JojoS 0:a0715ea739cb 3004 if ((irmp_pulse_time > S100_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * S100_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 3005 (irmp_pause_time > S100_START_BIT_LEN_MAX && irmp_pause_time <= 2 * S100_START_BIT_LEN_MAX))
JojoS 0:a0715ea739cb 3006 {
JojoS 0:a0715ea739cb 3007 last_value = 0;
JojoS 0:a0715ea739cb 3008 rc5_cmd_bit6 = 1<<6;
JojoS 0:a0715ea739cb 3009 }
JojoS 0:a0715ea739cb 3010 else
JojoS 0:a0715ea739cb 3011 {
JojoS 0:a0715ea739cb 3012 last_value = 1;
JojoS 0:a0715ea739cb 3013 }
JojoS 0:a0715ea739cb 3014 }
JojoS 0:a0715ea739cb 3015 else
JojoS 0:a0715ea739cb 3016 #endif // IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 3017
JojoS 0:a0715ea739cb 3018 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
JojoS 0:a0715ea739cb 3019 if (((irmp_pulse_time >= RC5_START_BIT_LEN_MIN && irmp_pulse_time <= RC5_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 3020 (irmp_pulse_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX)) &&
JojoS 0:a0715ea739cb 3021 ((irmp_pause_time >= RC5_START_BIT_LEN_MIN && irmp_pause_time <= RC5_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 3022 (irmp_pause_time >= 2 * RC5_START_BIT_LEN_MIN && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX)))
JojoS 0:a0715ea739cb 3023 { // it's RC5
JojoS 0:a0715ea739cb 3024 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3025 if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3026 irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3027 {
JojoS 0:a0715ea739cb 3028 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3029 ANALYZE_PRINTF ("protocol = RC5 or FDC\n");
JojoS 0:a0715ea739cb 3030 ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3031 FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3032 FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3033 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3034 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3035 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);
JojoS 0:a0715ea739cb 3036 #endif // ANALYZE
JojoS 0:a0715ea739cb 3037 memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));
JojoS 0:a0715ea739cb 3038 }
JojoS 0:a0715ea739cb 3039 else
JojoS 0:a0715ea739cb 3040 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3041
JojoS 0:a0715ea739cb 3042 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3043 if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3044 irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3045 {
JojoS 0:a0715ea739cb 3046 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3047 ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");
JojoS 0:a0715ea739cb 3048 ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3049 RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3050 RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3051 ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3052 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3053 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);
JojoS 0:a0715ea739cb 3054 #endif // ANALYZE
JojoS 0:a0715ea739cb 3055 memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));
JojoS 0:a0715ea739cb 3056 }
JojoS 0:a0715ea739cb 3057 else
JojoS 0:a0715ea739cb 3058 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3059 {
JojoS 0:a0715ea739cb 3060 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3061 ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3062 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3063 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3064 RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3065 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX);
JojoS 0:a0715ea739cb 3066 #endif // ANALYZE
JojoS 0:a0715ea739cb 3067 }
JojoS 0:a0715ea739cb 3068
JojoS 0:a0715ea739cb 3069 irmp_param_p = (IRMP_PARAMETER *) &rc5_param;
JojoS 0:a0715ea739cb 3070 last_pause = irmp_pause_time;
JojoS 0:a0715ea739cb 3071
JojoS 0:a0715ea739cb 3072 if ((irmp_pulse_time > RC5_START_BIT_LEN_MAX && irmp_pulse_time <= 2 * RC5_START_BIT_LEN_MAX) ||
JojoS 0:a0715ea739cb 3073 (irmp_pause_time > RC5_START_BIT_LEN_MAX && irmp_pause_time <= 2 * RC5_START_BIT_LEN_MAX))
JojoS 0:a0715ea739cb 3074 {
JojoS 0:a0715ea739cb 3075 last_value = 0;
JojoS 0:a0715ea739cb 3076 rc5_cmd_bit6 = 1<<6;
JojoS 0:a0715ea739cb 3077 }
JojoS 0:a0715ea739cb 3078 else
JojoS 0:a0715ea739cb 3079 {
JojoS 0:a0715ea739cb 3080 last_value = 1;
JojoS 0:a0715ea739cb 3081 }
JojoS 0:a0715ea739cb 3082 }
JojoS 0:a0715ea739cb 3083 else
JojoS 0:a0715ea739cb 3084 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1
JojoS 0:a0715ea739cb 3085
JojoS 0:a0715ea739cb 3086 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3087 if ( (irmp_pulse_time >= DENON_PULSE_LEN_MIN && irmp_pulse_time <= DENON_PULSE_LEN_MAX) &&
JojoS 0:a0715ea739cb 3088 ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 3089 (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 3090 { // it's DENON
JojoS 0:a0715ea739cb 3091 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3092 ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
JojoS 0:a0715ea739cb 3093 DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3094 DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,
JojoS 0:a0715ea739cb 3095 DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3096 #endif // ANALYZE
JojoS 0:a0715ea739cb 3097 irmp_param_p = (IRMP_PARAMETER *) &denon_param;
JojoS 0:a0715ea739cb 3098 }
JojoS 0:a0715ea739cb 3099 else
JojoS 0:a0715ea739cb 3100 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3101
JojoS 0:a0715ea739cb 3102 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3103 if ( (irmp_pulse_time >= THOMSON_PULSE_LEN_MIN && irmp_pulse_time <= THOMSON_PULSE_LEN_MAX) &&
JojoS 0:a0715ea739cb 3104 ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 3105 (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 3106 { // it's THOMSON
JojoS 0:a0715ea739cb 3107 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3108 ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
JojoS 0:a0715ea739cb 3109 THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3110 THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX,
JojoS 0:a0715ea739cb 3111 THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3112 #endif // ANALYZE
JojoS 0:a0715ea739cb 3113 irmp_param_p = (IRMP_PARAMETER *) &thomson_param;
JojoS 0:a0715ea739cb 3114 }
JojoS 0:a0715ea739cb 3115 else
JojoS 0:a0715ea739cb 3116 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3117
JojoS 0:a0715ea739cb 3118 #if IRMP_SUPPORT_BOSE_PROTOCOL == 1
JojoS 0:a0715ea739cb 3119 if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3120 irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3121 {
JojoS 0:a0715ea739cb 3122 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3123 ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3124 BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3125 BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3126 #endif // ANALYZE
JojoS 0:a0715ea739cb 3127 irmp_param_p = (IRMP_PARAMETER *) &bose_param;
JojoS 0:a0715ea739cb 3128 }
JojoS 0:a0715ea739cb 3129 else
JojoS 0:a0715ea739cb 3130 #endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1
JojoS 0:a0715ea739cb 3131
JojoS 0:a0715ea739cb 3132 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3133 if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3134 irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3135 { // it's RC6
JojoS 0:a0715ea739cb 3136 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3137 ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3138 RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3139 RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3140 #endif // ANALYZE
JojoS 0:a0715ea739cb 3141 irmp_param_p = (IRMP_PARAMETER *) &rc6_param;
JojoS 0:a0715ea739cb 3142 last_pause = 0;
JojoS 0:a0715ea739cb 3143 last_value = 1;
JojoS 0:a0715ea739cb 3144 }
JojoS 0:a0715ea739cb 3145 else
JojoS 0:a0715ea739cb 3146 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3147
JojoS 0:a0715ea739cb 3148 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
JojoS 0:a0715ea739cb 3149 if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3150 irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3151 { // it's RECS80EXT
JojoS 0:a0715ea739cb 3152 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3153 ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3154 RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3155 RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3156 #endif // ANALYZE
JojoS 0:a0715ea739cb 3157 irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;
JojoS 0:a0715ea739cb 3158 }
JojoS 0:a0715ea739cb 3159 else
JojoS 0:a0715ea739cb 3160 #endif // IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1
JojoS 0:a0715ea739cb 3161
JojoS 0:a0715ea739cb 3162 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
JojoS 0:a0715ea739cb 3163 if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3164 irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3165 { // it's NUBERT
JojoS 0:a0715ea739cb 3166 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3167 ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3168 NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3169 NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3170 #endif // ANALYZE
JojoS 0:a0715ea739cb 3171 irmp_param_p = (IRMP_PARAMETER *) &nubert_param;
JojoS 0:a0715ea739cb 3172 }
JojoS 0:a0715ea739cb 3173 else
JojoS 0:a0715ea739cb 3174 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1
JojoS 0:a0715ea739cb 3175
JojoS 0:a0715ea739cb 3176 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3177 if (irmp_pulse_time >= FAN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FAN_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3178 irmp_pause_time >= FAN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FAN_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3179 { // it's FAN
JojoS 0:a0715ea739cb 3180 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3181 ANALYZE_PRINTF ("protocol = FAN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3182 FAN_START_BIT_PULSE_LEN_MIN, FAN_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3183 FAN_START_BIT_PAUSE_LEN_MIN, FAN_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3184 #endif // ANALYZE
JojoS 0:a0715ea739cb 3185 irmp_param_p = (IRMP_PARAMETER *) &fan_param;
JojoS 0:a0715ea739cb 3186 }
JojoS 0:a0715ea739cb 3187 else
JojoS 0:a0715ea739cb 3188 #endif // IRMP_SUPPORT_FAN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3189
JojoS 0:a0715ea739cb 3190 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
JojoS 0:a0715ea739cb 3191 if (irmp_pulse_time >= SPEAKER_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SPEAKER_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3192 irmp_pause_time >= SPEAKER_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SPEAKER_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3193 { // it's SPEAKER
JojoS 0:a0715ea739cb 3194 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3195 ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3196 SPEAKER_START_BIT_PULSE_LEN_MIN, SPEAKER_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3197 SPEAKER_START_BIT_PAUSE_LEN_MIN, SPEAKER_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3198 #endif // ANALYZE
JojoS 0:a0715ea739cb 3199 irmp_param_p = (IRMP_PARAMETER *) &speaker_param;
JojoS 0:a0715ea739cb 3200 }
JojoS 0:a0715ea739cb 3201 else
JojoS 0:a0715ea739cb 3202 #endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
JojoS 0:a0715ea739cb 3203
JojoS 0:a0715ea739cb 3204 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3205 if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3206 irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3207 { // it's BANG_OLUFSEN
JojoS 0:a0715ea739cb 3208 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3209 ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");
JojoS 0:a0715ea739cb 3210 ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3211 BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3212 BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3213 ANALYZE_PRINTF ("start bit 2 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3214 BANG_OLUFSEN_START_BIT2_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3215 BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT2_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3216 ANALYZE_PRINTF ("start bit 3 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3217 BANG_OLUFSEN_START_BIT3_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3218 BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3219 ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3220 BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3221 BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3222 #endif // ANALYZE
JojoS 0:a0715ea739cb 3223 irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;
JojoS 0:a0715ea739cb 3224 last_value = 0;
JojoS 0:a0715ea739cb 3225 }
JojoS 0:a0715ea739cb 3226 else
JojoS 0:a0715ea739cb 3227 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3228
JojoS 0:a0715ea739cb 3229 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 3230 if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX &&
JojoS 0:a0715ea739cb 3231 irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3232 { // it's GRUNDIG
JojoS 0:a0715ea739cb 3233 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3234 ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3235 GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,
JojoS 0:a0715ea739cb 3236 GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3237 #endif // ANALYZE
JojoS 0:a0715ea739cb 3238 irmp_param_p = (IRMP_PARAMETER *) &grundig_param;
JojoS 0:a0715ea739cb 3239 last_pause = irmp_pause_time;
JojoS 0:a0715ea739cb 3240 last_value = 1;
JojoS 0:a0715ea739cb 3241 }
JojoS 0:a0715ea739cb 3242 else
JojoS 0:a0715ea739cb 3243 #endif // IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 3244
JojoS 0:a0715ea739cb 3245 #if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 // check MERLIN before RUWIDO!
JojoS 0:a0715ea739cb 3246 if (irmp_pulse_time >= MERLIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MERLIN_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3247 irmp_pause_time >= MERLIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MERLIN_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3248 { // it's MERLIN
JojoS 0:a0715ea739cb 3249 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3250 ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3251 MERLIN_START_BIT_PULSE_LEN_MIN, MERLIN_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3252 MERLIN_START_BIT_PAUSE_LEN_MIN, MERLIN_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3253 #endif // ANALYZE
JojoS 0:a0715ea739cb 3254 irmp_param_p = (IRMP_PARAMETER *) &merlin_param;
JojoS 0:a0715ea739cb 3255 last_pause = 0;
JojoS 0:a0715ea739cb 3256 last_value = 1;
JojoS 0:a0715ea739cb 3257 }
JojoS 0:a0715ea739cb 3258 else
JojoS 0:a0715ea739cb 3259 #endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3260
JojoS 0:a0715ea739cb 3261 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 3262 if (((irmp_pulse_time >= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 3263 (irmp_pulse_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX)) &&
JojoS 0:a0715ea739cb 3264 ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 3265 (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 3266 { // it's RUWIDO or SIEMENS
JojoS 0:a0715ea739cb 3267 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3268 ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",
JojoS 0:a0715ea739cb 3269 SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3270 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3271 SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,
JojoS 0:a0715ea739cb 3272 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3273 #endif // ANALYZE
JojoS 0:a0715ea739cb 3274 irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;
JojoS 0:a0715ea739cb 3275 last_pause = irmp_pause_time;
JojoS 0:a0715ea739cb 3276 last_value = 1;
JojoS 0:a0715ea739cb 3277 }
JojoS 0:a0715ea739cb 3278 else
JojoS 0:a0715ea739cb 3279 #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 3280
JojoS 0:a0715ea739cb 3281 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3282 if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3283 irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3284 {
JojoS 0:a0715ea739cb 3285 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3286 ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3287 FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3288 FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3289 #endif // ANALYZE
JojoS 0:a0715ea739cb 3290 irmp_param_p = (IRMP_PARAMETER *) &fdc_param;
JojoS 0:a0715ea739cb 3291 }
JojoS 0:a0715ea739cb 3292 else
JojoS 0:a0715ea739cb 3293 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3294
JojoS 0:a0715ea739cb 3295 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3296 if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3297 irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3298 {
JojoS 0:a0715ea739cb 3299 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3300 ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3301 RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3302 RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3303 #endif // ANALYZE
JojoS 0:a0715ea739cb 3304 irmp_param_p = (IRMP_PARAMETER *) &rccar_param;
JojoS 0:a0715ea739cb 3305 }
JojoS 0:a0715ea739cb 3306 else
JojoS 0:a0715ea739cb 3307 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3308
JojoS 0:a0715ea739cb 3309 #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3310 if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3311 irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3312 { // it's KATHREIN
JojoS 0:a0715ea739cb 3313 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3314 ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3315 KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3316 KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3317 #endif // ANALYZE
JojoS 0:a0715ea739cb 3318 irmp_param_p = (IRMP_PARAMETER *) &kathrein_param;
JojoS 0:a0715ea739cb 3319 }
JojoS 0:a0715ea739cb 3320 else
JojoS 0:a0715ea739cb 3321 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3322
JojoS 0:a0715ea739cb 3323 #if IRMP_SUPPORT_NETBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 3324 if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3325 irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3326 { // it's NETBOX
JojoS 0:a0715ea739cb 3327 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3328 ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3329 NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3330 NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3331 #endif // ANALYZE
JojoS 0:a0715ea739cb 3332 irmp_param_p = (IRMP_PARAMETER *) &netbox_param;
JojoS 0:a0715ea739cb 3333 }
JojoS 0:a0715ea739cb 3334 else
JojoS 0:a0715ea739cb 3335 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 3336
JojoS 0:a0715ea739cb 3337 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1
JojoS 0:a0715ea739cb 3338 if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3339 irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3340 {
JojoS 0:a0715ea739cb 3341 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3342 ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3343 LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3344 LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3345 #endif // ANALYZE
JojoS 0:a0715ea739cb 3346 irmp_param_p = (IRMP_PARAMETER *) &lego_param;
JojoS 0:a0715ea739cb 3347 }
JojoS 0:a0715ea739cb 3348 else
JojoS 0:a0715ea739cb 3349 #endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1
JojoS 0:a0715ea739cb 3350
JojoS 0:a0715ea739cb 3351 #if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 3352 if (irmp_pulse_time >= A1TVBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= A1TVBOX_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3353 irmp_pause_time >= A1TVBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= A1TVBOX_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3354 { // it's A1TVBOX
JojoS 0:a0715ea739cb 3355 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3356 ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3357 A1TVBOX_START_BIT_PULSE_LEN_MIN, A1TVBOX_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3358 A1TVBOX_START_BIT_PAUSE_LEN_MIN, A1TVBOX_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3359 #endif // ANALYZE
JojoS 0:a0715ea739cb 3360 irmp_param_p = (IRMP_PARAMETER *) &a1tvbox_param;
JojoS 0:a0715ea739cb 3361 last_pause = 0;
JojoS 0:a0715ea739cb 3362 last_value = 1;
JojoS 0:a0715ea739cb 3363 }
JojoS 0:a0715ea739cb 3364 else
JojoS 0:a0715ea739cb 3365 #endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1
JojoS 0:a0715ea739cb 3366
JojoS 0:a0715ea739cb 3367 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 3368 if (irmp_pulse_time >= ORTEK_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ORTEK_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3369 irmp_pause_time >= ORTEK_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ORTEK_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3370 { // it's ORTEK (Hama)
JojoS 0:a0715ea739cb 3371 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3372 ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3373 ORTEK_START_BIT_PULSE_LEN_MIN, ORTEK_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3374 ORTEK_START_BIT_PAUSE_LEN_MIN, ORTEK_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3375 #endif // ANALYZE
JojoS 0:a0715ea739cb 3376 irmp_param_p = (IRMP_PARAMETER *) &ortek_param;
JojoS 0:a0715ea739cb 3377 last_pause = 0;
JojoS 0:a0715ea739cb 3378 last_value = 1;
JojoS 0:a0715ea739cb 3379 parity = 0;
JojoS 0:a0715ea739cb 3380 }
JojoS 0:a0715ea739cb 3381 else
JojoS 0:a0715ea739cb 3382 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 3383
JojoS 0:a0715ea739cb 3384 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 3385 if (irmp_pulse_time >= RCMM32_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCMM32_START_BIT_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 3386 irmp_pause_time >= RCMM32_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3387 { // it's RCMM
JojoS 0:a0715ea739cb 3388 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3389 ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
JojoS 0:a0715ea739cb 3390 RCMM32_START_BIT_PULSE_LEN_MIN, RCMM32_START_BIT_PULSE_LEN_MAX,
JojoS 0:a0715ea739cb 3391 RCMM32_START_BIT_PAUSE_LEN_MIN, RCMM32_START_BIT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3392 #endif // ANALYZE
JojoS 0:a0715ea739cb 3393 irmp_param_p = (IRMP_PARAMETER *) &rcmm_param;
JojoS 0:a0715ea739cb 3394 }
JojoS 0:a0715ea739cb 3395 else
JojoS 0:a0715ea739cb 3396 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 3397 {
JojoS 0:a0715ea739cb 3398 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3399 ANALYZE_PRINTF ("protocol = UNKNOWN\n");
JojoS 0:a0715ea739cb 3400 #endif // ANALYZE
JojoS 0:a0715ea739cb 3401 irmp_start_bit_detected = 0; // wait for another start bit...
JojoS 0:a0715ea739cb 3402 }
JojoS 0:a0715ea739cb 3403
JojoS 0:a0715ea739cb 3404 if (irmp_start_bit_detected)
JojoS 0:a0715ea739cb 3405 {
JojoS 0:a0715ea739cb 3406 memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));
JojoS 0:a0715ea739cb 3407
JojoS 0:a0715ea739cb 3408 if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
JojoS 0:a0715ea739cb 3409 {
JojoS 0:a0715ea739cb 3410 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3411 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);
JojoS 0:a0715ea739cb 3412 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);
JojoS 0:a0715ea739cb 3413 #endif // ANALYZE
JojoS 0:a0715ea739cb 3414 }
JojoS 0:a0715ea739cb 3415 else
JojoS 0:a0715ea739cb 3416 {
JojoS 0:a0715ea739cb 3417 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3418 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,
JojoS 0:a0715ea739cb 3419 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);
JojoS 0:a0715ea739cb 3420 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max,
JojoS 0:a0715ea739cb 3421 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);
JojoS 0:a0715ea739cb 3422 #endif // ANALYZE
JojoS 0:a0715ea739cb 3423 }
JojoS 0:a0715ea739cb 3424
JojoS 0:a0715ea739cb 3425 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 3426 if (irmp_param2.protocol)
JojoS 0:a0715ea739cb 3427 {
JojoS 0:a0715ea739cb 3428 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3429 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);
JojoS 0:a0715ea739cb 3430 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);
JojoS 0:a0715ea739cb 3431 ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);
JojoS 0:a0715ea739cb 3432 ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);
JojoS 0:a0715ea739cb 3433 #endif // ANALYZE
JojoS 0:a0715ea739cb 3434 }
JojoS 0:a0715ea739cb 3435 #endif
JojoS 0:a0715ea739cb 3436
JojoS 0:a0715ea739cb 3437
JojoS 0:a0715ea739cb 3438 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3439 if (irmp_param.protocol == IRMP_RC6_PROTOCOL)
JojoS 0:a0715ea739cb 3440 {
JojoS 0:a0715ea739cb 3441 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3442 ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);
JojoS 0:a0715ea739cb 3443 #endif // ANALYZE
JojoS 0:a0715ea739cb 3444 }
JojoS 0:a0715ea739cb 3445 #endif
JojoS 0:a0715ea739cb 3446
JojoS 0:a0715ea739cb 3447 if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
JojoS 0:a0715ea739cb 3448 {
JojoS 0:a0715ea739cb 3449 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3450 ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);
JojoS 0:a0715ea739cb 3451 ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);
JojoS 0:a0715ea739cb 3452 #endif // ANALYZE
JojoS 0:a0715ea739cb 3453 }
JojoS 0:a0715ea739cb 3454 else
JojoS 0:a0715ea739cb 3455 {
JojoS 0:a0715ea739cb 3456 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3457 ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max,
JojoS 0:a0715ea739cb 3458 2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max);
JojoS 0:a0715ea739cb 3459 ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max,
JojoS 0:a0715ea739cb 3460 2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max);
JojoS 0:a0715ea739cb 3461 #endif // ANALYZE
JojoS 0:a0715ea739cb 3462 }
JojoS 0:a0715ea739cb 3463
JojoS 0:a0715ea739cb 3464 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3465 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3466 if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
JojoS 0:a0715ea739cb 3467 {
JojoS 0:a0715ea739cb 3468 ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);
JojoS 0:a0715ea739cb 3469 ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 3470 }
JojoS 0:a0715ea739cb 3471 #endif
JojoS 0:a0715ea739cb 3472
JojoS 0:a0715ea739cb 3473 ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset);
JojoS 0:a0715ea739cb 3474 ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset);
JojoS 0:a0715ea739cb 3475 ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len);
JojoS 0:a0715ea739cb 3476 ANALYZE_PRINTF ("stop_bit: %3d\n", irmp_param.stop_bit);
JojoS 0:a0715ea739cb 3477 #endif // ANALYZE
JojoS 0:a0715ea739cb 3478 }
JojoS 0:a0715ea739cb 3479
JojoS 0:a0715ea739cb 3480 irmp_bit = 0;
JojoS 0:a0715ea739cb 3481
JojoS 0:a0715ea739cb 3482 #if IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3483 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
JojoS 0:a0715ea739cb 3484 irmp_param.protocol != IRMP_RUWIDO_PROTOCOL && // Manchester, but not RUWIDO
JojoS 0:a0715ea739cb 3485 irmp_param.protocol != IRMP_RC6_PROTOCOL) // Manchester, but not RC6
JojoS 0:a0715ea739cb 3486 {
JojoS 0:a0715ea739cb 3487 if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)
JojoS 0:a0715ea739cb 3488 {
JojoS 0:a0715ea739cb 3489 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3490 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 3491 ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
JojoS 0:a0715ea739cb 3492 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3493 #endif // ANALYZE
JojoS 0:a0715ea739cb 3494 irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);
JojoS 0:a0715ea739cb 3495 }
JojoS 0:a0715ea739cb 3496 else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 3497 {
JojoS 0:a0715ea739cb 3498 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3499 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 3500 ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
JojoS 0:a0715ea739cb 3501 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3502 #endif // ANALYZE
JojoS 0:a0715ea739cb 3503 irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);
JojoS 0:a0715ea739cb 3504 }
JojoS 0:a0715ea739cb 3505 }
JojoS 0:a0715ea739cb 3506 else
JojoS 0:a0715ea739cb 3507 #endif // IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3508
JojoS 0:a0715ea739cb 3509 #if IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 3510 if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
JojoS 0:a0715ea739cb 3511 {
JojoS 0:a0715ea739cb 3512 ; // do nothing
JojoS 0:a0715ea739cb 3513 }
JojoS 0:a0715ea739cb 3514 else
JojoS 0:a0715ea739cb 3515 #endif // IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 3516
JojoS 0:a0715ea739cb 3517
JojoS 0:a0715ea739cb 3518 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3519 if (irmp_param.protocol == IRMP_DENON_PROTOCOL)
JojoS 0:a0715ea739cb 3520 {
JojoS 0:a0715ea739cb 3521 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3522 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 3523 #endif // ANALYZE
JojoS 0:a0715ea739cb 3524
JojoS 0:a0715ea739cb 3525 if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3526 { // pause timings correct for "1"?
JojoS 0:a0715ea739cb 3527 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3528 ANALYZE_PUTCHAR ('1'); // yes, store 1
JojoS 0:a0715ea739cb 3529 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3530 #endif // ANALYZE
JojoS 0:a0715ea739cb 3531 irmp_store_bit (1);
JojoS 0:a0715ea739cb 3532 }
JojoS 0:a0715ea739cb 3533 else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3534 { // pause timings correct for "0"?
JojoS 0:a0715ea739cb 3535 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3536 ANALYZE_PUTCHAR ('0'); // yes, store 0
JojoS 0:a0715ea739cb 3537 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3538 #endif // ANALYZE
JojoS 0:a0715ea739cb 3539 irmp_store_bit (0);
JojoS 0:a0715ea739cb 3540 }
JojoS 0:a0715ea739cb 3541 }
JojoS 0:a0715ea739cb 3542 else
JojoS 0:a0715ea739cb 3543 #endif // IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3544 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3545 if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL)
JojoS 0:a0715ea739cb 3546 {
JojoS 0:a0715ea739cb 3547 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3548 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 3549 #endif // ANALYZE
JojoS 0:a0715ea739cb 3550
JojoS 0:a0715ea739cb 3551 if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3552 { // pause timings correct for "1"?
JojoS 0:a0715ea739cb 3553 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3554 ANALYZE_PUTCHAR ('1'); // yes, store 1
JojoS 0:a0715ea739cb 3555 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3556 #endif // ANALYZE
JojoS 0:a0715ea739cb 3557 irmp_store_bit (1);
JojoS 0:a0715ea739cb 3558 }
JojoS 0:a0715ea739cb 3559 else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 3560 { // pause timings correct for "0"?
JojoS 0:a0715ea739cb 3561 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3562 ANALYZE_PUTCHAR ('0'); // yes, store 0
JojoS 0:a0715ea739cb 3563 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3564 #endif // ANALYZE
JojoS 0:a0715ea739cb 3565 irmp_store_bit (0);
JojoS 0:a0715ea739cb 3566 }
JojoS 0:a0715ea739cb 3567 }
JojoS 0:a0715ea739cb 3568 else
JojoS 0:a0715ea739cb 3569 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1
JojoS 0:a0715ea739cb 3570 {
JojoS 0:a0715ea739cb 3571 ; // else do nothing
JojoS 0:a0715ea739cb 3572 }
JojoS 0:a0715ea739cb 3573
JojoS 0:a0715ea739cb 3574 irmp_pulse_time = 1; // set counter to 1, not 0
JojoS 0:a0715ea739cb 3575 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 3576 wait_for_start_space = 0;
JojoS 0:a0715ea739cb 3577 }
JojoS 0:a0715ea739cb 3578 }
JojoS 0:a0715ea739cb 3579 else if (wait_for_space) // the data section....
JojoS 0:a0715ea739cb 3580 { // counting the time of darkness....
JojoS 0:a0715ea739cb 3581 uint_fast8_t got_light = FALSE;
JojoS 0:a0715ea739cb 3582
JojoS 0:a0715ea739cb 3583 if (irmp_input) // still dark?
JojoS 0:a0715ea739cb 3584 { // yes...
JojoS 0:a0715ea739cb 3585 if (irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 1)
JojoS 0:a0715ea739cb 3586 {
JojoS 0:a0715ea739cb 3587 if (
JojoS 0:a0715ea739cb 3588 #if IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3589 (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) ||
JojoS 0:a0715ea739cb 3590 #endif
JojoS 0:a0715ea739cb 3591 #if IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 3592 (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) ||
JojoS 0:a0715ea739cb 3593 #endif
JojoS 0:a0715ea739cb 3594 (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max))
JojoS 0:a0715ea739cb 3595 {
JojoS 0:a0715ea739cb 3596 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3597 if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))
JojoS 0:a0715ea739cb 3598 {
JojoS 0:a0715ea739cb 3599 ANALYZE_PRINTF ("stop bit detected\n");
JojoS 0:a0715ea739cb 3600 }
JojoS 0:a0715ea739cb 3601 #endif // ANALYZE
JojoS 0:a0715ea739cb 3602 irmp_param.stop_bit = 0;
JojoS 0:a0715ea739cb 3603 }
JojoS 0:a0715ea739cb 3604 else
JojoS 0:a0715ea739cb 3605 {
JojoS 0:a0715ea739cb 3606 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3607 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",
JojoS 0:a0715ea739cb 3608 irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);
JojoS 0:a0715ea739cb 3609 #endif // ANALYZE
JojoS 0:a0715ea739cb 3610 irmp_start_bit_detected = 0; // wait for another start bit...
JojoS 0:a0715ea739cb 3611 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 3612 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 3613 }
JojoS 0:a0715ea739cb 3614 }
JojoS 0:a0715ea739cb 3615 else
JojoS 0:a0715ea739cb 3616 {
JojoS 0:a0715ea739cb 3617 irmp_pause_time++; // increment counter
JojoS 0:a0715ea739cb 3618
JojoS 0:a0715ea739cb 3619 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
JojoS 0:a0715ea739cb 3620 if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && // Sony has a variable number of bits:
JojoS 0:a0715ea739cb 3621 irmp_pause_time > SIRCS_PAUSE_LEN_MAX && // minimum is 12
JojoS 0:a0715ea739cb 3622 irmp_bit >= 12 - 1) // pause too long?
JojoS 0:a0715ea739cb 3623 { // yes, break and close this frame
JojoS 0:a0715ea739cb 3624 irmp_param.complete_len = irmp_bit + 1; // set new complete length
JojoS 0:a0715ea739cb 3625 got_light = TRUE; // this is a lie, but helps (generates stop bit)
JojoS 0:a0715ea739cb 3626 irmp_tmp_address |= (irmp_bit - SIRCS_MINIMUM_DATA_LEN + 1) << 8; // new: store number of additional bits in upper byte of address!
JojoS 0:a0715ea739cb 3627 irmp_param.command_end = irmp_param.command_offset + irmp_bit + 1; // correct command length
JojoS 0:a0715ea739cb 3628 irmp_pause_time = SIRCS_PAUSE_LEN_MAX - 1; // correct pause length
JojoS 0:a0715ea739cb 3629 }
JojoS 0:a0715ea739cb 3630 else
JojoS 0:a0715ea739cb 3631 #endif
JojoS 0:a0715ea739cb 3632 #if IRMP_SUPPORT_FAN_PROTOCOL == 1
JojoS 0:a0715ea739cb 3633 if (irmp_param.protocol == IRMP_FAN_PROTOCOL && // FAN has no stop bit.
JojoS 0:a0715ea739cb 3634 irmp_bit >= FAN_COMPLETE_DATA_LEN - 1) // last bit in frame
JojoS 0:a0715ea739cb 3635 { // yes, break and close this frame
JojoS 0:a0715ea739cb 3636 if (irmp_pulse_time <= FAN_0_PULSE_LEN_MAX && irmp_pause_time >= FAN_0_PAUSE_LEN_MIN)
JojoS 0:a0715ea739cb 3637 {
JojoS 0:a0715ea739cb 3638 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3639 ANALYZE_PRINTF ("Generating virtual stop bit\n");
JojoS 0:a0715ea739cb 3640 #endif // ANALYZE
JojoS 0:a0715ea739cb 3641 got_light = TRUE; // this is a lie, but helps (generates stop bit)
JojoS 0:a0715ea739cb 3642 }
JojoS 0:a0715ea739cb 3643 else if (irmp_pulse_time >= FAN_1_PULSE_LEN_MIN && irmp_pause_time >= FAN_1_PAUSE_LEN_MIN)
JojoS 0:a0715ea739cb 3644 {
JojoS 0:a0715ea739cb 3645 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3646 ANALYZE_PRINTF ("Generating virtual stop bit\n");
JojoS 0:a0715ea739cb 3647 #endif // ANALYZE
JojoS 0:a0715ea739cb 3648 got_light = TRUE; // this is a lie, but helps (generates stop bit)
JojoS 0:a0715ea739cb 3649 }
JojoS 0:a0715ea739cb 3650 }
JojoS 0:a0715ea739cb 3651 else
JojoS 0:a0715ea739cb 3652 #endif
JojoS 0:a0715ea739cb 3653 #if IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 3654 // NETBOX generates no stop bit, here is the timeout condition:
JojoS 0:a0715ea739cb 3655 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_NETBOX_PROTOCOL &&
JojoS 0:a0715ea739cb 3656 irmp_pause_time >= NETBOX_PULSE_LEN * (NETBOX_COMPLETE_DATA_LEN - irmp_bit))
JojoS 0:a0715ea739cb 3657 {
JojoS 0:a0715ea739cb 3658 got_light = TRUE; // this is a lie, but helps (generates stop bit)
JojoS 0:a0715ea739cb 3659 }
JojoS 0:a0715ea739cb 3660 else
JojoS 0:a0715ea739cb 3661 #endif
JojoS 0:a0715ea739cb 3662 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1
JojoS 0:a0715ea739cb 3663 if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)
JojoS 0:a0715ea739cb 3664 {
JojoS 0:a0715ea739cb 3665 if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6))
JojoS 0:a0715ea739cb 3666 {
JojoS 0:a0715ea739cb 3667 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3668 ANALYZE_PRINTF ("Switching to IR60 protocol\n");
JojoS 0:a0715ea739cb 3669 #endif // ANALYZE
JojoS 0:a0715ea739cb 3670 got_light = TRUE; // this is a lie, but generates a stop bit ;-)
JojoS 0:a0715ea739cb 3671 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3672
JojoS 0:a0715ea739cb 3673 irmp_param.protocol = IRMP_IR60_PROTOCOL; // change protocol
JojoS 0:a0715ea739cb 3674 irmp_param.complete_len = IR60_COMPLETE_DATA_LEN; // correct complete len
JojoS 0:a0715ea739cb 3675 irmp_param.address_offset = IR60_ADDRESS_OFFSET;
JojoS 0:a0715ea739cb 3676 irmp_param.address_end = IR60_ADDRESS_OFFSET + IR60_ADDRESS_LEN;
JojoS 0:a0715ea739cb 3677 irmp_param.command_offset = IR60_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 3678 irmp_param.command_end = IR60_COMMAND_OFFSET + IR60_COMMAND_LEN;
JojoS 0:a0715ea739cb 3679
JojoS 0:a0715ea739cb 3680 irmp_tmp_command <<= 1;
JojoS 0:a0715ea739cb 3681 irmp_tmp_command |= first_bit;
JojoS 0:a0715ea739cb 3682 }
JojoS 0:a0715ea739cb 3683 else if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN - 2)
JojoS 0:a0715ea739cb 3684 { // special manchester decoder
JojoS 0:a0715ea739cb 3685 irmp_param.complete_len = GRUNDIG_COMPLETE_DATA_LEN; // correct complete len
JojoS 0:a0715ea739cb 3686 got_light = TRUE; // this is a lie, but generates a stop bit ;-)
JojoS 0:a0715ea739cb 3687 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3688 }
JojoS 0:a0715ea739cb 3689 else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)
JojoS 0:a0715ea739cb 3690 {
JojoS 0:a0715ea739cb 3691 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3692 ANALYZE_PRINTF ("Switching to NOKIA protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3693 #endif // ANALYZE
JojoS 0:a0715ea739cb 3694 irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol
JojoS 0:a0715ea739cb 3695 irmp_param.address_offset = NOKIA_ADDRESS_OFFSET;
JojoS 0:a0715ea739cb 3696 irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;
JojoS 0:a0715ea739cb 3697 irmp_param.command_offset = NOKIA_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 3698 irmp_param.command_end = NOKIA_COMMAND_OFFSET + NOKIA_COMMAND_LEN;
JojoS 0:a0715ea739cb 3699
JojoS 0:a0715ea739cb 3700 if (irmp_tmp_command & 0x300)
JojoS 0:a0715ea739cb 3701 {
JojoS 0:a0715ea739cb 3702 irmp_tmp_address = (irmp_tmp_command >> 8);
JojoS 0:a0715ea739cb 3703 irmp_tmp_command &= 0xFF;
JojoS 0:a0715ea739cb 3704 }
JojoS 0:a0715ea739cb 3705 }
JojoS 0:a0715ea739cb 3706 }
JojoS 0:a0715ea739cb 3707 else
JojoS 0:a0715ea739cb 3708 #endif
JojoS 0:a0715ea739cb 3709 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1
JojoS 0:a0715ea739cb 3710 if (irmp_param.protocol == IRMP_RUWIDO_PROTOCOL && !irmp_param.stop_bit)
JojoS 0:a0715ea739cb 3711 {
JojoS 0:a0715ea739cb 3712 if (irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= RUWIDO_COMPLETE_DATA_LEN - 2)
JojoS 0:a0715ea739cb 3713 { // special manchester decoder
JojoS 0:a0715ea739cb 3714 irmp_param.complete_len = RUWIDO_COMPLETE_DATA_LEN; // correct complete len
JojoS 0:a0715ea739cb 3715 got_light = TRUE; // this is a lie, but generates a stop bit ;-)
JojoS 0:a0715ea739cb 3716 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3717 }
JojoS 0:a0715ea739cb 3718 else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)
JojoS 0:a0715ea739cb 3719 {
JojoS 0:a0715ea739cb 3720 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3721 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");
JojoS 0:a0715ea739cb 3722 #endif // ANALYZE
JojoS 0:a0715ea739cb 3723 irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol
JojoS 0:a0715ea739cb 3724 irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET;
JojoS 0:a0715ea739cb 3725 irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;
JojoS 0:a0715ea739cb 3726 irmp_param.command_offset = SIEMENS_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 3727 irmp_param.command_end = SIEMENS_COMMAND_OFFSET + SIEMENS_COMMAND_LEN;
JojoS 0:a0715ea739cb 3728
JojoS 0:a0715ea739cb 3729 // 76543210
JojoS 0:a0715ea739cb 3730 // RUWIDO: AAAAAAAAACCCCCCCp
JojoS 0:a0715ea739cb 3731 // SIEMENS: AAAAAAAAAAACCCCCCCCCCp
JojoS 0:a0715ea739cb 3732 irmp_tmp_address <<= 2;
JojoS 0:a0715ea739cb 3733 irmp_tmp_address |= (irmp_tmp_command >> 6);
JojoS 0:a0715ea739cb 3734 irmp_tmp_command &= 0x003F;
JojoS 0:a0715ea739cb 3735 // irmp_tmp_command <<= 4;
JojoS 0:a0715ea739cb 3736 irmp_tmp_command |= last_value;
JojoS 0:a0715ea739cb 3737 }
JojoS 0:a0715ea739cb 3738 }
JojoS 0:a0715ea739cb 3739 else
JojoS 0:a0715ea739cb 3740 #endif
JojoS 0:a0715ea739cb 3741 #if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
JojoS 0:a0715ea739cb 3742 if (irmp_param.protocol == IRMP_ROOMBA_PROTOCOL && // Roomba has no stop bit
JojoS 0:a0715ea739cb 3743 irmp_bit >= ROOMBA_COMPLETE_DATA_LEN - 1) // it's the last data bit...
JojoS 0:a0715ea739cb 3744 { // break and close this frame
JojoS 0:a0715ea739cb 3745 if (irmp_pulse_time >= ROOMBA_1_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_1_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 3746 {
JojoS 0:a0715ea739cb 3747 irmp_pause_time = ROOMBA_1_PAUSE_LEN_EXACT;
JojoS 0:a0715ea739cb 3748 }
JojoS 0:a0715ea739cb 3749 else if (irmp_pulse_time >= ROOMBA_0_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_0_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 3750 {
JojoS 0:a0715ea739cb 3751 irmp_pause_time = ROOMBA_0_PAUSE_LEN;
JojoS 0:a0715ea739cb 3752 }
JojoS 0:a0715ea739cb 3753
JojoS 0:a0715ea739cb 3754 got_light = TRUE; // this is a lie, but helps (generates stop bit)
JojoS 0:a0715ea739cb 3755 }
JojoS 0:a0715ea739cb 3756 else
JojoS 0:a0715ea739cb 3757 #endif
JojoS 0:a0715ea739cb 3758 #if IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3759 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&
JojoS 0:a0715ea739cb 3760 irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)
JojoS 0:a0715ea739cb 3761 { // special manchester decoder
JojoS 0:a0715ea739cb 3762 got_light = TRUE; // this is a lie, but generates a stop bit ;-)
JojoS 0:a0715ea739cb 3763 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3764 }
JojoS 0:a0715ea739cb 3765 else
JojoS 0:a0715ea739cb 3766 #endif // IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3767 if (irmp_pause_time > IRMP_TIMEOUT_LEN) // timeout?
JojoS 0:a0715ea739cb 3768 { // yes...
JojoS 0:a0715ea739cb 3769 if (irmp_bit == irmp_param.complete_len - 1 && irmp_param.stop_bit == 0)
JojoS 0:a0715ea739cb 3770 {
JojoS 0:a0715ea739cb 3771 irmp_bit++;
JojoS 0:a0715ea739cb 3772 }
JojoS 0:a0715ea739cb 3773 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3774 else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit
JojoS 0:a0715ea739cb 3775 {
JojoS 0:a0715ea739cb 3776 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3777 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3778 #endif // ANALYZE
JojoS 0:a0715ea739cb 3779 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3780 irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3781 irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
JojoS 0:a0715ea739cb 3782 irmp_tmp_command = (irmp_tmp_address >> 4); // set command: upper 12 bits are command bits
JojoS 0:a0715ea739cb 3783 irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits
JojoS 0:a0715ea739cb 3784 irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...
JojoS 0:a0715ea739cb 3785 }
JojoS 0:a0715ea739cb 3786 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3787 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3788 else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 28 || irmp_bit == 29)) // it was a LGAIR stop bit
JojoS 0:a0715ea739cb 3789 {
JojoS 0:a0715ea739cb 3790 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3791 ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3792 #endif // ANALYZE
JojoS 0:a0715ea739cb 3793 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3794 irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3795 irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
JojoS 0:a0715ea739cb 3796 irmp_tmp_command = irmp_lgair_command; // set command: upper 8 bits are command bits
JojoS 0:a0715ea739cb 3797 irmp_tmp_address = irmp_lgair_address; // lower 4 bits are address bits
JojoS 0:a0715ea739cb 3798 irmp_start_bit_detected = 1; // tricky: don't wait for another start bit...
JojoS 0:a0715ea739cb 3799 }
JojoS 0:a0715ea739cb 3800 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3801
JojoS 0:a0715ea739cb 3802 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 3803 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3804 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32) // it was a NEC stop bit
JojoS 0:a0715ea739cb 3805 {
JojoS 0:a0715ea739cb 3806 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3807 ANALYZE_PRINTF ("Switching to NEC protocol\n");
JojoS 0:a0715ea739cb 3808 #endif // ANALYZE
JojoS 0:a0715ea739cb 3809 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3810 irmp_param.protocol = IRMP_NEC_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3811 irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
JojoS 0:a0715ea739cb 3812
JojoS 0:a0715ea739cb 3813 // 0123456789ABC0123456789ABC0123456701234567
JojoS 0:a0715ea739cb 3814 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
JojoS 0:a0715ea739cb 3815 // NEC: AAAAAAAAaaaaaaaaCCCCCCCCcccccccc
JojoS 0:a0715ea739cb 3816 irmp_tmp_address |= (irmp_tmp_address2 & 0x0007) << 13; // fm 2012-02-13: 12 -> 13
JojoS 0:a0715ea739cb 3817 irmp_tmp_command = (irmp_tmp_address2 >> 3) | (irmp_tmp_command << 10);
JojoS 0:a0715ea739cb 3818 }
JojoS 0:a0715ea739cb 3819 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3820 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3821 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 28) // it was a NEC stop bit
JojoS 0:a0715ea739cb 3822 {
JojoS 0:a0715ea739cb 3823 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3824 ANALYZE_PRINTF ("Switching to LGAIR protocol\n");
JojoS 0:a0715ea739cb 3825 #endif // ANALYZE
JojoS 0:a0715ea739cb 3826 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3827 irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3828 irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
JojoS 0:a0715ea739cb 3829 irmp_tmp_address = irmp_lgair_address;
JojoS 0:a0715ea739cb 3830 irmp_tmp_command = irmp_lgair_command;
JojoS 0:a0715ea739cb 3831 }
JojoS 0:a0715ea739cb 3832 #endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1
JojoS 0:a0715ea739cb 3833 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3834 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit
JojoS 0:a0715ea739cb 3835 {
JojoS 0:a0715ea739cb 3836 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3837 ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3838 #endif // ANALYZE
JojoS 0:a0715ea739cb 3839 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3840 irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3841 irmp_param.complete_len = irmp_bit; // patch length: 16 or 17
JojoS 0:a0715ea739cb 3842
JojoS 0:a0715ea739cb 3843 // 0123456789ABC0123456789ABC0123456701234567
JojoS 0:a0715ea739cb 3844 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc
JojoS 0:a0715ea739cb 3845 // JVC: AAAACCCCCCCCCCCC
JojoS 0:a0715ea739cb 3846 irmp_tmp_command = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9); // set command: upper 12 bits are command bits
JojoS 0:a0715ea739cb 3847 irmp_tmp_address = irmp_tmp_address & 0x000F; // lower 4 bits are address bits
JojoS 0:a0715ea739cb 3848 }
JojoS 0:a0715ea739cb 3849 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 3850 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 3851
JojoS 0:a0715ea739cb 3852 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
JojoS 0:a0715ea739cb 3853 else if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit == 32) // it was a SAMSUNG32 stop bit
JojoS 0:a0715ea739cb 3854 {
JojoS 0:a0715ea739cb 3855 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3856 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");
JojoS 0:a0715ea739cb 3857 #endif // ANALYZE
JojoS 0:a0715ea739cb 3858 irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;
JojoS 0:a0715ea739cb 3859 irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 3860 irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;
JojoS 0:a0715ea739cb 3861 irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;
JojoS 0:a0715ea739cb 3862 }
JojoS 0:a0715ea739cb 3863 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 3864
JojoS 0:a0715ea739cb 3865 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 3866 else if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL && (irmp_bit == 12 || irmp_bit == 24)) // it was a RCMM stop bit
JojoS 0:a0715ea739cb 3867 {
JojoS 0:a0715ea739cb 3868 if (irmp_bit == 12)
JojoS 0:a0715ea739cb 3869 {
JojoS 0:a0715ea739cb 3870 irmp_tmp_command = (irmp_tmp_address & 0xFF); // set command: lower 8 bits are command bits
JojoS 0:a0715ea739cb 3871 irmp_tmp_address >>= 8; // upper 4 bits are address bits
JojoS 0:a0715ea739cb 3872
JojoS 0:a0715ea739cb 3873 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3874 ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3875 #endif // ANALYZE
JojoS 0:a0715ea739cb 3876 irmp_param.protocol = IRMP_RCMM12_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3877 }
JojoS 0:a0715ea739cb 3878 else // if ((irmp_bit == 24)
JojoS 0:a0715ea739cb 3879 {
JojoS 0:a0715ea739cb 3880 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3881 ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3882 #endif // ANALYZE
JojoS 0:a0715ea739cb 3883 irmp_param.protocol = IRMP_RCMM24_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3884 }
JojoS 0:a0715ea739cb 3885 irmp_param.stop_bit = TRUE; // set flag
JojoS 0:a0715ea739cb 3886 irmp_param.complete_len = irmp_bit; // patch length
JojoS 0:a0715ea739cb 3887 }
JojoS 0:a0715ea739cb 3888 #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 3889
JojoS 0:a0715ea739cb 3890 #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
JojoS 0:a0715ea739cb 3891 else if (irmp_param.protocol == IRMP_MATSUSHITA_PROTOCOL && irmp_bit == 22) // it was a TECHNICS stop bit
JojoS 0:a0715ea739cb 3892 {
JojoS 0:a0715ea739cb 3893 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3894 ANALYZE_PRINTF ("Switching to TECHNICS protocol, irmp_bit = %d\n", irmp_bit);
JojoS 0:a0715ea739cb 3895 #endif // ANALYZE
JojoS 0:a0715ea739cb 3896 // Situation:
JojoS 0:a0715ea739cb 3897 // The first 12 bits have been stored in irmp_tmp_command (LSB first)
JojoS 0:a0715ea739cb 3898 // The following 10 bits have been stored in irmp_tmp_address (LSB first)
JojoS 0:a0715ea739cb 3899 // The code of TECHNICS is:
JojoS 0:a0715ea739cb 3900 // cccccccccccCCCCCCCCCCC (11 times c and 11 times C)
JojoS 0:a0715ea739cb 3901 // ccccccccccccaaaaaaaaaa
JojoS 0:a0715ea739cb 3902 // where C is inverted value of c
JojoS 0:a0715ea739cb 3903
JojoS 0:a0715ea739cb 3904 irmp_tmp_address <<= 1;
JojoS 0:a0715ea739cb 3905 if (irmp_tmp_command & (1<<11))
JojoS 0:a0715ea739cb 3906 {
JojoS 0:a0715ea739cb 3907 irmp_tmp_address |= 1;
JojoS 0:a0715ea739cb 3908 irmp_tmp_command &= ~(1<<11);
JojoS 0:a0715ea739cb 3909 }
JojoS 0:a0715ea739cb 3910
JojoS 0:a0715ea739cb 3911 if (irmp_tmp_command == ((~irmp_tmp_address) & 0x07FF))
JojoS 0:a0715ea739cb 3912 {
JojoS 0:a0715ea739cb 3913 irmp_tmp_address = 0;
JojoS 0:a0715ea739cb 3914
JojoS 0:a0715ea739cb 3915 irmp_param.protocol = IRMP_TECHNICS_PROTOCOL; // switch protocol
JojoS 0:a0715ea739cb 3916 irmp_param.complete_len = irmp_bit; // patch length
JojoS 0:a0715ea739cb 3917 }
JojoS 0:a0715ea739cb 3918 else
JojoS 0:a0715ea739cb 3919 {
JojoS 0:a0715ea739cb 3920 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3921 ANALYZE_PRINTF ("error 8: TECHNICS frame error\n");
JojoS 0:a0715ea739cb 3922 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 3923 #endif // ANALYZE
JojoS 0:a0715ea739cb 3924 irmp_start_bit_detected = 0; // wait for another start bit...
JojoS 0:a0715ea739cb 3925 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 3926 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 3927 }
JojoS 0:a0715ea739cb 3928 }
JojoS 0:a0715ea739cb 3929 #endif // IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
JojoS 0:a0715ea739cb 3930 else
JojoS 0:a0715ea739cb 3931 {
JojoS 0:a0715ea739cb 3932 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3933 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);
JojoS 0:a0715ea739cb 3934 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 3935 #endif // ANALYZE
JojoS 0:a0715ea739cb 3936 irmp_start_bit_detected = 0; // wait for another start bit...
JojoS 0:a0715ea739cb 3937 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 3938 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 3939 }
JojoS 0:a0715ea739cb 3940 }
JojoS 0:a0715ea739cb 3941 }
JojoS 0:a0715ea739cb 3942 }
JojoS 0:a0715ea739cb 3943 else
JojoS 0:a0715ea739cb 3944 { // got light now!
JojoS 0:a0715ea739cb 3945 got_light = TRUE;
JojoS 0:a0715ea739cb 3946 }
JojoS 0:a0715ea739cb 3947
JojoS 0:a0715ea739cb 3948 if (got_light)
JojoS 0:a0715ea739cb 3949 {
JojoS 0:a0715ea739cb 3950 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3951 ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 3952 #endif // ANALYZE
JojoS 0:a0715ea739cb 3953
JojoS 0:a0715ea739cb 3954 #if IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 3955 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester
JojoS 0:a0715ea739cb 3956 {
JojoS 0:a0715ea739cb 3957 #if 1
JojoS 0:a0715ea739cb 3958 if (irmp_pulse_time > irmp_param.pulse_1_len_max /* && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max */)
JojoS 0:a0715ea739cb 3959 #else // better, but some IR-RCs use asymmetric timings :-/
JojoS 0:a0715ea739cb 3960 if (irmp_pulse_time > irmp_param.pulse_1_len_max && irmp_pulse_time <= 2 * irmp_param.pulse_1_len_max &&
JojoS 0:a0715ea739cb 3961 irmp_pause_time <= 2 * irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 3962 #endif
JojoS 0:a0715ea739cb 3963 {
JojoS 0:a0715ea739cb 3964 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3965 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit
JojoS 0:a0715ea739cb 3966 {
JojoS 0:a0715ea739cb 3967 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3968 ANALYZE_PUTCHAR ('T');
JojoS 0:a0715ea739cb 3969 #endif // ANALYZE
JojoS 0:a0715ea739cb 3970 if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A
JojoS 0:a0715ea739cb 3971 {
JojoS 0:a0715ea739cb 3972 irmp_store_bit (1);
JojoS 0:a0715ea739cb 3973 last_value = 1;
JojoS 0:a0715ea739cb 3974 }
JojoS 0:a0715ea739cb 3975 else // RC6 mode 0
JojoS 0:a0715ea739cb 3976 {
JojoS 0:a0715ea739cb 3977 irmp_store_bit (0);
JojoS 0:a0715ea739cb 3978 last_value = 0;
JojoS 0:a0715ea739cb 3979 }
JojoS 0:a0715ea739cb 3980 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3981 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 3982 #endif // ANALYZE
JojoS 0:a0715ea739cb 3983 }
JojoS 0:a0715ea739cb 3984 else
JojoS 0:a0715ea739cb 3985 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3986 {
JojoS 0:a0715ea739cb 3987 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3988 ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');
JojoS 0:a0715ea739cb 3989 #endif // ANALYZE
JojoS 0:a0715ea739cb 3990 irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 );
JojoS 0:a0715ea739cb 3991
JojoS 0:a0715ea739cb 3992 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 3993 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit
JojoS 0:a0715ea739cb 3994 {
JojoS 0:a0715ea739cb 3995 #ifdef ANALYZE
JojoS 0:a0715ea739cb 3996 ANALYZE_PUTCHAR ('T');
JojoS 0:a0715ea739cb 3997 #endif // ANALYZE
JojoS 0:a0715ea739cb 3998 irmp_store_bit (1);
JojoS 0:a0715ea739cb 3999
JojoS 0:a0715ea739cb 4000 if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 4001 {
JojoS 0:a0715ea739cb 4002 last_value = 0;
JojoS 0:a0715ea739cb 4003 }
JojoS 0:a0715ea739cb 4004 else
JojoS 0:a0715ea739cb 4005 {
JojoS 0:a0715ea739cb 4006 last_value = 1;
JojoS 0:a0715ea739cb 4007 }
JojoS 0:a0715ea739cb 4008 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4009 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4010 #endif // ANALYZE
JojoS 0:a0715ea739cb 4011 }
JojoS 0:a0715ea739cb 4012 else
JojoS 0:a0715ea739cb 4013 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 4014 {
JojoS 0:a0715ea739cb 4015 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4016 ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');
JojoS 0:a0715ea739cb 4017 #endif // ANALYZE
JojoS 0:a0715ea739cb 4018 irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 );
JojoS 0:a0715ea739cb 4019 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 4020 if (! irmp_param2.protocol)
JojoS 0:a0715ea739cb 4021 #endif
JojoS 0:a0715ea739cb 4022 {
JojoS 0:a0715ea739cb 4023 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4024 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4025 #endif // ANALYZE
JojoS 0:a0715ea739cb 4026 }
JojoS 0:a0715ea739cb 4027 last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;
JojoS 0:a0715ea739cb 4028 }
JojoS 0:a0715ea739cb 4029 }
JojoS 0:a0715ea739cb 4030 }
JojoS 0:a0715ea739cb 4031 else if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max
JojoS 0:a0715ea739cb 4032 /* && irmp_pause_time <= 2 * irmp_param.pause_1_len_max */)
JojoS 0:a0715ea739cb 4033 {
JojoS 0:a0715ea739cb 4034 uint_fast8_t manchester_value;
JojoS 0:a0715ea739cb 4035
JojoS 0:a0715ea739cb 4036 if (last_pause > irmp_param.pause_1_len_max && last_pause <= 2 * irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 4037 {
JojoS 0:a0715ea739cb 4038 manchester_value = last_value ? 0 : 1;
JojoS 0:a0715ea739cb 4039 last_value = manchester_value;
JojoS 0:a0715ea739cb 4040 }
JojoS 0:a0715ea739cb 4041 else
JojoS 0:a0715ea739cb 4042 {
JojoS 0:a0715ea739cb 4043 manchester_value = last_value;
JojoS 0:a0715ea739cb 4044 }
JojoS 0:a0715ea739cb 4045
JojoS 0:a0715ea739cb 4046 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4047 ANALYZE_PUTCHAR (manchester_value + '0');
JojoS 0:a0715ea739cb 4048 #endif // ANALYZE
JojoS 0:a0715ea739cb 4049
JojoS 0:a0715ea739cb 4050 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
JojoS 0:a0715ea739cb 4051 if (! irmp_param2.protocol)
JojoS 0:a0715ea739cb 4052 #endif
JojoS 0:a0715ea739cb 4053 {
JojoS 0:a0715ea739cb 4054 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4055 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4056 #endif // ANALYZE
JojoS 0:a0715ea739cb 4057 }
JojoS 0:a0715ea739cb 4058
JojoS 0:a0715ea739cb 4059 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 4060 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1) // RC6 mode != 0 ???
JojoS 0:a0715ea739cb 4061 {
JojoS 0:a0715ea739cb 4062 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4063 ANALYZE_PRINTF ("Switching to RC6A protocol\n");
JojoS 0:a0715ea739cb 4064 #endif // ANALYZE
JojoS 0:a0715ea739cb 4065 irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;
JojoS 0:a0715ea739cb 4066 irmp_param.address_offset = 5;
JojoS 0:a0715ea739cb 4067 irmp_param.address_end = irmp_param.address_offset + 15;
JojoS 0:a0715ea739cb 4068 irmp_param.command_offset = irmp_param.address_end + 1; // skip 1 system bit, changes like a toggle bit
JojoS 0:a0715ea739cb 4069 irmp_param.command_end = irmp_param.command_offset + 16 - 1;
JojoS 0:a0715ea739cb 4070 irmp_tmp_address = 0;
JojoS 0:a0715ea739cb 4071 }
JojoS 0:a0715ea739cb 4072 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 4073
JojoS 0:a0715ea739cb 4074 irmp_store_bit (manchester_value);
JojoS 0:a0715ea739cb 4075 }
JojoS 0:a0715ea739cb 4076 else
JojoS 0:a0715ea739cb 4077 {
JojoS 0:a0715ea739cb 4078 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4079 if (irmp_param2.protocol == IRMP_FDC_PROTOCOL &&
JojoS 0:a0715ea739cb 4080 irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 4081 ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 4082 (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 4083 {
JojoS 0:a0715ea739cb 4084 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4085 ANALYZE_PUTCHAR ('?');
JojoS 0:a0715ea739cb 4086 #endif // ANALYZE
JojoS 0:a0715ea739cb 4087 irmp_param.protocol = 0; // switch to FDC, see below
JojoS 0:a0715ea739cb 4088 }
JojoS 0:a0715ea739cb 4089 else
JojoS 0:a0715ea739cb 4090 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4091 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 4092 if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL &&
JojoS 0:a0715ea739cb 4093 irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 4094 ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 4095 (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 4096 {
JojoS 0:a0715ea739cb 4097 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4098 ANALYZE_PUTCHAR ('?');
JojoS 0:a0715ea739cb 4099 #endif // ANALYZE
JojoS 0:a0715ea739cb 4100 irmp_param.protocol = 0; // switch to RCCAR, see below
JojoS 0:a0715ea739cb 4101 }
JojoS 0:a0715ea739cb 4102 else
JojoS 0:a0715ea739cb 4103 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 4104 {
JojoS 0:a0715ea739cb 4105 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4106 ANALYZE_PUTCHAR ('?');
JojoS 0:a0715ea739cb 4107 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4108 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 4109 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4110 #endif // ANALYZE
JojoS 0:a0715ea739cb 4111 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4112 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4113 }
JojoS 0:a0715ea739cb 4114 }
JojoS 0:a0715ea739cb 4115
JojoS 0:a0715ea739cb 4116 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4117 if (irmp_param2.protocol == IRMP_FDC_PROTOCOL && irmp_pulse_time >= FDC_PULSE_LEN_MIN && irmp_pulse_time <= FDC_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 4118 {
JojoS 0:a0715ea739cb 4119 if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4120 {
JojoS 0:a0715ea739cb 4121 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4122 ANALYZE_PRINTF (" 1 (FDC)\n");
JojoS 0:a0715ea739cb 4123 #endif // ANALYZE
JojoS 0:a0715ea739cb 4124 irmp_store_bit2 (1);
JojoS 0:a0715ea739cb 4125 }
JojoS 0:a0715ea739cb 4126 else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4127 {
JojoS 0:a0715ea739cb 4128 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4129 ANALYZE_PRINTF (" 0 (FDC)\n");
JojoS 0:a0715ea739cb 4130 #endif // ANALYZE
JojoS 0:a0715ea739cb 4131 irmp_store_bit2 (0);
JojoS 0:a0715ea739cb 4132 }
JojoS 0:a0715ea739cb 4133
JojoS 0:a0715ea739cb 4134 if (! irmp_param.protocol)
JojoS 0:a0715ea739cb 4135 {
JojoS 0:a0715ea739cb 4136 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4137 ANALYZE_PRINTF ("Switching to FDC protocol\n");
JojoS 0:a0715ea739cb 4138 #endif // ANALYZE
JojoS 0:a0715ea739cb 4139 memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));
JojoS 0:a0715ea739cb 4140 irmp_param2.protocol = 0;
JojoS 0:a0715ea739cb 4141 irmp_tmp_address = irmp_tmp_address2;
JojoS 0:a0715ea739cb 4142 irmp_tmp_command = irmp_tmp_command2;
JojoS 0:a0715ea739cb 4143 }
JojoS 0:a0715ea739cb 4144 }
JojoS 0:a0715ea739cb 4145 #endif // IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4146 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 4147 if (irmp_param2.protocol == IRMP_RCCAR_PROTOCOL && irmp_pulse_time >= RCCAR_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 4148 {
JojoS 0:a0715ea739cb 4149 if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4150 {
JojoS 0:a0715ea739cb 4151 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4152 ANALYZE_PRINTF (" 1 (RCCAR)\n");
JojoS 0:a0715ea739cb 4153 #endif // ANALYZE
JojoS 0:a0715ea739cb 4154 irmp_store_bit2 (1);
JojoS 0:a0715ea739cb 4155 }
JojoS 0:a0715ea739cb 4156 else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4157 {
JojoS 0:a0715ea739cb 4158 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4159 ANALYZE_PRINTF (" 0 (RCCAR)\n");
JojoS 0:a0715ea739cb 4160 #endif // ANALYZE
JojoS 0:a0715ea739cb 4161 irmp_store_bit2 (0);
JojoS 0:a0715ea739cb 4162 }
JojoS 0:a0715ea739cb 4163
JojoS 0:a0715ea739cb 4164 if (! irmp_param.protocol)
JojoS 0:a0715ea739cb 4165 {
JojoS 0:a0715ea739cb 4166 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4167 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");
JojoS 0:a0715ea739cb 4168 #endif // ANALYZE
JojoS 0:a0715ea739cb 4169 memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));
JojoS 0:a0715ea739cb 4170 irmp_param2.protocol = 0;
JojoS 0:a0715ea739cb 4171 irmp_tmp_address = irmp_tmp_address2;
JojoS 0:a0715ea739cb 4172 irmp_tmp_command = irmp_tmp_command2;
JojoS 0:a0715ea739cb 4173 }
JojoS 0:a0715ea739cb 4174 }
JojoS 0:a0715ea739cb 4175 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1
JojoS 0:a0715ea739cb 4176
JojoS 0:a0715ea739cb 4177 last_pause = irmp_pause_time;
JojoS 0:a0715ea739cb 4178 wait_for_space = 0;
JojoS 0:a0715ea739cb 4179 }
JojoS 0:a0715ea739cb 4180 else
JojoS 0:a0715ea739cb 4181 #endif // IRMP_SUPPORT_MANCHESTER == 1
JojoS 0:a0715ea739cb 4182
JojoS 0:a0715ea739cb 4183 #if IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 4184 if (irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL)
JojoS 0:a0715ea739cb 4185 {
JojoS 0:a0715ea739cb 4186 while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)
JojoS 0:a0715ea739cb 4187 {
JojoS 0:a0715ea739cb 4188 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4189 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4190 #endif // ANALYZE
JojoS 0:a0715ea739cb 4191 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4192
JojoS 0:a0715ea739cb 4193 if (irmp_pulse_time >= irmp_param.pulse_1_len_min)
JojoS 0:a0715ea739cb 4194 {
JojoS 0:a0715ea739cb 4195 irmp_pulse_time -= irmp_param.pulse_1_len_min;
JojoS 0:a0715ea739cb 4196 }
JojoS 0:a0715ea739cb 4197 else
JojoS 0:a0715ea739cb 4198 {
JojoS 0:a0715ea739cb 4199 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 4200 }
JojoS 0:a0715ea739cb 4201 }
JojoS 0:a0715ea739cb 4202
JojoS 0:a0715ea739cb 4203 while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 4204 {
JojoS 0:a0715ea739cb 4205 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4206 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4207 #endif // ANALYZE
JojoS 0:a0715ea739cb 4208 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4209
JojoS 0:a0715ea739cb 4210 if (irmp_pause_time >= irmp_param.pause_1_len_min)
JojoS 0:a0715ea739cb 4211 {
JojoS 0:a0715ea739cb 4212 irmp_pause_time -= irmp_param.pause_1_len_min;
JojoS 0:a0715ea739cb 4213 }
JojoS 0:a0715ea739cb 4214 else
JojoS 0:a0715ea739cb 4215 {
JojoS 0:a0715ea739cb 4216 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4217 }
JojoS 0:a0715ea739cb 4218 }
JojoS 0:a0715ea739cb 4219 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4220 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4221 #endif // ANALYZE
JojoS 0:a0715ea739cb 4222 wait_for_space = 0;
JojoS 0:a0715ea739cb 4223 }
JojoS 0:a0715ea739cb 4224 else
JojoS 0:a0715ea739cb 4225 #endif // IRMP_SUPPORT_SERIAL == 1
JojoS 0:a0715ea739cb 4226
JojoS 0:a0715ea739cb 4227 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 4228 if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit == 16) // Samsung: 16th bit
JojoS 0:a0715ea739cb 4229 {
JojoS 0:a0715ea739cb 4230 if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 4231 irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4232 {
JojoS 0:a0715ea739cb 4233 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4234 ANALYZE_PRINTF ("SYNC\n");
JojoS 0:a0715ea739cb 4235 #endif // ANALYZE
JojoS 0:a0715ea739cb 4236 wait_for_space = 0;
JojoS 0:a0715ea739cb 4237 irmp_bit++;
JojoS 0:a0715ea739cb 4238 }
JojoS 0:a0715ea739cb 4239 else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 4240 {
JojoS 0:a0715ea739cb 4241 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1
JojoS 0:a0715ea739cb 4242 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4243 ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol ");
JojoS 0:a0715ea739cb 4244 #endif // ANALYZE
JojoS 0:a0715ea739cb 4245 irmp_param.protocol = IRMP_SAMSUNG48_PROTOCOL;
JojoS 0:a0715ea739cb 4246 irmp_param.command_offset = SAMSUNG48_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 4247 irmp_param.command_end = SAMSUNG48_COMMAND_OFFSET + SAMSUNG48_COMMAND_LEN;
JojoS 0:a0715ea739cb 4248 irmp_param.complete_len = SAMSUNG48_COMPLETE_DATA_LEN;
JojoS 0:a0715ea739cb 4249 #else
JojoS 0:a0715ea739cb 4250 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4251 ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol ");
JojoS 0:a0715ea739cb 4252 #endif // ANALYZE
JojoS 0:a0715ea739cb 4253 irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL;
JojoS 0:a0715ea739cb 4254 irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 4255 irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;
JojoS 0:a0715ea739cb 4256 irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN;
JojoS 0:a0715ea739cb 4257 #endif
JojoS 0:a0715ea739cb 4258 if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4259 {
JojoS 0:a0715ea739cb 4260 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4261 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4262 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4263 #endif // ANALYZE
JojoS 0:a0715ea739cb 4264 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4265 wait_for_space = 0;
JojoS 0:a0715ea739cb 4266 }
JojoS 0:a0715ea739cb 4267 else
JojoS 0:a0715ea739cb 4268 {
JojoS 0:a0715ea739cb 4269 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4270 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4271 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4272 #endif // ANALYZE
JojoS 0:a0715ea739cb 4273 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4274 wait_for_space = 0;
JojoS 0:a0715ea739cb 4275 }
JojoS 0:a0715ea739cb 4276 }
JojoS 0:a0715ea739cb 4277 else
JojoS 0:a0715ea739cb 4278 { // timing incorrect!
JojoS 0:a0715ea739cb 4279 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4280 ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 4281 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4282 #endif // ANALYZE
JojoS 0:a0715ea739cb 4283 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4284 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4285 }
JojoS 0:a0715ea739cb 4286 }
JojoS 0:a0715ea739cb 4287 else
JojoS 0:a0715ea739cb 4288 #endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL
JojoS 0:a0715ea739cb 4289
JojoS 0:a0715ea739cb 4290 #if IRMP_SUPPORT_NEC16_PROTOCOL
JojoS 0:a0715ea739cb 4291 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 4292 if (irmp_param.protocol == IRMP_NEC42_PROTOCOL &&
JojoS 0:a0715ea739cb 4293 #else // IRMP_SUPPORT_NEC_PROTOCOL instead
JojoS 0:a0715ea739cb 4294 if (irmp_param.protocol == IRMP_NEC_PROTOCOL &&
JojoS 0:a0715ea739cb 4295 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1
JojoS 0:a0715ea739cb 4296 irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4297 {
JojoS 0:a0715ea739cb 4298 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4299 ANALYZE_PRINTF ("Switching to NEC16 protocol\n");
JojoS 0:a0715ea739cb 4300 #endif // ANALYZE
JojoS 0:a0715ea739cb 4301 irmp_param.protocol = IRMP_NEC16_PROTOCOL;
JojoS 0:a0715ea739cb 4302 irmp_param.address_offset = NEC16_ADDRESS_OFFSET;
JojoS 0:a0715ea739cb 4303 irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN;
JojoS 0:a0715ea739cb 4304 irmp_param.command_offset = NEC16_COMMAND_OFFSET;
JojoS 0:a0715ea739cb 4305 irmp_param.command_end = NEC16_COMMAND_OFFSET + NEC16_COMMAND_LEN;
JojoS 0:a0715ea739cb 4306 irmp_param.complete_len = NEC16_COMPLETE_DATA_LEN;
JojoS 0:a0715ea739cb 4307 wait_for_space = 0;
JojoS 0:a0715ea739cb 4308 }
JojoS 0:a0715ea739cb 4309 else
JojoS 0:a0715ea739cb 4310 #endif // IRMP_SUPPORT_NEC16_PROTOCOL
JojoS 0:a0715ea739cb 4311
JojoS 0:a0715ea739cb 4312 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1
JojoS 0:a0715ea739cb 4313 if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)
JojoS 0:a0715ea739cb 4314 {
JojoS 0:a0715ea739cb 4315 if (irmp_pulse_time >= BANG_OLUFSEN_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_PULSE_LEN_MAX)
JojoS 0:a0715ea739cb 4316 {
JojoS 0:a0715ea739cb 4317 if (irmp_bit == 1) // Bang & Olufsen: 3rd bit
JojoS 0:a0715ea739cb 4318 {
JojoS 0:a0715ea739cb 4319 if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4320 {
JojoS 0:a0715ea739cb 4321 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4322 ANALYZE_PRINTF ("3rd start bit\n");
JojoS 0:a0715ea739cb 4323 #endif // ANALYZE
JojoS 0:a0715ea739cb 4324 wait_for_space = 0;
JojoS 0:a0715ea739cb 4325 irmp_bit++;
JojoS 0:a0715ea739cb 4326 }
JojoS 0:a0715ea739cb 4327 else
JojoS 0:a0715ea739cb 4328 { // timing incorrect!
JojoS 0:a0715ea739cb 4329 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4330 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);
JojoS 0:a0715ea739cb 4331 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4332 #endif // ANALYZE
JojoS 0:a0715ea739cb 4333 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4334 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4335 }
JojoS 0:a0715ea739cb 4336 }
JojoS 0:a0715ea739cb 4337 else if (irmp_bit == 19) // Bang & Olufsen: trailer bit
JojoS 0:a0715ea739cb 4338 {
JojoS 0:a0715ea739cb 4339 if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4340 {
JojoS 0:a0715ea739cb 4341 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4342 ANALYZE_PRINTF ("trailer bit\n");
JojoS 0:a0715ea739cb 4343 #endif // ANALYZE
JojoS 0:a0715ea739cb 4344 wait_for_space = 0;
JojoS 0:a0715ea739cb 4345 irmp_bit++;
JojoS 0:a0715ea739cb 4346 }
JojoS 0:a0715ea739cb 4347 else
JojoS 0:a0715ea739cb 4348 { // timing incorrect!
JojoS 0:a0715ea739cb 4349 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4350 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);
JojoS 0:a0715ea739cb 4351 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4352 #endif // ANALYZE
JojoS 0:a0715ea739cb 4353 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4354 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4355 }
JojoS 0:a0715ea739cb 4356 }
JojoS 0:a0715ea739cb 4357 else
JojoS 0:a0715ea739cb 4358 {
JojoS 0:a0715ea739cb 4359 if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4360 { // pulse & pause timings correct for "1"?
JojoS 0:a0715ea739cb 4361 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4362 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4363 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4364 #endif // ANALYZE
JojoS 0:a0715ea739cb 4365 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4366 last_value = 1;
JojoS 0:a0715ea739cb 4367 wait_for_space = 0;
JojoS 0:a0715ea739cb 4368 }
JojoS 0:a0715ea739cb 4369 else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4370 { // pulse & pause timings correct for "0"?
JojoS 0:a0715ea739cb 4371 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4372 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4373 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4374 #endif // ANALYZE
JojoS 0:a0715ea739cb 4375 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4376 last_value = 0;
JojoS 0:a0715ea739cb 4377 wait_for_space = 0;
JojoS 0:a0715ea739cb 4378 }
JojoS 0:a0715ea739cb 4379 else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4380 {
JojoS 0:a0715ea739cb 4381 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4382 ANALYZE_PUTCHAR (last_value + '0');
JojoS 0:a0715ea739cb 4383 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4384 #endif // ANALYZE
JojoS 0:a0715ea739cb 4385 irmp_store_bit (last_value);
JojoS 0:a0715ea739cb 4386 wait_for_space = 0;
JojoS 0:a0715ea739cb 4387 }
JojoS 0:a0715ea739cb 4388 else
JojoS 0:a0715ea739cb 4389 { // timing incorrect!
JojoS 0:a0715ea739cb 4390 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4391 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);
JojoS 0:a0715ea739cb 4392 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4393 #endif // ANALYZE
JojoS 0:a0715ea739cb 4394 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4395 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4396 }
JojoS 0:a0715ea739cb 4397 }
JojoS 0:a0715ea739cb 4398 }
JojoS 0:a0715ea739cb 4399 else
JojoS 0:a0715ea739cb 4400 { // timing incorrect!
JojoS 0:a0715ea739cb 4401 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4402 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);
JojoS 0:a0715ea739cb 4403 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4404 #endif // ANALYZE
JojoS 0:a0715ea739cb 4405 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4406 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4407 }
JojoS 0:a0715ea739cb 4408 }
JojoS 0:a0715ea739cb 4409 else
JojoS 0:a0715ea739cb 4410 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL
JojoS 0:a0715ea739cb 4411
JojoS 0:a0715ea739cb 4412 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1
JojoS 0:a0715ea739cb 4413 if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL)
JojoS 0:a0715ea739cb 4414 {
JojoS 0:a0715ea739cb 4415 if (irmp_pause_time >= RCMM32_BIT_00_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_00_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4416 {
JojoS 0:a0715ea739cb 4417 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4418 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4419 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4420 #endif // ANALYZE
JojoS 0:a0715ea739cb 4421 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4422 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4423 }
JojoS 0:a0715ea739cb 4424 else if (irmp_pause_time >= RCMM32_BIT_01_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_01_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4425 {
JojoS 0:a0715ea739cb 4426 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4427 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4428 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4429 #endif // ANALYZE
JojoS 0:a0715ea739cb 4430 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4431 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4432 }
JojoS 0:a0715ea739cb 4433 else if (irmp_pause_time >= RCMM32_BIT_10_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_10_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4434 {
JojoS 0:a0715ea739cb 4435 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4436 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4437 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4438 #endif // ANALYZE
JojoS 0:a0715ea739cb 4439 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4440 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4441 }
JojoS 0:a0715ea739cb 4442 else if (irmp_pause_time >= RCMM32_BIT_11_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_11_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4443 {
JojoS 0:a0715ea739cb 4444 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4445 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4446 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4447 #endif // ANALYZE
JojoS 0:a0715ea739cb 4448 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4449 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4450 }
JojoS 0:a0715ea739cb 4451 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4452 ANALYZE_PRINTF ("\n");
JojoS 0:a0715ea739cb 4453 #endif // ANALYZE
JojoS 0:a0715ea739cb 4454 wait_for_space = 0;
JojoS 0:a0715ea739cb 4455 }
JojoS 0:a0715ea739cb 4456 else
JojoS 0:a0715ea739cb 4457 #endif
JojoS 0:a0715ea739cb 4458
JojoS 0:a0715ea739cb 4459 if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&
JojoS 0:a0715ea739cb 4460 irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)
JojoS 0:a0715ea739cb 4461 { // pulse & pause timings correct for "1"?
JojoS 0:a0715ea739cb 4462 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4463 ANALYZE_PUTCHAR ('1');
JojoS 0:a0715ea739cb 4464 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4465 #endif // ANALYZE
JojoS 0:a0715ea739cb 4466 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4467 wait_for_space = 0;
JojoS 0:a0715ea739cb 4468 }
JojoS 0:a0715ea739cb 4469 else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&
JojoS 0:a0715ea739cb 4470 irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)
JojoS 0:a0715ea739cb 4471 { // pulse & pause timings correct for "0"?
JojoS 0:a0715ea739cb 4472 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4473 ANALYZE_PUTCHAR ('0');
JojoS 0:a0715ea739cb 4474 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4475 #endif // ANALYZE
JojoS 0:a0715ea739cb 4476 irmp_store_bit (0);
JojoS 0:a0715ea739cb 4477 wait_for_space = 0;
JojoS 0:a0715ea739cb 4478 }
JojoS 0:a0715ea739cb 4479 else
JojoS 0:a0715ea739cb 4480 #if IRMP_SUPPORT_KATHREIN_PROTOCOL
JojoS 0:a0715ea739cb 4481
JojoS 0:a0715ea739cb 4482 if (irmp_param.protocol == IRMP_KATHREIN_PROTOCOL &&
JojoS 0:a0715ea739cb 4483 irmp_pulse_time >= KATHREIN_1_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_1_PULSE_LEN_MAX &&
JojoS 0:a0715ea739cb 4484 (((irmp_bit == 8 || irmp_bit == 6) &&
JojoS 0:a0715ea739cb 4485 irmp_pause_time >= KATHREIN_SYNC_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_SYNC_BIT_PAUSE_LEN_MAX) ||
JojoS 0:a0715ea739cb 4486 (irmp_bit == 12 &&
JojoS 0:a0715ea739cb 4487 irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)))
JojoS 0:a0715ea739cb 4488
JojoS 0:a0715ea739cb 4489 {
JojoS 0:a0715ea739cb 4490 if (irmp_bit == 8)
JojoS 0:a0715ea739cb 4491 {
JojoS 0:a0715ea739cb 4492 irmp_bit++;
JojoS 0:a0715ea739cb 4493 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4494 ANALYZE_PUTCHAR ('S');
JojoS 0:a0715ea739cb 4495 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4496 #endif // ANALYZE
JojoS 0:a0715ea739cb 4497 irmp_tmp_command <<= 1;
JojoS 0:a0715ea739cb 4498 }
JojoS 0:a0715ea739cb 4499 else
JojoS 0:a0715ea739cb 4500 {
JojoS 0:a0715ea739cb 4501 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4502 ANALYZE_PUTCHAR ('S');
JojoS 0:a0715ea739cb 4503 ANALYZE_NEWLINE ();
JojoS 0:a0715ea739cb 4504 #endif // ANALYZE
JojoS 0:a0715ea739cb 4505 irmp_store_bit (1);
JojoS 0:a0715ea739cb 4506 }
JojoS 0:a0715ea739cb 4507 wait_for_space = 0;
JojoS 0:a0715ea739cb 4508 }
JojoS 0:a0715ea739cb 4509 else
JojoS 0:a0715ea739cb 4510 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL
JojoS 0:a0715ea739cb 4511 { // timing incorrect!
JojoS 0:a0715ea739cb 4512 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4513 ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);
JojoS 0:a0715ea739cb 4514 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4515 #endif // ANALYZE
JojoS 0:a0715ea739cb 4516 irmp_start_bit_detected = 0; // reset flags and wait for next start bit
JojoS 0:a0715ea739cb 4517 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4518 }
JojoS 0:a0715ea739cb 4519
JojoS 0:a0715ea739cb 4520 irmp_pulse_time = 1; // set counter to 1, not 0
JojoS 0:a0715ea739cb 4521 }
JojoS 0:a0715ea739cb 4522 }
JojoS 0:a0715ea739cb 4523 else
JojoS 0:a0715ea739cb 4524 { // counting the pulse length ...
JojoS 0:a0715ea739cb 4525 if (! irmp_input) // still light?
JojoS 0:a0715ea739cb 4526 { // yes...
JojoS 0:a0715ea739cb 4527 irmp_pulse_time++; // increment counter
JojoS 0:a0715ea739cb 4528 }
JojoS 0:a0715ea739cb 4529 else
JojoS 0:a0715ea739cb 4530 { // now it's dark!
JojoS 0:a0715ea739cb 4531 wait_for_space = 1; // let's count the time (see above)
JojoS 0:a0715ea739cb 4532 irmp_pause_time = 1; // set pause counter to 1, not 0
JojoS 0:a0715ea739cb 4533 }
JojoS 0:a0715ea739cb 4534 }
JojoS 0:a0715ea739cb 4535
JojoS 0:a0715ea739cb 4536 if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0) // enough bits received?
JojoS 0:a0715ea739cb 4537 {
JojoS 0:a0715ea739cb 4538 if (last_irmp_command == irmp_tmp_command && key_repetition_len < AUTO_FRAME_REPETITION_LEN)
JojoS 0:a0715ea739cb 4539 {
JojoS 0:a0715ea739cb 4540 repetition_frame_number++;
JojoS 0:a0715ea739cb 4541 }
JojoS 0:a0715ea739cb 4542 else
JojoS 0:a0715ea739cb 4543 {
JojoS 0:a0715ea739cb 4544 repetition_frame_number = 0;
JojoS 0:a0715ea739cb 4545 }
JojoS 0:a0715ea739cb 4546
JojoS 0:a0715ea739cb 4547 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1
JojoS 0:a0715ea739cb 4548 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame
JojoS 0:a0715ea739cb 4549 if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))
JojoS 0:a0715ea739cb 4550 {
JojoS 0:a0715ea739cb 4551 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4552 ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4553 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4554 #endif // ANALYZE
JojoS 0:a0715ea739cb 4555 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4556 }
JojoS 0:a0715ea739cb 4557 else
JojoS 0:a0715ea739cb 4558 #endif
JojoS 0:a0715ea739cb 4559
JojoS 0:a0715ea739cb 4560 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 4561 // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
JojoS 0:a0715ea739cb 4562 if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL && repetition_frame_number == 1)
JojoS 0:a0715ea739cb 4563 {
JojoS 0:a0715ea739cb 4564 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4565 ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4566 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4567 #endif // ANALYZE
JojoS 0:a0715ea739cb 4568 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4569 }
JojoS 0:a0715ea739cb 4570 else
JojoS 0:a0715ea739cb 4571 #endif
JojoS 0:a0715ea739cb 4572
JojoS 0:a0715ea739cb 4573 #if 0 && IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 // fm 2015-12-02: don't ignore every 2nd frame
JojoS 0:a0715ea739cb 4574 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame
JojoS 0:a0715ea739cb 4575 if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)
JojoS 0:a0715ea739cb 4576 {
JojoS 0:a0715ea739cb 4577 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4578 ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4579 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4580 #endif // ANALYZE
JojoS 0:a0715ea739cb 4581 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4582 }
JojoS 0:a0715ea739cb 4583 else
JojoS 0:a0715ea739cb 4584 #endif
JojoS 0:a0715ea739cb 4585
JojoS 0:a0715ea739cb 4586 #if 0 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 // fm 2015-12-02: don't ignore every 2nd frame
JojoS 0:a0715ea739cb 4587 // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
JojoS 0:a0715ea739cb 4588 if ((irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL || irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL) && (repetition_frame_number & 0x01))
JojoS 0:a0715ea739cb 4589 {
JojoS 0:a0715ea739cb 4590 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4591 ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4592 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4593 #endif // ANALYZE
JojoS 0:a0715ea739cb 4594 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4595 }
JojoS 0:a0715ea739cb 4596 else
JojoS 0:a0715ea739cb 4597 #endif
JojoS 0:a0715ea739cb 4598
JojoS 0:a0715ea739cb 4599 #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1
JojoS 0:a0715ea739cb 4600 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
JojoS 0:a0715ea739cb 4601 if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))
JojoS 0:a0715ea739cb 4602 {
JojoS 0:a0715ea739cb 4603 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4604 ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4605 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4606 #endif // ANALYZE
JojoS 0:a0715ea739cb 4607 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4608 }
JojoS 0:a0715ea739cb 4609 else
JojoS 0:a0715ea739cb 4610 #endif
JojoS 0:a0715ea739cb 4611
JojoS 0:a0715ea739cb 4612 #if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1
JojoS 0:a0715ea739cb 4613 // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame
JojoS 0:a0715ea739cb 4614 if (irmp_param.protocol == IRMP_SPEAKER_PROTOCOL && (repetition_frame_number & 0x01))
JojoS 0:a0715ea739cb 4615 {
JojoS 0:a0715ea739cb 4616 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4617 ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
JojoS 0:a0715ea739cb 4618 repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
JojoS 0:a0715ea739cb 4619 #endif // ANALYZE
JojoS 0:a0715ea739cb 4620 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4621 }
JojoS 0:a0715ea739cb 4622 else
JojoS 0:a0715ea739cb 4623 #endif
JojoS 0:a0715ea739cb 4624
JojoS 0:a0715ea739cb 4625 {
JojoS 0:a0715ea739cb 4626 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4627 ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit);
JojoS 0:a0715ea739cb 4628 #endif // ANALYZE
JojoS 0:a0715ea739cb 4629 irmp_ir_detected = TRUE;
JojoS 0:a0715ea739cb 4630
JojoS 0:a0715ea739cb 4631 #if IRMP_SUPPORT_DENON_PROTOCOL == 1
JojoS 0:a0715ea739cb 4632 if (irmp_param.protocol == IRMP_DENON_PROTOCOL)
JojoS 0:a0715ea739cb 4633 { // check for repetition frame
JojoS 0:a0715ea739cb 4634 if ((~irmp_tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted
JojoS 0:a0715ea739cb 4635 {
JojoS 0:a0715ea739cb 4636 irmp_tmp_command = last_irmp_denon_command; // use command received before!
JojoS 0:a0715ea739cb 4637 last_irmp_denon_command = 0;
JojoS 0:a0715ea739cb 4638
JojoS 0:a0715ea739cb 4639 irmp_protocol = irmp_param.protocol; // store protocol
JojoS 0:a0715ea739cb 4640 irmp_address = irmp_tmp_address; // store address
JojoS 0:a0715ea739cb 4641 irmp_command = irmp_tmp_command; // store command
JojoS 0:a0715ea739cb 4642 }
JojoS 0:a0715ea739cb 4643 else
JojoS 0:a0715ea739cb 4644 {
JojoS 0:a0715ea739cb 4645 if ((irmp_tmp_command & 0x01) == 0x00)
JojoS 0:a0715ea739cb 4646 {
JojoS 0:a0715ea739cb 4647 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4648 ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);
JojoS 0:a0715ea739cb 4649 #endif // ANALYZE
JojoS 0:a0715ea739cb 4650 last_irmp_denon_command = irmp_tmp_command;
JojoS 0:a0715ea739cb 4651 denon_repetition_len = 0;
JojoS 0:a0715ea739cb 4652 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4653 }
JojoS 0:a0715ea739cb 4654 else
JojoS 0:a0715ea739cb 4655 {
JojoS 0:a0715ea739cb 4656 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4657 ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS);
JojoS 0:a0715ea739cb 4658 #endif // ANALYZE
JojoS 0:a0715ea739cb 4659 last_irmp_denon_command = 0;
JojoS 0:a0715ea739cb 4660 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4661 }
JojoS 0:a0715ea739cb 4662 }
JojoS 0:a0715ea739cb 4663 }
JojoS 0:a0715ea739cb 4664 else
JojoS 0:a0715ea739cb 4665 #endif // IRMP_SUPPORT_DENON_PROTOCOL
JojoS 0:a0715ea739cb 4666
JojoS 0:a0715ea739cb 4667 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1
JojoS 0:a0715ea739cb 4668 if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)
JojoS 0:a0715ea739cb 4669 { // Grundig start frame?
JojoS 0:a0715ea739cb 4670 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4671 ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");
JojoS 0:a0715ea739cb 4672 #endif // ANALYZE
JojoS 0:a0715ea739cb 4673 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4674 }
JojoS 0:a0715ea739cb 4675 else
JojoS 0:a0715ea739cb 4676 #endif // IRMP_SUPPORT_GRUNDIG_PROTOCOL
JojoS 0:a0715ea739cb 4677
JojoS 0:a0715ea739cb 4678 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1
JojoS 0:a0715ea739cb 4679 if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)
JojoS 0:a0715ea739cb 4680 { // Nokia start frame?
JojoS 0:a0715ea739cb 4681 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4682 ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");
JojoS 0:a0715ea739cb 4683 #endif // ANALYZE
JojoS 0:a0715ea739cb 4684 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4685 }
JojoS 0:a0715ea739cb 4686 else
JojoS 0:a0715ea739cb 4687 #endif // IRMP_SUPPORT_NOKIA_PROTOCOL
JojoS 0:a0715ea739cb 4688 {
JojoS 0:a0715ea739cb 4689 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4690 if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame
JojoS 0:a0715ea739cb 4691 {
JojoS 0:a0715ea739cb 4692 if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
JojoS 0:a0715ea739cb 4693 {
JojoS 0:a0715ea739cb 4694 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4695 ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len);
JojoS 0:a0715ea739cb 4696 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME ");
JojoS 0:a0715ea739cb 4697 #endif // ANALYZE
JojoS 0:a0715ea739cb 4698 irmp_tmp_address = last_irmp_address; // address is last address
JojoS 0:a0715ea739cb 4699 irmp_tmp_command = last_irmp_command; // command is last command
JojoS 0:a0715ea739cb 4700 irmp_flags |= IRMP_FLAG_REPETITION;
JojoS 0:a0715ea739cb 4701 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4702 }
JojoS 0:a0715ea739cb 4703 else
JojoS 0:a0715ea739cb 4704 {
JojoS 0:a0715ea739cb 4705 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4706 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
JojoS 0:a0715ea739cb 4707 key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
JojoS 0:a0715ea739cb 4708 #endif // ANALYZE
JojoS 0:a0715ea739cb 4709 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4710 }
JojoS 0:a0715ea739cb 4711 }
JojoS 0:a0715ea739cb 4712 #endif // IRMP_SUPPORT_NEC_PROTOCOL
JojoS 0:a0715ea739cb 4713
JojoS 0:a0715ea739cb 4714 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 4715 if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)
JojoS 0:a0715ea739cb 4716 {
JojoS 0:a0715ea739cb 4717 uint_fast8_t xor_value;
JojoS 0:a0715ea739cb 4718
JojoS 0:a0715ea739cb 4719 xor_value = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);
JojoS 0:a0715ea739cb 4720
JojoS 0:a0715ea739cb 4721 if (xor_value != (xor_check[2] & 0x0F))
JojoS 0:a0715ea739cb 4722 {
JojoS 0:a0715ea739cb 4723 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4724 ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F);
JojoS 0:a0715ea739cb 4725 #endif // ANALYZE
JojoS 0:a0715ea739cb 4726 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4727 }
JojoS 0:a0715ea739cb 4728
JojoS 0:a0715ea739cb 4729 xor_value = xor_check[2] ^ xor_check[3] ^ xor_check[4];
JojoS 0:a0715ea739cb 4730
JojoS 0:a0715ea739cb 4731 if (xor_value != xor_check[5])
JojoS 0:a0715ea739cb 4732 {
JojoS 0:a0715ea739cb 4733 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4734 ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]);
JojoS 0:a0715ea739cb 4735 #endif // ANALYZE
JojoS 0:a0715ea739cb 4736 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4737 }
JojoS 0:a0715ea739cb 4738
JojoS 0:a0715ea739cb 4739 irmp_flags |= genre2; // write the genre2 bits into MSB of the flag byte
JojoS 0:a0715ea739cb 4740 }
JojoS 0:a0715ea739cb 4741 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1
JojoS 0:a0715ea739cb 4742
JojoS 0:a0715ea739cb 4743 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 4744 if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)
JojoS 0:a0715ea739cb 4745 {
JojoS 0:a0715ea739cb 4746 if (parity == PARITY_CHECK_FAILED)
JojoS 0:a0715ea739cb 4747 {
JojoS 0:a0715ea739cb 4748 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4749 ANALYZE_PRINTF ("error 6: parity check failed\n");
JojoS 0:a0715ea739cb 4750 #endif // ANALYZE
JojoS 0:a0715ea739cb 4751 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4752 }
JojoS 0:a0715ea739cb 4753
JojoS 0:a0715ea739cb 4754 if ((irmp_tmp_address & 0x03) == 0x02)
JojoS 0:a0715ea739cb 4755 {
JojoS 0:a0715ea739cb 4756 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4757 ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");
JojoS 0:a0715ea739cb 4758 #endif // ANALYZE
JojoS 0:a0715ea739cb 4759 irmp_ir_detected = FALSE;
JojoS 0:a0715ea739cb 4760 }
JojoS 0:a0715ea739cb 4761 irmp_tmp_address >>= 2;
JojoS 0:a0715ea739cb 4762 }
JojoS 0:a0715ea739cb 4763 #endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1
JojoS 0:a0715ea739cb 4764
JojoS 0:a0715ea739cb 4765 #if IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 4766 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode = 6?
JojoS 0:a0715ea739cb 4767 {
JojoS 0:a0715ea739cb 4768 irmp_protocol = IRMP_RC6A_PROTOCOL;
JojoS 0:a0715ea739cb 4769 }
JojoS 0:a0715ea739cb 4770 else
JojoS 0:a0715ea739cb 4771 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1
JojoS 0:a0715ea739cb 4772 {
JojoS 0:a0715ea739cb 4773 irmp_protocol = irmp_param.protocol;
JojoS 0:a0715ea739cb 4774 }
JojoS 0:a0715ea739cb 4775
JojoS 0:a0715ea739cb 4776 #if IRMP_SUPPORT_FDC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4777 if (irmp_param.protocol == IRMP_FDC_PROTOCOL)
JojoS 0:a0715ea739cb 4778 {
JojoS 0:a0715ea739cb 4779 if (irmp_tmp_command & 0x000F) // released key?
JojoS 0:a0715ea739cb 4780 {
JojoS 0:a0715ea739cb 4781 irmp_tmp_command = (irmp_tmp_command >> 4) | 0x80; // yes, set bit 7
JojoS 0:a0715ea739cb 4782 }
JojoS 0:a0715ea739cb 4783 else
JojoS 0:a0715ea739cb 4784 {
JojoS 0:a0715ea739cb 4785 irmp_tmp_command >>= 4; // no, it's a pressed key
JojoS 0:a0715ea739cb 4786 }
JojoS 0:a0715ea739cb 4787 irmp_tmp_command |= (irmp_tmp_address << 2) & 0x0F00; // 000000CCCCAAAAAA -> 0000CCCC00000000
JojoS 0:a0715ea739cb 4788 irmp_tmp_address &= 0x003F;
JojoS 0:a0715ea739cb 4789 }
JojoS 0:a0715ea739cb 4790 #endif
JojoS 0:a0715ea739cb 4791
JojoS 0:a0715ea739cb 4792 irmp_address = irmp_tmp_address; // store address
JojoS 0:a0715ea739cb 4793 #if IRMP_SUPPORT_NEC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4794 if (irmp_param.protocol == IRMP_NEC_PROTOCOL)
JojoS 0:a0715ea739cb 4795 {
JojoS 0:a0715ea739cb 4796 last_irmp_address = irmp_tmp_address; // store as last address, too
JojoS 0:a0715ea739cb 4797 }
JojoS 0:a0715ea739cb 4798 #endif
JojoS 0:a0715ea739cb 4799
JojoS 0:a0715ea739cb 4800 #if IRMP_SUPPORT_RC5_PROTOCOL == 1
JojoS 0:a0715ea739cb 4801 if (irmp_param.protocol == IRMP_RC5_PROTOCOL)
JojoS 0:a0715ea739cb 4802 {
JojoS 0:a0715ea739cb 4803 irmp_tmp_command |= rc5_cmd_bit6; // store bit 6
JojoS 0:a0715ea739cb 4804 }
JojoS 0:a0715ea739cb 4805 #endif
JojoS 0:a0715ea739cb 4806 #if IRMP_SUPPORT_S100_PROTOCOL == 1
JojoS 0:a0715ea739cb 4807 if (irmp_param.protocol == IRMP_S100_PROTOCOL)
JojoS 0:a0715ea739cb 4808 {
JojoS 0:a0715ea739cb 4809 irmp_tmp_command |= rc5_cmd_bit6; // store bit 6
JojoS 0:a0715ea739cb 4810 }
JojoS 0:a0715ea739cb 4811 #endif
JojoS 0:a0715ea739cb 4812 irmp_command = irmp_tmp_command; // store command
JojoS 0:a0715ea739cb 4813
JojoS 0:a0715ea739cb 4814 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1
JojoS 0:a0715ea739cb 4815 irmp_id = irmp_tmp_id;
JojoS 0:a0715ea739cb 4816 #endif
JojoS 0:a0715ea739cb 4817 }
JojoS 0:a0715ea739cb 4818 }
JojoS 0:a0715ea739cb 4819
JojoS 0:a0715ea739cb 4820 if (irmp_ir_detected)
JojoS 0:a0715ea739cb 4821 {
JojoS 0:a0715ea739cb 4822 if (last_irmp_command == irmp_tmp_command &&
JojoS 0:a0715ea739cb 4823 last_irmp_address == irmp_tmp_address &&
JojoS 0:a0715ea739cb 4824 key_repetition_len < IRMP_KEY_REPETITION_LEN)
JojoS 0:a0715ea739cb 4825 {
JojoS 0:a0715ea739cb 4826 irmp_flags |= IRMP_FLAG_REPETITION;
JojoS 0:a0715ea739cb 4827 }
JojoS 0:a0715ea739cb 4828
JojoS 0:a0715ea739cb 4829 last_irmp_address = irmp_tmp_address; // store as last address, too
JojoS 0:a0715ea739cb 4830 last_irmp_command = irmp_tmp_command; // store as last command, too
JojoS 0:a0715ea739cb 4831
JojoS 0:a0715ea739cb 4832 key_repetition_len = 0;
JojoS 0:a0715ea739cb 4833 }
JojoS 0:a0715ea739cb 4834 else
JojoS 0:a0715ea739cb 4835 {
JojoS 0:a0715ea739cb 4836 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4837 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');
JojoS 0:a0715ea739cb 4838 #endif // ANALYZE
JojoS 0:a0715ea739cb 4839 }
JojoS 0:a0715ea739cb 4840
JojoS 0:a0715ea739cb 4841 irmp_start_bit_detected = 0; // and wait for next start bit
JojoS 0:a0715ea739cb 4842 irmp_tmp_command = 0;
JojoS 0:a0715ea739cb 4843 irmp_pulse_time = 0;
JojoS 0:a0715ea739cb 4844 irmp_pause_time = 0;
JojoS 0:a0715ea739cb 4845
JojoS 0:a0715ea739cb 4846 #if IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4847 if (irmp_protocol == IRMP_JVC_PROTOCOL) // the stop bit of JVC frame is also start bit of next frame
JojoS 0:a0715ea739cb 4848 { // set pulse time here!
JojoS 0:a0715ea739cb 4849 irmp_pulse_time = ((uint_fast8_t)(F_INTERRUPTS * JVC_START_BIT_PULSE_TIME));
JojoS 0:a0715ea739cb 4850 }
JojoS 0:a0715ea739cb 4851 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1
JojoS 0:a0715ea739cb 4852 }
JojoS 0:a0715ea739cb 4853 }
JojoS 0:a0715ea739cb 4854 }
JojoS 0:a0715ea739cb 4855
JojoS 0:a0715ea739cb 4856 #if defined(STELLARIS_ARM_CORTEX_M4)
JojoS 0:a0715ea739cb 4857 // Clear the timer interrupt
JojoS 0:a0715ea739cb 4858 TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
JojoS 0:a0715ea739cb 4859 #endif
JojoS 0:a0715ea739cb 4860
JojoS 0:a0715ea739cb 4861 return (irmp_ir_detected);
JojoS 0:a0715ea739cb 4862 }
JojoS 0:a0715ea739cb 4863
JojoS 0:a0715ea739cb 4864 #ifdef ANALYZE
JojoS 0:a0715ea739cb 4865
JojoS 0:a0715ea739cb 4866 /*---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 4867 * main functions - for Unix/Linux + Windows only!
JojoS 0:a0715ea739cb 4868 *
JojoS 0:a0715ea739cb 4869 * AVR: see main.c!
JojoS 0:a0715ea739cb 4870 *
JojoS 0:a0715ea739cb 4871 * Compile it under linux with:
JojoS 0:a0715ea739cb 4872 * cc irmp.c -o irmp
JojoS 0:a0715ea739cb 4873 *
JojoS 0:a0715ea739cb 4874 * usage: ./irmp [-v|-s|-a|-l] < file
JojoS 0:a0715ea739cb 4875 *
JojoS 0:a0715ea739cb 4876 * options:
JojoS 0:a0715ea739cb 4877 * -v verbose
JojoS 0:a0715ea739cb 4878 * -s silent
JojoS 0:a0715ea739cb 4879 * -a analyze
JojoS 0:a0715ea739cb 4880 * -l list pulse/pauses
JojoS 0:a0715ea739cb 4881 *---------------------------------------------------------------------------------------------------------------------------------------------------
JojoS 0:a0715ea739cb 4882 */
JojoS 0:a0715ea739cb 4883
JojoS 0:a0715ea739cb 4884 void
JojoS 0:a0715ea739cb 4885 print_spectrum (char * text, int * buf, int is_pulse)
JojoS 0:a0715ea739cb 4886 {
JojoS 0:a0715ea739cb 4887 int i;
JojoS 0:a0715ea739cb 4888 int j;
JojoS 0:a0715ea739cb 4889 int min;
JojoS 0:a0715ea739cb 4890 int max;
JojoS 0:a0715ea739cb 4891 int max_value = 0;
JojoS 0:a0715ea739cb 4892 int value;
JojoS 0:a0715ea739cb 4893 int sum = 0;
JojoS 0:a0715ea739cb 4894 int counter = 0;
JojoS 0:a0715ea739cb 4895 double average = 0;
JojoS 0:a0715ea739cb 4896 double tolerance;
JojoS 0:a0715ea739cb 4897
JojoS 0:a0715ea739cb 4898 puts ("-----------------------------------------------------------------------------");
JojoS 0:a0715ea739cb 4899 printf ("%s:\n", text);
JojoS 0:a0715ea739cb 4900
JojoS 0:a0715ea739cb 4901 for (i = 0; i < 256; i++)
JojoS 0:a0715ea739cb 4902 {
JojoS 0:a0715ea739cb 4903 if (buf[i] > max_value)
JojoS 0:a0715ea739cb 4904 {
JojoS 0:a0715ea739cb 4905 max_value = buf[i];
JojoS 0:a0715ea739cb 4906 }
JojoS 0:a0715ea739cb 4907 }
JojoS 0:a0715ea739cb 4908
JojoS 0:a0715ea739cb 4909 for (i = 1; i < 200; i++)
JojoS 0:a0715ea739cb 4910 {
JojoS 0:a0715ea739cb 4911 if (buf[i] > 0)
JojoS 0:a0715ea739cb 4912 {
JojoS 0:a0715ea739cb 4913 printf ("%3d ", i);
JojoS 0:a0715ea739cb 4914 value = (buf[i] * 60) / max_value;
JojoS 0:a0715ea739cb 4915
JojoS 0:a0715ea739cb 4916 for (j = 0; j < value; j++)
JojoS 0:a0715ea739cb 4917 {
JojoS 0:a0715ea739cb 4918 putchar ('o');
JojoS 0:a0715ea739cb 4919 }
JojoS 0:a0715ea739cb 4920 printf (" %d\n", buf[i]);
JojoS 0:a0715ea739cb 4921
JojoS 0:a0715ea739cb 4922 sum += i * buf[i];
JojoS 0:a0715ea739cb 4923 counter += buf[i];
JojoS 0:a0715ea739cb 4924 }
JojoS 0:a0715ea739cb 4925 else
JojoS 0:a0715ea739cb 4926 {
JojoS 0:a0715ea739cb 4927 max = i - 1;
JojoS 0:a0715ea739cb 4928
JojoS 0:a0715ea739cb 4929 if (counter > 0)
JojoS 0:a0715ea739cb 4930 {
JojoS 0:a0715ea739cb 4931 average = (float) sum / (float) counter;
JojoS 0:a0715ea739cb 4932
JojoS 0:a0715ea739cb 4933 if (is_pulse)
JojoS 0:a0715ea739cb 4934 {
JojoS 0:a0715ea739cb 4935 printf ("pulse ");
JojoS 0:a0715ea739cb 4936 }
JojoS 0:a0715ea739cb 4937 else
JojoS 0:a0715ea739cb 4938 {
JojoS 0:a0715ea739cb 4939 printf ("pause ");
JojoS 0:a0715ea739cb 4940 }
JojoS 0:a0715ea739cb 4941
JojoS 0:a0715ea739cb 4942 printf ("avg: %4.1f=%6.1f us, ", average, (1000000. * average) / (float) F_INTERRUPTS);
JojoS 0:a0715ea739cb 4943 printf ("min: %2d=%6.1f us, ", min, (1000000. * min) / (float) F_INTERRUPTS);
JojoS 0:a0715ea739cb 4944 printf ("max: %2d=%6.1f us, ", max, (1000000. * max) / (float) F_INTERRUPTS);
JojoS 0:a0715ea739cb 4945
JojoS 0:a0715ea739cb 4946 tolerance = (max - average);
JojoS 0:a0715ea739cb 4947
JojoS 0:a0715ea739cb 4948 if (average - min > tolerance)
JojoS 0:a0715ea739cb 4949 {
JojoS 0:a0715ea739cb 4950 tolerance = average - min;
JojoS 0:a0715ea739cb 4951 }
JojoS 0:a0715ea739cb 4952
JojoS 0:a0715ea739cb 4953 tolerance = tolerance * 100 / average;
JojoS 0:a0715ea739cb 4954 printf ("tol: %4.1f%%\n", tolerance);
JojoS 0:a0715ea739cb 4955 }
JojoS 0:a0715ea739cb 4956
JojoS 0:a0715ea739cb 4957 counter = 0;
JojoS 0:a0715ea739cb 4958 sum = 0;
JojoS 0:a0715ea739cb 4959 min = i + 1;
JojoS 0:a0715ea739cb 4960 }
JojoS 0:a0715ea739cb 4961 }
JojoS 0:a0715ea739cb 4962 }
JojoS 0:a0715ea739cb 4963
JojoS 0:a0715ea739cb 4964 #define STATE_LEFT_SHIFT 0x01
JojoS 0:a0715ea739cb 4965 #define STATE_RIGHT_SHIFT 0x02
JojoS 0:a0715ea739cb 4966 #define STATE_LEFT_CTRL 0x04
JojoS 0:a0715ea739cb 4967 #define STATE_LEFT_ALT 0x08
JojoS 0:a0715ea739cb 4968 #define STATE_RIGHT_ALT 0x10
JojoS 0:a0715ea739cb 4969
JojoS 0:a0715ea739cb 4970 #define KEY_ESCAPE 0x1B // keycode = 0x006e
JojoS 0:a0715ea739cb 4971 #define KEY_MENUE 0x80 // keycode = 0x0070
JojoS 0:a0715ea739cb 4972 #define KEY_BACK 0x81 // keycode = 0x0071
JojoS 0:a0715ea739cb 4973 #define KEY_FORWARD 0x82 // keycode = 0x0072
JojoS 0:a0715ea739cb 4974 #define KEY_ADDRESS 0x83 // keycode = 0x0073
JojoS 0:a0715ea739cb 4975 #define KEY_WINDOW 0x84 // keycode = 0x0074
JojoS 0:a0715ea739cb 4976 #define KEY_1ST_PAGE 0x85 // keycode = 0x0075
JojoS 0:a0715ea739cb 4977 #define KEY_STOP 0x86 // keycode = 0x0076
JojoS 0:a0715ea739cb 4978 #define KEY_MAIL 0x87 // keycode = 0x0077
JojoS 0:a0715ea739cb 4979 #define KEY_FAVORITES 0x88 // keycode = 0x0078
JojoS 0:a0715ea739cb 4980 #define KEY_NEW_PAGE 0x89 // keycode = 0x0079
JojoS 0:a0715ea739cb 4981 #define KEY_SETUP 0x8A // keycode = 0x007a
JojoS 0:a0715ea739cb 4982 #define KEY_FONT 0x8B // keycode = 0x007b
JojoS 0:a0715ea739cb 4983 #define KEY_PRINT 0x8C // keycode = 0x007c
JojoS 0:a0715ea739cb 4984 #define KEY_ON_OFF 0x8E // keycode = 0x007c
JojoS 0:a0715ea739cb 4985
JojoS 0:a0715ea739cb 4986 #define KEY_INSERT 0x90 // keycode = 0x004b
JojoS 0:a0715ea739cb 4987 #define KEY_DELETE 0x91 // keycode = 0x004c
JojoS 0:a0715ea739cb 4988 #define KEY_LEFT 0x92 // keycode = 0x004f
JojoS 0:a0715ea739cb 4989 #define KEY_HOME 0x93 // keycode = 0x0050
JojoS 0:a0715ea739cb 4990 #define KEY_END 0x94 // keycode = 0x0051
JojoS 0:a0715ea739cb 4991 #define KEY_UP 0x95 // keycode = 0x0053
JojoS 0:a0715ea739cb 4992 #define KEY_DOWN 0x96 // keycode = 0x0054
JojoS 0:a0715ea739cb 4993 #define KEY_PAGE_UP 0x97 // keycode = 0x0055
JojoS 0:a0715ea739cb 4994 #define KEY_PAGE_DOWN 0x98 // keycode = 0x0056
JojoS 0:a0715ea739cb 4995 #define KEY_RIGHT 0x99 // keycode = 0x0059
JojoS 0:a0715ea739cb 4996 #define KEY_MOUSE_1 0x9E // keycode = 0x0400
JojoS 0:a0715ea739cb 4997 #define KEY_MOUSE_2 0x9F // keycode = 0x0800
JojoS 0:a0715ea739cb 4998
JojoS 0:a0715ea739cb 4999 static uint_fast8_t
JojoS 0:a0715ea739cb 5000 get_fdc_key (uint_fast16_t cmd)
JojoS 0:a0715ea739cb 5001 {
JojoS 0:a0715ea739cb 5002 static uint8_t key_table[128] =
JojoS 0:a0715ea739cb 5003 {
JojoS 0:a0715ea739cb 5004 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
JojoS 0:a0715ea739cb 5005 0, '^', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '�', '�', 0, '\b',
JojoS 0:a0715ea739cb 5006 '\t','q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', '�', '+', 0, 0, 'a',
JojoS 0:a0715ea739cb 5007 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '�', '�', '#', '\r', 0, '<', 'y', 'x',
JojoS 0:a0715ea739cb 5008 'c', 'v', 'b', 'n', 'm', ',', '.', '-', 0, 0, 0, 0, 0, ' ', 0, 0,
JojoS 0:a0715ea739cb 5009
JojoS 0:a0715ea739cb 5010 0, '�', '!', '"', '�', '$', '%', '&', '/', '(', ')', '=', '?', '`', 0, '\b',
JojoS 0:a0715ea739cb 5011 '\t','Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', 'O', 'P', '�', '*', 0, 0, 'A',
JojoS 0:a0715ea739cb 5012 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '�', '�', '\'','\r', 0, '>', 'Y', 'X',
JojoS 0:a0715ea739cb 5013 'C', 'V', 'B', 'N', 'M', ';', ':', '_', 0, 0, 0, 0, 0, ' ', 0, 0
JojoS 0:a0715ea739cb 5014 };
JojoS 0:a0715ea739cb 5015 static uint_fast8_t state;
JojoS 0:a0715ea739cb 5016
JojoS 0:a0715ea739cb 5017 uint_fast8_t key = 0;
JojoS 0:a0715ea739cb 5018
JojoS 0:a0715ea739cb 5019 switch (cmd)
JojoS 0:a0715ea739cb 5020 {
JojoS 0:a0715ea739cb 5021 case 0x002C: state |= STATE_LEFT_SHIFT; break; // pressed left shift
JojoS 0:a0715ea739cb 5022 case 0x00AC: state &= ~STATE_LEFT_SHIFT; break; // released left shift
JojoS 0:a0715ea739cb 5023 case 0x0039: state |= STATE_RIGHT_SHIFT; break; // pressed right shift
JojoS 0:a0715ea739cb 5024 case 0x00B9: state &= ~STATE_RIGHT_SHIFT; break; // released right shift
JojoS 0:a0715ea739cb 5025 case 0x003A: state |= STATE_LEFT_CTRL; break; // pressed left ctrl
JojoS 0:a0715ea739cb 5026 case 0x00BA: state &= ~STATE_LEFT_CTRL; break; // released left ctrl
JojoS 0:a0715ea739cb 5027 case 0x003C: state |= STATE_LEFT_ALT; break; // pressed left alt
JojoS 0:a0715ea739cb 5028 case 0x00BC: state &= ~STATE_LEFT_ALT; break; // released left alt
JojoS 0:a0715ea739cb 5029 case 0x003E: state |= STATE_RIGHT_ALT; break; // pressed left alt
JojoS 0:a0715ea739cb 5030 case 0x00BE: state &= ~STATE_RIGHT_ALT; break; // released left alt
JojoS 0:a0715ea739cb 5031
JojoS 0:a0715ea739cb 5032 case 0x006e: key = KEY_ESCAPE; break;
JojoS 0:a0715ea739cb 5033 case 0x004b: key = KEY_INSERT; break;
JojoS 0:a0715ea739cb 5034 case 0x004c: key = KEY_DELETE; break;
JojoS 0:a0715ea739cb 5035 case 0x004f: key = KEY_LEFT; break;
JojoS 0:a0715ea739cb 5036 case 0x0050: key = KEY_HOME; break;
JojoS 0:a0715ea739cb 5037 case 0x0051: key = KEY_END; break;
JojoS 0:a0715ea739cb 5038 case 0x0053: key = KEY_UP; break;
JojoS 0:a0715ea739cb 5039 case 0x0054: key = KEY_DOWN; break;
JojoS 0:a0715ea739cb 5040 case 0x0055: key = KEY_PAGE_UP; break;
JojoS 0:a0715ea739cb 5041 case 0x0056: key = KEY_PAGE_DOWN; break;
JojoS 0:a0715ea739cb 5042 case 0x0059: key = KEY_RIGHT; break;
JojoS 0:a0715ea739cb 5043 case 0x0400: key = KEY_MOUSE_1; break;
JojoS 0:a0715ea739cb 5044 case 0x0800: key = KEY_MOUSE_2; break;
JojoS 0:a0715ea739cb 5045
JojoS 0:a0715ea739cb 5046 default:
JojoS 0:a0715ea739cb 5047 {
JojoS 0:a0715ea739cb 5048 if (!(cmd & 0x80)) // pressed key
JojoS 0:a0715ea739cb 5049 {
JojoS 0:a0715ea739cb 5050 if (cmd >= 0x70 && cmd <= 0x7F) // function keys
JojoS 0:a0715ea739cb 5051 {
JojoS 0:a0715ea739cb 5052 key = cmd + 0x10; // 7x -> 8x
JojoS 0:a0715ea739cb 5053 }
JojoS 0:a0715ea739cb 5054 else if (cmd < 64) // key listed in key_table
JojoS 0:a0715ea739cb 5055 {
JojoS 0:a0715ea739cb 5056 if (state & (STATE_LEFT_ALT | STATE_RIGHT_ALT))
JojoS 0:a0715ea739cb 5057 {
JojoS 0:a0715ea739cb 5058 switch (cmd)
JojoS 0:a0715ea739cb 5059 {
JojoS 0:a0715ea739cb 5060 case 0x0003: key = '�'; break;
JojoS 0:a0715ea739cb 5061 case 0x0008: key = '{'; break;
JojoS 0:a0715ea739cb 5062 case 0x0009: key = '['; break;
JojoS 0:a0715ea739cb 5063 case 0x000A: key = ']'; break;
JojoS 0:a0715ea739cb 5064 case 0x000B: key = '}'; break;
JojoS 0:a0715ea739cb 5065 case 0x000C: key = '\\'; break;
JojoS 0:a0715ea739cb 5066 case 0x001C: key = '~'; break;
JojoS 0:a0715ea739cb 5067 case 0x002D: key = '|'; break;
JojoS 0:a0715ea739cb 5068 case 0x0034: key = 0xB5; break; // Mu
JojoS 0:a0715ea739cb 5069 }
JojoS 0:a0715ea739cb 5070 }
JojoS 0:a0715ea739cb 5071 else if (state & (STATE_LEFT_CTRL))
JojoS 0:a0715ea739cb 5072 {
JojoS 0:a0715ea739cb 5073 if (key_table[cmd] >= 'a' && key_table[cmd] <= 'z')
JojoS 0:a0715ea739cb 5074 {
JojoS 0:a0715ea739cb 5075 key = key_table[cmd] - 'a' + 1;
JojoS 0:a0715ea739cb 5076 }
JojoS 0:a0715ea739cb 5077 else
JojoS 0:a0715ea739cb 5078 {
JojoS 0:a0715ea739cb 5079 key = key_table[cmd];
JojoS 0:a0715ea739cb 5080 }
JojoS 0:a0715ea739cb 5081 }
JojoS 0:a0715ea739cb 5082 else
JojoS 0:a0715ea739cb 5083 {
JojoS 0:a0715ea739cb 5084 int idx = cmd + ((state & (STATE_LEFT_SHIFT | STATE_RIGHT_SHIFT)) ? 64 : 0);
JojoS 0:a0715ea739cb 5085
JojoS 0:a0715ea739cb 5086 if (key_table[idx])
JojoS 0:a0715ea739cb 5087 {
JojoS 0:a0715ea739cb 5088 key = key_table[idx];
JojoS 0:a0715ea739cb 5089 }
JojoS 0:a0715ea739cb 5090 }
JojoS 0:a0715ea739cb 5091 }
JojoS 0:a0715ea739cb 5092 }
JojoS 0:a0715ea739cb 5093 break;
JojoS 0:a0715ea739cb 5094 }
JojoS 0:a0715ea739cb 5095 }
JojoS 0:a0715ea739cb 5096
JojoS 0:a0715ea739cb 5097 return (key);
JojoS 0:a0715ea739cb 5098 }
JojoS 0:a0715ea739cb 5099
JojoS 0:a0715ea739cb 5100 static int analyze = FALSE;
JojoS 0:a0715ea739cb 5101 static int list = FALSE;
JojoS 0:a0715ea739cb 5102 static IRMP_DATA irmp_data;
JojoS 0:a0715ea739cb 5103 static int expected_protocol;
JojoS 0:a0715ea739cb 5104 static int expected_address;
JojoS 0:a0715ea739cb 5105 static int expected_command;
JojoS 0:a0715ea739cb 5106 static int do_check_expected_values;
JojoS 0:a0715ea739cb 5107
JojoS 0:a0715ea739cb 5108 static void
JojoS 0:a0715ea739cb 5109 next_tick (void)
JojoS 0:a0715ea739cb 5110 {
JojoS 0:a0715ea739cb 5111 if (! analyze && ! list)
JojoS 0:a0715ea739cb 5112 {
JojoS 0:a0715ea739cb 5113 (void) irmp_ISR ();
JojoS 0:a0715ea739cb 5114
JojoS 0:a0715ea739cb 5115 if (irmp_get_data (&irmp_data))
JojoS 0:a0715ea739cb 5116 {
JojoS 0:a0715ea739cb 5117 uint_fast8_t key;
JojoS 0:a0715ea739cb 5118
JojoS 0:a0715ea739cb 5119 ANALYZE_ONLY_NORMAL_PUTCHAR (' ');
JojoS 0:a0715ea739cb 5120
JojoS 0:a0715ea739cb 5121 if (verbose)
JojoS 0:a0715ea739cb 5122 {
JojoS 0:a0715ea739cb 5123 printf ("%8.3fms ", (double) (time_counter * 1000) / F_INTERRUPTS);
JojoS 0:a0715ea739cb 5124 }
JojoS 0:a0715ea739cb 5125
JojoS 0:a0715ea739cb 5126 if (irmp_data.protocol == IRMP_ACP24_PROTOCOL)
JojoS 0:a0715ea739cb 5127 {
JojoS 0:a0715ea739cb 5128 uint16_t temp = (irmp_data.command & 0x000F) + 15;
JojoS 0:a0715ea739cb 5129
JojoS 0:a0715ea739cb 5130 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, temp=%d",
JojoS 0:a0715ea739cb 5131 irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, temp);
JojoS 0:a0715ea739cb 5132 }
JojoS 0:a0715ea739cb 5133 else if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0)
JojoS 0:a0715ea739cb 5134 {
JojoS 0:a0715ea739cb 5135 if ((key >= 0x20 && key < 0x7F) || key >= 0xA0)
JojoS 0:a0715ea739cb 5136 {
JojoS 0:a0715ea739cb 5137 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",
JojoS 0:a0715ea739cb 5138 irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key, key);
JojoS 0:a0715ea739cb 5139 }
JojoS 0:a0715ea739cb 5140 else if (key == '\r' || key == '\t' || key == KEY_ESCAPE || (key >= 0x80 && key <= 0x9F)) // function keys
JojoS 0:a0715ea739cb 5141 {
JojoS 0:a0715ea739cb 5142 char * p = (char *) NULL;
JojoS 0:a0715ea739cb 5143
JojoS 0:a0715ea739cb 5144 switch (key)
JojoS 0:a0715ea739cb 5145 {
JojoS 0:a0715ea739cb 5146 case '\t' : p = "TAB"; break;
JojoS 0:a0715ea739cb 5147 case '\r' : p = "CR"; break;
JojoS 0:a0715ea739cb 5148 case KEY_ESCAPE : p = "ESCAPE"; break;
JojoS 0:a0715ea739cb 5149 case KEY_MENUE : p = "MENUE"; break;
JojoS 0:a0715ea739cb 5150 case KEY_BACK : p = "BACK"; break;
JojoS 0:a0715ea739cb 5151 case KEY_FORWARD : p = "FORWARD"; break;
JojoS 0:a0715ea739cb 5152 case KEY_ADDRESS : p = "ADDRESS"; break;
JojoS 0:a0715ea739cb 5153 case KEY_WINDOW : p = "WINDOW"; break;
JojoS 0:a0715ea739cb 5154 case KEY_1ST_PAGE : p = "1ST_PAGE"; break;
JojoS 0:a0715ea739cb 5155 case KEY_STOP : p = "STOP"; break;
JojoS 0:a0715ea739cb 5156 case KEY_MAIL : p = "MAIL"; break;
JojoS 0:a0715ea739cb 5157 case KEY_FAVORITES : p = "FAVORITES"; break;
JojoS 0:a0715ea739cb 5158 case KEY_NEW_PAGE : p = "NEW_PAGE"; break;
JojoS 0:a0715ea739cb 5159 case KEY_SETUP : p = "SETUP"; break;
JojoS 0:a0715ea739cb 5160 case KEY_FONT : p = "FONT"; break;
JojoS 0:a0715ea739cb 5161 case KEY_PRINT : p = "PRINT"; break;
JojoS 0:a0715ea739cb 5162 case KEY_ON_OFF : p = "ON_OFF"; break;
JojoS 0:a0715ea739cb 5163
JojoS 0:a0715ea739cb 5164 case KEY_INSERT : p = "INSERT"; break;
JojoS 0:a0715ea739cb 5165 case KEY_DELETE : p = "DELETE"; break;
JojoS 0:a0715ea739cb 5166 case KEY_LEFT : p = "LEFT"; break;
JojoS 0:a0715ea739cb 5167 case KEY_HOME : p = "HOME"; break;
JojoS 0:a0715ea739cb 5168 case KEY_END : p = "END"; break;
JojoS 0:a0715ea739cb 5169 case KEY_UP : p = "UP"; break;
JojoS 0:a0715ea739cb 5170 case KEY_DOWN : p = "DOWN"; break;
JojoS 0:a0715ea739cb 5171 case KEY_PAGE_UP : p = "PAGE_UP"; break;
JojoS 0:a0715ea739cb 5172 case KEY_PAGE_DOWN : p = "PAGE_DOWN"; break;
JojoS 0:a0715ea739cb 5173 case KEY_RIGHT : p = "RIGHT"; break;
JojoS 0:a0715ea739cb 5174 case KEY_MOUSE_1 : p = "KEY_MOUSE_1"; break;
JojoS 0:a0715ea739cb 5175 case KEY_MOUSE_2 : p = "KEY_MOUSE_2"; break;
JojoS 0:a0715ea739cb 5176 default : p = "<UNKNWON>"; break;
JojoS 0:a0715ea739cb 5177 }
JojoS 0:a0715ea739cb 5178
JojoS 0:a0715ea739cb 5179 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",
JojoS 0:a0715ea739cb 5180 irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key, p);
JojoS 0:a0715ea739cb 5181 }
JojoS 0:a0715ea739cb 5182 else
JojoS 0:a0715ea739cb 5183 {
JojoS 0:a0715ea739cb 5184 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",
JojoS 0:a0715ea739cb 5185 irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key);
JojoS 0:a0715ea739cb 5186 }
JojoS 0:a0715ea739cb 5187 }
JojoS 0:a0715ea739cb 5188 else
JojoS 0:a0715ea739cb 5189 {
JojoS 0:a0715ea739cb 5190 printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",
JojoS 0:a0715ea739cb 5191 irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags);
JojoS 0:a0715ea739cb 5192 }
JojoS 0:a0715ea739cb 5193
JojoS 0:a0715ea739cb 5194 if (do_check_expected_values)
JojoS 0:a0715ea739cb 5195 {
JojoS 0:a0715ea739cb 5196 if (irmp_data.protocol != expected_protocol ||
JojoS 0:a0715ea739cb 5197 irmp_data.address != expected_address ||
JojoS 0:a0715ea739cb 5198 irmp_data.command != expected_command)
JojoS 0:a0715ea739cb 5199 {
JojoS 0:a0715ea739cb 5200 printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
JojoS 0:a0715ea739cb 5201 expected_protocol, irmp_protocol_names[expected_protocol], expected_address, expected_command);
JojoS 0:a0715ea739cb 5202 }
JojoS 0:a0715ea739cb 5203 else
JojoS 0:a0715ea739cb 5204 {
JojoS 0:a0715ea739cb 5205 printf (" checked!\n");
JojoS 0:a0715ea739cb 5206 }
JojoS 0:a0715ea739cb 5207 do_check_expected_values = FALSE; // only check 1st frame in a line!
JojoS 0:a0715ea739cb 5208 }
JojoS 0:a0715ea739cb 5209 else
JojoS 0:a0715ea739cb 5210 {
JojoS 0:a0715ea739cb 5211 putchar ('\n');
JojoS 0:a0715ea739cb 5212 }
JojoS 0:a0715ea739cb 5213 }
JojoS 0:a0715ea739cb 5214 }
JojoS 0:a0715ea739cb 5215 }
JojoS 0:a0715ea739cb 5216
JojoS 0:a0715ea739cb 5217 int
JojoS 0:a0715ea739cb 5218 main (int argc, char ** argv)
JojoS 0:a0715ea739cb 5219 {
JojoS 0:a0715ea739cb 5220 int i;
JojoS 0:a0715ea739cb 5221 int ch;
JojoS 0:a0715ea739cb 5222 int last_ch = 0;
JojoS 0:a0715ea739cb 5223 int pulse = 0;
JojoS 0:a0715ea739cb 5224 int pause = 0;
JojoS 0:a0715ea739cb 5225
JojoS 0:a0715ea739cb 5226 int start_pulses[256];
JojoS 0:a0715ea739cb 5227 int start_pauses[256];
JojoS 0:a0715ea739cb 5228 int pulses[256];
JojoS 0:a0715ea739cb 5229 int pauses[256];
JojoS 0:a0715ea739cb 5230
JojoS 0:a0715ea739cb 5231 int first_pulse = TRUE;
JojoS 0:a0715ea739cb 5232 int first_pause = TRUE;
JojoS 0:a0715ea739cb 5233
JojoS 0:a0715ea739cb 5234 if (argc == 2)
JojoS 0:a0715ea739cb 5235 {
JojoS 0:a0715ea739cb 5236 if (! strcmp (argv[1], "-v"))
JojoS 0:a0715ea739cb 5237 {
JojoS 0:a0715ea739cb 5238 verbose = TRUE;
JojoS 0:a0715ea739cb 5239 }
JojoS 0:a0715ea739cb 5240 else if (! strcmp (argv[1], "-l"))
JojoS 0:a0715ea739cb 5241 {
JojoS 0:a0715ea739cb 5242 list = TRUE;
JojoS 0:a0715ea739cb 5243 }
JojoS 0:a0715ea739cb 5244 else if (! strcmp (argv[1], "-a"))
JojoS 0:a0715ea739cb 5245 {
JojoS 0:a0715ea739cb 5246 analyze = TRUE;
JojoS 0:a0715ea739cb 5247 }
JojoS 0:a0715ea739cb 5248 else if (! strcmp (argv[1], "-s"))
JojoS 0:a0715ea739cb 5249 {
JojoS 0:a0715ea739cb 5250 silent = TRUE;
JojoS 0:a0715ea739cb 5251 }
JojoS 0:a0715ea739cb 5252 else if (! strcmp (argv[1], "-r"))
JojoS 0:a0715ea739cb 5253 {
JojoS 0:a0715ea739cb 5254 radio = TRUE;
JojoS 0:a0715ea739cb 5255 }
JojoS 0:a0715ea739cb 5256 }
JojoS 0:a0715ea739cb 5257
JojoS 0:a0715ea739cb 5258 for (i = 0; i < 256; i++)
JojoS 0:a0715ea739cb 5259 {
JojoS 0:a0715ea739cb 5260 start_pulses[i] = 0;
JojoS 0:a0715ea739cb 5261 start_pauses[i] = 0;
JojoS 0:a0715ea739cb 5262 pulses[i] = 0;
JojoS 0:a0715ea739cb 5263 pauses[i] = 0;
JojoS 0:a0715ea739cb 5264 }
JojoS 0:a0715ea739cb 5265
JojoS 0:a0715ea739cb 5266 IRMP_PIN = 0xFF;
JojoS 0:a0715ea739cb 5267
JojoS 0:a0715ea739cb 5268 while ((ch = getchar ()) != EOF)
JojoS 0:a0715ea739cb 5269 {
JojoS 0:a0715ea739cb 5270 if (ch == '_' || ch == '0')
JojoS 0:a0715ea739cb 5271 {
JojoS 0:a0715ea739cb 5272 if (last_ch != ch)
JojoS 0:a0715ea739cb 5273 {
JojoS 0:a0715ea739cb 5274 if (pause > 0)
JojoS 0:a0715ea739cb 5275 {
JojoS 0:a0715ea739cb 5276 if (list)
JojoS 0:a0715ea739cb 5277 {
JojoS 0:a0715ea739cb 5278 printf ("pause: %d\n", pause);
JojoS 0:a0715ea739cb 5279 }
JojoS 0:a0715ea739cb 5280
JojoS 0:a0715ea739cb 5281 if (analyze)
JojoS 0:a0715ea739cb 5282 {
JojoS 0:a0715ea739cb 5283 if (first_pause)
JojoS 0:a0715ea739cb 5284 {
JojoS 0:a0715ea739cb 5285 if (pause < 256)
JojoS 0:a0715ea739cb 5286 {
JojoS 0:a0715ea739cb 5287 start_pauses[pause]++;
JojoS 0:a0715ea739cb 5288 }
JojoS 0:a0715ea739cb 5289 first_pause = FALSE;
JojoS 0:a0715ea739cb 5290 }
JojoS 0:a0715ea739cb 5291 else
JojoS 0:a0715ea739cb 5292 {
JojoS 0:a0715ea739cb 5293 if (pause < 256)
JojoS 0:a0715ea739cb 5294 {
JojoS 0:a0715ea739cb 5295 pauses[pause]++;
JojoS 0:a0715ea739cb 5296 }
JojoS 0:a0715ea739cb 5297 }
JojoS 0:a0715ea739cb 5298 }
JojoS 0:a0715ea739cb 5299 }
JojoS 0:a0715ea739cb 5300 pause = 0;
JojoS 0:a0715ea739cb 5301 }
JojoS 0:a0715ea739cb 5302 pulse++;
JojoS 0:a0715ea739cb 5303 IRMP_PIN = 0x00;
JojoS 0:a0715ea739cb 5304 }
JojoS 0:a0715ea739cb 5305 else if (ch == 0xaf || ch == '-' || ch == '1')
JojoS 0:a0715ea739cb 5306 {
JojoS 0:a0715ea739cb 5307 if (last_ch != ch)
JojoS 0:a0715ea739cb 5308 {
JojoS 0:a0715ea739cb 5309 if (list)
JojoS 0:a0715ea739cb 5310 {
JojoS 0:a0715ea739cb 5311 printf ("pulse: %d ", pulse);
JojoS 0:a0715ea739cb 5312 }
JojoS 0:a0715ea739cb 5313
JojoS 0:a0715ea739cb 5314 if (analyze)
JojoS 0:a0715ea739cb 5315 {
JojoS 0:a0715ea739cb 5316 if (first_pulse)
JojoS 0:a0715ea739cb 5317 {
JojoS 0:a0715ea739cb 5318 if (pulse < 256)
JojoS 0:a0715ea739cb 5319 {
JojoS 0:a0715ea739cb 5320 start_pulses[pulse]++;
JojoS 0:a0715ea739cb 5321 }
JojoS 0:a0715ea739cb 5322 first_pulse = FALSE;
JojoS 0:a0715ea739cb 5323 }
JojoS 0:a0715ea739cb 5324 else
JojoS 0:a0715ea739cb 5325 {
JojoS 0:a0715ea739cb 5326 if (pulse < 256)
JojoS 0:a0715ea739cb 5327 {
JojoS 0:a0715ea739cb 5328 pulses[pulse]++;
JojoS 0:a0715ea739cb 5329 }
JojoS 0:a0715ea739cb 5330 }
JojoS 0:a0715ea739cb 5331 }
JojoS 0:a0715ea739cb 5332 pulse = 0;
JojoS 0:a0715ea739cb 5333 }
JojoS 0:a0715ea739cb 5334
JojoS 0:a0715ea739cb 5335 pause++;
JojoS 0:a0715ea739cb 5336 IRMP_PIN = 0xff;
JojoS 0:a0715ea739cb 5337 }
JojoS 0:a0715ea739cb 5338 else if (ch == '\n')
JojoS 0:a0715ea739cb 5339 {
JojoS 0:a0715ea739cb 5340 IRMP_PIN = 0xff;
JojoS 0:a0715ea739cb 5341 time_counter = 0;
JojoS 0:a0715ea739cb 5342
JojoS 0:a0715ea739cb 5343 if (list && pause > 0)
JojoS 0:a0715ea739cb 5344 {
JojoS 0:a0715ea739cb 5345 printf ("pause: %d\n", pause);
JojoS 0:a0715ea739cb 5346 }
JojoS 0:a0715ea739cb 5347 pause = 0;
JojoS 0:a0715ea739cb 5348
JojoS 0:a0715ea739cb 5349 if (! analyze)
JojoS 0:a0715ea739cb 5350 {
JojoS 0:a0715ea739cb 5351 for (i = 0; i < (int) ((10000.0 * F_INTERRUPTS) / 10000); i++) // newline: long pause of 10000 msec
JojoS 0:a0715ea739cb 5352 {
JojoS 0:a0715ea739cb 5353 next_tick ();
JojoS 0:a0715ea739cb 5354 }
JojoS 0:a0715ea739cb 5355 }
JojoS 0:a0715ea739cb 5356 first_pulse = TRUE;
JojoS 0:a0715ea739cb 5357 first_pause = TRUE;
JojoS 0:a0715ea739cb 5358 }
JojoS 0:a0715ea739cb 5359 else if (ch == '#')
JojoS 0:a0715ea739cb 5360 {
JojoS 0:a0715ea739cb 5361 time_counter = 0;
JojoS 0:a0715ea739cb 5362
JojoS 0:a0715ea739cb 5363 if (analyze)
JojoS 0:a0715ea739cb 5364 {
JojoS 0:a0715ea739cb 5365 while ((ch = getchar()) != '\n' && ch != EOF)
JojoS 0:a0715ea739cb 5366 {
JojoS 0:a0715ea739cb 5367 ;
JojoS 0:a0715ea739cb 5368 }
JojoS 0:a0715ea739cb 5369 }
JojoS 0:a0715ea739cb 5370 else
JojoS 0:a0715ea739cb 5371 {
JojoS 0:a0715ea739cb 5372 char buf[1024];
JojoS 0:a0715ea739cb 5373 char * p;
JojoS 0:a0715ea739cb 5374 int idx = -1;
JojoS 0:a0715ea739cb 5375
JojoS 0:a0715ea739cb 5376 puts ("----------------------------------------------------------------------");
JojoS 0:a0715ea739cb 5377 putchar (ch);
JojoS 0:a0715ea739cb 5378
JojoS 0:a0715ea739cb 5379
JojoS 0:a0715ea739cb 5380 while ((ch = getchar()) != '\n' && ch != EOF)
JojoS 0:a0715ea739cb 5381 {
JojoS 0:a0715ea739cb 5382 if (ch != '\r') // ignore CR in DOS/Windows files
JojoS 0:a0715ea739cb 5383 {
JojoS 0:a0715ea739cb 5384 if (ch == '[' && idx == -1)
JojoS 0:a0715ea739cb 5385 {
JojoS 0:a0715ea739cb 5386 idx = 0;
JojoS 0:a0715ea739cb 5387 }
JojoS 0:a0715ea739cb 5388 else if (idx >= 0)
JojoS 0:a0715ea739cb 5389 {
JojoS 0:a0715ea739cb 5390 if (ch == ']')
JojoS 0:a0715ea739cb 5391 {
JojoS 0:a0715ea739cb 5392 do_check_expected_values = FALSE;
JojoS 0:a0715ea739cb 5393 buf[idx] = '\0';
JojoS 0:a0715ea739cb 5394 idx = -1;
JojoS 0:a0715ea739cb 5395
JojoS 0:a0715ea739cb 5396 expected_protocol = atoi (buf);
JojoS 0:a0715ea739cb 5397
JojoS 0:a0715ea739cb 5398 if (expected_protocol > 0)
JojoS 0:a0715ea739cb 5399 {
JojoS 0:a0715ea739cb 5400 p = buf;
JojoS 0:a0715ea739cb 5401 while (*p)
JojoS 0:a0715ea739cb 5402 {
JojoS 0:a0715ea739cb 5403 if (*p == 'x')
JojoS 0:a0715ea739cb 5404 {
JojoS 0:a0715ea739cb 5405 p++;
JojoS 0:a0715ea739cb 5406
JojoS 0:a0715ea739cb 5407 if (sscanf (p, "%x", &expected_address) == 1)
JojoS 0:a0715ea739cb 5408 {
JojoS 0:a0715ea739cb 5409 do_check_expected_values = TRUE;
JojoS 0:a0715ea739cb 5410 }
JojoS 0:a0715ea739cb 5411 break;
JojoS 0:a0715ea739cb 5412 }
JojoS 0:a0715ea739cb 5413 p++;
JojoS 0:a0715ea739cb 5414 }
JojoS 0:a0715ea739cb 5415
JojoS 0:a0715ea739cb 5416 if (do_check_expected_values)
JojoS 0:a0715ea739cb 5417 {
JojoS 0:a0715ea739cb 5418 do_check_expected_values = FALSE;
JojoS 0:a0715ea739cb 5419
JojoS 0:a0715ea739cb 5420 while (*p)
JojoS 0:a0715ea739cb 5421 {
JojoS 0:a0715ea739cb 5422 if (*p == 'x')
JojoS 0:a0715ea739cb 5423 {
JojoS 0:a0715ea739cb 5424 p++;
JojoS 0:a0715ea739cb 5425
JojoS 0:a0715ea739cb 5426 if (sscanf (p, "%x", &expected_command) == 1)
JojoS 0:a0715ea739cb 5427 {
JojoS 0:a0715ea739cb 5428 do_check_expected_values = TRUE;
JojoS 0:a0715ea739cb 5429 }
JojoS 0:a0715ea739cb 5430 break;
JojoS 0:a0715ea739cb 5431 }
JojoS 0:a0715ea739cb 5432 p++;
JojoS 0:a0715ea739cb 5433 }
JojoS 0:a0715ea739cb 5434
JojoS 0:a0715ea739cb 5435 if (do_check_expected_values)
JojoS 0:a0715ea739cb 5436 {
JojoS 0:a0715ea739cb 5437 // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);
JojoS 0:a0715ea739cb 5438 }
JojoS 0:a0715ea739cb 5439 }
JojoS 0:a0715ea739cb 5440 }
JojoS 0:a0715ea739cb 5441 }
JojoS 0:a0715ea739cb 5442 else if (idx < 1024 - 2)
JojoS 0:a0715ea739cb 5443 {
JojoS 0:a0715ea739cb 5444 buf[idx++] = ch;
JojoS 0:a0715ea739cb 5445 }
JojoS 0:a0715ea739cb 5446 }
JojoS 0:a0715ea739cb 5447 putchar (ch);
JojoS 0:a0715ea739cb 5448 }
JojoS 0:a0715ea739cb 5449 }
JojoS 0:a0715ea739cb 5450 putchar ('\n');
JojoS 0:a0715ea739cb 5451 }
JojoS 0:a0715ea739cb 5452
JojoS 0:a0715ea739cb 5453 }
JojoS 0:a0715ea739cb 5454
JojoS 0:a0715ea739cb 5455 last_ch = ch;
JojoS 0:a0715ea739cb 5456
JojoS 0:a0715ea739cb 5457 next_tick ();
JojoS 0:a0715ea739cb 5458 }
JojoS 0:a0715ea739cb 5459
JojoS 0:a0715ea739cb 5460 if (analyze)
JojoS 0:a0715ea739cb 5461 {
JojoS 0:a0715ea739cb 5462 print_spectrum ("START PULSES", start_pulses, TRUE);
JojoS 0:a0715ea739cb 5463 print_spectrum ("START PAUSES", start_pauses, FALSE);
JojoS 0:a0715ea739cb 5464 print_spectrum ("PULSES", pulses, TRUE);
JojoS 0:a0715ea739cb 5465 print_spectrum ("PAUSES", pauses, FALSE);
JojoS 0:a0715ea739cb 5466 puts ("-----------------------------------------------------------------------------");
JojoS 0:a0715ea739cb 5467 }
JojoS 0:a0715ea739cb 5468 return 0;
JojoS 0:a0715ea739cb 5469 }
JojoS 0:a0715ea739cb 5470
JojoS 0:a0715ea739cb 5471 #endif // ANALYZE