stmhal: Add USB_VCP.setinterrupt method, to disable CTRL-C.

This commit is contained in:
Damien George
2014-11-29 15:23:21 +00:00
parent b395220ef0
commit 19fb1b4dd7
5 changed files with 19 additions and 1 deletions

View File

@@ -17,6 +17,15 @@ Constructors
Methods
-------
.. method:: usb_vcp.setinterrupt(chr)
Set the character which interrupts running Python code. This is set
to 3 (CTRL-C) by default, and when a CTRL-C character is received over
the USB VCP port, a KeyboardInterrupt exception is raised.
Set to -1 to disable this interrupt feature. This is useful when you
want to send raw bytes over the USB VCP port.
.. method:: usb_vcp.any()
Return ``True`` if any characters waiting, else ``False``.

View File

@@ -7,6 +7,7 @@ It's as simple as::
import select
def pass_through(usb, uart):
usb.setinterrupt(-1)
while True:
select.select([usb, uart], [], [])
if usb.any():