]> cloudbase.mooo.com Git - irmp.git/blame - irmp.h
Version 2.3.10: improved ORTEK detection, added ROOMBA protocol
[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
40ca4604 6 * $Id: irmp.h,v 1.82 2013/04/09 11:55:39 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
40ca4604 73#if IRMP_SUPPORT_RC6_PROTOCOL == 1 && IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
74# warning RC6 protocol conflicts wih ROOMBA, please enable only one of both protocols\r
75# warning ROOMBA protocol disabled\r
76# undef IRMP_SUPPORT_ROOMBA_PROTOCOL\r
77# define IRMP_SUPPORT_ROOMBA_PROTOCOL 0\r
78#endif\r
79\r
08f2dd9d 80#if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
81# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
82# undef IRMP_SUPPORT_SIEMENS_PROTOCOL\r
83# define IRMP_SUPPORT_SIEMENS_PROTOCOL 0\r
84#endif\r
9e16d699 85\r
08f2dd9d 86#if IRMP_SUPPORT_RUWIDO_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
87# warning F_INTERRUPTS too low, RUWIDO protocol disabled (should be at least 15000)\r
88# undef IRMP_SUPPORT_RUWIDO_PROTOCOL\r
89# define IRMP_SUPPORT_RUWIDO_PROTOCOL 0\r
90#endif\r
770a1a9d 91\r
08f2dd9d 92#if IRMP_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
93# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r
94# undef IRMP_SUPPORT_RECS80_PROTOCOL\r
95# define IRMP_SUPPORT_RECS80_PROTOCOL 0\r
96#endif\r
9405f84a 97\r
08f2dd9d 98#if IRMP_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
99# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r
100# undef IRMP_SUPPORT_RECS80EXT_PROTOCOL\r
101# define IRMP_SUPPORT_RECS80EXT_PROTOCOL 0\r
102#endif\r
111d6191 103\r
08f2dd9d 104#if IRMP_SUPPORT_LEGO_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
105# warning F_INTERRUPTS too low, LEGO protocol disabled (should be at least 20000)\r
106# undef IRMP_SUPPORT_LEGO_PROTOCOL\r
107# define IRMP_SUPPORT_LEGO_PROTOCOL 0\r
108#endif\r
deba2a0a 109\r
08f2dd9d 110#if IRMP_SUPPORT_JVC_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
111# warning JVC protocol needs also NEC protocol, NEC protocol enabled\r
112# undef IRMP_SUPPORT_NEC_PROTOCOL\r
113# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
114#endif\r
f50e01e7 115\r
08f2dd9d 116#if IRMP_SUPPORT_NEC16_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
117# warning NEC16 protocol needs also NEC protocol, NEC protocol enabled\r
118# undef IRMP_SUPPORT_NEC_PROTOCOL\r
119# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
120#endif\r
beda975f 121\r
08f2dd9d 122#if IRMP_SUPPORT_NEC42_PROTOCOL == 1 && IRMP_SUPPORT_NEC_PROTOCOL == 0\r
123# warning NEC42 protocol needs also NEC protocol, NEC protocol enabled\r
124# undef IRMP_SUPPORT_NEC_PROTOCOL\r
125# define IRMP_SUPPORT_NEC_PROTOCOL 1\r
126#endif\r
4225a882 127\r
08f2dd9d 128#if F_INTERRUPTS > 20000\r
129#error F_INTERRUPTS too high (should be not greater than 20000)\r
130#endif\r
4225a882 131\r
08f2dd9d 132#include "irmpprotocols.h"\r
4225a882 133\r
08f2dd9d 134#define IRMP_FLAG_REPETITION 0x01\r
4225a882 135\r
1f54e86c 136extern void irmp_init (void);\r
137extern uint8_t irmp_get_data (IRMP_DATA *);\r
138extern uint8_t irmp_is_busy (void);\r
139extern uint8_t irmp_ISR (void);\r
4225a882 140\r
1f54e86c 141#if IRMP_PROTOCOL_NAMES == 1\r
142extern char * irmp_protocol_names[IRMP_N_PROTOCOLS + 1];\r
4225a882 143#endif\r
144\r
7644ac04 145#if IRMP_USE_CALLBACK == 1\r
146extern void irmp_set_callback_ptr (void (*cb)(uint8_t));\r
08f2dd9d 147#endif // IRMP_USE_CALLBACK == 1\r
7644ac04 148\r
08f2dd9d 149#endif /* _IRMP_H_ */\r