Skip to content

Commit 22ae8fc

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. Signed-off-by: TOKITA Hiroshi <[email protected]>
1 parent 211d5dc commit 22ae8fc

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
@@ -259,7 +259,9 @@ void noTone(pin_size_t pinNumber) {
259259

260260
void delay(unsigned long ms) { k_sleep(K_MSEC(ms)); }
261261

262-
void delayMicroseconds(unsigned int us) { k_sleep(K_USEC(us)); }
262+
void delayMicroseconds(unsigned int us) {
263+
k_busy_wait(us);
264+
}
263265

264266
unsigned long micros(void) {
265267
return k_cyc_to_us_floor32(k_cycle_get_32());

0 commit comments

Comments
 (0)