summaryrefslogtreecommitdiff
path: root/stmhal/usb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-11-29 15:23:21 +0000
committerDamien George <damien.p.george@gmail.com>2014-11-29 15:23:21 +0000
commit19fb1b4dd7173ad2cf4b2bb1b0f0c06498499bd2 (patch)
tree0f557d2d687fad065dd4ad11a3ff3f3b35a83a0f /stmhal/usb.c
parentb395220ef00ccf9700a37e470f4d4cf021743572 (diff)
stmhal: Add USB_VCP.setinterrupt method, to disable CTRL-C.
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 0499aaa8d..82f23c26f 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -174,6 +174,12 @@ STATIC mp_obj_t pyb_usb_vcp_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint
return (mp_obj_t)&pyb_usb_vcp_obj;
}
+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));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_vcp_setinterrupt_obj, pyb_usb_vcp_setinterrupt);
+
/// \method any()
/// Return `True` if any characters waiting, else `False`.
STATIC mp_obj_t pyb_usb_vcp_any(mp_obj_t self_in) {
@@ -252,6 +258,7 @@ mp_obj_t pyb_usb_vcp___exit__(mp_uint_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_usb_vcp___exit___obj, 4, 4, pyb_usb_vcp___exit__);
STATIC const mp_map_elem_t pyb_usb_vcp_locals_dict_table[] = {
+ { MP_OBJ_NEW_QSTR(MP_QSTR_setinterrupt), (mp_obj_t)&pyb_usb_vcp_setinterrupt_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_any), (mp_obj_t)&pyb_usb_vcp_any_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_send), (mp_obj_t)&pyb_usb_vcp_send_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&pyb_usb_vcp_recv_obj },