-- globals referenced: isblackout, dodraw, ledfb, ledfb_claimed, remotefb, remotetmr, lamp_announce, tq, loaddrawfn
-- assumptions: gpio.trig(6) is the right thing to do for touch IRQs
-local touch_tq = (dofile "tq.lc")(5)
local touchfb = ws2812.newBuffer(32,3)
local touch_fini = nil
local touch_db_blackout = nil
local function ontouch()
local _, down = cap:rt()
- if touch_fini ~= nil then touch_tq:dequeue(touch_fini) end
+ if touch_fini ~= nil then tq:dequeue(touch_fini) end
-- nothing down, kick off timer for touch done
- if down == 0 then touch_fini = touch_tq:queue(1500,ontouchdone) end
+ if down == 0 then touch_fini = tq:queue(1500,ontouchdone) end
-- back right button: display toggle once per touch of button
if bit.isset(down,0) then
- if touch_db_blackout == nil then toggleblackout() else touch_tq:dequeue(touch_db_blackout) end
- touch_db_blackout = touch_tq:queue(300,onblackdebounce)
+ if touch_db_blackout == nil then toggleblackout() else tq:dequeue(touch_db_blackout) end
+ touch_db_blackout = tq:queue(300,onblackdebounce)
end
if not isblackout then
if touch_db_fn == nil then
touchfnix = touchfnix + 1
if touchfnix > #touchfns then touchfnix = 1 end
- touch_db_fn = touch_tq:queue(200,onfndebounce)
+ touch_db_fn = tq:queue(200,onfndebounce)
end
claimfb()
end