Skip to content

Commit

Permalink
zephyr/main: allow to build when CONFIG_MULTITHREADING=n
Browse files Browse the repository at this point in the history
K_sleep() is not available when multithreading is disabled.
Let's use k_busy_wait() in that case.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
  • Loading branch information
nvlsianpu committed May 17, 2021
1 parent 0cf0dbd commit 9b97456
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boot/zephyr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ static bool detect_pin(const char* port, int pin, uint32_t expected, int delay)

if (detect_value == expected) {
if (delay > 0) {
#ifdef CONFIG_MULTITHREADING
k_sleep(K_MSEC(50));
#else
k_busy_wait(50000);
#endif

/* Get the uptime for debounce purposes. */
int64_t timestamp = k_uptime_get();
Expand All @@ -409,7 +413,11 @@ static bool detect_pin(const char* port, int pin, uint32_t expected, int delay)
}

/* Delay 1 ms */
#ifdef CONFIG_MULTITHREADING
k_sleep(K_MSEC(1));
#else
k_busy_wait(1000);
#endif
}
}
}
Expand Down

0 comments on commit 9b97456

Please sign in to comment.