]>
Commit | Line | Data |
---|---|---|
1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
2 | * irmpsystem.h - system specific includes and defines\r | |
3 | *\r | |
4 | * Copyright (c) 2009-2016 Frank Meyer - frank(at)fli4l.de\r | |
5 | *\r | |
6 | * $Id: irmpsystem.h,v 1.25 2016/12/19 09:01:41 fm Exp $\r | |
7 | *\r | |
8 | * This program is free software; you can redistribute it and/or modify\r | |
9 | * it under the terms of the GNU General Public License as published by\r | |
10 | * the Free Software Foundation; either version 2 of the License, or\r | |
11 | * (at your option) any later version.\r | |
12 | *---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
13 | */\r | |
14 | \r | |
15 | #ifndef _IRMPSYSTEM_H_\r | |
16 | #define _IRMPSYSTEM_H_\r | |
17 | \r | |
18 | #if !defined(_IRMP_H_) && !defined(_IRSND_H_)\r | |
19 | # error please include only irmp.h or irsnd.h, not irmpsystem.h\r | |
20 | #endif\r | |
21 | \r | |
22 | #if defined(__18CXX) // Microchip PIC C18 compiler\r | |
23 | # define PIC_C18\r | |
24 | #elif defined(__XC8) // PIC XC8 compiler\r | |
25 | # include <xc.h>\r | |
26 | # define PIC_C18\r | |
27 | #elif defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC compiler\r | |
28 | # define PIC_CCS\r | |
29 | #elif defined(STM32F1) // ARM STM32 with libopencm3\r | |
30 | # define LIBOPENCM3\r | |
31 | #elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32\r | |
32 | # include <stm32l1xx.h>\r | |
33 | # define ARM_STM32\r | |
34 | # define ARM_STM32L1XX\r | |
35 | # define F_CPU (SysCtlClockGet())\r | |
36 | #elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \\r | |
37 | || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \\r | |
38 | || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \\r | |
39 | || defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32\r | |
40 | # include <stm32f10x.h>\r | |
41 | # define ARM_STM32\r | |
42 | # define ARM_STM32F10X\r | |
43 | # define F_CPU (SysCtlClockGet())\r | |
44 | #elif defined(STM32F4XX) // ARM STM32\r | |
45 | # include <stm32f4xx.h>\r | |
46 | # define ARM_STM32\r | |
47 | # define ARM_STM32F4XX\r | |
48 | #elif defined(__SDCC_stm8) // STM8\r | |
49 | # define SDCC_STM8\r | |
50 | #elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)\r | |
51 | # define STELLARIS_ARM_CORTEX_M4\r | |
52 | # define F_CPU (SysCtlClockGet())\r | |
53 | #elif defined(__xtensa__) // ESP8266 (Arduino)\r | |
54 | # include "Arduino.h"\r | |
55 | # include "ets_sys.h"\r | |
56 | # include "osapi.h"\r | |
57 | # include "gpio.h"\r | |
58 | # include "os_type.h"\r | |
59 | # include "c_types.h"\r | |
60 | # define uint_fast8_t uint8_t\r | |
61 | # define uint_fast16_t uint16_t\r | |
62 | #elif defined(TEENSYDUINO) && (defined(__MK20DX256__) || defined(__MK20DX128__)) // Teensy 3.x (tested on Teensy 3.1 in Arduino 1.6.5 / Teensyduino 1.2.5)\r | |
63 | # include <core_pins.h>\r | |
64 | # define TEENSY_ARM_CORTEX_M4\r | |
65 | #elif defined(unix) || defined(WIN32) || defined(__APPLE__) // Unix/Linux or Windows or Apple\r | |
66 | # define UNIX_OR_WINDOWS\r | |
67 | #elif defined(__MBED__) // mbed platform\r | |
68 | // #include "mbed.h" // if mbed.h is used, source must be compiled as cpp\r | |
69 | #include "gpio_api.h"\r | |
70 | #else\r | |
71 | # define ATMEL_AVR // ATMEL AVR\r | |
72 | #endif\r | |
73 | \r | |
74 | #include <string.h>\r | |
75 | \r | |
76 | #ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows\r | |
77 | # include <stdio.h>\r | |
78 | # include <stdlib.h>\r | |
79 | # define F_CPU 8000000L\r | |
80 | # define ANALYZE\r | |
81 | # ifdef unix\r | |
82 | # include <stdint.h>\r | |
83 | # else\r | |
84 | typedef unsigned char uint8_t;\r | |
85 | typedef unsigned short uint16_t;\r | |
86 | # endif\r | |
87 | #endif\r | |
88 | \r | |
89 | \r | |
90 | #if defined(ATMEL_AVR)\r | |
91 | # include <stdint.h>\r | |
92 | # include <stdio.h>\r | |
93 | # include <avr/io.h>\r | |
94 | # include <util/delay.h>\r | |
95 | # include <avr/pgmspace.h>\r | |
96 | # include <avr/interrupt.h>\r | |
97 | # define IRSND_OC2 0 // OC2\r | |
98 | # define IRSND_OC2A 1 // OC2A\r | |
99 | # define IRSND_OC2B 2 // OC2B\r | |
100 | # define IRSND_OC0 3 // OC0\r | |
101 | # define IRSND_OC0A 4 // OC0A\r | |
102 | # define IRSND_OC0B 5 // OC0B\r | |
103 | \r | |
104 | # define IRSND_XMEGA_OC0A 0 // OC0A\r | |
105 | # define IRSND_XMEGA_OC0B 1 // OC0B\r | |
106 | # define IRSND_XMEGA_OC0C 2 // OC0C\r | |
107 | # define IRSND_XMEGA_OC0D 3 // OC0D\r | |
108 | # define IRSND_XMEGA_OC1A 4 // OC1A\r | |
109 | # define IRSND_XMEGA_OC1B 5 // OC1B\r | |
110 | \r | |
111 | #elif defined(STELLARIS_ARM_CORTEX_M4)\r | |
112 | \r | |
113 | # include "inc/hw_ints.h"\r | |
114 | # include "inc/hw_memmap.h"\r | |
115 | # include "inc/hw_types.h"\r | |
116 | # include "inc/hw_gpio.h"\r | |
117 | # include "driverlib/fpu.h"\r | |
118 | # include "driverlib/sysctl.h"\r | |
119 | # include "driverlib/interrupt.h"\r | |
120 | # include "driverlib/gpio.h"\r | |
121 | # include "driverlib/rom.h"\r | |
122 | # include "driverlib/systick.h"\r | |
123 | # include "driverlib/pin_map.h"\r | |
124 | # include "driverlib/timer.h"\r | |
125 | # define PROGMEM\r | |
126 | # define memcpy_P memcpy\r | |
127 | # define APP_SYSTICKS_PER_SEC 32\r | |
128 | \r | |
129 | #elif defined(ARM_STM32F10X)\r | |
130 | \r | |
131 | # include "stm32f10x_gpio.h"\r | |
132 | # include "stm32f10x_rcc.h"\r | |
133 | # include "stm32f10x_tim.h"\r | |
134 | # include "misc.h"\r | |
135 | # define PROGMEM\r | |
136 | # define memcpy_P memcpy\r | |
137 | \r | |
138 | #elif defined(LIBOPENCM3)\r | |
139 | \r | |
140 | # include <libopencm3/cm3/nvic.h>\r | |
141 | # include <libopencm3/stm32/rcc.h>\r | |
142 | # include <libopencm3/stm32/gpio.h>\r | |
143 | # include <libopencm3/stm32/timer.h>\r | |
144 | # define PROGMEM\r | |
145 | # define memcpy_P memcpy\r | |
146 | \r | |
147 | #elif defined(SDCC_STM8)\r | |
148 | \r | |
149 | # include "stm8s.h"\r | |
150 | # define PROGMEM\r | |
151 | # define memcpy_P memcpy\r | |
152 | # define __attribute__(x)\r | |
153 | # define uint_fast8_t uint8_t\r | |
154 | # define uint_fast16_t uint16_t\r | |
155 | \r | |
156 | #elif defined(TEENSY_ARM_CORTEX_M4)\r | |
157 | # define PROGMEM\r | |
158 | # define memcpy_P memcpy\r | |
159 | \r | |
160 | #elif defined(__xtensa__)\r | |
161 | # define PROGMEM\r | |
162 | # define memcpy_P memcpy\r | |
163 | \r | |
164 | #elif defined(__MBED__)\r | |
165 | # define PROGMEM\r | |
166 | # define memcpy_P memcpy\r | |
167 | \r | |
168 | #else\r | |
169 | # define PROGMEM\r | |
170 | # define memcpy_P memcpy\r | |
171 | \r | |
172 | #endif\r | |
173 | \r | |
174 | #if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32) || defined(STELLARIS_ARM_CORTEX_M4)\r | |
175 | typedef unsigned char uint8_t;\r | |
176 | typedef unsigned short uint16_t;\r | |
177 | typedef unsigned char uint_fast8_t;\r | |
178 | typedef unsigned short uint_fast16_t;\r | |
179 | #endif\r | |
180 | \r | |
181 | #if defined (PIC_C18) // PIC C18 or XC8 compiler\r | |
182 | # include <p18cxxx.h> // main PIC18 h file\r | |
183 | #ifndef __XC8\r | |
184 | # include <timers.h> // timer lib\r | |
185 | # include <pwm.h> // pwm lib\r | |
186 | #endif\r | |
187 | # define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module\r | |
188 | # define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module\r | |
189 | #endif\r | |
190 | \r | |
191 | #ifndef TRUE\r | |
192 | # define TRUE 1\r | |
193 | # define FALSE 0\r | |
194 | #endif\r | |
195 | \r | |
196 | #if defined(PIC_C18)\r | |
197 | #define IRMP_PACKED_STRUCT\r | |
198 | #else\r | |
199 | #define IRMP_PACKED_STRUCT __attribute__ ((__packed__))\r | |
200 | #endif\r | |
201 | \r | |
202 | typedef struct IRMP_PACKED_STRUCT\r | |
203 | {\r | |
204 | uint8_t protocol; // protocol, e.g. NEC_PROTOCOL\r | |
205 | uint16_t address; // address\r | |
206 | uint16_t command; // command\r | |
207 | uint8_t flags; // flags, e.g. repetition\r | |
208 | } IRMP_DATA;\r | |
209 | \r | |
210 | #endif // _IRMPSYSTEM_H_\r |