mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
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.
68 lines
1.7 KiB
C
68 lines
1.7 KiB
C
/*
|
|
* tio - a simple serial terminal I/O tool
|
|
*
|
|
* Copyright (c) 2014-2022 Martin Lund
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
* 02110-1301, USA.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <limits.h>
|
|
#include <termios.h>
|
|
#include <sys/param.h>
|
|
|
|
enum timestamp_t
|
|
{
|
|
TIMESTAMP_NONE,
|
|
TIMESTAMP_24HOUR,
|
|
TIMESTAMP_24HOUR_START,
|
|
TIMESTAMP_24HOUR_DELTA,
|
|
TIMESTAMP_ISO8601,
|
|
TIMESTAMP_END,
|
|
};
|
|
|
|
enum timestamp_t timestamp_option_parse(const char *arg);
|
|
|
|
/* Options */
|
|
struct option_t
|
|
{
|
|
const char *tty_device;
|
|
unsigned int baudrate;
|
|
int databits;
|
|
char *flow;
|
|
int stopbits;
|
|
char *parity;
|
|
int output_delay;
|
|
int dtr_pulse_duration;
|
|
bool no_autoconnect;
|
|
bool log;
|
|
bool log_strip;
|
|
bool local_echo;
|
|
enum timestamp_t timestamp;
|
|
const char *log_filename;
|
|
const char *map;
|
|
const char *socket;
|
|
int color;
|
|
bool hex_mode;
|
|
};
|
|
|
|
extern struct option_t option;
|
|
|
|
void options_print();
|
|
void options_parse(int argc, char *argv[]);
|
|
void options_parse_final(int argc, char *argv[]);
|