summaryrefslogtreecommitdiff
path: root/stmhal/usb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-01-07 23:38:50 +0000
committerDamien George <damien.p.george@gmail.com>2015-01-07 23:38:50 +0000
commit3b51b3e90f1d513031ad2c6b6a2a0d5d391f753d (patch)
tree6903d1a13bdc49860c325e531e81582beb6063bf /stmhal/usb.c
parent7a0636e80aea2ce1af03c890e024dabcdffcdf78 (diff)
stmhal: Collect all root pointers together in 1 place.
A GC in stmhal port now only scans true root pointers, not entire BSS. This reduces base GC time from 1700ms to 900ms.
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 50a5a7420..0bda0aaeb 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -45,12 +45,11 @@ USBD_HandleTypeDef hUSBDDevice;
#endif
STATIC int dev_is_enabled = 0;
-STATIC mp_obj_t mp_const_vcp_interrupt = MP_OBJ_NULL;
void pyb_usb_init0(void) {
// create an exception object for interrupting by VCP
- mp_const_vcp_interrupt = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
- USBD_CDC_SetInterrupt(-1, mp_const_vcp_interrupt);
+ 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));
}
void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
@@ -102,9 +101,9 @@ bool usb_vcp_is_connected(void) {
void usb_vcp_set_interrupt_char(int c) {
if (dev_is_enabled) {
if (c != -1) {
- mp_obj_exception_clear_traceback(mp_const_vcp_interrupt);
+ mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_const_vcp_interrupt));
}
- USBD_CDC_SetInterrupt(c, mp_const_vcp_interrupt);
+ USBD_CDC_SetInterrupt(c, MP_STATE_PORT(mp_const_vcp_interrupt));
}
}