Skip to content

Commit d89cafd

Browse files
committed
lib/utils/interrupt_char: Use core-provided mp_kbd_exception if enabled.
Ultimately all ports that use lib/utils/interrupt_char would enable MICROPY_KBD_EXCEPTION, so this is an interim solution.
1 parent 7f1da0a commit d89cafd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/utils/interrupt_char.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@ int mp_interrupt_char;
3131

3232
void mp_hal_set_interrupt_char(int c) {
3333
if (c != -1) {
34+
#if MICROPY_KBD_EXCEPTION
35+
mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
36+
#else
3437
mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception));
38+
#endif
3539
}
3640
mp_interrupt_char = c;
3741
}
3842

3943
void mp_keyboard_interrupt(void) {
44+
#if MICROPY_KBD_EXCEPTION
45+
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
46+
#else
4047
MP_STATE_VM(mp_pending_exception) = MP_STATE_PORT(mp_kbd_exception);
48+
#endif
4149
}

0 commit comments

Comments
 (0)