fix: timerRead() is returning the last read value, not the actual #3434 (#5498)

This commit is contained in:
Lori 2021-08-23 16:19:37 +02:00 committed by GitHub
parent 29455a0447
commit 94809ce38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,8 +119,9 @@ void ARDUINO_ISR_ATTR __timerISR(void * arg){
} }
} }
uint64_t timerRead(hw_timer_t *timer){ uint64_t inline timerRead(hw_timer_t *timer){
timer->dev->update = 1; timer->dev->update = 1;
while (timer->dev->update) {};
uint64_t h = timer->dev->cnt_high; uint64_t h = timer->dev->cnt_high;
uint64_t l = timer->dev->cnt_low; uint64_t l = timer->dev->cnt_low;
return (h << 32) | l; return (h << 32) | l;