From cb7a167c7dee2fa1a19bd09ede3bae8b140e79da Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Feb 2022 11:47:36 +0100 Subject: build: use PlatformIO --- tools/monitor.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tools/monitor.py (limited to 'tools/monitor.py') diff --git a/tools/monitor.py b/tools/monitor.py deleted file mode 100644 index f909efb..0000000 --- a/tools/monitor.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Serial monitor.""" -import argparse -import sys -import asyncio -import os - -if os.name == "nt": # NT-based operating systems (Windows) - from serial.serialwin32 import Serial -elif os.name == "posix": - from serial.serialposix import Serial -else: - raise NotImplementedError( - "Sorry no implementation for your platform ({}) available." - .format(sys.platform) - ) - - -async def read(port: str, baud_rate: int): - """Reads a serial port.""" - with Serial(port, baud_rate) as serial_port: - while(serial_port.is_open): - sys.stdout.buffer.write(serial_port.read()) - sys.stdout.flush() - - -async def main(): - """Monitors serial output.""" - parser = argparse.ArgumentParser( - description="A tool for monitoring a Arduino") - - parser.add_argument( - "port", help="A serial device port e.g. /dev/ttyACM0 or com3") - parser.add_argument("baud_rate", help="The serial device baud rate") - - args = parser.parse_args() - - await read(args.port, args.baud_rate) - -if __name__ == "__main__": - try: - asyncio.run(main()) - except KeyboardInterrupt: - print("\nReceived keyboard interrupt. Exiting...") - exit(0) -- cgit v1.2.3-18-g5258