X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/fa09ce10c2ae1f28febb317b0c84596423852e28..4d08a2f77cb136eeac9a0ec3bc5caf9fbba94c52:/irsnd.h diff --git a/irsnd.h b/irsnd.h index 5d2abb8..748a4ea 100644 --- a/irsnd.h +++ b/irsnd.h @@ -1,11 +1,9 @@ -/*--------------------------------------------------------------------------------------------------------------------------------------------------- + /*--------------------------------------------------------------------------------------------------------------------------------------------------- * irsnd.h * - * Copyright (c) 2010-2012 Frank Meyer - frank(at)fli4l.de + * Copyright (c) 2010-2016 Frank Meyer - frank(at)fli4l.de * - * $Id: irsnd.h,v 1.14 2012/12/12 15:44:53 fm Exp $ - * - * ATMEGA88 @ 8 MHz + * $Id: irsnd.h,v 1.26 2017/02/17 09:13:07 fm Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,31 +48,46 @@ # endif #elif defined(PIC_C18) -// Do not change lines below until you have a different HW. Example is for 18F2550/18F4550 -// setup macro for PWM used PWM module -# if IRSND_OCx == IRSND_PIC_CCP2 -# define IRSND_PIN TRISCbits.TRISC1 // RC1 = PWM2 -# define SetDCPWM(x) SetDCPWM2(x) -# define ClosePWM ClosePWM2 -# define OpenPWM(x) OpenPWM2(x) -# endif -# if IRSND_OCx == IRSND_PIC_CCP1 -# define IRSND_PIN TRISCbits.TRISC2 // RC2 = PWM1 -# define SetDCPWM(x) SetDCPWM1(x) -# define ClosePWM ClosePWM1 -# define OpenPWM(x) OpenPWM1(x) -# endif -//Setup macro for OpenTimer with defined Pre_Scaler -# if Pre_Scaler == 1 -# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_1); -# elif Pre_Scaler == 4 -# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_4); -# elif Pre_Scaler == 16 -# define OpenTimer OpenTimer2(TIMER_INT_OFF & T2_PS_1_16); -# else -# error Incorrect value for Pre_Scaler -# endif -#endif // ARM_STM32 + +# if defined(__12F1840) + // Do not change lines below unless you have a different HW. This example is for 12F1840 + // setup macro for PWM used PWM module + + //~ # define PWMon() TMR2=0,IRSND_PIN=1 + //~ # define PWMoff() CCP1CON &=(~0b1100) + //~ # define PWMon() TMR2ON=1 + //~ # define PWMoff() TMR2ON=0 + #if defined(IRSND_DEBUG) + #define PWMon() LATA0=1 + #define PWMoff() LATA0=0 + #define IRSND_PIN LATA0 + #else + # define PWMon() TMR2=0,CCP1CON |=0b1100 + # define PWMoff() CCP1CON &=(~0b1100) + # define IRSND_PIN RA2 + #endif + +#else + // Do not change lines below until you have a different HW. Example is for 18F2550/18F4550 + // setup macro for PWM used PWM module + # if IRSND_OCx == IRSND_PIC_CCP2 + # define PWMon() TMR2=0,CCP2CON |=0b1100 + # define PWMoff() CCP2CON &=(~0b1100) + # define IRSND_PIN TRISCbits.TRISC1 // RC1 = PWM2 + # define SetDCPWM(x) SetDCPWM2(x) + # define ClosePWM ClosePWM2 + # define OpenPWM(x) OpenPWM2(x) + # endif + # if IRSND_OCx == IRSND_PIC_CCP1 + # define PWMon() TMR2=0,CCP1CON |=0b1100 + # define PWMoff() CCP1CON &=(~0b1100) + # define IRSND_PIN TRISCbits.TRISC2 // RC2 = PWM1 + # define SetDCPWM(x) SetDCPWM1(x) + # define ClosePWM ClosePWM1 + # define OpenPWM(x) OpenPWM1(x) + # endif +# endif +# endif // PIC_C18 #if IRSND_SUPPORT_SIEMENS_PROTOCOL == 1 && F_INTERRUPTS < 15000 # warning F_INTERRUPTS too low, SIEMENS protocol disabled (should be at least 15000) @@ -88,14 +101,14 @@ # define IRSND_SUPPORT_A1TVBOX_PROTOCOL 0 #endif -#if IRSND_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 20000 -# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 20000) +#if IRSND_SUPPORT_RECS80_PROTOCOL == 1 && F_INTERRUPTS < 15000 +# warning F_INTERRUPTS too low, RECS80 protocol disabled (should be at least 15000) # undef IRSND_SUPPORT_RECS80_PROTOCOL # define IRSND_SUPPORT_RECS80_PROTOCOL 0 #endif -#if IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 20000 -# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 20000) +#if IRSND_SUPPORT_RECS80EXT_PROTOCOL == 1 && F_INTERRUPTS < 15000 +# warning F_INTERRUPTS too low, RECS80EXT protocol disabled (should be at least 15000) # undef IRSND_SUPPORT_RECS80EXT_PROTOCOL # define IRSND_SUPPORT_RECS80EXT_PROTOCOL 0 #endif @@ -113,6 +126,11 @@ #define IRSND_ENDLESS_REPETITION 15 // endless repetions #define IRSND_REPETITION_MASK 0x0F // lower nibble of flags +#ifdef __cplusplus +extern "C" +{ +#endif + extern void irsnd_init (void); extern uint8_t irsnd_is_busy (void); extern uint8_t irsnd_send_data (IRMP_DATA *, uint8_t); @@ -123,4 +141,8 @@ extern uint8_t irsnd_ISR (void); extern void irsnd_set_callback_ptr (void (*cb)(uint8_t)); #endif // IRSND_USE_CALLBACK == 1 +#ifdef __cplusplus +} +#endif + #endif /* _IRSND_H_ */