Skip to content

Commit 94809ce

Browse files
authored
fix: timerRead() is returning the last read value, not the actual #3434 (#5498)
1 parent 29455a0 commit 94809ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: cores/esp32/esp32-hal-timer.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ void ARDUINO_ISR_ATTR __timerISR(void * arg){
119119
}
120120
}
121121

122-
uint64_t timerRead(hw_timer_t *timer){
122+
uint64_t inline timerRead(hw_timer_t *timer){
123123
timer->dev->update = 1;
124+
while (timer->dev->update) {};
124125
uint64_t h = timer->dev->cnt_high;
125126
uint64_t l = timer->dev->cnt_low;
126127
return (h << 32) | l;

0 commit comments

Comments
 (0)