heater.c: set up timer 2 only when present.

This was found by running the new regression tests. ...and seeing
that this is pretty old code, I wonder how Teacup could ever
compile for the Teensy2 guys.
This commit is contained in:
Markus Hitter 2015-07-13 12:56:20 +02:00
parent df451d72fd
commit 5489ddccab
1 changed files with 13 additions and 9 deletions

View File

@ -117,15 +117,17 @@ void heater_init() {
// timer 1 is used for stepping // timer 1 is used for stepping
TCCR2A = MASK(WGM21) | MASK(WGM20); #ifdef TCCR2A
// PWM frequencies in TCCR2B, see page 156 of the ATmega644 reference. TCCR2A = MASK(WGM21) | MASK(WGM20);
TCCR2B = MASK(CS20); // F_CPU / 256 (about 78(62.5) kHz on a 20(16) MHz chip) // PWM frequencies in TCCR2B, see page 156 of the ATmega644 reference.
#ifndef FAST_PWM TCCR2B = MASK(CS20); // F_CPU / 256 (about 78(62.5) kHz on a 20(16) MHz chip)
TCCR2B = MASK(CS20) | MASK(CS21) | MASK(CS22); // F_CPU / 256 / 1024 #ifndef FAST_PWM
#endif TCCR2B = MASK(CS20) | MASK(CS21) | MASK(CS22); // F_CPU / 256 / 1024
TIMSK2 = 0; #endif
OCR2A = 0; TIMSK2 = 0;
OCR2B = 0; OCR2A = 0;
OCR2B = 0;
#endif
#ifdef TCCR3A #ifdef TCCR3A
TCCR3A = MASK(WGM30); TCCR3A = MASK(WGM30);
@ -180,12 +182,14 @@ void heater_init() {
case (uint16_t) &OCR0B: case (uint16_t) &OCR0B:
TCCR0A |= MASK(COM0B1); TCCR0A |= MASK(COM0B1);
break; break;
#ifdef TCCR2A
case (uint16_t) &OCR2A: case (uint16_t) &OCR2A:
TCCR2A |= MASK(COM2A1); TCCR2A |= MASK(COM2A1);
break; break;
case (uint16_t) &OCR2B: case (uint16_t) &OCR2B:
TCCR2A |= MASK(COM2B1); TCCR2A |= MASK(COM2B1);
break; break;
#endif
#ifdef TCCR3A #ifdef TCCR3A
case (uint16_t) &OCR3AL: case (uint16_t) &OCR3AL:
TCCR3A |= MASK(COM3A1); TCCR3A |= MASK(COM3A1);