summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-15 12:32:00 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-15 12:32:00 +1100
commitf254cfd3c46432efabf837668c91271fddc8ea27 (patch)
treecec5d6b82c6b8df8880b9c53aa6417e26a88cad8
parent29b58796136e3c9133cd268b163db1c53e67ac9b (diff)
downloadmicropython-f254cfd3c46432efabf837668c91271fddc8ea27.tar.gz
micropython-f254cfd3c46432efabf837668c91271fddc8ea27.zip
stmhal: Rename mp_const_vcp_interrupt to mp_kbd_exception.
mp_kbd_exception is now considered the standard variable name to hold the singleton KeyboardInterrupt exception. This patch also moves the creation of this object from pyb_usb_init() to main().
-rw-r--r--stmhal/main.c1
-rw-r--r--stmhal/mpconfigport.h2
-rw-r--r--stmhal/pendsv.c2
-rw-r--r--stmhal/usb.c8
4 files changed, 6 insertions, 7 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index 78afe54ef6..6140a06a8a 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -438,6 +438,7 @@ 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
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 979cb3678d..203d41472b 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -208,7 +208,7 @@ extern const struct _mp_obj_module_t mp_module_network;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
\
- mp_obj_t mp_const_vcp_interrupt; \
+ mp_obj_t mp_kbd_exception; \
mp_obj_t pyb_hid_report_desc; \
\
mp_obj_t pyb_config_main; \
diff --git a/stmhal/pendsv.c b/stmhal/pendsv.c
index fb66a3dad4..ff4480eed3 100644
--- a/stmhal/pendsv.c
+++ b/stmhal/pendsv.c
@@ -36,7 +36,7 @@
// PENDSV call that actually raises the exception. It must be non-static
// otherwise gcc-5 optimises it away. It can point to the heap but is not
// traced by GC. This is okay because we only ever set it to
-// mp_const_vcp_interrupt which is in the root-pointer set.
+// mp_kbd_exception which is in the root-pointer set.
void *pendsv_object;
void pendsv_init(void) {
diff --git a/stmhal/usb.c b/stmhal/usb.c
index b0a66ef9b0..591cb321aa 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -96,9 +96,7 @@ const mp_obj_tuple_t pyb_usb_hid_keyboard_obj = {
};
void pyb_usb_init0(void) {
- // create an exception object for interrupting by VCP
- MP_STATE_PORT(mp_const_vcp_interrupt) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
- USBD_CDC_SetInterrupt(-1, MP_STATE_PORT(mp_const_vcp_interrupt));
+ USBD_CDC_SetInterrupt(-1, MP_STATE_PORT(mp_kbd_exception));
MP_STATE_PORT(pyb_hid_report_desc) = MP_OBJ_NULL;
}
@@ -146,9 +144,9 @@ 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_const_vcp_interrupt));
+ mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception));
}
- USBD_CDC_SetInterrupt(c, MP_STATE_PORT(mp_const_vcp_interrupt));
+ USBD_CDC_SetInterrupt(c, MP_STATE_PORT(mp_kbd_exception));
}
}