]> cloudbase.mooo.com Git - irmp.git/blame - irmp.h
Version 2.9.2: added S100 protocol, some minor corrections
[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
c2b70f0b 6 * $Id: irmp.h,v 1.95 2015/05/29 08:23:56 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
08f2dd9d 76#endif\r
a7054daf 77\r
0834784c 78#if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
79# warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols\r
08f2dd9d 80# warning RUWIDO protocol disabled\r
81# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
82# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
83#endif\r
b5ea7869 84\r
40ca4604 85#if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
86# warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols\r
87# warning ROOMBA protocol disabled\r
88# undef IRMP_SUPPORT_ROOMBA_PROTOCOL\r
89# define IRMP_SUPPORT_ROOMBA_PROTOCOL 0\r
90#endif\r
91\r
cb93f9e9 92#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
93# warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols\r
94# warning ORTEK protocol disabled\r
95# undef IRMP_SUPPORT_ORTEK_PROTOCOL\r
96# define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r
97#endif\r
98\r
c2b70f0b 99#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_S100_PROTOCOL == 1\r
100# warning RC5 protocol conflicts wih S100, please enable only one of both protocols\r
101# warning S100 protocol disabled\r
102# undef IRMP_SUPPORT_S100_PROTOCOL\r
103# define IRMP_SUPPORT_S100_PROTOCOL 0\r
104#endif\r
105\r
106#if IRMP_SUPPORT_NUBERT_PROTOCOL == 1 && IRMP_SUPPORT_FAN_PROTOCOL == 1\r
107# warning NUBERT protocol conflicts wih FAN, please enable only one of both protocols\r
108# warning FAN protocol disabled\r
109# undef IRMP_SUPPORT_FAN_PROTOCOL\r
110# define IRMP_SUPPORT_FAN_PROTOCOL 0\r
111#endif\r
112\r
cb93f9e9 113#if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
114# warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols\r
115# warning ORTEK protocol disabled\r
116# undef IRMP_SUPPORT_ORTEK_PROTOCOL\r
117# define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r
118#endif\r
119\r
120#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 && IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
121# warning ORTEK protocol conflicts wih NETBOX, please enable only one of both protocols\r
122# warning NETBOX protocol disabled\r
123# undef IRMP_SUPPORT_NETBOX_PROTOCOL\r
124# define IRMP_SUPPORT_NETBOX_PROTOCOL 0\r
125#endif\r
126\r
08f2dd9d 127#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
128# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
129# undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r
130# define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r
131#endif\r
9e16d699 132\r
08f2dd9d 133#if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
134# warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r
135# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
136# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
137#endif\r
770a1a9d 138\r
08f2dd9d 139#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
140# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r
141# undef IRMP_SUPPORT_RECS80_PROTOCOL\r
142# define IRMP_SUPPORT_RECS80_PROTOCOL 0\r
143#endif\r
9405f84a 144\r
08f2dd9d 145#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
146# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r
147# undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r
148# define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r
149#endif\r
111d6191 150\r
08f2dd9d 151#if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
152# warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r
153# undef IRMP_SUPPORT_LEGO_PROTOCOL\r
154# define IRMP_SUPPORT_LEGO_PROTOCOL 0\r
155#endif\r
deba2a0a 156\r
956ea3ea 157#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 0\r
158# warning SAMSUNG48 protocol needs also SAMSUNG protocol, SAMSUNG protocol enabled\r
159# undef IRMP_SUPPORT_SAMSUNG_PROTOCOL\r
160# define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1\r
161#endif\r
162\r
08f2dd9d 163#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
164# warning JVC protocol needs also NEC protocol, NEC protocol enabled\r
165# undef IRMP_SUPPORT_NEC_PROTOCOL\r
166# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
167#endif\r
f50e01e7 168\r
08f2dd9d 169#if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
170# warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r
171# undef IRMP_SUPPORT_NEC_PROTOCOL\r
172# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
173#endif\r
beda975f 174\r
08f2dd9d 175#if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
176# warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r
177# undef IRMP_SUPPORT_NEC_PROTOCOL\r
178# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
69da6090 179#endif\r
180\r
181#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
182# warning LGAIR protocol needs also NEC protocol, NEC protocol enabled\r
183# undef IRMP_SUPPORT_NEC_PROTOCOL\r
184# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
08f2dd9d 185#endif\r
4225a882 186\r
cb93f9e9 187#if IRMP_SUPPORT_RCMM_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
188# warning F_INTERRUPTS too low, RCMM protocol disabled (should be at least 20000)\r
189# undef IRMP_SUPPORT_RCMM_PROTOCOL\r
190# define IRMP_SUPPORT_RCMM_PROTOCOL 0\r
191#endif\r
192\r
08f2dd9d 193#if F_INTERRUPTS > 20000\r
194#error F_INTERRUPTS too high (should be not greater than 20000)\r
195#endif\r
4225a882 196\r
08f2dd9d 197#include "irmpprotocols.h"\r
4225a882 198\r
08f2dd9d 199#define IRMP_FLAG_REPETITION 0x01\r
4225a882 200\r
1f54e86c 201extern void irmp_init (void);\r
061e654c 202extern uint_fast8_t irmp_get_data (IRMP_DATA *);\r
061e654c 203extern uint_fast8_t irmp_ISR (void);\r
4225a882 204\r
1f54e86c 205#if IRMP_PROTOCOL_NAMES == 1\r
622f5f59 206extern const char * const irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM;\r
4225a882 207#endif\r
208\r
7644ac04 209#if IRMP_USE_CALLBACK == 1\r
061e654c 210extern void irmp_set_callback_ptr (void (*cb)(uint_fast8_t));\r
08f2dd9d 211#endif // IRMP_USE_CALLBACK == 1\r
7644ac04 212\r
08f2dd9d 213#endif /* _IRMP_H_ */\r