v1
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
-- IOC.lua — I/O Controller (AtlasOS Terminal v2.0)
|
||||
-- out[1] = display_text → Terminal
|
||||
-- out[2] = display_clear → Terminal
|
||||
-- out[3] = display_color → Terminal
|
||||
-- out[4] = cmd_tx → CMC.in[1] (IN|command)
|
||||
-- in[1] = user_input ← Terminal
|
||||
-- in[2] = text_rx ← CMC.out[1] (OUT|text)
|
||||
-- in[3] = clear_rx ← CMC.out[2] (1 = clear)
|
||||
-- in[4] = color_rx ← CMC.out[3] (R,G,B)
|
||||
|
||||
local txActive = false
|
||||
|
||||
inp = {}
|
||||
|
||||
function upd()
|
||||
if inp[1] ~= nil then
|
||||
out[4] = "IN|" .. tostring(inp[1])
|
||||
txActive = true
|
||||
elseif txActive then
|
||||
out[4] = ""
|
||||
txActive = false
|
||||
end
|
||||
|
||||
if inp[2] ~= nil then
|
||||
local msg = tostring(inp[2])
|
||||
local _, arg = msg:match("^(%w+)%|(.+)$")
|
||||
if arg then out[1] = arg end
|
||||
end
|
||||
|
||||
if inp[3] ~= nil and tonumber(inp[3]) == 1 then
|
||||
out[2] = 1
|
||||
end
|
||||
|
||||
if inp[4] ~= nil then
|
||||
out[3] = tostring(inp[4])
|
||||
end
|
||||
|
||||
table.clear(inp)
|
||||
end
|
||||
Reference in New Issue
Block a user