Update obd2_timer.c, add comment about clearing status register

added reference to datasheet section 13.4
This commit is contained in:
SemvdH
2023-10-27 09:43:01 +02:00
committed by GitHub
parent 4dd618988a
commit 33e7bb7f66

View File

@@ -20,7 +20,9 @@ void obd2_timer_reset()
*/
/* disable interrupts */
RTT->RTT_MR &= ~RTT_MR_ALMIEN;
/* clear the status register */
/* clear the status register (reading it clears it)
SAM3X datasheet section 13.4: Reading the RTT_SR status register resets the RTTINC and ALMS fields.
*/
RTT->RTT_SR;
/* set the alarm value to 0*/
RTT->RTT_AR = 0;
@@ -29,4 +31,4 @@ void obd2_timer_reset()
/* reset the RTT*/
RTT->RTT_MR |= RTT_MR_RTTRST;
}
}