]>
Commit | Line | Data |
---|---|---|
1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
2 | * irmp.h\r | |
3 | *\r | |
4 | * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de\r | |
5 | *\r | |
6 | * $Id: irmp.h,v 1.98 2015/11/10 08:39:27 fm Exp $\r | |
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 | |
15 | #ifndef _IRMP_H_\r | |
16 | #define _IRMP_H_\r | |
17 | \r | |
18 | #include "irmpsystem.h"\r | |
19 | \r | |
20 | #ifndef IRMP_USE_AS_LIB\r | |
21 | # include "irmpconfig.h"\r | |
22 | #endif\r | |
23 | \r | |
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 | |
28 | # define IRMP_DDR_PRE CONCAT(PORT, IRMP_PORT_LETTER)\r | |
29 | # define IRMP_PIN_PRE CONCAT(PORT, IRMP_PORT_LETTER)\r | |
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 | |
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 | |
44 | \r | |
45 | #elif defined (PIC_C18) || defined (PIC_CCS)\r | |
46 | # define input(x) (x)\r | |
47 | \r | |
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 | |
65 | \r | |
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 | |
75 | \r | |
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 | |
83 | #endif\r | |
84 | \r | |
85 | #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1\r | |
86 | # undef IRMP_SUPPORT_MATSUSHITA_PROTOCOL\r | |
87 | # define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1\r | |
88 | #endif\r | |
89 | \r | |
90 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r | |
91 | # warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols\r | |
92 | # warning RUWIDO protocol disabled\r | |
93 | # undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r | |
94 | # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r | |
95 | #endif\r | |
96 | \r | |
97 | #if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_ACP24_PROTOCOL == 1\r | |
98 | # warning DENON protocol conflicts wih ACP24, please enable only one of both protocols\r | |
99 | # warning ACP24 protocol disabled\r | |
100 | # undef IRMP_SUPPORT_ACP24_PROTOCOL\r | |
101 | # define IRMP_SUPPORT_ACP24_PROTOCOL 0\r | |
102 | #endif\r | |
103 | \r | |
104 | #if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r | |
105 | # warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols\r | |
106 | # warning ROOMBA protocol disabled\r | |
107 | # undef IRMP_SUPPORT_ROOMBA_PROTOCOL\r | |
108 | # define IRMP_SUPPORT_ROOMBA_PROTOCOL 0\r | |
109 | #endif\r | |
110 | \r | |
111 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r | |
112 | # warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols\r | |
113 | # warning ORTEK protocol disabled\r | |
114 | # undef IRMP_SUPPORT_ORTEK_PROTOCOL\r | |
115 | # define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r | |
116 | #endif\r | |
117 | \r | |
118 | #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_S100_PROTOCOL == 1\r | |
119 | # warning RC5 protocol conflicts wih S100, please enable only one of both protocols\r | |
120 | # warning S100 protocol disabled\r | |
121 | # undef IRMP_SUPPORT_S100_PROTOCOL\r | |
122 | # define IRMP_SUPPORT_S100_PROTOCOL 0\r | |
123 | #endif\r | |
124 | \r | |
125 | #if IRMP_SUPPORT_NUBERT_PROTOCOL == 1 && IRMP_SUPPORT_FAN_PROTOCOL == 1\r | |
126 | # warning NUBERT protocol conflicts wih FAN, please enable only one of both protocols\r | |
127 | # warning FAN protocol disabled\r | |
128 | # undef IRMP_SUPPORT_FAN_PROTOCOL\r | |
129 | # define IRMP_SUPPORT_FAN_PROTOCOL 0\r | |
130 | #endif\r | |
131 | \r | |
132 | #if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r | |
133 | # warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols\r | |
134 | # warning ORTEK protocol disabled\r | |
135 | # undef IRMP_SUPPORT_ORTEK_PROTOCOL\r | |
136 | # define IRMP_SUPPORT_ORTEK_PROTOCOL 0\r | |
137 | #endif\r | |
138 | \r | |
139 | #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 && IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r | |
140 | # warning ORTEK protocol conflicts wih NETBOX, please enable only one of both protocols\r | |
141 | # warning NETBOX protocol disabled\r | |
142 | # undef IRMP_SUPPORT_NETBOX_PROTOCOL\r | |
143 | # define IRMP_SUPPORT_NETBOX_PROTOCOL 0\r | |
144 | #endif\r | |
145 | \r | |
146 | #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
147 | # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r | |
148 | # undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r | |
149 | # define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r | |
150 | #endif\r | |
151 | \r | |
152 | #if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
153 | # warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r | |
154 | # undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r | |
155 | # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r | |
156 | #endif\r | |
157 | \r | |
158 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
159 | # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r | |
160 | # undef IRMP_SUPPORT_RECS80_PROTOCOL\r | |
161 | # define IRMP_SUPPORT_RECS80_PROTOCOL 0\r | |
162 | #endif\r | |
163 | \r | |
164 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
165 | # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r | |
166 | # undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r | |
167 | # define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r | |
168 | #endif\r | |
169 | \r | |
170 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r | |
171 | # warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r | |
172 | # undef IRMP_SUPPORT_LEGO_PROTOCOL\r | |
173 | # define IRMP_SUPPORT_LEGO_PROTOCOL 0\r | |
174 | #endif\r | |
175 | \r | |
176 | #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 0\r | |
177 | # warning SAMSUNG48 protocol needs also SAMSUNG protocol, SAMSUNG protocol enabled\r | |
178 | # undef IRMP_SUPPORT_SAMSUNG_PROTOCOL\r | |
179 | # define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1\r | |
180 | #endif\r | |
181 | \r | |
182 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
183 | # warning JVC protocol needs also NEC protocol, NEC protocol enabled\r | |
184 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
185 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
186 | #endif\r | |
187 | \r | |
188 | #if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
189 | # warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r | |
190 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
191 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
192 | #endif\r | |
193 | \r | |
194 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
195 | # warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r | |
196 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
197 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
198 | #endif\r | |
199 | \r | |
200 | #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
201 | # warning LGAIR protocol needs also NEC protocol, NEC protocol enabled\r | |
202 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
203 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
204 | #endif\r | |
205 | \r | |
206 | #if IRMP_SUPPORT_RCMM_PROTOCOL == 1 && F_INTERRUPTS < 20000\r | |
207 | # warning F_INTERRUPTS too low, RCMM protocol disabled (should be at least 20000)\r | |
208 | # undef IRMP_SUPPORT_RCMM_PROTOCOL\r | |
209 | # define IRMP_SUPPORT_RCMM_PROTOCOL 0\r | |
210 | #endif\r | |
211 | \r | |
212 | #if F_INTERRUPTS > 20000\r | |
213 | #error F_INTERRUPTS too high (should be not greater than 20000)\r | |
214 | #endif\r | |
215 | \r | |
216 | #include "irmpprotocols.h"\r | |
217 | \r | |
218 | #define IRMP_FLAG_REPETITION 0x01\r | |
219 | \r | |
220 | extern void irmp_init (void);\r | |
221 | extern uint_fast8_t irmp_get_data (IRMP_DATA *);\r | |
222 | extern uint_fast8_t irmp_ISR (void);\r | |
223 | \r | |
224 | #if IRMP_PROTOCOL_NAMES == 1\r | |
225 | extern const char * const irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM;\r | |
226 | #endif\r | |
227 | \r | |
228 | #if IRMP_USE_CALLBACK == 1\r | |
229 | extern void irmp_set_callback_ptr (void (*cb)(uint_fast8_t));\r | |
230 | #endif // IRMP_USE_CALLBACK == 1\r | |
231 | \r | |
232 | #endif /* _IRMP_H_ */\r |