keyboard

package
Version: v0.0.0-...-8199819 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2015 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpG1       int32 = 0x1
	SpG2             = 0x2
	SpG3             = 0x4
	SpG4             = 0x8
	SpG5             = 0x10
	SpG6             = 0x20
	SpG7             = 0x40
	SpG8             = 0x80
	SpG9             = 0x100
	SpG10            = 0x200
	SpG11            = 0x400
	SpG12            = 0x800
	SpG13            = 0x1000
	SpG14            = 0x2000
	SpG15            = 0x4000
	SpG16            = 0x8000
	SpG17            = 0x10000
	SpG18            = 0x20000
	SpMetaOff        = 0x40000
	SpLight          = 0x80000
	SpM1             = 0x100000
	SpM2             = 0x200000
	SpM3             = 0x400000
	SpMR             = 0x800000
	SpLCD_R          = 0x1000000
	SpLCD_1          = 0x2000000
	SpLCD_2          = 0x4000000
	SpLCD_3          = 0x8000000
	SpLCD_4          = 0x10000000
	SpMuteHead       = 0x20000000
	SpMuteMic        = 0x40000000
)

Variables

View Source
var Debug bool

Functions

func LookupKey

func LookupKey(k Key) (int, bool)

func RawDoKeyDown

func RawDoKeyDown(k int)

func RawDoKeyUp

func RawDoKeyUp(k int)

Types

type App

type App interface {
	LCDKeyDown(int)
	LCDKeyUp(int)
}

type Key

type Key uint8
const (
	// letter keys
	KeyA Key = iota + 4
	KeyB
	KeyC
	KeyD
	KeyE
	KeyF
	KeyG
	KeyH
	KeyI
	KeyJ
	KeyK
	KeyL
	KeyM
	KeyN
	KeyO
	KeyP
	KeyQ
	KeyR
	KeyS
	KeyT
	KeyU
	KeyV
	KeyW
	KeyX
	KeyY
	KeyZ
	Key1 // num row
	Key2
	Key3
	Key4
	Key5
	Key6
	Key7
	Key8
	Key9
	Key0
	KeyEnter // actions
	KeyEsc
	KeyBackspace
	KeyTab
	KeySpace
	KeyMinus
	KeyEqual
	KeyLeftBrace
	KeyRightBrace
	KeyBackslash

	KeySemicolon
	KeyApostrophe
	KeyGrave
	KeyComma
	KeyDot
	KeySlash
	KeyCapsLock
	KeyF1
	KeyF2
	KeyF3
	KeyF4
	KeyF5
	KeyF6
	KeyF7
	KeyF8
	KeyF9
	KeyF10
	KeyF11
	KeyF12
	KeySysRq
	KeyScrollLock
	KeyPause
	KeyInsert
	KeyHome
	KeyPageUp
	KeyDelete
	KeyEnd
	KeyPageDown
	KeyRight
	KeyLeft
	KeyDown
	KeyUp
	KeyNumLock

	KeyNPSlash
	KeyNPAsterisk
	KeyNPMinus
	KeyNPPlus
	KeyNPEnter
	KeyNP1
	KeyNP2
	KeyNP3
	KeyNP4
	KeyNP5
	KeyNP6
	KeyNP7
	KeyNP8
	KeyNP9
	KeyNP0
	KeyNPDot

	MediaNext
	MediaBack
	MediaStop
	MediaPlayPause
	MediaMute
	MediaVolUp
	MediaVolDown

	// Modifier keys
	LeftCtrl
	LeftShift
	LeftAlt
	LeftMeta
	RightCtrl
	RightShift
	RightAlt
	RightMeta
)

type Keyboard

type Keyboard struct {
	DeviceInfo  *hid.DeviceInfo
	Device      *hid.Device
	CurrentMode Mode
	Modes       [3]Mode
	CurrentApp  App
	Apps        []App
	// contains filtered or unexported fields
}

func NewKeyboard

func NewKeyboard() Keyboard

func (Keyboard) HandleMediaKey

func (k Keyboard) HandleMediaKey(keys byte)

func (*Keyboard) HandleModifierKeys

func (k *Keyboard) HandleModifierKeys(keys byte)

func (Keyboard) HandleNormalKeys

func (kboard Keyboard) HandleNormalKeys(keys []byte)

func (*Keyboard) HandleSpecialKeys

func (k *Keyboard) HandleSpecialKeys(keys []byte)

func (Keyboard) SetColor

func (k Keyboard) SetColor(c color.NRGBA)

func (Keyboard) SetImage

func (k Keyboard) SetImage(img image.Gray)

func (*Keyboard) Start

func (k *Keyboard) Start() error

type Mode

type Mode interface {
	DoKeyDown(Key)
	DoKeyUp(Key)
	MacroKeyDown(int)
	MacroKeyUp(int)
}

type QwertyMode

type QwertyMode struct {
}

func (QwertyMode) DoKeyDown

func (qm QwertyMode) DoKeyDown(k Key)

func (QwertyMode) DoKeyUp

func (qm QwertyMode) DoKeyUp(k Key)

func (QwertyMode) MacroKeyDown

func (qm QwertyMode) MacroKeyDown(k int)

func (QwertyMode) MacroKeyUp

func (qm QwertyMode) MacroKeyUp(k int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL