You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
440 B
18 lines
440 B
Making a UART - USB pass through
|
|
================================
|
|
|
|
It's as simple as::
|
|
|
|
import pyb
|
|
import select
|
|
|
|
def pass_through(usb, uart):
|
|
usb.setinterrupt(-1)
|
|
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))
|
|
|