]> cloudbase.mooo.com Git - irmp.git/blob - irmpsystem.h
Version 2.2.3: added support for ATtiny167
[irmp.git] / irmpsystem.h
1 /*---------------------------------------------------------------------------------------------------------------------------------------------------
2 * irmpsystem.h - system specific includes and defines
3 *
4 * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de
5 *
6 * $Id: irmpsystem.h,v 1.6 2012/05/23 14:02:45 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(__PCM__) || defined(__PCB__) || defined(__PCH__) // CCS PIC compiler
25 # define PIC_CCS
26 #elif defined(STM32L1XX_MD) || defined(STM32L1XX_MDP) || defined(STM32L1XX_HD) // ARM STM32
27 # include <stm32l1xx.h>
28 # define ARM_STM32
29 # define ARM_STM32L1XX
30 #elif defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) \
31 || defined(STM32F10X_MD) || defined(STM32F10X_MD_VL) \
32 || defined(STM32F10X_HD) || defined(STM32F10X_HD_VL) \
33 || defined(STM32F10X_XL) || defined(STM32F10X_CL) // ARM STM32
34 # include <stm32f10x.h>
35 # define ARM_STM32
36 # define ARM_STM32F10X
37 #elif defined(STM32F4XX) // ARM STM32
38 # include <stm32f4xx.h>
39 # define ARM_STM32
40 # define ARM_STM32F4XX
41 #elif defined(unix) || defined(WIN32) // Unix/Linux or Windows
42 # define UNIX_OR_WINDOWS
43 #else
44 # define ATMEL_AVR // ATMEL AVR
45 #endif
46
47 #include <string.h>
48
49 #ifdef UNIX_OR_WINDOWS // Analyze on Unix/Linux or Windows
50 # include <stdio.h>
51 # include <stdlib.h>
52 # define F_CPU 8000000L
53 # define ANALYZE
54 # define DEBUG
55 # ifdef unix
56 # include <stdint.h>
57 # else
58 typedef unsigned char uint8_t;
59 typedef unsigned short uint16_t;
60 # endif
61 #endif
62
63
64 #if defined(ATMEL_AVR)
65 # include <stdint.h>
66 # include <stdio.h>
67 # include <avr/io.h>
68 # include <util/delay.h>
69 # include <avr/pgmspace.h>
70 # include <avr/interrupt.h>
71 # define IRSND_OC2 0 // OC2
72 # define IRSND_OC2A 1 // OC2A
73 # define IRSND_OC2B 2 // OC2B
74 # define IRSND_OC0 3 // OC0
75 # define IRSND_OC0A 4 // OC0A
76 # define IRSND_OC0B 5 // OC0B
77 #else
78 # define PROGMEM
79 # define memcpy_P memcpy
80 #endif
81
82 #if defined(PIC_CCS) || defined(PIC_C18) || defined(ARM_STM32)
83 typedef unsigned char uint8_t;
84 typedef unsigned short uint16_t;
85 #endif
86
87 #if defined (PIC_C18)
88 # include <p18cxxx.h> // main PIC18 h file
89 # include <timers.h> // timer lib
90 # include <pwm.h> // pwm lib
91 # define IRSND_PIC_CCP1 1 // PIC C18 RC2 = PWM1 module
92 # define IRSND_PIC_CCP2 2 // PIC C18 RC1 = PWM2 module
93 #endif
94
95 #ifndef TRUE
96 # define TRUE 1
97 # define FALSE 0
98 #endif
99
100 typedef struct
101 {
102 uint8_t protocol; // protocol, i.e. NEC_PROTOCOL
103 uint16_t address; // address
104 uint16_t command; // command
105 uint8_t flags; // flags, e.g. repetition
106 } IRMP_DATA;
107
108 #endif // _IRMPSYSTEM_H_