Use the timer to kick off WMP readings regularly.
This commit is contained in:
13
timer.c
13
timer.c
@@ -58,7 +58,6 @@ void init_timer(void)
|
||||
TWREG(PC) = 0;
|
||||
|
||||
TREG(TCR) = TCR_ENABLE;
|
||||
event_register(EVENT_TIMER, timer_event_handler);
|
||||
}
|
||||
|
||||
unsigned int timer_read(void)
|
||||
@@ -74,9 +73,10 @@ void timer_delay_clocks(unsigned int clocks)
|
||||
|
||||
void timer_set_period(unsigned int period)
|
||||
{
|
||||
interrupt_register(TIMER0, timer_interrupt_handler);
|
||||
TWREG(MR0) = period;
|
||||
TWREG(MCR) = MR0I | MR0R;
|
||||
interrupt_register(TIMER0, timer_interrupt_handler);
|
||||
TWREG(TC) = 0;
|
||||
}
|
||||
|
||||
void __attribute__((interrupt("IRQ"))) timer_interrupt_handler(void)
|
||||
@@ -87,15 +87,8 @@ void __attribute__((interrupt("IRQ"))) timer_interrupt_handler(void)
|
||||
|
||||
if (ir & (1<<0)) {
|
||||
/* Match channel 0 */
|
||||
putstr(" *timer0* ");
|
||||
event_set(EVENT_TIMER);
|
||||
}
|
||||
|
||||
event_set(EVENT_TIMER);
|
||||
|
||||
interrupt_clear();
|
||||
}
|
||||
|
||||
void timer_event_handler(void)
|
||||
{
|
||||
putstr(" *t0event* ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user