joystick

package
v0.31.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Joystick *joystick

Functions

func Port

func Port() *joystick

Port returns the USB Joystick port.

func UseSettings

func UseSettings(def Definitions, rxHandlerFunc func(b []byte), setupFunc func(setup usb.Setup) bool, hidDesc []byte) *joystick

UseSettings overrides the Joystick settings. This function must be called from init().

Types

type AxisValue

type AxisValue struct {
	Value int
	// contains filtered or unexported fields
}

type Constraint

type Constraint struct {
	MinIn  int
	MaxIn  int
	MinOut int16
	MaxOut int16
}

type Definitions

type Definitions struct {
	ReportID     byte
	ButtonCnt    int
	HatSwitchCnt int
	AxisDefs     []Constraint
	// contains filtered or unexported fields
}

func DefaultDefinitions

func DefaultDefinitions() Definitions

func (Definitions) Descriptor

func (c Definitions) Descriptor() []byte

func (Definitions) NewState

func (c Definitions) NewState() State

type HatDirection

type HatDirection uint8
const (
	HatUp HatDirection = iota
	HatRightUp
	HatRight
	HatRightDown
	HatDown
	HatLeftDown
	HatLeft
	HatLeftUp
	HatCenter
)

type State

type State struct {
	Buttons     []byte
	HatSwitches []HatDirection
	Axises      []*AxisValue
	// contains filtered or unexported fields
}

func (State) Axis

func (s State) Axis(index int) int

func (State) Button

func (s State) Button(index int) bool

func (State) Hat

func (s State) Hat(index int) HatDirection

func (State) MarshalBinary

func (s State) MarshalBinary() ([]byte, error)

func (State) SetAxis

func (s State) SetAxis(index int, v int)

func (State) SetButton

func (s State) SetButton(index int, push bool)

func (State) SetHat

func (s State) SetHat(index int, dir HatDirection)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL