summaryrefslogtreecommitdiff
path: root/stmhal/usb.c
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 /stmhal/usb.c
parent29b58796136e3c9133cd268b163db1c53e67ac9b (diff)
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().
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index b0a66ef9b..591cb321a 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));
}
}