]> www.fi.muni.cz Git - heater.git/blobdiff - firmware/main.c
firmware: make sure PWM output pin is zero before suspend
[heater.git] / 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)