Revision 1b054655 toolbox/led.c

View differences:

toolbox/led.c
1 1
#include "led.h"
2 2
#include <avr/io.h>
3
#include <avr/interrupt.h>
3 4

  
4 5
#define PRESCALE 64
5 6
#define CLOCK_SEL 3
......
31 32
    ms++;
32 33
    if (ms == period) {
33 34
      blink();
34
      if (count = 0) {
35
      if (count == 0) {
35 36
        TCCR0B = 0;
36 37
      }
37 38
      ms = 0;
......
44 45
  ms = 0;
45 46
  error = 0;
46 47
  count = n_times*2-1;
47
  period = period_ms;
48
  period = period_ms/2;
48 49
  OCR0A = OCR;
50
  TIMSK = _BV(OCIE0A);
49 51
  TCCR0A = _BV(WGM01);
50 52
  TCCR0B = CLOCK_SEL;
51 53
}

Also available in: Unified diff