adding uartloop module for turning a micropython board into a serial adapter
This commit is contained in:
parent
c3a644d60e
commit
2544f4d2f6
|
@ -0,0 +1,13 @@
|
||||||
|
import pyb
|
||||||
|
|
||||||
|
def UARTPassThruLoop(bus_usb, bus_uart):
|
||||||
|
bus_usb.setinterrupt(-1)
|
||||||
|
while True:
|
||||||
|
if bus_usb.any(): bus_uart.write(bus_usb.read(256))
|
||||||
|
if bus_uart.any(): bus_usb.write(bus_uart.read(256))
|
||||||
|
|
||||||
|
def UARTPassThru(id_uart, baud_uart):
|
||||||
|
uart=pyb.UART(id_uart,baud_uart,timeout=75,timeout_char=75)
|
||||||
|
usb=pyb.USB_VCP()
|
||||||
|
print("Now entering UART passthru loop. To exit, reset.")
|
||||||
|
UARTPassThruLoop(usb, uart)
|
Loading…
Reference in New Issue