driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEYBOARD_REPORT_ID   = 0x04
	KEYS_PER_ROW         = 59   // According to their dumb layout
	DEFAULT_ACTUATION    = 0x14 // 0x14 is 2.0mm, there should be always 59 keys!!! (unless 3rd row)
	CUSTOM_COLOR_PADDING = 0x80 // TODO: support
	COLORS_PER_PACKET    = 13   // hex, max 13 keys per packet TODO: support
)
View Source
const (
	PACKET_IDENTITY    = 0xA0
	PACKET_LEDMODESEL  = 0xAE
	PACKET_MODIFYKEY   = 0xB6
	PACKET_TURBORT     = 0xB5
	PACKET_KEYTRACKING = 0xB7
)
View Source
const (
	KEYBOARD_A75PRO = "A75" // We don't give a damn about pro, they work pretty much the same
	KEYBOARD_A75    = "A75"
	KEYBOARD_G65    = "G65"
	KEYBOARD_G60    = "G60"
	KEYBOARD_G75    = "G75"
)
View Source
const (
	SEQUENCE_OFF = 0x00

	SEQUENCE_ALWAYS          = 0x02
	SEQUENCE_SPECTRUM        = 0x03
	SEQUENCE_BREATH          = 0x04
	SEQUENCE_PRESS           = 0x05
	SEQUENCE_STARS           = 0x06
	SEQUENCE_WAVE            = 0x07
	SEQUENCE_SURF            = 0x08
	SEQUENCE_SURFDOWN        = 0x09
	SEQUENCE_RIPPLE          = 0x0A
	SEQUENCE_FISH            = 0x0B
	SEQUENCE_FOUNTAIN        = 0x0C
	SEQUENCE_TRAFFIC         = 0x0D
	SEQUENCE_SNAKE           = 0x0E
	SEQUENCE_SURF_REPEAT     = 0x0F
	SEQUENCE_SURF_CROSS      = 0x10
	SEQUENCE_LASER_KEY       = 0x11
	SEQUENCE_FOUNTAIN_RANDOM = 0x12
	SEQUENCE_CUSTOM          = 0x13
)

Variables

View Source
var CHARACTER_KEYS = []int{
	43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
	64, 65, 66, 67, 68, 69, 70, 71, 72,
	86, 87, 88, 89, 90, 91, 92,
}
View Source
var KEYBOARD_LAYOUT = []string{}/* 126 elements not displayed */

Imagine this is a const

View Source
var NUMERALS_KEYS = []int{22, 23, 24, 25, 26, 27, 28, 29, 30, 31}
View Source
var WASD_KEYS = []int{44, 64, 65, 66}

Functions

func ActuationFloatToByte

func ActuationFloatToByte(actuation float32) byte

func BoolToByte

func BoolToByte(b bool) byte

func BuildIdentity

func BuildIdentity() []byte

func BuildKeyTracking

func BuildKeyTracking(track bool) []byte

func BuildLEDModeSelect

func BuildLEDModeSelect(direction, sequence, speed, brightness, rgb byte) []byte

func BuildLEDModeSelectTurbo

func BuildLEDModeSelectTurbo(direction, sequence, speed, brightness, rgb byte) []byte

func BuildModifyRow

func BuildModifyRow(row uint8, keys []byte, defaultValue byte) []byte

Row 0 is the first row, row 1 is the second row, and row 2 is the third row

func BuildModifyRowActuation

func BuildModifyRowActuation(row uint8, keys []byte) []byte

func BuildModifyRowDownstroke

func BuildModifyRowDownstroke(row uint8, keys []byte) []byte

func BuildModifyRowUpstroke

func BuildModifyRowUpstroke(row uint8, keys []byte) []byte

func BuildRapidTriggerTurbo

func BuildRapidTriggerTurbo(rt, turbo bool) []byte

func DetectKeyboardModel

func DetectKeyboardModel(modelBytes []byte) (string, int)

func GetIndexByKey

func GetIndexByKey(key string) int

func GetKeyByIndex

func GetKeyByIndex(index int) string

func GetRowByIndex

func GetRowByIndex(index int) int

Types

type DDKeyboardIdentity

type DDKeyboardIdentity struct {
	KeyboardModel string
	KeyboardType  uint8

	FirmwareVersion string
	Turbo           bool
	RapidTrigger    bool
}

type DDLight

type DDLight struct {
	Direction  byte
	Speed      byte
	Sequence   byte
	Brightness byte
}

type DDPacket

type DDPacket struct {
	Packet uint8
	Data   []byte
}

type DrunkDeerController

type DrunkDeerController struct {
	Light *DDLight
	// contains filtered or unexported fields
}

func NewDrunkDeerController

func NewDrunkDeerController(device *hid.Device) *DrunkDeerController

func (*DrunkDeerController) Close

func (d *DrunkDeerController) Close() error

func (*DrunkDeerController) GetActuations

func (d *DrunkDeerController) GetActuations() []byte

func (*DrunkDeerController) GetIdentity

func (d *DrunkDeerController) GetIdentity() *DDKeyboardIdentity

func (*DrunkDeerController) LoadActuations

func (d *DrunkDeerController) LoadActuations(actuations []byte)

func (*DrunkDeerController) LoadDownstrokes

func (d *DrunkDeerController) LoadDownstrokes(downstrokes []byte)

func (*DrunkDeerController) LoadUpstrokes

func (d *DrunkDeerController) LoadUpstrokes(upstrokes []byte)

func (*DrunkDeerController) Log

func (d *DrunkDeerController) Log(str string, v ...interface{})

func (*DrunkDeerController) ModifyActuationsByIndexes

func (d *DrunkDeerController) ModifyActuationsByIndexes(indexes []int, actuation byte)

func (*DrunkDeerController) ModifyActuationsByNames

func (d *DrunkDeerController) ModifyActuationsByNames(names []string, actuations byte)

#region Modifiers

func (*DrunkDeerController) ModifyAllActuations

func (d *DrunkDeerController) ModifyAllActuations(actuation byte)

func (*DrunkDeerController) QueuePacket

func (d *DrunkDeerController) QueuePacket(p []byte)

func (*DrunkDeerController) SendDownstrokes

func (d *DrunkDeerController) SendDownstrokes(row uint8, keys []byte)

func (*DrunkDeerController) SendIdentity

func (d *DrunkDeerController) SendIdentity()

#region Packet senders

func (*DrunkDeerController) SendLEDModeSelect

func (d *DrunkDeerController) SendLEDModeSelect(direction, sequence, speed, brightness, rgb byte)

func (*DrunkDeerController) SendLEDModeSelectTurbo

func (d *DrunkDeerController) SendLEDModeSelectTurbo(direction, sequence, speed, brightness, rgb byte)

func (*DrunkDeerController) SendModifyRow

func (d *DrunkDeerController) SendModifyRow(row uint8, keys []byte)

func (*DrunkDeerController) SendRapidTriggerTurbo

func (d *DrunkDeerController) SendRapidTriggerTurbo(rt, turbo bool)

func (*DrunkDeerController) SendUpstrokes

func (d *DrunkDeerController) SendUpstrokes(row uint8, keys []byte)

func (*DrunkDeerController) SetDebug

func (d *DrunkDeerController) SetDebug(debug bool)

func (*DrunkDeerController) WriteDefaults

func (d *DrunkDeerController) WriteDefaults()

Jump to

Keyboard shortcuts

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