summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/mpconfigport.h3
-rw-r--r--ports/esp32/uart.c10
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);