Add Pulse DTR command

MCUs like the ESP32 can be reset if the serial port DTR line is
pulsed for a short time.  You could just type CTRL-t d CTRL-t d
but that's a little awkward since you have to lift your finger
off the CTRL key to type the Ds.  Now you can just type CTRL-T D.

* Added new command "D" to pulse the DTR line.  I.E.  Toggle its
  state twice with a configurable duration between toggles.

* Added new config/command line option "--dtr-pulse-duration"
  to set the duration between the DTR state toggles.  The default
  is 100ms.
This commit is contained in:
George Joseph 2022-07-07 10:45:37 -06:00
parent a717631207
commit f24cee61e7
8 changed files with 42 additions and 0 deletions

View file

@ -256,6 +256,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
tio_printf(" ctrl-t b Send break");
tio_printf(" ctrl-t c Show configuration");
tio_printf(" ctrl-t d Toggle DTR line");
tio_printf(" ctrl-t D Pulse DTR line");
tio_printf(" ctrl-t e Toggle local echo mode");
tio_printf(" ctrl-t h Toggle hexadecimal mode");
tio_printf(" ctrl-t l Clear screen");
@ -286,6 +287,12 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
toggle_line("DTR", TIOCM_DTR);
break;
case KEY_SHIFT_D:
toggle_line("DTR", TIOCM_DTR);
delay(option.dtr_pulse_duration);
toggle_line("DTR", TIOCM_DTR);
break;
case KEY_R:
toggle_line("RTS", TIOCM_RTS);
break;