]> cloudbase.mooo.com Git - irmp.git/blob - irmp.h
Version 2.6.7: corrected minor bug: missing newline before #else
[irmp.git] / irmp.h
1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmp.h
3 *
4 * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de
5 *
6 * $Id: irmp.h,v 1.89 2014/09/15 10:27:38 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 (ATMEL_AVR)
25 # define _CONCAT(a,b) a##b
26 # define CONCAT(a,b) _CONCAT(a,b)
27 # define IRMP_PORT CONCAT(PORT, IRMP_PORT_LETTER)
28 # define IRMP_DDR CONCAT(DDR, IRMP_PORT_LETTER)
29 # define IRMP_PIN CONCAT(PIN, IRMP_PORT_LETTER)
30 # define IRMP_BIT IRMP_BIT_NUMBER
31 # define input(x) ((x) & (1 << IRMP_BIT))
32 #elif defined (PIC_C18)
33 # define input(x) (x)
34 #elif defined (PIC_CCS)
35 # define input(x) (x)
36 #elif defined (ARM_STM32)
37 # define _CONCAT(a,b) a##b
38 # define CONCAT(a,b) _CONCAT(a,b)
39 # define IRMP_PORT CONCAT(GPIO, IRMP_PORT_LETTER)
40 # if defined (ARM_STM32L1XX)
41 # define IRMP_PORT_RCC CONCAT(RCC_AHBPeriph_GPIO, IRMP_PORT_LETTER)
42 # elif defined (ARM_STM32F10X)
43 # define IRMP_PORT_RCC CONCAT(RCC_APB2Periph_GPIO, IRMP_PORT_LETTER)
44 # elif defined (ARM_STM32F4XX)
45 # define IRMP_PORT_RCC CONCAT(RCC_AHB1Periph_GPIO, IRMP_PORT_LETTER)
46 # endif
47 # define IRMP_BIT CONCAT(GPIO_Pin_, IRMP_BIT_NUMBER)
48 # define IRMP_PIN IRMP_PORT // for use with input(x) below
49 # define input(x) (GPIO_ReadInputDataBit(x, IRMP_BIT))
50 # ifndef USE_STDPERIPH_DRIVER
51 # warning The STM32 port of IRMP uses the ST standard peripheral drivers which are not enabled in your build configuration.
52 # endif
53 #elif defined (STELLARIS_ARM_CORTEX_M4)
54 # define _CONCAT(a,b) a##b
55 # define CONCAT(a,b) _CONCAT(a,b)
56 # define IRMP_PORT_PERIPH CONCAT(SYSCTL_PERIPH_GPIO, IRMP_PORT_LETTER)
57 # define IRMP_PORT_BASE CONCAT(GPIO_PORT, CONCAT(IRMP_PORT_LETTER, _BASE))
58 # define IRMP_PORT_PIN CONCAT(GPIO_PIN_, IRMP_BIT_NUMBER)
59 # define IRMP_PIN IRMP_PORT_PIN
60 # define input(x) ((uint8_t)(ROM_GPIOPinRead(IRMP_PORT_BASE, IRMP_PORT_PIN)))
61 # define sei() IntMasterEnable()
62 #endif
63
64 #if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1
65 # warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols
66 # warning RUWIDO protocol disabled
67 # undef IRMP_SUPPORT_RUWIDO_PROTOCOL
68 # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0
69 #endif
70
71 #if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1
72 # warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols
73 # warning ROOMBA protocol disabled
74 # undef IRMP_SUPPORT_ROOMBA_PROTOCOL
75 # define IRMP_SUPPORT_ROOMBA_PROTOCOL 0
76 #endif
77
78 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1
79 # warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols
80 # warning ORTEK protocol disabled
81 # undef IRMP_SUPPORT_ORTEK_PROTOCOL
82 # define IRMP_SUPPORT_ORTEK_PROTOCOL 0
83 #endif
84
85 #if IRMP_SUPPORT_FDC_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1
86 # warning FDC protocol conflicts wih ORTEK, please enable only one of both protocols
87 # warning ORTEK protocol disabled
88 # undef IRMP_SUPPORT_ORTEK_PROTOCOL
89 # define IRMP_SUPPORT_ORTEK_PROTOCOL 0
90 #endif
91
92 #if IRMP_SUPPORT_ORTEK_PROTOCOL == 1 && IRMP_SUPPORT_NETBOX_PROTOCOL == 1
93 # warning ORTEK protocol conflicts wih NETBOX, please enable only one of both protocols
94 # warning NETBOX protocol disabled
95 # undef IRMP_SUPPORT_NETBOX_PROTOCOL
96 # define IRMP_SUPPORT_NETBOX_PROTOCOL 0
97 #endif
98
99 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000
100 # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)
101 # undef IRMP_SUPPORT_SIEMENS_PROTOCOL
102 # define IRMP_SUPPORT_SIEMENS_PROTOCOL 0
103 #endif
104
105 #if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000
106 # warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)
107 # undef IRMP_SUPPORT_RUWIDO_PROTOCOL
108 # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0
109 #endif
110
111 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000
112 # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)
113 # undef IRMP_SUPPORT_RECS80_PROTOCOL
114 # define IRMP_SUPPORT_RECS80_PROTOCOL 0
115 #endif
116
117 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000
118 # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)
119 # undef IRMP_SUPPORT_RECS80EXT_PROTOCOL
120 # define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0
121 #endif
122
123 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000
124 # warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)
125 # undef IRMP_SUPPORT_LEGO_PROTOCOL
126 # define IRMP_SUPPORT_LEGO_PROTOCOL 0
127 #endif
128
129 #if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 && IRMP_SUPPORT_SAMSUNG_PROTOCOL == 0
130 # warning SAMSUNG48 protocol needs also SAMSUNG protocol, SAMSUNG protocol enabled
131 # undef IRMP_SUPPORT_SAMSUNG_PROTOCOL
132 # define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1
133 #endif
134
135 #if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
136 # warning JVC protocol needs also NEC protocol, NEC protocol enabled
137 # undef IRMP_SUPPORT_NEC_PROTOCOL
138 # define IRMP_SUPPORT_NEC_PROTOCOL 1
139 #endif
140
141 #if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
142 # warning NEC16 protocol needs also NEC protocol, NEC protocol enabled
143 # undef IRMP_SUPPORT_NEC_PROTOCOL
144 # define IRMP_SUPPORT_NEC_PROTOCOL 1
145 #endif
146
147 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
148 # warning NEC42 protocol needs also NEC protocol, NEC protocol enabled
149 # undef IRMP_SUPPORT_NEC_PROTOCOL
150 # define IRMP_SUPPORT_NEC_PROTOCOL 1
151 #endif
152
153 #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
154 # warning LGAIR protocol needs also NEC protocol, NEC protocol enabled
155 # undef IRMP_SUPPORT_NEC_PROTOCOL
156 # define IRMP_SUPPORT_NEC_PROTOCOL 1
157 #endif
158
159 #if IRMP_SUPPORT_RCMM_PROTOCOL == 1 && F_INTERRUPTS < 20000
160 # warning F_INTERRUPTS too low, RCMM protocol disabled (should be at least 20000)
161 # undef IRMP_SUPPORT_RCMM_PROTOCOL
162 # define IRMP_SUPPORT_RCMM_PROTOCOL 0
163 #endif
164
165 #if F_INTERRUPTS > 20000
166 #error F_INTERRUPTS too high (should be not greater than 20000)
167 #endif
168
169 #include "irmpprotocols.h"
170
171 #define IRMP_FLAG_REPETITION 0x01
172
173 extern void irmp_init (void);
174 extern uint8_t irmp_get_data (IRMP_DATA *);
175 extern uint8_t irmp_is_busy (void);
176 extern uint8_t irmp_ISR (void);
177
178 #if IRMP_PROTOCOL_NAMES == 1
179 extern const char * const irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM;
180 #endif
181
182 #if IRMP_USE_CALLBACK == 1
183 extern void irmp_set_callback_ptr (void (*cb)(uint8_t));
184 #endif // IRMP_USE_CALLBACK == 1
185
186 #endif /* _IRMP_H_ */