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