unix/mpconfigport: Make MICROPY_EVENT_POLL_HOOK call usleep directly.

So that MICROPY_EVENT_POLL_HOOK can be used without including py/mphal.h.

Signed-off-by: Damien George <damien@micropython.org>
pull/8916/head
Damien George 2022-07-15 12:12:57 +10:00
rodzic 18ecc29bb8
commit e30e7ced6f
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -328,7 +328,7 @@ static inline unsigned long mp_urandom_seed_init(void) {
do { \
extern void mp_handle_pending(bool); \
mp_handle_pending(true); \
mp_hal_delay_us(500); \
usleep(500); /* equivalent to mp_hal_delay_us(500) */ \
} while (0);
#include <sched.h>

Wyświetl plik

@ -233,7 +233,7 @@ void mp_hal_delay_ms(mp_uint_t ms) {
#ifdef MICROPY_EVENT_POLL_HOOK
mp_uint_t start = mp_hal_ticks_ms();
while (mp_hal_ticks_ms() - start < ms) {
// MICROPY_EVENT_POLL_HOOK does mp_hal_delay_us(500) (i.e. usleep(500)).
// MICROPY_EVENT_POLL_HOOK does usleep(500).
MICROPY_EVENT_POLL_HOOK
}
#else