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