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