]>
Commit | Line | Data |
---|---|---|
1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r | |
2 | * irmpsystem.h - system specific includes and defines\r | |
3 | *\r | |
4 | * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de\r | |
5 | *\r | |
6 | * $Id: irmpsystem.h,v 1.21 2015/11/18 08:27:50 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(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32\r | |
30 | # include <stm32l1xx.h>\r | |
31 | # define ARM_STM32\r | |
32 | # define ARM_STM32L1XX\r | |
33 | # define F_CPU (SysCtlClockGet())\r | |
34 | #elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \\r | |
35 | || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \\r | |
36 | || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \\r | |
37 | || defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32\r | |
38 | # include <stm32f10x.h>\r | |
39 | # define ARM_STM32\r | |
40 | # define ARM_STM32F10X\r | |
41 | # define F_CPU (SysCtlClockGet())\r | |
42 | #elif defined(STM32F4XX) // ARM STM32\r | |
43 | # include <stm32f4xx.h>\r | |
44 | # define ARM_STM32\r | |
45 | # define ARM_STM32F4XX\r | |
46 | #elif defined(__SDCC_stm8) // STM8\r | |
47 | # define SDCC_STM8\r | |
48 | #elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)\r | |
49 | # define STELLARIS_ARM_CORTEX_M4\r | |
50 | # define F_CPU (SysCtlClockGet())\r | |
51 | #elif defined(__xtensa__)\r | |
52 | # include "ets_sys.h"\r | |
53 | # include "osapi.h"\r | |
54 | # include "gpio.h"\r | |
55 | # include "os_type.h"\r | |
56 | # include "c_types.h" \r | |
57 | # define uint_fast8_t uint8_t\r | |
58 | # define uint_fast16_t uint16_t\r | |
59 | #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 | |
60 | # include <core_pins.h>\r | |
61 | # define TEENSY_ARM_CORTEX_M4\r | |
62 | #elif defined(unix) || defined(WIN32) || defined(__APPLE__) // Unix/Linux or Windows or Apple\r | |
63 | # define UNIX_OR_WINDOWS\r | |
64 | #else\r | |
65 | # define ATMEL_AVR // ATMEL AVR\r | |
66 | #endif\r | |
67 | \r | |
68 | #include <string.h>\r | |
69 | \r | |
70 | #ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows\r | |
71 | # include <stdio.h>\r | |
72 | # include <stdlib.h>\r | |
73 | # define F_CPU 8000000L\r | |
74 | # define ANALYZE\r | |
75 | # ifdef unix\r | |
76 | # include <stdint.h>\r | |
77 | # else\r | |
78 | typedef unsigned char uint8_t;\r | |
79 | typedef unsigned short uint16_t;\r | |
80 | # endif\r | |
81 | #endif\r | |
82 | \r | |
83 | \r | |
84 | #if defined(ATMEL_AVR)\r | |
85 | # include <stdint.h>\r | |
86 | # include <stdio.h>\r | |
87 | # include <avr/io.h>\r | |
88 | # include <util/delay.h>\r | |
89 | # include <avr/pgmspace.h>\r | |
90 | # include <avr/interrupt.h>\r | |
91 | # define IRSND_OC2 0 // OC2\r | |
92 | # define IRSND_OC2A 1 // OC2A\r | |
93 | # define IRSND_OC2B 2 // OC2B\r | |
94 | # define IRSND_OC0 3 // OC0\r | |
95 | # define IRSND_OC0A 4 // OC0A\r | |
96 | # define IRSND_OC0B 5 // OC0B\r | |
97 | \r | |
98 | # define IRSND_XMEGA_OC0A 0 // OC0A\r | |
99 | # define IRSND_XMEGA_OC0B 1 // OC0B\r | |
100 | # define IRSND_XMEGA_OC0C 2 // OC0C\r | |
101 | # define IRSND_XMEGA_OC0D 3 // OC0D\r | |
102 | # define IRSND_XMEGA_OC1A 4 // OC1A\r | |
103 | # define IRSND_XMEGA_OC1B 5 // OC1B\r | |
104 | \r | |
105 | #elif defined(STELLARIS_ARM_CORTEX_M4)\r | |
106 | \r | |
107 | # include "inc/hw_ints.h"\r | |
108 | # include "inc/hw_memmap.h"\r | |
109 | # include "inc/hw_types.h"\r | |
110 | # include "inc/hw_gpio.h"\r | |
111 | # include "driverlib/fpu.h"\r | |
112 | # include "driverlib/sysctl.h"\r | |
113 | # include "driverlib/interrupt.h"\r | |
114 | # include "driverlib/gpio.h"\r | |
115 | # include "driverlib/rom.h"\r | |
116 | # include "driverlib/systick.h"\r | |
117 | # include "driverlib/pin_map.h"\r | |
118 | # include "driverlib/timer.h"\r | |
119 | # define PROGMEM\r | |
120 | # define memcpy_P memcpy\r | |
121 | # define APP_SYSTICKS_PER_SEC 32\r | |
122 | \r | |
123 | #elif defined(ARM_STM32F10X)\r | |
124 | \r | |
125 | # include "stm32f10x_gpio.h"\r | |
126 | # include "stm32f10x_rcc.h"\r | |
127 | # include "stm32f10x_tim.h"\r | |
128 | # include "misc.h"\r | |
129 | # define PROGMEM\r | |
130 | # define memcpy_P memcpy\r | |
131 | \r | |
132 | #elif defined(SDCC_STM8)\r | |
133 | \r | |
134 | # include "stm8s.h"\r | |
135 | # define PROGMEM\r | |
136 | # define memcpy_P memcpy\r | |
137 | # define __attribute__(x)\r | |
138 | # define uint_fast8_t uint8_t\r | |
139 | # define uint_fast16_t uint16_t\r | |
140 | \r | |
141 | #elif defined(TEENSY_ARM_CORTEX_M4)\r | |
142 | # define PROGMEM\r | |
143 | # define memcpy_P memcpy\r | |
144 | \r | |
145 | #else\r | |
146 | # define PROGMEM\r | |
147 | # define memcpy_P memcpy\r | |
148 | \r | |
149 | #endif\r | |
150 | \r | |
151 | #if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32) || defined(STELLARIS_ARM_CORTEX_M4)\r | |
152 | typedef unsigned char uint8_t;\r | |
153 | typedef unsigned short uint16_t;\r | |
154 | #endif\r | |
155 | \r | |
156 | #if defined (PIC_C18) // PIC C18 or XC8 compiler\r | |
157 | # include <p18cxxx.h> // main PIC18 h file\r | |
158 | #ifndef __XC8\r | |
159 | # include <timers.h> // timer lib\r | |
160 | # include <pwm.h> // pwm lib\r | |
161 | #endif\r | |
162 | # define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module\r | |
163 | # define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module\r | |
164 | #endif\r | |
165 | \r | |
166 | #ifndef TRUE\r | |
167 | # define TRUE 1\r | |
168 | # define FALSE 0\r | |
169 | #endif\r | |
170 | \r | |
171 | typedef struct __attribute__ ((__packed__))\r | |
172 | {\r | |
173 | uint8_t protocol; // protocol, e.g. NEC_PROTOCOL\r | |
174 | uint16_t address; // address\r | |
175 | uint16_t command; // command\r | |
176 | uint8_t flags; // flags, e.g. repetition\r | |
177 | } IRMP_DATA;\r | |
178 | \r | |
179 | #endif // _IRMPSYSTEM_H_\r |