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:
Martin Lund 2024-04-29 14:45:36 +02:00
parent eef0a15194
commit 6d77201ba0
6 changed files with 112 additions and 211 deletions

View file

@ -1,7 +1,5 @@
high(DTR)
low(RTS)
set{DTR=high, RTS=low}
msleep(100)
low(DTR)
high(RTS)
set{DTR=low, RTS=high}
msleep(100)
low(RTS)
set{RTS=toggle}