]> cloudbase.mooo.com Git - irmp.git/blob - irmp.h
Version 2.3.9: added ORTEK and TELEFUNKEN protocol
[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.81 2013/01/17 07:33:13 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_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000
74 # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)
75 # undef IRMP_SUPPORT_SIEMENS_PROTOCOL
76 # define IRMP_SUPPORT_SIEMENS_PROTOCOL 0
77 #endif
78
79 #if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000
80 # warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)
81 # undef IRMP_SUPPORT_RUWIDO_PROTOCOL
82 # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0
83 #endif
84
85 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000
86 # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)
87 # undef IRMP_SUPPORT_RECS80_PROTOCOL
88 # define IRMP_SUPPORT_RECS80_PROTOCOL 0
89 #endif
90
91 #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000
92 # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)
93 # undef IRMP_SUPPORT_RECS80EXT_PROTOCOL
94 # define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0
95 #endif
96
97 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000
98 # warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)
99 # undef IRMP_SUPPORT_LEGO_PROTOCOL
100 # define IRMP_SUPPORT_LEGO_PROTOCOL 0
101 #endif
102
103 #if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
104 # warning JVC protocol needs also NEC protocol, NEC protocol enabled
105 # undef IRMP_SUPPORT_NEC_PROTOCOL
106 # define IRMP_SUPPORT_NEC_PROTOCOL 1
107 #endif
108
109 #if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
110 # warning NEC16 protocol needs also NEC protocol, NEC protocol enabled
111 # undef IRMP_SUPPORT_NEC_PROTOCOL
112 # define IRMP_SUPPORT_NEC_PROTOCOL 1
113 #endif
114
115 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0
116 # warning NEC42 protocol needs also NEC protocol, NEC protocol enabled
117 # undef IRMP_SUPPORT_NEC_PROTOCOL
118 # define IRMP_SUPPORT_NEC_PROTOCOL 1
119 #endif
120
121 #if F_INTERRUPTS > 20000
122 #error F_INTERRUPTS too high (should be not greater than 20000)
123 #endif
124
125 #include "irmpprotocols.h"
126
127 #define IRMP_FLAG_REPETITION 0x01
128
129 extern void irmp_init (void);
130 extern uint8_t irmp_get_data (IRMP_DATA *);
131 extern uint8_t irmp_is_busy (void);
132 extern uint8_t irmp_ISR (void);
133
134 #if IRMP_PROTOCOL_NAMES == 1
135 extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];
136 #endif
137
138 #if IRMP_USE_CALLBACK == 1
139 extern void irmp_set_callback_ptr (void (*cb)(uint8_t));
140 #endif // IRMP_USE_CALLBACK == 1
141
142 #endif /* _IRMP_H_ */