aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lpc176x/timer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lpc176x/timer.c b/src/lpc176x/timer.c
index d8196329..1b966d1c 100644
--- a/src/lpc176x/timer.c
+++ b/src/lpc176x/timer.c
@@ -37,6 +37,9 @@ timer_init(void)
{
// Disable timer
LPC_TIM0->TCR = 0x02;
+ // Setup clock and prescaler (divide sys clock by 4)
+ LPC_SC->PCLKSEL0 = (LPC_SC->PCLKSEL0 & ~(0x3<<2)) | (0x1<<2);
+ LPC_TIM0->PR = 3;
// Enable interrupts
NVIC_SetPriority(TIMER0_IRQn, 2);
NVIC_EnableIRQ(TIMER0_IRQn);