rework usart RX timings

This commit is contained in:
Philippe Teuwen 2019-05-22 23:30:52 +02:00
commit e0c9e2b0d1
4 changed files with 70 additions and 14 deletions

View file

@ -62,6 +62,13 @@ uint32_t RAMFUNC GetTickCount(void) {
return AT91C_BASE_RTTC->RTTC_RTVR;// was * 2;
}
uint32_t RAMFUNC GetTickCountDelta(uint32_t start_ticks) {
uint32_t stop_ticks = AT91C_BASE_RTTC->RTTC_RTVR;
if (stop_ticks > start_ticks)
return stop_ticks - start_ticks;
return (UINT32_MAX - start_ticks) + stop_ticks;
}
// -------------------------------------------------------------------------
// microseconds timer
// -------------------------------------------------------------------------