sam3: Add enable_pclock() helper function

Add a helper function to enable peripheral clocks.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2018-12-28 19:00:29 -05:00
parent b4baabe408
commit 4683036f98
10 changed files with 32 additions and 22 deletions

View File

@@ -41,7 +41,7 @@ timer_init(void)
tc->TC_CCR = TC_CCR_CLKDIS;
tc->TC_IDR = 0xFFFFFFFF;
// Enable it
PMC->PMC_PCER0 = 1 << ID_TC0;
enable_pclock(ID_TC0);
tc->TC_CMR = TC_CMR_WAVE | TC_CMR_WAVSEL_UP | TC_CMR_TCCLKS_TIMER_CLOCK1;
tc->TC_IER = TC_IER_CPAS;
NVIC_SetPriority(TC0_IRQn, 1);