IR REMOTE Library port mapping and timer interrupt help

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)

A question. But IR used for sending or receiving ?

The TIMER_PWM_PIN is used only in IRsend::enableIROut, not used when receiving

I need to SEND only

The Tx pins are usually fixed for each timer.

You may be able to customise the code within the library to support the use of OC5C

Another approach could be to set 44 as an input and jumper 46 to 44 (Untested??)