Allow slow PWM on 10 bit timers.

Another contribution by DaveX, thank you.
http://forums.reprap.org/read.php?147,33082,165415#msg-165415
This commit is contained in:
Markus Hitter 2012-11-11 14:18:55 +01:00
parent fd019f350f
commit be560aaa01
1 changed files with 4 additions and 1 deletions

View File

@ -139,6 +139,9 @@ void heater_init() {
TCCR4C = MASK(PWM4D); // and D TCCR4C = MASK(PWM4D); // and D
TCCR4D = MASK(WGM40); // Phase correct TCCR4D = MASK(WGM40); // Phase correct
TCCR4B = MASK(CS40); // no prescaler TCCR4B = MASK(CS40); // no prescaler
#ifndef FAST_PWM
TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16mhz / 4096 /256
#endif
TC4H = 0; // clear high bits TC4H = 0; // clear high bits
OCR4C = 0xff; // 8 bit max count at top before reset OCR4C = 0xff; // 8 bit max count at top before reset
#else #else
@ -431,7 +434,7 @@ void heater_set(heater_t index, uint8_t value) {
*(heaters[index].heater_pwm) = value; *(heaters[index].heater_pwm) = value;
#ifdef DEBUG #ifdef DEBUG
if (DEBUG_PID && (debug_flags & DEBUG_PID)) if (DEBUG_PID && (debug_flags & DEBUG_PID))
sersendf_P(PSTR("PWM{%u = %u}\n"), index, OCR0A); sersendf_P(PSTR("PWM{%u = %u}\n"), index, *heaters[index].heater_pwm);
#endif #endif
} }
else { else {