]> cloudbase.mooo.com Git - irmp.git/blob - irmpsystem.h
Version 2.6.7: corrected minor bug: missing newline before #else
[irmp.git] / irmpsystem.h
1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmpsystem.h - system specific includes and defines
3 *
4 * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de
5 *
6 * $Id: irmpsystem.h,v 1.14 2014/09/15 10:27:38 fm Exp $
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *---------------------------------------------------------------------------------------------------------------------------------------------------
13 */
14
15 #ifndef _IRMPSYSTEM_H_
16 #define _IRMPSYSTEM_H_
17
18 #if !defined(_IRMP_H_) && !defined(_IRSND_H_)
19 # error please include only irmp.h or irsnd.h, not irmpsystem.h
20 #endif
21
22 #if defined(__18CXX) // Microchip PIC C18 compiler
23 # define PIC_C18
24 #elif defined(__XC8) // PIC XC8 compiler
25 # include <xc.h>
26 # define PIC_C18
27 #elif defined(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC compiler
28 # define PIC_CCS
29 #elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32
30 # include <stm32l1xx.h>
31 # define ARM_STM32
32 # define ARM_STM32L1XX
33 #elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \
34 || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \
35 || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \
36 || defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32
37 # include <stm32f10x.h>
38 # define ARM_STM32
39 # define ARM_STM32F10X
40 # define F_CPU (SysCtlClockGet())
41 #elif defined(STM32F4XX) // ARM STM32
42 # include <stm32f4xx.h>
43 # define ARM_STM32
44 # define ARM_STM32F4XX
45 #elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)
46 # define STELLARIS_ARM_CORTEX_M4
47 # define F_CPU (SysCtlClockGet())
48 #elif defined(unix) || defined(WIN32) || defined(__APPLE__) // Unix/Linux or Windows or Apple
49 # define UNIX_OR_WINDOWS
50 #else
51 # define ATMEL_AVR // ATMEL AVR
52 #endif
53
54 #include <string.h>
55
56 #ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows
57 # include <stdio.h>
58 # include <stdlib.h>
59 # define F_CPU 8000000L
60 # define ANALYZE
61 # ifdef unix
62 # include <stdint.h>
63 # else
64 typedef unsigned char uint8_t;
65 typedef unsigned short uint16_t;
66 # endif
67 #endif
68
69
70 #if defined(ATMEL_AVR)
71 # include <stdint.h>
72 # include <stdio.h>
73 # include <avr/io.h>
74 # include <util/delay.h>
75 # include <avr/pgmspace.h>
76 # include <avr/interrupt.h>
77 # define IRSND_OC2 0 // OC2
78 # define IRSND_OC2A 1 // OC2A
79 # define IRSND_OC2B 2 // OC2B
80 # define IRSND_OC0 3 // OC0
81 # define IRSND_OC0A 4 // OC0A
82 # define IRSND_OC0B 5 // OC0B
83 #elif defined(STELLARIS_ARM_CORTEX_M4)
84 # include "inc/hw_ints.h"
85 # include "inc/hw_memmap.h"
86 # include "inc/hw_types.h"
87 # include "inc/hw_gpio.h"
88 # include "driverlib/fpu.h"
89 # include "driverlib/sysctl.h"
90 # include "driverlib/interrupt.h"
91 # include "driverlib/gpio.h"
92 # include "driverlib/rom.h"
93 # include "driverlib/systick.h"
94 # include "driverlib/pin_map.h"
95 # include "driverlib/timer.h"
96 # define PROGMEM volatile
97 # define memcpy_P memcpy
98 # define APP_SYSTICKS_PER_SEC 32
99 #elif defined(ARM_STM32F10X)
100 # include "stm32f10x_gpio.h"
101 # include "stm32f10x_rcc.h"
102 # include "stm32f10x_tim.h"
103 # include "misc.h"
104 # define PROGMEM
105 # define memcpy_P memcpy
106 #else
107 # define PROGMEM
108 # define memcpy_P memcpy
109 #endif
110
111 #if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32) || defined(STELLARIS_ARM_CORTEX_M4)
112 typedef unsigned char uint8_t;
113 typedef unsigned short uint16_t;
114 #endif
115
116 #if defined (PIC_C18) // PIC C18 or XC8 compiler
117 # include <p18cxxx.h> // main PIC18 h file
118 #ifndef __XC8
119 # include <timers.h> // timer lib
120 # include <pwm.h> // pwm lib
121 #endif
122 # define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module
123 # define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module
124 #endif
125
126 #ifndef TRUE
127 # define TRUE 1
128 # define FALSE 0
129 #endif
130
131 typedef struct
132 {
133 uint8_t protocol; // protocol, i.e. NEC_PROTOCOL
134 uint16_t address; // address
135 uint16_t command; // command
136 uint8_t flags; // flags, e.g. repetition
137 } IRMP_DATA;
138
139 #endif // _IRMPSYSTEM_H_