diff options
author | Damien George <damien.p.george@gmail.com> | 2016-12-15 13:35:54 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-12-15 13:35:54 +1100 |
commit | d89cafd5c30be57db99cbf10993bca00d9f523fb (patch) | |
tree | 0edf71dff60050cc09ff5e0f604aff539ecfb517 | |
parent | 7f1da0a03b1559080ca4d054bd38f104bde168e6 (diff) | |
download | micropython-d89cafd5c30be57db99cbf10993bca00d9f523fb.tar.gz micropython-d89cafd5c30be57db99cbf10993bca00d9f523fb.zip |
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.
-rw-r--r-- | lib/utils/interrupt_char.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c index 3133d5c068..ab4efd9113 100644 --- a/lib/utils/interrupt_char.c +++ b/lib/utils/interrupt_char.c @@ -31,11 +31,19 @@ int mp_interrupt_char; void mp_hal_set_interrupt_char(int c) { if (c != -1) { + #if MICROPY_KBD_EXCEPTION + mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))); + #else mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception)); + #endif } mp_interrupt_char = c; } void mp_keyboard_interrupt(void) { + #if MICROPY_KBD_EXCEPTION + MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)); + #else MP_STATE_VM(mp_pending_exception) = MP_STATE_PORT(mp_kbd_exception); + #endif } |