Skip to content
Permalink
Browse files

use timer makros for prescaler 64 (32768Hz/256/64=2Hz)

  • Loading branch information...
eku authored and eku committed Jan 26, 2011
1 parent 5d9a93d commit ae3ef983b34d45b01d08a52c9209d3ac9dd823d2
Showing with 7 additions and 17 deletions.
  1. +1 −1 services/clock/clock.c
  2. +6 −16 services/clock/clock.h
@@ -61,7 +61,7 @@ clock_init(void)
ASSR = _BV(CLOCK_TIMER_AS);
CLOCK_TIMER_CNT = 0;
/* 64 prescaler to get every 0.5 second an interrupt */
CLOCK_TIMER_TCCR = _BV(CLOCK_SELECT_1) | _BV(CLOCK_SELECT_0);
CLOCK_TIMER_PRESCALER_64;

/* Wait until the bytes are written */
#ifdef CLOCK_TIMER_RBUSY
@@ -32,14 +32,9 @@
#define CLOCK_TIMER_AS AS0
#define CLOCK_INT_OVERFLOW_CLR TC0_INT_OVERFLOW_CLR
#define CLOCK_INT_OVERFLOW_ON TC0_INT_OVERFLOW_ON
#define CLOCK_TIMER_TCCR TCCR0
#define CLOCK_TIMER_CNT TCNT0
#define CLOCK_TIMER_ENABLE TOIE0
#define CLOCK_TIMER_OVERFLOW TOV0
#define CLOCK_SIG _VECTOR_OVERFLOW0
#define CLOCK_SELECT_2 CS02
#define CLOCK_SELECT_1 CS01
#define CLOCK_SELECT_0 CS00
#define CLOCK_TIMER_PRESCALER_64 TC0_PRESCALER_64
#define CLOCK_TIMER_CNT TC0_COUNTER_CURRENT
#define CLOCK_SIG TC0_VECTOR_OVERFLOW
#define CLOCK_TIMER_NBUSY TCN0UB
#define CLOCK_TIMER_RBUSY TCR0UB

@@ -49,14 +44,9 @@
#define CLOCK_TIMER_AS AS2
#define CLOCK_INT_OVERFLOW_CLR TC2_INT_OVERFLOW_CLR
#define CLOCK_INT_OVERFLOW_ON TC2_INT_OVERFLOW_ON
#define CLOCK_TIMER_TCCR _TCCR2_PRESCALE
#define CLOCK_TIMER_CNT TCNT2
#define CLOCK_TIMER_ENABLE TOIE2
#define CLOCK_TIMER_OVERFLOW TOV2
#define CLOCK_SIG _VECTOR_OVERFLOW2
#define CLOCK_SELECT_2 CS22
#define CLOCK_SELECT_1 CS21
#define CLOCK_SELECT_0 CS20
#define CLOCK_TIMER_PRESCALER_64 TC2_PRESCALER_64
#define CLOCK_TIMER_CNT TC2_COUNTER_CURRENT
#define CLOCK_SIG TC2_VECTOR_OVERFLOW
#define CLOCK_TIMER_NBUSY TCN2UB
#ifdef TCR2BUB
# define CLOCK_TIMER_RBUSY TCR2BUB

0 comments on commit ae3ef98

Please sign in to comment.
You can’t perform that action at this time.