wiimote

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Wiimote held vertically
	BtnA     Keycode = 0x130
	BtnB             = 0x131
	Btn1             = 0x101
	Btn2             = 0x102
	BtnUp            = 0x67
	BtnRight         = 0x6A
	BtnLeft          = 0x69
	BtnDown          = 0x6C
	BtnPlus          = 0x197
	BtnMinus         = 0x19C
	BtnHome          = 0x13C

	BtnZ = 0x135
	BtnC = 0x132

	Pressed  KeyState = 0x01
	Released          = 0x00

	Sync     EventType = 0x00
	Key      EventType = 0x01
	Relative EventType = 0x02
	Absolute EventType = 0x03

	StickMask Stick = 0xF0
	AxisMask  Stick = 0x0F

	NunchukStick Stick = 0x10
	NunchukX           = 0x00
	NunchukY           = 0x01
)
View Source
const (
	Wiimote  Device = `"Nintendo Wii Remote"`
	Nunchuk         = `"Nintendo Wii Remote Nunchuk"`
	NoDevice        = ""

	Add    Action = "add"
	Change        = "change"
	Remove        = "remove"
)

Variables

View Source
var KeyMap = map[Keycode]KeyInfo{
	BtnA:     KeyInfo{BtnA, "A"},
	BtnB:     KeyInfo{BtnB, "B"},
	Btn1:     KeyInfo{Btn1, "1"},
	Btn2:     KeyInfo{Btn2, "2"},
	BtnUp:    KeyInfo{BtnUp, "D-pad Up"},
	BtnDown:  KeyInfo{BtnDown, "D-pad Down"},
	BtnLeft:  KeyInfo{BtnLeft, "D-pad Left"},
	BtnRight: KeyInfo{BtnRight, "D-pad Right"},
	BtnPlus:  KeyInfo{BtnPlus, "+"},
	BtnMinus: KeyInfo{BtnMinus, "-"},
	BtnHome:  KeyInfo{BtnHome, "Home"},

	BtnZ: KeyInfo{BtnZ, "Z"},
	BtnC: KeyInfo{BtnC, "C"},
}
View Source
var StickMap = map[Stick]string{
	NunchukStick: "Nunchuk Stick",
}

Functions

This section is empty.

Types

type Action added in v0.1.2

type Action string

type Device added in v0.1.2

type Device string

type EventCode added in v0.1.2

type EventCode uint16

type EventReader

type EventReader struct {
	actor.Base
	// contains filtered or unexported fields
}

func NewEventReader

func NewEventReader(path string) *EventReader

func (*EventReader) Initialize

func (e *EventReader) Initialize() error

type EventType added in v0.1.2

type EventType uint16

type EventVal added in v0.1.2

type EventVal int32

type Finder

type Finder struct {
	actor.Base
	// contains filtered or unexported fields
}

func NewFinder

func NewFinder() *Finder

func (*Finder) Finalize added in v0.1.2

func (f *Finder) Finalize()

func (*Finder) Initialize

func (f *Finder) Initialize() error

type InputEvent added in v0.1.2

type InputEvent struct {
	Timestamp syscall.Timeval
	Type      EventType
	Code      EventCode
	Value     EventVal
}

See https://www.kernel.org/doc/Documentation/input/input.txt

type KeyInfo added in v0.1.2

type KeyInfo struct {
	Code       Keycode
	PrettyName string
}

type KeyState

type KeyState uint32

type Keycode

type Keycode EventCode

type Manager

type Manager interface {
	AddDevice(dev Device, eventPath string)
	HandleKeyEvent(Keycode, KeyState)
	HandleStickEvent(Stick, EventVal)
}

type Stick added in v0.1.2

type Stick EventCode

type StickAxis added in v0.1.2

type StickAxis EventCode

Jump to

Keyboard shortcuts

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