From d0ca6c155dd3f2b04f295bad5845218042dd94ee Mon Sep 17 00:00:00 2001 From: Vasiliy Marnopolskiy Date: Tue, 14 Feb 2012 00:56:34 +0400 Subject: [PATCH] Support board with Atmega8 --- IRremoteInt.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/IRremoteInt.h b/IRremoteInt.h index 751a888..a577b43 100644 --- a/IRremoteInt.h +++ b/IRremoteInt.h @@ -14,7 +14,11 @@ #ifndef IRremoteint_h #define IRremoteint_h +#if defined(ARDUINO) && ARDUINO >= 100 +#include +#else #include +#endif // define which timer to use // @@ -51,6 +55,10 @@ //#define IR_USE_TIMER1 // tx = pin 13 #define IR_USE_TIMER2 // tx = pin 14 +// Atmega8 +#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__) + #define IR_USE_TIMER1 // tx = pin 9 + // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc #else //#define IR_USE_TIMER1 // tx = pin 9 @@ -216,8 +224,13 @@ extern volatile irparams_t irparams; #define TIMER_RESET #define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) #define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) -#define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) -#define TIMER_DISABLE_INTR (TIMSK1 = 0) +#if defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__) + #define TIMER_ENABLE_INTR (TIMSK = _BV(OCIE1A)) + #define TIMER_DISABLE_INTR (TIMSK = 0) +#else + #define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) + #define TIMER_DISABLE_INTR (TIMSK1 = 0) +#endif #define TIMER_INTR_NAME TIMER1_COMPA_vect #define TIMER_CONFIG_KHZ(val) ({ \ const uint16_t pwmval = SYSCLOCK / 2000 / (val); \