diff options
| author | Damien George | 2020-02-07 12:11:22 +1100 |
|---|---|---|
| committer | Damien George | 2020-02-07 16:08:31 +1100 |
| commit | f4641b2378121470747f52bd1eab9219ac933506 (patch) | |
| tree | fd43d2f0fe4132e006653e054603d53bd940cf90 | |
| parent | 8d0421c3cf25e3faae03c936f889a31fd02c3ce7 (diff) | |
esp32/uart: Use core-provided mp_keyboard_interrupt, placed in IRAM.
| -rw-r--r-- | ports/esp32/mpconfigport.h | 3 | ||||
| -rw-r--r-- | ports/esp32/uart.c | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 96e47fbba..bca68538b 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -260,6 +260,9 @@ void *esp_native_code_commit(void*, size_t, void*); } while (0); #endif +// Functions that should go in IRAM +#define MICROPY_WRAP_MP_KEYBOARD_INTERRUPT(f) IRAM_ATTR f + #define UINT_FMT "%u" #define INT_FMT "%d" diff --git a/ports/esp32/uart.c b/ports/esp32/uart.c index 10a4ba462..381be7f4f 100644 --- a/ports/esp32/uart.c +++ b/ports/esp32/uart.c @@ -30,7 +30,7 @@ #include "driver/uart.h" -#include "py/mpstate.h" +#include "py/runtime.h" #include "py/mphal.h" STATIC void uart_irq_handler(void *arg); @@ -50,13 +50,7 @@ STATIC void IRAM_ATTR uart_irq_handler(void *arg) { while (uart->status.rxfifo_cnt) { uint8_t c = uart->fifo.rw_byte; if (c == mp_interrupt_char) { - // inline version of mp_keyboard_interrupt(); - MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)); - #if MICROPY_ENABLE_SCHEDULER - if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) { - MP_STATE_VM(sched_state) = MP_SCHED_PENDING; - } - #endif + mp_keyboard_interrupt(); } else { // this is an inline function so will be in IRAM ringbuf_put(&stdin_ringbuf, c); |
