use duetimer and fix bug where if the next state is the same the exit function would still get called

This commit is contained in:
Sem van der Hoeven
2023-11-23 23:39:44 +01:00
parent 796a8938c3
commit b4067c8379
3 changed files with 25 additions and 47 deletions

View File

@@ -60,9 +60,7 @@ void obd2_TC_init()
TC0->TC_CHANNEL[0].TC_IDR = 0xFFFFFFFF;
/* Clear status register by reading it*/
TC0->TC_CHANNEL[0].TC_SR;
/* disable the quadrature decoder, to route the IO pins of TIOA and TIOB directly to the timer counter function (36.6.14.1) */
// TC0->TC_BMR &= ~(TC_BMR_QDEN);
/* Set wave mode to UP mode with automatic trigger, select wave mode, set the clock to MCK / 2*/
TC0->TC_CHANNEL[0].TC_CMR = TC_CMR_WAVSEL_UP_RC | TC_CMR_WAVE | TC_CMR_TCCLKS_TIMER_CLOCK1;
/* Enable the RC Compare interrupt*/