]> www.fi.muni.cz Git - heater.git/commitdiff
firmware: make sure PWM output pin is zero before suspend
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 1 Feb 2014 21:08:40 +0000 (22:08 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 1 Feb 2014 21:08:40 +0000 (22:08 +0100)
firmware/main.c

index 76bed47f45f1f70895f4abc25bf1f9588ac8b988..4ac8171d16ac03f482409081a76847b7c5659753 100644 (file)
@@ -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)