-/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
* irsnd.h\r
*\r
- * Copyright (c) 2010-2012 Frank Meyer - frank(at)fli4l.de\r
+ * Copyright (c) 2010-2015 Frank Meyer - frank(at)fli4l.de\r
*\r
- * $Id: irsnd.h,v 1.12 2012/05/23 12:26:26 fm Exp $\r
- *\r
- * ATMEGA88 @ 8 MHz\r
+ * $Id: irsnd.h,v 1.23 2015/11/18 08:27:50 fm Exp $\r
*\r
* This program is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
# endif\r
# define IRSND_BIT CONCAT(GPIO_Pin_, IRSND_BIT_NUMBER)\r
# define IRSND_TIMER CONCAT(TIM, IRSND_TIMER_NUMBER)\r
+# define IRSND_TIMER_CHANNEL CONCAT(TIM_Channel_, IRSND_TIMER_CHANNEL_NUMBER)\r
# if ((IRSND_TIMER_NUMBER >= 2) && (IRSND_TIMER_NUMBER <= 5)) || ((IRSND_TIMER_NUMBER >= 12) && (IRSND_TIMER_NUMBER <= 14))\r
# define IRSND_TIMER_RCC CONCAT(RCC_APB1Periph_TIM, IRSND_TIMER_NUMBER)\r
# elif (IRSND_TIMER_NUMBER == 1) || ((IRSND_TIMER_NUMBER >= 8) && (IRSND_TIMER_NUMBER <= 11))\r
# endif\r
\r
#elif defined(PIC_C18)\r
-// Do not change lines below until you have a different HW. Example is for 18F2550/18F4550\r
-// setup macro for PWM used PWM module\r
-# if IRSND_OCx == IRSND_PIC_CCP2 \r
-# define IRSND_PIN TRISCbits.TRISC1 // RC1 = PWM2\r
-# define SetDCPWM(x) SetDCPWM2(x) \r
-# define ClosePWM ClosePWM2\r
-# define OpenPWM(x) OpenPWM2(x) \r
-# endif\r
-# if IRSND_OCx == IRSND_PIC_CCP1 \r
-# define IRSND_PIN TRISCbits.TRISC2 // RC2 = PWM1\r
-# define SetDCPWM(x) SetDCPWM1(x)\r
-# define ClosePWM ClosePWM1\r
-# define OpenPWM(x) OpenPWM1(x)\r
-# endif\r
-//Setup macro for OpenTimer with defined Pre_Scaler\r
-# if Pre_Scaler == 1\r
-# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_1); \r
-# elif Pre_Scaler == 4\r
-# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_4); \r
-# elif Pre_Scaler == 16\r
-# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_16); \r
-# else\r
-# error Incorrect value for Pre_Scaler\r
-# endif\r
-#endif // ARM_STM32\r
+\r
+# if defined(__12F1840)\r
+ // Do not change lines below unless you have a different HW. This example is for 12F1840\r
+ // setup macro for PWM used PWM module\r
+ \r
+ //~ # define PWMon() TMR2=0,IRSND_PIN=1\r
+ //~ # define PWMoff() CCP1CON &=(~0b1100)\r
+ //~ # define PWMon() TMR2ON=1\r
+ //~ # define PWMoff() TMR2ON=0\r
+ #if defined(IRSND_DEBUG) \r
+ #define PWMon() LATA0=1\r
+ #define PWMoff() LATA0=0\r
+ #define IRSND_PIN LATA0\r
+ #else\r
+ # define PWMon() TMR2=0,CCP1CON |=0b1100\r
+ # define PWMoff() CCP1CON &=(~0b1100)\r
+ # define IRSND_PIN RA2\r
+ #endif\r
+\r
+#else\r
+ // Do not change lines below until you have a different HW. Example is for 18F2550/18F4550\r
+ // setup macro for PWM used PWM module\r
+ # if IRSND_OCx == IRSND_PIC_CCP2 \r
+ # define PWMon() TMR2=0,CCP2CON |=0b1100\r
+ # define PWMoff() CCP2CON &=(~0b1100)\r
+ # define IRSND_PIN TRISCbits.TRISC1 // RC1 = PWM2\r
+ # define SetDCPWM(x) SetDCPWM2(x) \r
+ # define ClosePWM ClosePWM2\r
+ # define OpenPWM(x) OpenPWM2(x) \r
+ # endif\r
+ # if IRSND_OCx == IRSND_PIC_CCP1 \r
+ # define PWMon() TMR2=0,CCP1CON |=0b1100\r
+ # define PWMoff() CCP1CON &=(~0b1100)\r
+ # define IRSND_PIN TRISCbits.TRISC2 // RC2 = PWM1\r
+ # define SetDCPWM(x) SetDCPWM1(x)\r
+ # define ClosePWM ClosePWM1\r
+ # define OpenPWM(x) OpenPWM1(x)\r
+ # endif \r
+# endif\r
+# endif // PIC_C18\r
\r
#if IRSND_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
# warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000)\r
# define IRSND_SUPPORT_SIEMENS_PROTOCOL 0\r
#endif\r
\r
-#if IRSND_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
-# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 20000)\r
+#if IRSND_SUPPORT_A1TVBOX_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
+# warning F_INTERRUPTS too low, A1TVBOX protocol disabled (should be at least 15000)\r
+# undef IRSND_SUPPORT_A1TVBOX_PROTOCOL\r
+# define IRSND_SUPPORT_A1TVBOX_PROTOCOL 0\r
+#endif\r
+\r
+#if IRSND_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
+# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000)\r
# undef IRSND_SUPPORT_RECS80_PROTOCOL\r
# define IRSND_SUPPORT_RECS80_PROTOCOL 0\r
#endif\r
\r
-#if IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 20000\r
-# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 20000)\r
+#if IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000\r
+# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000)\r
# undef IRSND_SUPPORT_RECS80EXT_PROTOCOL\r
# define IRSND_SUPPORT_RECS80EXT_PROTOCOL 0\r
#endif\r
#define IRSND_ENDLESS_REPETITION 15 // endless repetions\r
#define IRSND_REPETITION_MASK 0x0F // lower nibble of flags\r
\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
extern void irsnd_init (void);\r
extern uint8_t irsnd_is_busy (void);\r
extern uint8_t irsnd_send_data (IRMP_DATA *, uint8_t);\r
extern void irsnd_set_callback_ptr (void (*cb)(uint8_t));\r
#endif // IRSND_USE_CALLBACK == 1\r
\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
#endif /* _IRSND_H_ */\r