HidJoystick
This service is experimental and may change in the future.
Controls a HID joystick.
import { HidJoystick } from "@devicescript/core"
const hidJoystick = new HidJoystick()
Commands
setButtons
Sets the up/down button state, one byte per button, supports analog buttons. For digital buttons, use 0 for released, 1 for pressed.
hidJoystick.setButtons(...pressure: number[]): Promise<void>
setAxis
Sets the state of analog inputs.
hidJoystick.setAxis(...position: number[]): Promise<void>
Registers
buttonCount
Number of button report supported
type:
Register<number>(packing formatu8)constant: the register value will not change (until the next reset)
read only
import { HidJoystick } from "@devicescript/core"
const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.buttonCount.read()
write and read will block until a server is bound to the client.
buttonsAnalog
A bitset that indicates which button is analog.
type:
Register<number>(packing formatu32)constant: the register value will not change (until the next reset)
read only
import { HidJoystick } from "@devicescript/core"
const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.buttonsAnalog.read()
write and read will block until a server is bound to the client.
axisCount
Number of analog input supported
type:
Register<number>(packing formatu8)constant: the register value will not change (until the next reset)
read only
import { HidJoystick } from "@devicescript/core"
const hidJoystick = new HidJoystick()
// ...
const value = await hidJoystick.axisCount.read()
write and read will block until a server is bound to the client.