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:
2023-03-17 18:00:26 +01:00
commit 959699c1d3
10 changed files with 553 additions and 0 deletions

View 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