From 3c4db9f91c01211aed47afe3efdd11477badc0bc Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 31 Jul 2014 10:30:42 +0100 Subject: stmhal: Add USB_VCP class/object, for direct USB VCP control. Before, pyb.stdin/pyb.stdout allowed some kind of access to the USB VCP device, but it was basic access. This patch adds a proper USB_VCP class and object with much more control over the USB VCP device. Create an object with pyb.USB_VCP(), then use this object as if it were a UART object. It has send, recv, read, write, and other methods. send and recv allow a timeout to be specified. Addresses issue 774. --- stmhal/modpyb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'stmhal/modpyb.c') diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index 38a680da2..ace0020f7 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -367,6 +367,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_have_cdc), (mp_obj_t)&pyb_have_cdc_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_repl_uart), (mp_obj_t)&pyb_repl_uart_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_hid), (mp_obj_t)&pyb_hid_send_report_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_USB_VCP), (mp_obj_t)&pyb_usb_vcp_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_millis), (mp_obj_t)&pyb_millis_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj }, -- cgit v1.2.3