Browse Source

Add option to force DTS and RTS pins high

This is for development boards like those for the ESP32, where it's
common to use RTS and DTR to control chip resets.
master
Jim Paris 2 months ago
parent
commit
9838c8136f
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      terminal.py

+ 10
- 1
terminal.py View File

@@ -362,6 +362,9 @@ if __name__ == "__main__":
help="Don't use colors in output")
parser.add_argument("--flow", "-f", action="store_true",
help="Enable RTS/CTS flow control")
parser.add_argument("--esp", "-e", action="store_true",
help="Force RTS and DTR high, for ESP boards. Note that"
" the lines may still glitch low at startup.")
parser.add_argument("--bufsize", "-z", metavar="SIZE", type=int,
help="Buffer size for reads and writes", default=65536)

@@ -395,7 +398,13 @@ if __name__ == "__main__":
sys.stderr.write("error: %s specified more than once\n" % node)
raise SystemExit(1)
try:
dev = MySerial(node, baud, rtscts = args.flow)
dev = MySerial(None, baud, rtscts = args.flow)
dev.port = node
if args.esp:
# Force DTR and RTS high by setting to false
dev.dtr = False
dev.rts = False
dev.open()
except serial.serialutil.SerialException:
sys.stderr.write("error opening %s\n" % node)
raise SystemExit(1)


Loading…
Cancel
Save