https://www.fi.muni.cz/~kas/git
/
tinyboard.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Experimental step-up driver for chain of 5630 LEDs.
[tinyboard.git]
/
projects
/
step-up
/
wdt.c
1
#include <avr/io.h>
2
#include <avr/interrupt.h>
3
#include <avr/wdt.h>
4
5
#include "lights.h"
6
7
void init_wdt()
8
{
9
WDTCR = _BV(WDIE) | _BV(WDP1); // interrupt mode, 64 ms
10
}
11
12
void susp_wdt()
13
{
14
wdt_disable();
15
}
16
17
ISR(WDT_vect) {
18
++jiffies;
19
20
if (pwm_enabled) {
21
need_pwmled_adc = 1;
22
}
23
24
if (jiffies & 0x000F) {
25
need_battery_adc = 1; // about every 1s
26
}
27
28
patterns_next_tick();
29
timer_check_buttons();
30
if (!adc_enabled)
31
start_next_adc(); // only if not running
32
}