Files
rp2040-hid/FlyWithLua/rpi2040_hid.lua
Matthias Blankertz 959699c1d3 Initial USB HID implementation
- One button reported as gamepad button
- One LED controlable via application specific HID report and FlyWithLua
2023-03-17 18:20:26 +01:00

21 lines
519 B
Lua

device = hid_open(0x1209, 1)
if device == nil then
print("No device!")
else
dataref("low_vac", "sim/cockpit2/annunciators/low_vacuum", "readable")
local prev_low_vac
function low_vac_indicator()
if low_vac ~= prev_low_vac then
if low_vac > 0 then
hid_write(device, 2, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
else
hid_write(device, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
end
prev_low_vac = low_vac
end
end
do_every_frame("low_vac_indicator()")
end