]>
cloudbase.mooo.com Git - irmp.git/blob - irmp.h
1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
4 * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de
6 * $Id: irmp.h,v 1.100 2015/11/17 13:51:45 fm Exp $
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 *---------------------------------------------------------------------------------------------------------------------------------------------------
18 #include "irmpsystem.h"
20 #ifndef IRMP_USE_AS_LIB
21 # include "irmpconfig.h"
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))
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))
45 #elif defined (PIC_C18) || defined (PIC_CCS)
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)
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.
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()
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))
83 #elif defined (TEENSY_ARM_CORTEX_M4)
84 # define input(x) ((uint8_t)(digitalReadFast(x)))
86 #elif defined(__xtensa__)
87 # define IRMP_BIT IRMP_BIT_NUMBER
88 # define input(x) GPIO_INPUT_GET(IRMP_BIT_NUMBER)
91 #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1
92 # undef IRMP_SUPPORT_MATSUSHITA_PROTOCOL
93 # define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
225 #if F_INTERRUPTS > 20000
226 #error F_INTERRUPTS too high (should be not greater than 20000)
229 #include "irmpprotocols.h"
231 #define IRMP_FLAG_REPETITION 0x01
238 extern void irmp_init (void);
239 extern uint_fast8_t irmp_get_data (IRMP_DATA
*);
240 extern uint_fast8_t irmp_ISR (void);
242 #if IRMP_PROTOCOL_NAMES == 1
243 extern const char * const irmp_protocol_names
[IRMP_N_PROTOCOLS
+ 1] PROGMEM
;
246 #if IRMP_USE_CALLBACK == 1
247 extern void irmp_set_callback_ptr (void (*cb
)(uint_fast8_t));
248 #endif // IRMP_USE_CALLBACK == 1
254 #endif /* _IRMP_H_ */