stmhal: Use core-provided keyboard exception object.

pull/2688/head
Damien George 2016-12-15 15:51:34 +11:00
rodzic d89cafd5c3
commit a770ba147e
4 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -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_slash_lib));
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
// zeroing out memory and resetting any of the sub-systems. Following this

Wyświetl plik

@ -42,6 +42,7 @@
#define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_KBD_EXCEPTION (1)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_REPL_EMACS_KEYS (1)
#define MICROPY_REPL_AUTO_INDENT (1)
@ -208,7 +209,6 @@ extern const struct _mp_obj_module_t mp_module_network;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
\
mp_obj_t mp_kbd_exception; \
mp_obj_t pyb_hid_report_desc; \
\
mp_obj_t pyb_config_main; \

Wyświetl plik

@ -144,7 +144,7 @@ bool usb_vcp_is_enabled(void) {
void usb_vcp_set_interrupt_char(int c) {
if (pyb_usb_flags & PYB_USB_FLAG_DEV_ENABLED) {
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);
}

Wyświetl plik

@ -353,7 +353,7 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
if (*src == user_interrupt_char) {
char_found = true;
// 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 {
if (char_found) {
*dest = *src;