From: Jan "Yenya" Kasprzak Date: Fri, 30 Nov 2012 01:22:58 +0000 (+0100) Subject: make timer faster, sub-1 LSB PWM values need it X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=commitdiff_plain;h=c4ab80eff676edbc1fd16727f79c17ec5f337d32 make timer faster, sub-1 LSB PWM values need it otherwise, the step-up blinks with low pwm settings --- diff --git a/firmware/tmr.c b/firmware/tmr.c index 9a0a38b..37b240b 100644 --- a/firmware/tmr.c +++ b/firmware/tmr.c @@ -4,14 +4,14 @@ #include "lights.h" volatile uint16_t jiffies; -#define PATTERN_DIV 5 // clk/10 +#define PATTERN_DIV 10 // clk/10 static unsigned char pattern_div; void init_tmr() { TCCR0A = _BV(WGM00); TCCR0B = _BV(CS02) | _BV(CS00); // CLK/1024 = 1 kHz - OCR0A = 10; // 100 Hz + OCR0A = 5; // 200 Hz TIMSK |= _BV(OCIE0A); jiffies = 0;