diff --git a/tools/bitmap_over_fifo.py b/tools/bitmap_over_fifo.py index 529db70..0039a48 100644 --- a/tools/bitmap_over_fifo.py +++ b/tools/bitmap_over_fifo.py @@ -118,8 +118,8 @@ def clear(self) -> None: self.__check_ack() -def main(fifo_path: str, show: bool, toggle_animation: bool, stop_animation: bool, refresh_rate: int, clear: bool, use_stdin: bool): - with open('fifo.in', 'wb', 0) as fifo_out, open('fifo.out', 'rb', 0) as fifo_in: +def main(fifo_path_in: str, fifo_path_out: str, show: bool, toggle_animation: bool, stop_animation: bool, refresh_rate: int, clear: bool, use_stdin: bool): + with open(fifo_path_in, 'wb', 0) as fifo_out, open(fifo_path_out, 'rb', 0) as fifo_in: fd_in = fifo_in.fileno() os.set_blocking(fd_in, True) @@ -146,7 +146,8 @@ def main(fifo_path: str, show: bool, toggle_animation: bool, stop_animation: boo if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument('-f', '--fifo', help='Named pipe (FIFO) path', type=str, default='fifo') + parser.add_argument('--fifo-in', help='Named pipe (FIFO) for UART communication (debug_uart.py). Input endpoint', type=str, default='fifo.in') + parser.add_argument('--fifo-out', help='Named pipe (FIFO) for UART communication (debug_uart.py). Output endpoint', type=str, default='fifo.out') parser.add_argument('-s', '--show', help='Show piped image (on the PC) before sending', default=False, action='store_true') parser.add_argument('--toggle-animation', help='Start animation on the target device. Inhibit default behavior (send bitmap). No piped image', default=False, action='store_true') parser.add_argument('--stop-animation', help='Stop animation on the target device. Inhibit default behavior (send bitmap). No piped image', default=False, action='store_true') @@ -156,5 +157,5 @@ def main(fifo_path: str, show: bool, toggle_animation: bool, stop_animation: boo parser.add_argument('--clear', help='Clear frame buffer stored on the embedded device. Inhibit default behavior (send bitmap). No piped image', default=False, action='store_true') args = parser.parse_args() - main(args.fifo, args.show, args.toggle_animation, args.stop_animation, args.refresh_rate, args.clear, args.nostdin) + main(args.fifo_in, args.fifo_out, args.show, args.toggle_animation, args.stop_animation, args.refresh_rate, args.clear, args.nostdin) diff --git a/tools/uart_proxy.py b/tools/uart_proxy.py index e7503db..fa0d37b 100644 --- a/tools/uart_proxy.py +++ b/tools/uart_proxy.py @@ -23,11 +23,11 @@ def create_fifo(path: str) -> None: def delete_fifo(path: str) -> None: os.unlink(path) -def main(port: str, fifo_path: str) -> None: - create_fifo('fifo.in') - create_fifo('fifo.out') +def main(port: str, fifo_path_in: str, fifo_path_out: str) -> None: + create_fifo(fifo_path_in) + create_fifo(fifo_path_out) try: - with serial.Serial(port=port, baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=0) as uart, open('fifo.in', 'rb', 0) as fifo_in, open('fifo.out', 'wb', 0) as fifo_out: + with serial.Serial(port=port, baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=0) as uart, open(fifo_path_in, 'rb', 0) as fifo_in, open(fifo_path_out, 'wb', 0) as fifo_out: fd_in = fifo_in.fileno() os.set_blocking(fd_in, False) uart.flushInput() @@ -51,14 +51,15 @@ def main(port: str, fifo_path: str) -> None: except Exception as e: logging.debug(e) - delete_fifo('fifo.in') - delete_fifo('fifo.out') + delete_fifo(fifo_path_in) + delete_fifo(fifo_path_out) if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG, filemode="a", format="%(asctime)s - %(levelname)s -> %(message)s") parser = argparse.ArgumentParser() parser.add_argument('-p', '--port', help='Serial port name', type=str, default=SERIAL_PORT_NAME) - parser.add_argument('-f', '--fifo', help='Named pipe (FIFO) for UART communication (debug_uart.py)', type=str, default='fifo') + parser.add_argument('--fifo-in', help='Named pipe (FIFO) for UART communication (debug_uart.py). Input endpoint', type=str, default='fifo.in') + parser.add_argument('--fifo-out', help='Named pipe (FIFO) for UART communication (debug_uart.py). Output endpoint', type=str, default='fifo.out') args = parser.parse_args() - main(args.port, args.fifo) + main(args.port, args.fifo_in, args.fifo_out)