From 45d4a7a89883c3433604d4e011b665796a583008 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 29 Oct 2010 15:17:18 +0900 Subject: improve layer switching --- timer.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 timer.c (limited to 'timer.c') diff --git a/timer.c b/timer.c new file mode 100644 index 000000000..23663042c --- /dev/null +++ b/timer.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include "timer.h" + +uint16_t timer_count = 0; + +// Configure timer 0 to generate a timer overflow interrupt every +// 256*1024 clock cycles, or approx 61 Hz when using 16 MHz clock +// This demonstrates how to use interrupts to implement a simple +// inactivity timeout. +void timer_init(void) +{ + TCCR0A = 0x00; + TCCR0B = 0x05; + TIMSK0 = (1<