From be560aaa01bcb4615712694d39c31a1ebdc4acb9 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 11 Nov 2012 14:18:55 +0100 Subject: [PATCH] Allow slow PWM on 10 bit timers. Another contribution by DaveX, thank you. http://forums.reprap.org/read.php?147,33082,165415#msg-165415 --- heater.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/heater.c b/heater.c index f96e9f1..df03488 100644 --- a/heater.c +++ b/heater.c @@ -139,6 +139,9 @@ void heater_init() { TCCR4C = MASK(PWM4D); // and D TCCR4D = MASK(WGM40); // Phase correct TCCR4B = MASK(CS40); // no prescaler + #ifndef FAST_PWM + TCCR4B = MASK(CS40) | MASK(CS42) | MASK(CS43); // 16mhz / 4096 /256 + #endif TC4H = 0; // clear high bits OCR4C = 0xff; // 8 bit max count at top before reset #else @@ -431,7 +434,7 @@ void heater_set(heater_t index, uint8_t value) { *(heaters[index].heater_pwm) = value; #ifdef DEBUG 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 } else {