g13

package module
v0.0.0-...-4fa0c42 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 8 Imported by: 0

README

= g13 - Go library for Logitech G13

NOTE: This is work in progress. 


== USB protocol

----
8 bytes:

1    allways 1?
2-3  stick x, y (0-255)
4-8  keys:
4: G1  G2  G3  G4  G5  G6  G7  G8
5: G9  G10 G11 G12 G13 G14 G15 G16		
6: G17 G18 G19 G20 G21 G22 undef1 light_state
7: BD  L1  L2  L3  L4  M1  M2  M3
8: MR left right stick undef2 light1 light2 toggle	
----

Documentation

Index

Constants

View Source
const (
	USBVendorLogitech = 0x046d
	USBProductG13     = 0xc21c

	USBEndpointG13Key = 1
	USBEndpointG13LCD = 2
)

USB vendor and product IDs

View Source
const (
	LCDSizeX = 160
	LCDSizeY = 48
)
View Source
const (
	KeyG1 = iota
	KeyG2
	KeyG3
	KeyG4
	KeyG5
	KeyG6
	KeyG7
	KeyG8
	KeyG9
	KeyG10
	KeyG11
	KeyG12
	KeyG13
	KeyG14
	KeyG15
	KeyG16
	KeyG17
	KeyG18
	KeyG19
	KeyG20
	KeyG21
	KeyG22
	Undef1
	LightState
	KeyBD
	KeyL1
	KeyL2
	KeyL3
	KeyL4
	KeyM1
	KeyM2
	KeyM3
	KeyMR
	KeyLeft
	KeyRight
	KeyStick
	Undef2
	Light
	Light2
	Undef3
)

G13 keys

View Source
const (
	LEDM1 = 0x1
	LEDM2 = 0x2
	LEDM3 = 0x4
	LEDMR = 0x8
)

Variables

View Source
var Keys = []string{
	"G1",
	"G2",
	"G3",
	"G4",
	"G5",
	"G6",
	"G7",
	"G8",
	"G9",
	"G10",
	"G11",
	"G12",
	"G13",
	"G14",
	"G15",
	"G16",
	"G17",
	"G18",
	"G19",
	"G20",
	"G21",
	"G22",
	"Undef1",
	"LightState",
	"BD",
	"L1",
	"L2",
	"L3",
	"L4",
	"M1",
	"M2",
	"M3",
	"MR",
	"Left",
	"Right",
	"Stick",
	"Undef2",
	"Light",
	"Light2",
	"Undef3",
}

Functions

This section is empty.

Types

type G13

type G13 struct {
	KeyCh       chan KeyState
	StickCh     chan StickState
	BacklightCh chan bool
	LCD         *image.Gray16
	// contains filtered or unexported fields
}

G13 is the G13

func NewG13

func NewG13() (*G13, error)

NewG13 creates a new G13

func (*G13) AddString

func (g13 *G13) AddString(s string, x, y int)

func (*G13) AddStringx

func (g13 *G13) AddStringx(s string, x, y int)

func (*G13) ClearLCD

func (g13 *G13) ClearLCD()

func (*G13) Color

func (g13 *G13) Color() color.Color

func (*G13) DrawLCD

func (g13 *G13) DrawLCD()

func (*G13) SetColor

func (g13 *G13) SetColor(c color.Color) error

func (*G13) SetMLEDs

func (g13 *G13) SetMLEDs(leds byte)

type KeyState

type KeyState struct {
	Key  int
	Down bool
}

type StickState

type StickState struct {
	X int
	Y int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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