lpc176x: Divide system clock within timer; not on system bus
Scaling the timer on the system bus has a notable impact on performance. So, scale the timer within the timer hardware itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
0079311b0b
commit
8fca908445
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue