ok, here is a list of the parts I have guessed need changing. If any of these is not part of the register or bit references please point it out:
again you can get the .cpp file i am trying to fix from this zip file:
http://arcfn.com/files/IRremote.zipvoid IRsend::mark(int time) {
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
TCCR2A |= _BV(COM2B1); // Enable pin 3 PWM output
delayMicroseconds(time);
I changed only TCCR2A to TCCR0A here
/* Leave pin off for time (given in microseconds) */
void IRsend::space(int time) {
// Sends an IR space for the specified number of microseconds.
// A space is no output, so the PWM output is disabled.
TCCR2A &= ~(_BV(COM2B1)); // Disable pin 3 PWM output
delayMicroseconds(time);
I changed only TCCR2A to TCCR0A here
// Disable the Timer2 Interrupt (which is used for receiving IR)
TIMSK2 &= ~_BV(TOIE2); //Timer2 Overflow Interrupt
I only changed TIMSK2 to TIMSK0 here
// COM2A = 00: disconnect OC2A
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
// WGM2 = 101: phase-correct PWM with OCRA as top
// CS2 = 000: no prescaling
TCCR2A = _BV(WGM20);
TCCR2B = _BV(WGM22) | _BV(CS20);
I changed TCCR2A to TCCR0A and TCCR2B to TCCR0B
// The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
OCR2A = SYSCLOCK / 2 / khz / 1000;
OCR2B = OCR2A / 3; // 33% duty cycle
I changed both 'OCR2A's to OCR0A and OCR2B to OCR0B
// setup pulse clock timer interrupt
TCCR2A = 0; // normal mode
I changed TCCR2A to TCCR0A
//Prescale /8 (16M/8 = 0.5 microseconds per tick)
// Therefore, the timer interval can range from 0.5 to 128 microseconds
// depending on the reset value (255 to 0)
cbi(TCCR2B,CS22);
sbi(TCCR2B,CS21);
cbi(TCCR2B,CS20);
I changed only the 'TCCR2B's to TCCR0B
//Timer2 Overflow Interrupt Enable
sbi(TIMSK2,TOIE2);
RESET_TIMER2;
I changed TIMSK2 to TIMSK0 and RESET_TIMER2 to RESET_TIMER0
ISR(TIMER2_OVF_vect)
{
RESET_TIMER2;
I changed both 'TIMER2's to TIMER0
After doing all of this I Attempted to compile for the attiny85 and got this error:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::mark(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:172:13: error: ‘COM2B1’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::space(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:180:15: error: ‘COM2B1’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::enableIROut(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:3: error: ‘TIMSK0’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:14: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:207:12: error: ‘WGM20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:12: error: ‘WGM22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:25: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRrecv::enableIRIn()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:229:3: error: ‘CS22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:230:3: error: ‘CS21’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:231:3: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TIMSK2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:236:3: error: ‘TCNT2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In function ‘void __vector_5()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:266:3: error: ‘RESET_TIMER0’ was not declared in this scope