]> cloudbase.mooo.com Git - irmp.git/blame - irmpsystem.h
Version 2.5.6: added logging for ARM_STM32F4XX
[irmp.git] / irmpsystem.h
CommitLineData
08f2dd9d 1/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
2 * irmpsystem.h - system specific includes and defines\r
3 *\r
2ac088b2 4 * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de\r
08f2dd9d 5 *\r
4a7dc859 6 * $Id: irmpsystem.h,v 1.11 2014/07/01 07:50:33 fm Exp $\r
08f2dd9d 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
4a7dc859 24#elif defined(__XC8) // PIC XC8 compiler\r
25# include <xc.h>\r
26# define PIC_C18\r
08f2dd9d 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#elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \\r
34 || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \\r
35 || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \\r
36 || defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32\r
37# include <stm32f10x.h>\r
38# define ARM_STM32\r
39# define ARM_STM32F10X\r
40#elif defined(STM32F4XX) // ARM STM32\r
41# include <stm32f4xx.h>\r
42# define ARM_STM32\r
43# define ARM_STM32F4XX\r
afd1e690 44#elif defined(TARGET_IS_BLIZZARD_RA2) // TI Stellaris (tested on Stellaris Launchpad with Code Composer Studio)\r
45# define STELLARIS_ARM_CORTEX_M4\r
46# define F_CPU (SysCtlClockGet())\r
cb93f9e9 47#elif defined(unix) || defined(WIN32) || defined(__APPLE__) // Unix/Linux or Windows or Apple\r
08f2dd9d 48# define UNIX_OR_WINDOWS\r
49#else\r
50# define ATMEL_AVR // ATMEL AVR\r
51#endif\r
52\r
53#include <string.h>\r
54\r
55#ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows\r
56# include <stdio.h>\r
57# include <stdlib.h>\r
08f2dd9d 58# define F_CPU 8000000L\r
59# define ANALYZE\r
0684a302 60# ifdef unix\r
61# include <stdint.h>\r
62# else\r
63typedef unsigned char uint8_t;\r
64typedef unsigned short uint16_t;\r
65# endif\r
08f2dd9d 66#endif\r
67\r
0684a302 68\r
08f2dd9d 69#if defined(ATMEL_AVR)\r
70# include <stdint.h>\r
71# include <stdio.h>\r
72# include <avr/io.h>\r
73# include <util/delay.h>\r
74# include <avr/pgmspace.h>\r
75# include <avr/interrupt.h>\r
76# define IRSND_OC2 0 // OC2\r
77# define IRSND_OC2A 1 // OC2A\r
78# define IRSND_OC2B 2 // OC2B\r
79# define IRSND_OC0 3 // OC0\r
80# define IRSND_OC0A 4 // OC0A\r
81# define IRSND_OC0B 5 // OC0B\r
afd1e690 82#elif defined(STELLARIS_ARM_CORTEX_M4)\r
83# include "inc/hw_ints.h"\r
84# include "inc/hw_memmap.h"\r
85# include "inc/hw_types.h"\r
86# include "inc/hw_gpio.h"\r
87# include "driverlib/fpu.h"\r
88# include "driverlib/sysctl.h"\r
89# include "driverlib/interrupt.h"\r
90# include "driverlib/gpio.h"\r
91# include "driverlib/rom.h"\r
92# include "driverlib/systick.h"\r
93# include "driverlib/pin_map.h"\r
94# include "driverlib/timer.h"\r
95# define PROGMEM volatile\r
96# define memcpy_P memcpy\r
97# define APP_SYSTICKS_PER_SEC 32\r
08f2dd9d 98#else\r
99# define PROGMEM\r
100# define memcpy_P memcpy\r
101#endif\r
102\r
afd1e690 103#if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32) || defined(STELLARIS_ARM_CORTEX_M4)\r
08f2dd9d 104typedef unsigned char uint8_t;\r
105typedef unsigned short uint16_t;\r
106#endif\r
107\r
4a7dc859 108#if defined (PIC_C18) // PIC C18 or XC8 compiler\r
08f2dd9d 109# include <p18cxxx.h> // main PIC18 h file\r
110# include <timers.h> // timer lib\r
111# include <pwm.h> // pwm lib\r
112# define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module\r
113# define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module\r
114#endif\r
115\r
116#ifndef TRUE\r
117# define TRUE 1\r
118# define FALSE 0\r
119#endif\r
120\r
121typedef struct\r
122{\r
123 uint8_t protocol; // protocol, i.e. NEC_PROTOCOL\r
124 uint16_t address; // address\r
125 uint16_t command; // command\r
126 uint8_t flags; // flags, e.g. repetition\r
127} IRMP_DATA;\r
128\r
129#endif // _IRMPSYSTEM_H_\r