diff options
| author | Angus Gratton <angus@redyak.com.au> | 2023-12-07 10:05:39 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-12-08 12:50:38 +1100 |
| commit | 73879734d9954477607199e92fe945537c3c3745 (patch) | |
| tree | 3d69131cf6ce3992aaee1fd54bfd8ab0d7298d6a /ports/esp8266/uart.c | |
| parent | c393f5c12321a80bea40af7ef2e42a077df5d806 (diff) | |
esp8266: Update port to use new event functions.
This is necessary to avoid watchdog timeout in long i2c.scan(), as
previously machine_i2c.c would call MICROPY_EVENT_POLL_HOOK if
MICROPY_EVENT_POLL_HOOK_FAST was not available.
Compared to previous implementation, this implementation removes the
ets_event_poll() function and calls the SDK function ets_loop_iter() from
MICROPY_INTERNAL_EVENT_HOOK instead. This allows using the port-agnostic
functions in more places.
There is a small behaviour change, which is that the event loop gets
iterated in a few more places (i.e. anywhere that mp_event_handle_nowait()
is called). However, this looks like maybe only modselect.c - and is
probably good to process Wi-Fi events in that polling loop.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'ports/esp8266/uart.c')
| -rw-r--r-- | ports/esp8266/uart.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ports/esp8266/uart.c b/ports/esp8266/uart.c index c0a33acb5..80ae5e617 100644 --- a/ports/esp8266/uart.c +++ b/ports/esp8266/uart.c @@ -18,6 +18,7 @@ #include "c_types.h" #include "user_interface.h" #include "py/mphal.h" +#include "py/runtime.h" // seems that this is missing in the Espressif SDK #define FUNC_U0RXD 0 @@ -218,7 +219,7 @@ bool ICACHE_FLASH_ATTR uart_rx_wait(uint32_t timeout_us) { if (system_get_time() - start >= timeout_us) { return false; // timeout } - ets_event_poll(); + mp_event_handle_nowait(); } } |
