]> www.fi.muni.cz Git - bike-lights.git/commitdiff
make timer faster, sub-1 LSB PWM values need it
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 30 Nov 2012 01:22:58 +0000 (02:22 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 30 Nov 2012 01:22:58 +0000 (02:22 +0100)
otherwise, the step-up blinks with low pwm settings

firmware/tmr.c

index 9a0a38b346b0adc00bb88a4d32e6df12fa0c549b..37b240b5d65245898722036d00f740ad322b1350 100644 (file)
@@ -4,14 +4,14 @@
 #include "lights.h"
 
 volatile uint16_t jiffies;
-#define PATTERN_DIV  // 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;