Skip to content
  • Damien George's avatar
    stmhal: Add ioctl to USB_VCP object, so it works with select. · 9a41b32b
    Damien George authored
    This patch also enables non-blocking streams on stmhal port.
    
    One can now make a USB-UART pass-through function:
    
    def pass_through(usb, uart):
        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))
    9a41b32b