summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 7db8ca218a..40c474f432 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -45,8 +45,14 @@
USBD_HandleTypeDef hUSBDDevice;
#endif
-static int dev_is_enabled = 0;
-mp_obj_t mp_const_vcp_interrupt = MP_OBJ_NULL;
+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_msg(&mp_type_OSError, "VCPInterrupt");
+ USBD_CDC_SetInterrupt(VCP_CHAR_NONE, mp_const_vcp_interrupt);
+}
void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
#ifdef USE_DEVICE_MODE
@@ -72,9 +78,6 @@ void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
USBD_Start(&hUSBDDevice);
}
dev_is_enabled = 1;
-
- // create an exception object for interrupting by VCP
- mp_const_vcp_interrupt = mp_obj_new_exception_msg(&mp_type_OSError, "VCPInterrupt");
#endif
}