diff options
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r-- | stmhal/usb.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c index 7eb3f179a9..c413ce4bac 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -38,6 +38,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mperrno.h" +#include "py/mphal.h" #include "bufhelper.h" #include "usb.h" @@ -96,7 +97,7 @@ const mp_obj_tuple_t pyb_usb_hid_keyboard_obj = { }; void pyb_usb_init0(void) { - USBD_CDC_SetInterrupt(-1); + mp_hal_set_interrupt_char(-1); MP_STATE_PORT(pyb_hid_report_desc) = MP_OBJ_NULL; } @@ -141,15 +142,6 @@ bool usb_vcp_is_enabled(void) { return (pyb_usb_flags & PYB_USB_FLAG_DEV_ENABLED) != 0; } -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_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))); - } - USBD_CDC_SetInterrupt(c); - } -} - int usb_vcp_recv_byte(uint8_t *c) { return USBD_CDC_Rx(c, 1, 0); } @@ -364,7 +356,7 @@ STATIC mp_obj_t pyb_usb_vcp_make_new(const mp_obj_type_t *type, size_t n_args, s } STATIC mp_obj_t pyb_usb_vcp_setinterrupt(mp_obj_t self_in, mp_obj_t int_chr_in) { - usb_vcp_set_interrupt_char(mp_obj_get_int(int_chr_in)); + mp_hal_set_interrupt_char(mp_obj_get_int(int_chr_in)); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_vcp_setinterrupt_obj, pyb_usb_vcp_setinterrupt); |