]>
Commit | Line | Data |
---|---|---|
1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
2 | * irmp.h\r | |
3 | *\r | |
4 | * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de\r | |
5 | *\r | |
6 | * $Id: irmp.h,v 1.80 2012/11/18 17:51:26 fm Exp $\r | |
7 | *\r | |
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 | |
17 | #ifndef _IRMP_H_\r | |
18 | #define _IRMP_H_\r | |
19 | \r | |
20 | #include "irmpsystem.h"\r | |
21 | \r | |
22 | #ifndef IRMP_USE_AS_LIB\r | |
23 | # include "irmpconfig.h"\r | |
24 | #endif\r | |
25 | \r | |
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 | |
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 | |
64 | #endif\r | |
65 | \r | |
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 | |
72 | \r | |
73 | #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
74 | # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r | |
75 | # undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r | |
76 | # define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r | |
77 | #endif\r | |
78 | \r | |
79 | #if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
80 | # warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r | |
81 | # undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r | |
82 | # define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r | |
83 | #endif\r | |
84 | \r | |
85 | #if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
86 | # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r | |
87 | # undef IRMP_SUPPORT_RECS80_PROTOCOL\r | |
88 | # define IRMP_SUPPORT_RECS80_PROTOCOL 0\r | |
89 | #endif\r | |
90 | \r | |
91 | #if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r | |
92 | # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r | |
93 | # undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r | |
94 | # define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r | |
95 | #endif\r | |
96 | \r | |
97 | #if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r | |
98 | # warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r | |
99 | # undef IRMP_SUPPORT_LEGO_PROTOCOL\r | |
100 | # define IRMP_SUPPORT_LEGO_PROTOCOL 0\r | |
101 | #endif\r | |
102 | \r | |
103 | #if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
104 | # warning JVC protocol needs also NEC protocol, NEC protocol enabled\r | |
105 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
106 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
107 | #endif\r | |
108 | \r | |
109 | #if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
110 | # warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r | |
111 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
112 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
113 | #endif\r | |
114 | \r | |
115 | #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r | |
116 | # warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r | |
117 | # undef IRMP_SUPPORT_NEC_PROTOCOL\r | |
118 | # define IRMP_SUPPORT_NEC_PROTOCOL 1\r | |
119 | #endif\r | |
120 | \r | |
121 | #if F_INTERRUPTS > 20000\r | |
122 | #error F_INTERRUPTS too high (should be not greater than 20000)\r | |
123 | #endif\r | |
124 | \r | |
125 | #include "irmpprotocols.h"\r | |
126 | \r | |
127 | #define IRMP_FLAG_REPETITION 0x01\r | |
128 | \r | |
129 | extern void irmp_init (void);\r | |
130 | extern uint8_t irmp_get_data (IRMP_DATA *);\r | |
131 | extern uint8_t irmp_is_busy (void);\r | |
132 | extern uint8_t irmp_ISR (void);\r | |
133 | \r | |
134 | #if IRMP_PROTOCOL_NAMES == 1\r | |
135 | extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];\r | |
136 | #endif\r | |
137 | \r | |
138 | #if IRMP_USE_CALLBACK == 1\r | |
139 | extern void irmp_set_callback_ptr (void (*cb)(uint8_t));\r | |
140 | #endif // IRMP_USE_CALLBACK == 1\r | |
141 | \r | |
142 | #endif /* _IRMP_H_ */\r |