Hi All,
I have a problem interfacing an IR led to a custom board with ATmega 2560 , unfortunately I have exposed only pin 44 (OC5C) instead of the defined pin 46 (OC5A) for the 2560 in the standard attached library.
The help I need is to switch the settings of the Timer5 and the related interrupt function from port A to port C in the library to activate pin 44 , here the code:
//---------------------------------------------------------
// Timer5 (16 bits)
//
#elif defined(IR_USE_TIMER5)
#define TIMER_RESET
#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1))
#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1)))
#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A))
#define TIMER_DISABLE_INTR (TIMSK5 = 0)
#define TIMER_INTR_NAME TIMER5_COMPA_vect
#define TIMER_CONFIG_KHZ(val) ({ \
const uint16_t pwmval = SYSCLOCK / 2000 / (val); \
TCCR5A = _BV(WGM51); \
TCCR5B = _BV(WGM53) | _BV(CS50); \
ICR5 = pwmval; \
OCR5A = pwmval / 3; \
})
#define TIMER_CONFIG_NORMAL() ({ \
TCCR5A = 0; \
TCCR5B = _BV(WGM52) | _BV(CS50); \
OCR5A = SYSCLOCK * USECPERTICK / 1000000; \
TCNT5 = 0; \
})
//-----------------
#if defined(CORE_OC5A_PIN)
# define TIMER_PWM_PIN CORE_OC5A_PIN
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
# define TIMER_PWM_PIN 46 // Arduino Mega
#else
# error "Please add OC5A pin number here\n"
#endif
//---------------------------------------------------------
Thanks for any help in advanced
Flavio
Arduino-IRremote-master.zip (73.6 KB)