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