|
|
@ -67,7 +67,7 @@ const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = {
|
|
|
|
{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper
|
|
|
|
{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper
|
|
|
|
{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature
|
|
|
|
{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature
|
|
|
|
{ TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3]
|
|
|
|
{ TC1, 2, TC5_IRQn, 0}, // 5 - [servo timer3]
|
|
|
|
{ TC2, 0, TC6_IRQn, 0}, // 6 - tone
|
|
|
|
{ TC2, 0, TC6_IRQn, 15}, // 6 - tone
|
|
|
|
{ TC2, 1, TC7_IRQn, 0}, // 7
|
|
|
|
{ TC2, 1, TC7_IRQn, 0}, // 7
|
|
|
|
{ TC2, 2, TC8_IRQn, 0}, // 8
|
|
|
|
{ TC2, 2, TC8_IRQn, 0}, // 8
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -100,6 +100,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
|
|
|
pmc_enable_periph_clk((uint32_t)irq);
|
|
|
|
pmc_enable_periph_clk((uint32_t)irq);
|
|
|
|
NVIC_SetPriority(irq, TimerConfig [timer_num].priority);
|
|
|
|
NVIC_SetPriority(irq, TimerConfig [timer_num].priority);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wave mode, reset counter on match with RC,
|
|
|
|
TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1);
|
|
|
|
TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1);
|
|
|
|
|
|
|
|
|
|
|
|
TC_SetRC(tc, channel, VARIANT_MCK / 2 / frequency);
|
|
|
|
TC_SetRC(tc, channel, VARIANT_MCK / 2 / frequency);
|
|
|
|