44 lines
877 B
Go
44 lines
877 B
Go
package hhkb
|
|
|
|
// Mode is the keyboard personality selected by the DIP switches.
|
|
type Mode byte
|
|
|
|
const (
|
|
ModeHHK Mode = iota
|
|
ModeMac
|
|
ModeLite
|
|
ModeSecret
|
|
)
|
|
|
|
func (m Mode) String() string {
|
|
switch m {
|
|
case ModeHHK:
|
|
return "HHK"
|
|
case ModeMac:
|
|
return "Mac"
|
|
case ModeLite:
|
|
return "Lite"
|
|
case ModeSecret:
|
|
return "Secret"
|
|
}
|
|
return "unknown"
|
|
}
|
|
|
|
// LayerLen is the size of one key layer. A key's number indexes directly into
|
|
// the layer to give its scancode.
|
|
const LayerLen = 128
|
|
|
|
// Layer holds the scancode assigned to every key on one layer.
|
|
type Layer [LayerLen]byte
|
|
|
|
// Key describes one physical key: its protocol key number, factory default
|
|
// scancode, visual row, and position/width in key units (as in QMK layouts,
|
|
// where 1.0 is a normal keycap). The key tables live in models.go.
|
|
type Key struct {
|
|
Num int
|
|
Def byte
|
|
Row int
|
|
X float64
|
|
W float64
|
|
}
|