]> cloudbase.mooo.com Git - irmp.git/blame - irmp.h
Version 2.3.6: corrected detection of inverted Denon frames
[irmp.git] / irmp.h
CommitLineData
4225a882 1/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
2 * irmp.h\r
3 *\r
2ac088b2 4 * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de\r
4225a882 5 *\r
2ac088b2 6 * $Id: irmp.h,v 1.81 2013/01/17 07:33:13 fm Exp $\r
cb8474cc 7 *\r
4225a882 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
08f2dd9d 17#ifndef _IRMP_H_\r
18#define _IRMP_H_\r
4225a882 19\r
08f2dd9d 20#include "irmpsystem.h"\r
93ba2e01 21\r
08f2dd9d 22#ifndef IRMP_USE_AS_LIB\r
23# include "irmpconfig.h"\r
9405f84a 24#endif\r
c7a47e89 25\r
08f2dd9d 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
afd1e690 55#elif defined (STELLARIS_ARM_CORTEX_M4)\r
56# define _CONCAT(a,b) a##b\r
57# define CONCAT(a,b) _CONCAT(a,b)\r
58# define IRMP_PORT_PERIPH CONCAT(SYSCTL_PERIPH_GPIO, IRMP_PORT_LETTER)\r
59# define IRMP_PORT_BASE CONCAT(GPIO_PORT, CONCAT(IRMP_PORT_LETTER, _BASE))\r
60# define IRMP_PORT_PIN CONCAT(GPIO_PIN_, IRMP_BIT_NUMBER)\r
61# define IRMP_PIN IRMP_PORT_PIN\r
62# define input(x) ((uint8_t)(ROM_GPIOPinRead(IRMP_PORT_BASE, IRMP_PORT_PIN)))\r
63# define sei() IntMasterEnable()\r
08f2dd9d 64#endif\r
a7054daf 65\r
08f2dd9d 66#if IRMP_SUPPORT_DENON_PROTOCOL == 1 && IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
67# warning DENON protocol conflicts wih RUWIDO, please enable only one of both protocols\r
68# warning RUWIDO protocol disabled\r
69# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
70# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
71#endif\r
b5ea7869 72\r
08f2dd9d 73#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
74# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
75# undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r
76# define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r
77#endif\r
9e16d699 78\r
08f2dd9d 79#if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
80# warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r
81# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
82# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
83#endif\r
770a1a9d 84\r
08f2dd9d 85#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
86# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r
87# undef IRMP_SUPPORT_RECS80_PROTOCOL\r
88# define IRMP_SUPPORT_RECS80_PROTOCOL 0\r
89#endif\r
9405f84a 90\r
08f2dd9d 91#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
92# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r
93# undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r
94# define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r
95#endif\r
111d6191 96\r
08f2dd9d 97#if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
98# warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r
99# undef IRMP_SUPPORT_LEGO_PROTOCOL\r
100# define IRMP_SUPPORT_LEGO_PROTOCOL 0\r
101#endif\r
deba2a0a 102\r
08f2dd9d 103#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
104# warning JVC protocol needs also NEC protocol, NEC protocol enabled\r
105# undef IRMP_SUPPORT_NEC_PROTOCOL\r
106# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
107#endif\r
f50e01e7 108\r
08f2dd9d 109#if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
110# warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r
111# undef IRMP_SUPPORT_NEC_PROTOCOL\r
112# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
113#endif\r
beda975f 114\r
08f2dd9d 115#if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
116# warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r
117# undef IRMP_SUPPORT_NEC_PROTOCOL\r
118# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
119#endif\r
4225a882 120\r
08f2dd9d 121#if F_INTERRUPTS > 20000\r
122#error F_INTERRUPTS too high (should be not greater than 20000)\r
123#endif\r
4225a882 124\r
08f2dd9d 125#include "irmpprotocols.h"\r
4225a882 126\r
08f2dd9d 127#define IRMP_FLAG_REPETITION 0x01\r
4225a882 128\r
1f54e86c 129extern void irmp_init (void);\r
130extern uint8_t irmp_get_data (IRMP_DATA *);\r
131extern uint8_t irmp_is_busy (void);\r
132extern uint8_t irmp_ISR (void);\r
4225a882 133\r
1f54e86c 134#if IRMP_PROTOCOL_NAMES == 1\r
135extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];\r
4225a882 136#endif\r
137\r
7644ac04 138#if IRMP_USE_CALLBACK == 1\r
139extern void irmp_set_callback_ptr (void (*cb)(uint8_t));\r
08f2dd9d 140#endif // IRMP_USE_CALLBACK == 1\r
7644ac04 141\r
08f2dd9d 142#endif /* _IRMP_H_ */\r