16 PMC->PMC_PCER0 |= (1u << ID_TC0);
17 TC0->TC_CHANNEL[0].TC_CMR |= TC_CMR_TCCLKS_TIMER_CLOCK1;
20 TC0->TC_CHANNEL[0].TC_CCR = (TC_CCR_CLKEN | TC_CCR_SWTRG);
25 uint32_t start = TC0->TC_CHANNEL[0].TC_CV;
26 uint32_t end = us * 42u;
29 while ((uint32_t)(TC0->TC_CHANNEL[0].TC_CV - start) < end);
34 uint32_t start = TC0->TC_CHANNEL[0].TC_CV;
35 uint32_t end = ms * 42000u;
38 while ((uint32_t)(TC0->TC_CHANNEL[0].TC_CV - start) < end);
43 WDT->WDT_MR |= WDT_MR_WDDIS;
void tc_delay_ms(uint32_t ms)
Creates a hardware delay in milliseconds.
void tc_delay_us(uint32_t us)
Creates a hardware delay in microseconds.
void tc_init(void)
Initializes TC0->Channel0.
void wdt_disable(void)
Disables SAM3X8E watchdog timer.
HAL interface for timer counter of SAM3X8E.