Add TC start

This commit is contained in:
Sem van der Hoeven
2023-10-31 23:15:18 +01:00
parent f4d617e1a3
commit 923e82d0cf
2 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
#include "sam3xa/include/component/component_tc.h"
#include "obd2_timer.h"
void obd2_RTT_init(void)
@@ -47,4 +48,12 @@ void obd2_TC_init()
{
/* enable the timer/counter 0 */
TC0->TC_CHANNEL[0].TC_CCR |= TC_CCR_CLKEN;
/* 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);
}
void obd2_TC_start()
{
/* software trigger the timer reset it and start the clock */
TC0->TC_CHANNEL[0].TC_CCR |= TC_CCR_SWTRG;
}

View File

@@ -16,6 +16,7 @@ void obd2_RTT_enable();
void obd2_RTT_set_period(__UINT32_TYPE__ period);
void obd2_TC_init();
void obd2_TC_start();
#ifdef __cplusplus
}