First release of porting 'Infrared Multiprotocol' library from mikrocontroller.net
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] ); } } }
irmp.h@0:a0715ea739cb, 2016-01-09 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
JojoS | 0:a0715ea739cb | 1 | /*--------------------------------------------------------------------------------------------------------------------------------------------------- |
JojoS | 0:a0715ea739cb | 2 | * irmp.h |
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.h,v 1.101 2015/11/18 08:27:50 fm Exp $ |
JojoS | 0:a0715ea739cb | 7 | * |
JojoS | 0:a0715ea739cb | 8 | * This program is free software; you can redistribute it and/or modify |
JojoS | 0:a0715ea739cb | 9 | * it under the terms of the GNU General Public License as published by |
JojoS | 0:a0715ea739cb | 10 | * the Free Software Foundation; either version 2 of the License, or |
JojoS | 0:a0715ea739cb | 11 | * (at your option) any later version. |
JojoS | 0:a0715ea739cb | 12 | *--------------------------------------------------------------------------------------------------------------------------------------------------- |
JojoS | 0:a0715ea739cb | 13 | */ |
JojoS | 0:a0715ea739cb | 14 | |
JojoS | 0:a0715ea739cb | 15 | #ifndef _IRMP_H_ |
JojoS | 0:a0715ea739cb | 16 | #define _IRMP_H_ |
JojoS | 0:a0715ea739cb | 17 | |
JojoS | 0:a0715ea739cb | 18 | #include "irmpsystem.h" |
JojoS | 0:a0715ea739cb | 19 | |
JojoS | 0:a0715ea739cb | 20 | #ifndef IRMP_USE_AS_LIB |
JojoS | 0:a0715ea739cb | 21 | # include "irmpconfig.h" |
JojoS | 0:a0715ea739cb | 22 | #endif |
JojoS | 0:a0715ea739cb | 23 | |
JojoS | 0:a0715ea739cb | 24 | #if defined (__AVR_XMEGA__) |
JojoS | 0:a0715ea739cb | 25 | # define _CONCAT(a,b) a##b |
JojoS | 0:a0715ea739cb | 26 | # define CONCAT(a,b) _CONCAT(a,b) |
JojoS | 0:a0715ea739cb | 27 | # define IRMP_PORT_PRE CONCAT(PORT, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 28 | # define IRMP_DDR_PRE CONCAT(PORT, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 29 | # define IRMP_PIN_PRE CONCAT(PORT, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 30 | # define IRMP_PORT IRMP_PORT_PRE.OUT |
JojoS | 0:a0715ea739cb | 31 | # define IRMP_DDR IRMP_DDR_PRE.DIR |
JojoS | 0:a0715ea739cb | 32 | # define IRMP_PIN IRMP_PIN_PRE.IN |
JojoS | 0:a0715ea739cb | 33 | # define IRMP_BIT IRMP_BIT_NUMBER |
JojoS | 0:a0715ea739cb | 34 | # define input(x) ((x) & (1 << IRMP_BIT)) |
JojoS | 0:a0715ea739cb | 35 | |
JojoS | 0:a0715ea739cb | 36 | #elif defined (ATMEL_AVR) |
JojoS | 0:a0715ea739cb | 37 | # define _CONCAT(a,b) a##b |
JojoS | 0:a0715ea739cb | 38 | # define CONCAT(a,b) _CONCAT(a,b) |
JojoS | 0:a0715ea739cb | 39 | # define IRMP_PORT CONCAT(PORT, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 40 | # define IRMP_DDR CONCAT(DDR, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 41 | # define IRMP_PIN CONCAT(PIN, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 42 | # define IRMP_BIT IRMP_BIT_NUMBER |
JojoS | 0:a0715ea739cb | 43 | # define input(x) ((x) & (1 << IRMP_BIT)) |
JojoS | 0:a0715ea739cb | 44 | |
JojoS | 0:a0715ea739cb | 45 | #elif defined (PIC_C18) || defined (PIC_CCS) |
JojoS | 0:a0715ea739cb | 46 | # define input(x) (x) |
JojoS | 0:a0715ea739cb | 47 | |
JojoS | 0:a0715ea739cb | 48 | #elif defined (ARM_STM32) |
JojoS | 0:a0715ea739cb | 49 | # define _CONCAT(a,b) a##b |
JojoS | 0:a0715ea739cb | 50 | # define CONCAT(a,b) _CONCAT(a,b) |
JojoS | 0:a0715ea739cb | 51 | # define IRMP_PORT CONCAT(GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 52 | # if defined (ARM_STM32L1XX) |
JojoS | 0:a0715ea739cb | 53 | # define IRMP_PORT_RCC CONCAT(RCC_AHBPeriph_GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 54 | # elif defined (ARM_STM32F10X) |
JojoS | 0:a0715ea739cb | 55 | # define IRMP_PORT_RCC CONCAT(RCC_APB2Periph_GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 56 | # elif defined (ARM_STM32F4XX) |
JojoS | 0:a0715ea739cb | 57 | # define IRMP_PORT_RCC CONCAT(RCC_AHB1Periph_GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 58 | # endif |
JojoS | 0:a0715ea739cb | 59 | # define IRMP_BIT CONCAT(GPIO_Pin_, IRMP_BIT_NUMBER) |
JojoS | 0:a0715ea739cb | 60 | # define IRMP_PIN IRMP_PORT // for use with input(x) below |
JojoS | 0:a0715ea739cb | 61 | # define input(x) (GPIO_ReadInputDataBit(x, IRMP_BIT)) |
JojoS | 0:a0715ea739cb | 62 | # ifndef USE_STDPERIPH_DRIVER |
JojoS | 0:a0715ea739cb | 63 | # warning The STM32 port of IRMP uses the ST standard peripheral drivers which are not enabled in your build configuration. |
JojoS | 0:a0715ea739cb | 64 | # endif |
JojoS | 0:a0715ea739cb | 65 | |
JojoS | 0:a0715ea739cb | 66 | #elif defined (STELLARIS_ARM_CORTEX_M4) |
JojoS | 0:a0715ea739cb | 67 | # define _CONCAT(a,b) a##b |
JojoS | 0:a0715ea739cb | 68 | # define CONCAT(a,b) _CONCAT(a,b) |
JojoS | 0:a0715ea739cb | 69 | # define IRMP_PORT_PERIPH CONCAT(SYSCTL_PERIPH_GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 70 | # define IRMP_PORT_BASE CONCAT(GPIO_PORT, CONCAT(IRMP_PORT_LETTER, _BASE)) |
JojoS | 0:a0715ea739cb | 71 | # define IRMP_PORT_PIN CONCAT(GPIO_PIN_, IRMP_BIT_NUMBER) |
JojoS | 0:a0715ea739cb | 72 | # define IRMP_PIN IRMP_PORT_PIN |
JojoS | 0:a0715ea739cb | 73 | # define input(x) ((uint8_t)(ROM_GPIOPinRead(IRMP_PORT_BASE, IRMP_PORT_PIN))) |
JojoS | 0:a0715ea739cb | 74 | # define sei() IntMasterEnable() |
JojoS | 0:a0715ea739cb | 75 | |
JojoS | 0:a0715ea739cb | 76 | #elif defined(__SDCC_stm8) |
JojoS | 0:a0715ea739cb | 77 | # define _CONCAT(a,b) a##b |
JojoS | 0:a0715ea739cb | 78 | # define CONCAT(a,b) _CONCAT(a,b) |
JojoS | 0:a0715ea739cb | 79 | # define IRMP_GPIO_STRUCT CONCAT(GPIO, IRMP_PORT_LETTER) |
JojoS | 0:a0715ea739cb | 80 | # define IRMP_BIT IRMP_BIT_NUMBER |
JojoS | 0:a0715ea739cb | 81 | # define input(x) ((x) & (1 << IRMP_BIT)) |
JojoS | 0:a0715ea739cb | 82 | |
JojoS | 0:a0715ea739cb | 83 | #elif defined (TEENSY_ARM_CORTEX_M4) |
JojoS | 0:a0715ea739cb | 84 | # define input(x) ((uint8_t)(digitalReadFast(x))) |
JojoS | 0:a0715ea739cb | 85 | |
JojoS | 0:a0715ea739cb | 86 | #elif defined(__xtensa__) |
JojoS | 0:a0715ea739cb | 87 | # define IRMP_BIT IRMP_BIT_NUMBER |
JojoS | 0:a0715ea739cb | 88 | # define input(x) GPIO_INPUT_GET(IRMP_BIT_NUMBER) |
JojoS | 0:a0715ea739cb | 89 | #endif |
JojoS | 0:a0715ea739cb | 90 | |
JojoS | 0:a0715ea739cb | 91 | #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 92 | # undef IRMP_SUPPORT_MATSUSHITA_PROTOCOL |
JojoS | 0:a0715ea739cb | 93 | # define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 94 | #endif |
JojoS | 0:a0715ea739cb | 95 | |
JojoS | 0:a0715ea739cb | 96 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 97 | # warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 98 | # warning RUWIDO protocol disabled |
JojoS | 0:a0715ea739cb | 99 | # undef IRMP_SUPPORT_RUWIDO_PROTOCOL |
JojoS | 0:a0715ea739cb | 100 | # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 101 | #endif |
JojoS | 0:a0715ea739cb | 102 | |
JojoS | 0:a0715ea739cb | 103 | #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 && IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 104 | # warning KASEIKYO protocol conflicts wih PANASONIC, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 105 | # warning PANASONIC protocol disabled |
JojoS | 0:a0715ea739cb | 106 | # undef IRMP_SUPPORT_PANASONIC_PROTOCOL |
JojoS | 0:a0715ea739cb | 107 | # define IRMP_SUPPORT_PANASONIC_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 108 | #endif |
JojoS | 0:a0715ea739cb | 109 | |
JojoS | 0:a0715ea739cb | 110 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_ACP24_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 111 | # warning DENON protocol conflicts wih ACP24, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 112 | # warning ACP24 protocol disabled |
JojoS | 0:a0715ea739cb | 113 | # undef IRMP_SUPPORT_ACP24_PROTOCOL |
JojoS | 0:a0715ea739cb | 114 | # define IRMP_SUPPORT_ACP24_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 115 | #endif |
JojoS | 0:a0715ea739cb | 116 | |
JojoS | 0:a0715ea739cb | 117 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 118 | # warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 119 | # warning ROOMBA protocol disabled |
JojoS | 0:a0715ea739cb | 120 | # undef IRMP_SUPPORT_ROOMBA_PROTOCOL |
JojoS | 0:a0715ea739cb | 121 | # define IRMP_SUPPORT_ROOMBA_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 122 | #endif |
JojoS | 0:a0715ea739cb | 123 | |
JojoS | 0:a0715ea739cb | 124 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 125 | # warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 126 | # warning ORTEK protocol disabled |
JojoS | 0:a0715ea739cb | 127 | # undef IRMP_SUPPORT_ORTEK_PROTOCOL |
JojoS | 0:a0715ea739cb | 128 | # define IRMP_SUPPORT_ORTEK_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 129 | #endif |
JojoS | 0:a0715ea739cb | 130 | |
JojoS | 0:a0715ea739cb | 131 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_S100_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 132 | # warning RC5 protocol conflicts wih S100, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 133 | # warning S100 protocol disabled |
JojoS | 0:a0715ea739cb | 134 | # undef IRMP_SUPPORT_S100_PROTOCOL |
JojoS | 0:a0715ea739cb | 135 | # define IRMP_SUPPORT_S100_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 136 | #endif |
JojoS | 0:a0715ea739cb | 137 | |
JojoS | 0:a0715ea739cb | 138 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1 && IRMP_SUPPORT_FAN_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 139 | # warning NUBERT protocol conflicts wih FAN, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 140 | # warning FAN protocol disabled |
JojoS | 0:a0715ea739cb | 141 | # undef IRMP_SUPPORT_FAN_PROTOCOL |
JojoS | 0:a0715ea739cb | 142 | # define IRMP_SUPPORT_FAN_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 143 | #endif |
JojoS | 0:a0715ea739cb | 144 | |
JojoS | 0:a0715ea739cb | 145 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 146 | # warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 147 | # warning ORTEK protocol disabled |
JojoS | 0:a0715ea739cb | 148 | # undef IRMP_SUPPORT_ORTEK_PROTOCOL |
JojoS | 0:a0715ea739cb | 149 | # define IRMP_SUPPORT_ORTEK_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 150 | #endif |
JojoS | 0:a0715ea739cb | 151 | |
JojoS | 0:a0715ea739cb | 152 | #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 && IRMP_SUPPORT_NETBOX_PROTOCOL == 1 |
JojoS | 0:a0715ea739cb | 153 | # warning ORTEK protocol conflicts wih NETBOX, please enable only one of both protocols |
JojoS | 0:a0715ea739cb | 154 | # warning NETBOX protocol disabled |
JojoS | 0:a0715ea739cb | 155 | # undef IRMP_SUPPORT_NETBOX_PROTOCOL |
JojoS | 0:a0715ea739cb | 156 | # define IRMP_SUPPORT_NETBOX_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 157 | #endif |
JojoS | 0:a0715ea739cb | 158 | |
JojoS | 0:a0715ea739cb | 159 | #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000 |
JojoS | 0:a0715ea739cb | 160 | # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000) |
JojoS | 0:a0715ea739cb | 161 | # undef IRMP_SUPPORT_SIEMENS_PROTOCOL |
JojoS | 0:a0715ea739cb | 162 | # define IRMP_SUPPORT_SIEMENS_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 163 | #endif |
JojoS | 0:a0715ea739cb | 164 | |
JojoS | 0:a0715ea739cb | 165 | #if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000 |
JojoS | 0:a0715ea739cb | 166 | # warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000) |
JojoS | 0:a0715ea739cb | 167 | # undef IRMP_SUPPORT_RUWIDO_PROTOCOL |
JojoS | 0:a0715ea739cb | 168 | # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 169 | #endif |
JojoS | 0:a0715ea739cb | 170 | |
JojoS | 0:a0715ea739cb | 171 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000 |
JojoS | 0:a0715ea739cb | 172 | # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000) |
JojoS | 0:a0715ea739cb | 173 | # undef IRMP_SUPPORT_RECS80_PROTOCOL |
JojoS | 0:a0715ea739cb | 174 | # define IRMP_SUPPORT_RECS80_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 175 | #endif |
JojoS | 0:a0715ea739cb | 176 | |
JojoS | 0:a0715ea739cb | 177 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000 |
JojoS | 0:a0715ea739cb | 178 | # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000) |
JojoS | 0:a0715ea739cb | 179 | # undef IRMP_SUPPORT_RECS80EXT_PROTOCOL |
JojoS | 0:a0715ea739cb | 180 | # define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 181 | #endif |
JojoS | 0:a0715ea739cb | 182 | |
JojoS | 0:a0715ea739cb | 183 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000 |
JojoS | 0:a0715ea739cb | 184 | # warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000) |
JojoS | 0:a0715ea739cb | 185 | # undef IRMP_SUPPORT_LEGO_PROTOCOL |
JojoS | 0:a0715ea739cb | 186 | # define IRMP_SUPPORT_LEGO_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 187 | #endif |
JojoS | 0:a0715ea739cb | 188 | |
JojoS | 0:a0715ea739cb | 189 | #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 0 |
JojoS | 0:a0715ea739cb | 190 | # warning SAMSUNG48 protocol needs also SAMSUNG protocol, SAMSUNG protocol enabled |
JojoS | 0:a0715ea739cb | 191 | # undef IRMP_SUPPORT_SAMSUNG_PROTOCOL |
JojoS | 0:a0715ea739cb | 192 | # define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 193 | #endif |
JojoS | 0:a0715ea739cb | 194 | |
JojoS | 0:a0715ea739cb | 195 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0 |
JojoS | 0:a0715ea739cb | 196 | # warning JVC protocol needs also NEC protocol, NEC protocol enabled |
JojoS | 0:a0715ea739cb | 197 | # undef IRMP_SUPPORT_NEC_PROTOCOL |
JojoS | 0:a0715ea739cb | 198 | # define IRMP_SUPPORT_NEC_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 199 | #endif |
JojoS | 0:a0715ea739cb | 200 | |
JojoS | 0:a0715ea739cb | 201 | #if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0 |
JojoS | 0:a0715ea739cb | 202 | # warning NEC16 protocol needs also NEC protocol, NEC protocol enabled |
JojoS | 0:a0715ea739cb | 203 | # undef IRMP_SUPPORT_NEC_PROTOCOL |
JojoS | 0:a0715ea739cb | 204 | # define IRMP_SUPPORT_NEC_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 205 | #endif |
JojoS | 0:a0715ea739cb | 206 | |
JojoS | 0:a0715ea739cb | 207 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0 |
JojoS | 0:a0715ea739cb | 208 | # warning NEC42 protocol needs also NEC protocol, NEC protocol enabled |
JojoS | 0:a0715ea739cb | 209 | # undef IRMP_SUPPORT_NEC_PROTOCOL |
JojoS | 0:a0715ea739cb | 210 | # define IRMP_SUPPORT_NEC_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 211 | #endif |
JojoS | 0:a0715ea739cb | 212 | |
JojoS | 0:a0715ea739cb | 213 | #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0 |
JojoS | 0:a0715ea739cb | 214 | # warning LGAIR protocol needs also NEC protocol, NEC protocol enabled |
JojoS | 0:a0715ea739cb | 215 | # undef IRMP_SUPPORT_NEC_PROTOCOL |
JojoS | 0:a0715ea739cb | 216 | # define IRMP_SUPPORT_NEC_PROTOCOL 1 |
JojoS | 0:a0715ea739cb | 217 | #endif |
JojoS | 0:a0715ea739cb | 218 | |
JojoS | 0:a0715ea739cb | 219 | #if IRMP_SUPPORT_RCMM_PROTOCOL == 1 && F_INTERRUPTS < 20000 |
JojoS | 0:a0715ea739cb | 220 | # warning F_INTERRUPTS too low, RCMM protocol disabled (should be at least 20000) |
JojoS | 0:a0715ea739cb | 221 | # undef IRMP_SUPPORT_RCMM_PROTOCOL |
JojoS | 0:a0715ea739cb | 222 | # define IRMP_SUPPORT_RCMM_PROTOCOL 0 |
JojoS | 0:a0715ea739cb | 223 | #endif |
JojoS | 0:a0715ea739cb | 224 | |
JojoS | 0:a0715ea739cb | 225 | #if F_INTERRUPTS > 20000 |
JojoS | 0:a0715ea739cb | 226 | #error F_INTERRUPTS too high (should be not greater than 20000) |
JojoS | 0:a0715ea739cb | 227 | #endif |
JojoS | 0:a0715ea739cb | 228 | |
JojoS | 0:a0715ea739cb | 229 | #include "irmpprotocols.h" |
JojoS | 0:a0715ea739cb | 230 | |
JojoS | 0:a0715ea739cb | 231 | #define IRMP_FLAG_REPETITION 0x01 |
JojoS | 0:a0715ea739cb | 232 | |
JojoS | 0:a0715ea739cb | 233 | #ifdef __cplusplus |
JojoS | 0:a0715ea739cb | 234 | extern "C" |
JojoS | 0:a0715ea739cb | 235 | { |
JojoS | 0:a0715ea739cb | 236 | #endif |
JojoS | 0:a0715ea739cb | 237 | |
JojoS | 0:a0715ea739cb | 238 | extern void irmp_init (void); |
JojoS | 0:a0715ea739cb | 239 | extern uint_fast8_t irmp_get_data (IRMP_DATA *); |
JojoS | 0:a0715ea739cb | 240 | extern uint_fast8_t irmp_ISR (void); |
JojoS | 0:a0715ea739cb | 241 | |
JojoS | 0:a0715ea739cb | 242 | #if IRMP_PROTOCOL_NAMES == 1 |
JojoS | 0:a0715ea739cb | 243 | extern const char * const irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM; |
JojoS | 0:a0715ea739cb | 244 | #endif |
JojoS | 0:a0715ea739cb | 245 | |
JojoS | 0:a0715ea739cb | 246 | #if IRMP_USE_CALLBACK == 1 |
JojoS | 0:a0715ea739cb | 247 | extern void irmp_set_callback_ptr (void (*cb)(uint_fast8_t)); |
JojoS | 0:a0715ea739cb | 248 | #endif // IRMP_USE_CALLBACK == 1 |
JojoS | 0:a0715ea739cb | 249 | |
JojoS | 0:a0715ea739cb | 250 | #ifdef __cplusplus |
JojoS | 0:a0715ea739cb | 251 | } |
JojoS | 0:a0715ea739cb | 252 | #endif |
JojoS | 0:a0715ea739cb | 253 | |
JojoS | 0:a0715ea739cb | 254 | #endif /* _IRMP_H_ */ |