Commit a770ba14 authored by Damien George's avatar Damien George
Browse files

stmhal: Use core-provided keyboard exception object.

parent d89cafd5
...@@ -438,7 +438,6 @@ soft_reset: ...@@ -438,7 +438,6 @@ soft_reset:
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash));
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
mp_obj_list_init(mp_sys_argv, 0); mp_obj_list_init(mp_sys_argv, 0);
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
// Initialise low-level sub-systems. Here we need to very basic things like // Initialise low-level sub-systems. Here we need to very basic things like
// zeroing out memory and resetting any of the sub-systems. Following this // zeroing out memory and resetting any of the sub-systems. Following this
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_STACK_CHECK (1) #define MICROPY_STACK_CHECK (1)
#define MICROPY_KBD_EXCEPTION (1)
#define MICROPY_HELPER_REPL (1) #define MICROPY_HELPER_REPL (1)
#define MICROPY_REPL_EMACS_KEYS (1) #define MICROPY_REPL_EMACS_KEYS (1)
#define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_REPL_AUTO_INDENT (1)
...@@ -208,7 +209,6 @@ extern const struct _mp_obj_module_t mp_module_network; ...@@ -208,7 +209,6 @@ extern const struct _mp_obj_module_t mp_module_network;
#define MICROPY_PORT_ROOT_POINTERS \ #define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \ const char *readline_hist[8]; \
\ \
mp_obj_t mp_kbd_exception; \
mp_obj_t pyb_hid_report_desc; \ mp_obj_t pyb_hid_report_desc; \
\ \
mp_obj_t pyb_config_main; \ mp_obj_t pyb_config_main; \
......
...@@ -144,7 +144,7 @@ bool usb_vcp_is_enabled(void) { ...@@ -144,7 +144,7 @@ bool usb_vcp_is_enabled(void) {
void usb_vcp_set_interrupt_char(int c) { void usb_vcp_set_interrupt_char(int c) {
if (pyb_usb_flags & PYB_USB_FLAG_DEV_ENABLED) { if (pyb_usb_flags & PYB_USB_FLAG_DEV_ENABLED) {
if (c != -1) { if (c != -1) {
mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception)); mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
} }
USBD_CDC_SetInterrupt(c); USBD_CDC_SetInterrupt(c);
} }
......
...@@ -353,7 +353,7 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) { ...@@ -353,7 +353,7 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
if (*src == user_interrupt_char) { if (*src == user_interrupt_char) {
char_found = true; char_found = true;
// raise exception when interrupts are finished // raise exception when interrupts are finished
pendsv_nlr_jump(MP_STATE_PORT(mp_kbd_exception)); pendsv_nlr_jump(&MP_STATE_VM(mp_kbd_exception));
} else { } else {
if (char_found) { if (char_found) {
*dest = *src; *dest = *src;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment