Commit a90896ea authored by Sven Greiner's avatar Sven Greiner
Browse files

Fix zero PWM bug with fast PWM

As the datasheet tells us, fast PWM cannot reach zero duty cycle.

D'oh!
parent c3f761a8
......@@ -107,6 +107,11 @@ void delay_ms(uint16_t duration) {
*/
static inline void set_pwm(uint8_t pwm) {
OCR0B = pwm;
if (!pwm) {
TCCR0A &= ~(1 << COM0B1);
} else {
TCCR0A |= (1 << COM0B1);
}
}
/**
......@@ -142,7 +147,7 @@ void blink(uint8_t count, uint16_t speed) {
delay_ms(speed);
delay_ms(speed);
}
OCR0B = old_pwm;
set_pwm(old_pwm);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment