From: Jan "Yenya" Kasprzak Date: Sat, 1 Feb 2014 21:08:40 +0000 (+0100) Subject: firmware: make sure PWM output pin is zero before suspend X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=heater.git;a=commitdiff_plain;h=b30695c8b29227d4de4624940982d94899e8a348;hp=d3b9a34d6b153bd04e7d233c2e2bbcecc70a6fa5 firmware: make sure PWM output pin is zero before suspend --- diff --git a/firmware/main.c b/firmware/main.c index 76bed47..4ac8171 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -179,6 +179,7 @@ static void pwm_init() power_timer1_enable(); DDRB |= _BV(PB4); + PORTB &= ~_BV(PB4); // TCCR1 = _BV(CS10); // clk/1 = 1 MHz TCCR1 = _BV(CS11) | _BV(CS13); // clk/512 = 2 kHz @@ -192,6 +193,9 @@ static void pwm_init() static void pwm_susp() { TCCR1 = 0; + TIMSK = 0; + GTCCR = 0; + PORTB &= ~_BV(PB4); } ISR(TIM1_OVF_vect)