Skip to content

Commit 9224720

Browse files
committed
zephyrCommon: Change delayMicroseconds to busy loop
Since Arduino's `delayMicroseconds` is implemented as a busy loop, we change it to using `k_busy_wait` to improve compatibility.
1 parent cf33dbf commit 9224720

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cores/arduino/zephyrCommon.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ void noTone(pin_size_t pinNumber) {
280280

281281
void delay(unsigned long ms) { k_sleep(K_MSEC(ms)); }
282282

283-
void delayMicroseconds(unsigned int us) { k_sleep(K_USEC(us)); }
283+
void delayMicroseconds(unsigned int us) {
284+
k_busy_wait(us);
285+
}
284286

285287
unsigned long micros(void) {
286288
return k_cyc_to_us_floor32(k_cycle_get_32());

0 commit comments

Comments
 (0)