]>
Commit | Line | Data |
---|---|---|
4225a882 | 1 | /*---------------------------------------------------------------------------------------------------------------------------------------------------\r |
2 | * irsnd.h\r | |
3 | *\r | |
08f2dd9d | 4 | * Copyright (c) 2010-2012 Frank Meyer - frank(at)fli4l.de\r |
4225a882 | 5 | *\r |
acd29fb9 | 6 | * $Id: irsnd.h,v 1.13 2012/06/05 12:00:46 fm Exp $\r |
5481e9cd | 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 _IRSND_H_\r |
18 | #define _IRSND_H_\r | |
4225a882 | 19 | \r |
08f2dd9d | 20 | #include "irmpsystem.h"\r |
21 | #ifndef IRSND_USE_AS_LIB\r | |
22 | # include "irsndconfig.h"\r | |
23 | #endif\r | |
9c86ff1a | 24 | \r |
08f2dd9d | 25 | #if defined (ARM_STM32) // STM32\r |
26 | # define _CONCAT(a,b) a##b\r | |
27 | # define CONCAT(a,b) _CONCAT(a,b)\r | |
28 | # define IRSND_PORT CONCAT(GPIO, IRSND_PORT_LETTER)\r | |
29 | # if defined (ARM_STM32L1XX)\r | |
30 | # define IRSND_PORT_RCC CONCAT(RCC_AHBPeriph_GPIO, IRSND_PORT_LETTER)\r | |
31 | # define IRSND_GPIO_AF CONCAT(GPIO_AF_TIM, IRSND_TIMER_NUMBER)\r | |
32 | # elif defined (ARM_STM32F10X)\r | |
33 | # define IRSND_PORT_RCC CONCAT(RCC_APB2Periph_GPIO, IRSND_PORT_LETTER)\r | |
34 | # elif defined (ARM_STM32F4XX)\r | |
35 | # define IRSND_PORT_RCC CONCAT(RCC_AHB1Periph_GPIO, IRSND_PORT_LETTER)\r | |
36 | # define IRSND_GPIO_AF CONCAT(GPIO_AF_TIM, IRSND_TIMER_NUMBER)\r | |
37 | # endif\r | |
38 | # define IRSND_BIT CONCAT(GPIO_Pin_, IRSND_BIT_NUMBER)\r | |
39 | # define IRSND_TIMER CONCAT(TIM, IRSND_TIMER_NUMBER)\r | |
acd29fb9 | 40 | # define IRSND_TIMER_CHANNEL CONCAT(TIM_Channel_, IRSND_TIMER_CHANNEL_NUMBER)\r |
08f2dd9d | 41 | # if ((IRSND_TIMER_NUMBER >= 2) && (IRSND_TIMER_NUMBER <= 5)) || ((IRSND_TIMER_NUMBER >= 12) && (IRSND_TIMER_NUMBER <= 14))\r |
42 | # define IRSND_TIMER_RCC CONCAT(RCC_APB1Periph_TIM, IRSND_TIMER_NUMBER)\r | |
43 | # elif (IRSND_TIMER_NUMBER == 1) || ((IRSND_TIMER_NUMBER >= 8) && (IRSND_TIMER_NUMBER <= 11))\r | |
44 | # define IRSND_TIMER_RCC CONCAT(RCC_APB2Periph_TIM, IRSND_TIMER_NUMBER)\r | |
45 | # else\r | |
46 | # error IRSND_TIMER_NUMBER not valid.\r | |
47 | # endif\r | |
48 | # ifndef USE_STDPERIPH_DRIVER\r | |
49 | # warning The STM32 port of IRSND uses the ST standard peripheral drivers which are not enabled in your build configuration.\r | |
50 | # endif\r | |
beda975f | 51 | \r |
08f2dd9d | 52 | #elif defined(PIC_C18)\r |
53 | // Do not change lines below until you have a different HW. Example is for 18F2550/18F4550\r | |
54 | // setup macro for PWM used PWM module\r | |
55 | # if IRSND_OCx == IRSND_PIC_CCP2 \r | |
56 | # define IRSND_PIN TRISCbits.TRISC1 // RC1 = PWM2\r | |
57 | # define SetDCPWM(x) SetDCPWM2(x) \r | |
58 | # define ClosePWM ClosePWM2\r | |
59 | # define OpenPWM(x) OpenPWM2(x) \r | |
60 | # endif\r | |
61 | # if IRSND_OCx == IRSND_PIC_CCP1 \r | |
62 | # define IRSND_PIN TRISCbits.TRISC2 // RC2 = PWM1\r | |
63 | # define SetDCPWM(x) SetDCPWM1(x)\r | |
64 | # define ClosePWM ClosePWM1\r | |
65 | # define OpenPWM(x) OpenPWM1(x)\r | |
66 | # endif\r | |
67 | //Setup macro for OpenTimer with defined Pre_Scaler\r | |
68 | # if Pre_Scaler == 1\r | |
69 | # define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_1); \r | |
70 | # elif Pre_Scaler == 4\r | |
71 | # define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_4); \r | |
72 | # elif Pre_Scaler == 16\r | |
73 | # define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_16); \r | |
74 | # else\r | |
75 | # error Incorrect value for Pre_Scaler\r | |
76 | # endif\r | |
77 | #endif // ARM_STM32\r | |
4225a882 | 78 | \r |
08f2dd9d | 79 | #if IRSND_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r |
80 | # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r | |
81 | # undef IRSND_SUPPORT_SIEMENS_PROTOCOL\r | |
82 | # define IRSND_SUPPORT_SIEMENS_PROTOCOL 0\r | |
83 | #endif\r | |
4225a882 | 84 | \r |
08f2dd9d | 85 | #if IRSND_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 20000\r |
86 | # warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 20000)\r | |
87 | # undef IRSND_SUPPORT_RECS80_PROTOCOL\r | |
88 | # define IRSND_SUPPORT_RECS80_PROTOCOL 0\r | |
89 | #endif\r | |
4225a882 | 90 | \r |
08f2dd9d | 91 | #if IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 20000\r |
92 | # warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 20000)\r | |
93 | # undef IRSND_SUPPORT_RECS80EXT_PROTOCOL\r | |
94 | # define IRSND_SUPPORT_RECS80EXT_PROTOCOL 0\r | |
95 | #endif\r | |
beda975f | 96 | \r |
08f2dd9d | 97 | #if IRSND_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 IRSND_SUPPORT_LEGO_PROTOCOL\r | |
100 | # define IRSND_SUPPORT_LEGO_PROTOCOL 0\r | |
101 | #endif\r | |
102 | \r | |
103 | #include "irmpprotocols.h"\r | |
104 | \r | |
105 | #define IRSND_NO_REPETITIONS 0 // no repetitions\r | |
106 | #define IRSND_MAX_REPETITIONS 14 // max # of repetitions\r | |
107 | #define IRSND_ENDLESS_REPETITION 15 // endless repetions\r | |
108 | #define IRSND_REPETITION_MASK 0x0F // lower nibble of flags\r | |
109 | \r | |
110 | extern void irsnd_init (void);\r | |
111 | extern uint8_t irsnd_is_busy (void);\r | |
112 | extern uint8_t irsnd_send_data (IRMP_DATA *, uint8_t);\r | |
113 | extern void irsnd_stop (void);\r | |
114 | extern uint8_t irsnd_ISR (void);\r | |
4225a882 | 115 | \r |
f50e01e7 | 116 | #if IRSND_USE_CALLBACK == 1\r |
08f2dd9d | 117 | extern void irsnd_set_callback_ptr (void (*cb)(uint8_t));\r |
f50e01e7 | 118 | #endif // IRSND_USE_CALLBACK == 1\r |
119 | \r | |
08f2dd9d | 120 | #endif /* _IRSND_H_ */\r |