summaryrefslogtreecommitdiff
path: root/stmhal/modpyb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-07-31 10:30:42 +0100
committerDamien George <damien.p.george@gmail.com>2014-07-31 10:30:42 +0100
commit3c4db9f91c01211aed47afe3efdd11477badc0bc (patch)
treeba4a7fbf2d13c672992966469f5bf7abf7ec1d98 /stmhal/modpyb.c
parent5f27a7e81135f7a7c0c75ee551fe0c6103048046 (diff)
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.
Diffstat (limited to 'stmhal/modpyb.c')
-rw-r--r--stmhal/modpyb.c1
1 files changed, 1 insertions, 0 deletions
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 },