Skip to content

Commit a2af9e3

Browse files
committed
Support board with Atmega8
1 parent fb741e9 commit a2af9e3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

IRremoteInt.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
#ifndef IRremoteint_h
1515
#define IRremoteint_h
1616

17+
#if defined(ARDUINO) && ARDUINO >= 100
18+
#include <Arduino.h>
19+
#else
1720
#include <WProgram.h>
21+
#endif
1822

1923
// define which timer to use
2024
//
@@ -51,6 +55,10 @@
5155
//#define IR_USE_TIMER1 // tx = pin 13
5256
#define IR_USE_TIMER2 // tx = pin 14
5357

58+
// Atmega8
59+
#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__)
60+
#define IR_USE_TIMER1 // tx = pin 9
61+
5462
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc
5563
#else
5664
//#define IR_USE_TIMER1 // tx = pin 9
@@ -216,8 +224,13 @@ extern volatile irparams_t irparams;
216224
#define TIMER_RESET
217225
#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1))
218226
#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1)))
219-
#define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A))
220-
#define TIMER_DISABLE_INTR (TIMSK1 = 0)
227+
#if defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__)
228+
#define TIMER_ENABLE_INTR (TIMSK = _BV(OCIE1A))
229+
#define TIMER_DISABLE_INTR (TIMSK = 0)
230+
#else
231+
#define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A))
232+
#define TIMER_DISABLE_INTR (TIMSK1 = 0)
233+
#endif
221234
#define TIMER_INTR_NAME TIMER1_COMPA_vect
222235
#define TIMER_CONFIG_KHZ(val) ({ \
223236
const uint16_t pwmval = SYSCLOCK / 2000 / (val); \

0 commit comments

Comments
 (0)