#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#include "lights.h"

void init_wdt()
{
	wdt_enable(WDTO_60MS);
	WDTCR |= _BV(WDIE);
}

void susp_wdt()
{
	wdt_disable();
}

ISR(WDT_vect) {
	++jiffies;

	if (jiffies & 0x000F) {
		need_battery_adc = 1; // about every 1s
	}

	patterns_next_tick();
	timer_check_buttons();
}
