mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Simplify lua line manipulation API
Collapses lua high(), low(), toggle(), config_high(), config_low(),
config_apply() into one simple function:
set{<line>=<state>, ...}
Line can be any of DTR, RTS, CTS, DSR, CD, RI.
State is high, low, or toggle.
Example:
script = set{DTR=high, RTS=low}; msleep(100); set{DTR=low, RTS=high}; msleep(100); set{RTS=low}
Notice the use of {} instad of () when calling the set function. This is
required to pass parameters by name in lua.
This commit is contained in:
parent
eef0a15194
commit
6d77201ba0
6 changed files with 112 additions and 211 deletions
12
src/tty.h
12
src/tty.h
|
|
@ -46,6 +46,13 @@ typedef struct
|
|||
char *description;
|
||||
} device_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mask;
|
||||
int value;
|
||||
bool reserved;
|
||||
} tty_line_config_t;
|
||||
|
||||
extern const char *device_name;
|
||||
extern bool interactive_mode;
|
||||
extern bool map_i_nl_cr;
|
||||
|
|
@ -60,9 +67,6 @@ void tty_wait_for_device(void);
|
|||
void list_serial_devices(void);
|
||||
void tty_input_thread_create(void);
|
||||
void tty_input_thread_wait_ready(void);
|
||||
void tty_line_set(int fd, int mask, bool value);
|
||||
void tty_line_toggle(int fd, int mask);
|
||||
void tty_line_config(int mask, bool value);
|
||||
void tty_line_config_apply(void);
|
||||
void tty_line_set(int fd, tty_line_config_t line_config[]);
|
||||
void tty_search(void);
|
||||
GList *tty_search_for_serial_devices(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue