Initial USB HID implementation
- One button reported as gamepad button - One LED controlable via application specific HID report and FlyWithLua
This commit is contained in:
20
FlyWithLua/rpi2040_hid.lua
Normal file
20
FlyWithLua/rpi2040_hid.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user