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