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