2014-10-30 21:37:19 -04:00
|
|
|
Making a UART - USB pass through
|
|
|
|
================================
|
|
|
|
|
|
|
|
It's as simple as::
|
|
|
|
|
|
|
|
import pyb
|
|
|
|
import select
|
|
|
|
|
|
|
|
def pass_through(usb, uart):
|
2014-11-29 10:23:21 -05:00
|
|
|
usb.setinterrupt(-1)
|
2014-10-30 21:37:19 -04:00
|
|
|
while True:
|
|
|
|
select.select([usb, uart], [], [])
|
|
|
|
if usb.any():
|
|
|
|
uart.write(usb.read(256))
|
|
|
|
if uart.any():
|
|
|
|
usb.write(uart.read(256))
|
|
|
|
|
|
|
|
pass_through(pyb.USB_VCP(), pyb.UART(1, 9600))
|