Documentation
¶
Index ¶
- type AxisValue
- type Constraint
- type Definitions
- type HatDirection
- type Joystick
- type RingBuffer
- type State
- func (s State) Axis(index int) int
- func (s State) Button(index int) bool
- func (s State) Hat(index int) HatDirection
- func (s State) MarshalBinary() ([]byte, error)
- func (s State) SetAxis(index int, v int)
- func (s State) SetButton(index int, push bool)
- func (s State) SetHat(index int, dir HatDirection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 Joystick ¶
type Joystick struct {
State
// contains filtered or unexported fields
}
func (*Joystick) SendReport ¶
to InterruptOut
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is ring buffer implementation inspired by post at https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
func (*RingBuffer) Clear ¶
func (rb *RingBuffer) Clear()
Clear resets the head and tail pointer to zero.
func (*RingBuffer) Get ¶
func (rb *RingBuffer) Get() ([]byte, bool)
Get returns a byte from the buffer. If the buffer is empty, the method will return a false as the second value.
func (*RingBuffer) Put ¶
func (rb *RingBuffer) Put(val []byte) bool
Put stores a byte in the buffer. If the buffer is already full, the method will return false.
func (*RingBuffer) Used ¶
func (rb *RingBuffer) Used() uint8
Used returns how many bytes in buffer have been used.
type State ¶
type State struct {
Buttons []byte
HatSwitches []HatDirection
Axises []*AxisValue
// contains filtered or unexported fields
}
func (State) Hat ¶
func (s State) Hat(index int) HatDirection
func (State) MarshalBinary ¶
func (State) SetHat ¶
func (s State) SetHat(index int, dir HatDirection)
Click to show internal directories.
Click to hide internal directories.