]> cloudbase.mooo.com Git - irmp.git/blame_incremental - irmp.h
version 2.1.0: corrected denon timing, new source structure
[irmp.git] / irmp.h
... / ...
CommitLineData
1/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
2 * irmp.h\r
3 *\r
4 * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de\r
5 *\r
6 * $Id: irmp.h,v 1.79 2012/05/23 12:26:25 fm Exp $\r
7 *\r
8 * ATMEGA88 @ 8 MHz\r
9 *\r
10 * This program is free software; you can redistribute it and/or modify\r
11 * it under the terms of the GNU General Public License as published by\r
12 * the Free Software Foundation; either version 2 of the License, or\r
13 * (at your option) any later version.\r
14 *---------------------------------------------------------------------------------------------------------------------------------------------------\r
15 */\r
16\r
17#ifndef _IRMP_H_\r
18#define _IRMP_H_\r
19\r
20#include "irmpsystem.h"\r
21\r
22#ifndef IRMP_USE_AS_LIB\r
23# include "irmpconfig.h"\r
24#endif\r
25\r
26#if defined (ATMEL_AVR)\r
27# define _CONCAT(a,b) a##b\r
28# define CONCAT(a,b) _CONCAT(a,b)\r
29# define IRMP_PORT CONCAT(PORT, IRMP_PORT_LETTER)\r
30# define IRMP_DDR CONCAT(DDR, IRMP_PORT_LETTER)\r
31# define IRMP_PIN CONCAT(PIN, IRMP_PORT_LETTER)\r
32# define IRMP_BIT IRMP_BIT_NUMBER\r
33# define input(x) ((x) & (1 << IRMP_BIT))\r
34#elif defined (PIC_C18)\r
35# define input(x) (x)\r
36#elif defined (PIC_CCS)\r
37# define input(x) (x)\r
38#elif defined (ARM_STM32)\r
39# define _CONCAT(a,b) a##b\r
40# define CONCAT(a,b) _CONCAT(a,b)\r
41# define IRMP_PORT CONCAT(GPIO, IRMP_PORT_LETTER)\r
42# if defined (ARM_STM32L1XX)\r
43# define IRMP_PORT_RCC CONCAT(RCC_AHBPeriph_GPIO, IRMP_PORT_LETTER)\r
44# elif defined (ARM_STM32F10X)\r
45# define IRMP_PORT_RCC CONCAT(RCC_APB2Periph_GPIO, IRMP_PORT_LETTER)\r
46# elif defined (ARM_STM32F4XX)\r
47# define IRMP_PORT_RCC CONCAT(RCC_AHB1Periph_GPIO, IRMP_PORT_LETTER)\r
48# endif\r
49# define IRMP_BIT CONCAT(GPIO_Pin_, IRMP_BIT_NUMBER)\r
50# define IRMP_PIN IRMP_PORT // for use with input(x) below\r
51# define input(x) (GPIO_ReadInputDataBit(x, IRMP_BIT))\r
52# ifndef USE_STDPERIPH_DRIVER\r
53# warning The STM32 port of IRMP uses the ST standard peripheral drivers which are not enabled in your build configuration.\r
54# endif\r
55#endif\r
56\r
57#if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
58# warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols\r
59# warning RUWIDO protocol disabled\r
60# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
61# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
62#endif\r
63\r
64#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
65# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
66# undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r
67# define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r
68#endif\r
69\r
70#if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
71# warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r
72# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
73# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
74#endif\r
75\r
76#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
77# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r
78# undef IRMP_SUPPORT_RECS80_PROTOCOL\r
79# define IRMP_SUPPORT_RECS80_PROTOCOL 0\r
80#endif\r
81\r
82#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
83# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r
84# undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r
85# define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r
86#endif\r
87\r
88#if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
89# warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r
90# undef IRMP_SUPPORT_LEGO_PROTOCOL\r
91# define IRMP_SUPPORT_LEGO_PROTOCOL 0\r
92#endif\r
93\r
94#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
95# warning JVC protocol needs also NEC protocol, NEC protocol enabled\r
96# undef IRMP_SUPPORT_NEC_PROTOCOL\r
97# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
98#endif\r
99\r
100#if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
101# warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r
102# undef IRMP_SUPPORT_NEC_PROTOCOL\r
103# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
104#endif\r
105\r
106#if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
107# warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r
108# undef IRMP_SUPPORT_NEC_PROTOCOL\r
109# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
110#endif\r
111\r
112#if F_INTERRUPTS > 20000\r
113#error F_INTERRUPTS too high (should be not greater than 20000)\r
114#endif\r
115\r
116#include "irmpprotocols.h"\r
117\r
118#define IRMP_FLAG_REPETITION 0x01\r
119\r
120extern void irmp_init (void);\r
121extern uint8_t irmp_get_data (IRMP_DATA *);\r
122extern uint8_t irmp_is_busy (void);\r
123extern uint8_t irmp_ISR (void);\r
124\r
125#if IRMP_PROTOCOL_NAMES == 1\r
126extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];\r
127#endif\r
128\r
129#if IRMP_USE_CALLBACK == 1\r
130extern void irmp_set_callback_ptr (void (*cb)(uint8_t));\r
131#endif // IRMP_USE_CALLBACK == 1\r
132\r
133#endif /* _IRMP_H_ */\r