Documentation ¶
Index ¶
- Constants
- func DefaultCPUReset() error
- func DefaultEnterBootloader() error
- type Backlight
- type BacklightColorStrip
- type BacklightDriver
- type BacklightLevel
- type BacklightMode
- type BootloaderError
- type ColorPixeler
- type ColorStrip
- type ColorWriter
- type ConsumerKey
- type Encoder
- type EncoderPos
- type Encoders
- type EncodersSubscriber
- type EncodersSubscriberFunc
- type EnterBootloaderFunc
- type Event
- type EventReceiver
- type EventReceiverFunc
- type FsErr
- type Host
- type KeyAction
- type KeyActionFunc
- type Keyboard
- func (kbd *Keyboard) ActiveLayer() uint8
- func (kbd *Keyboard) AddEventReceiver(receiver EventReceiver)
- func (kbd *Keyboard) BacklightColor() hsv.Color
- func (kbd *Keyboard) BacklightDriver() BacklightDriver
- func (kbd *Keyboard) BacklightEnabled() bool
- func (kbd *Keyboard) BacklightMode() BacklightMode
- func (kbd *Keyboard) BacklightUpdate(mode BacklightMode, color hsv.Color, force bool)
- func (kbd *Keyboard) CLI() *console.Console
- func (kbd *Keyboard) CPUReset() error
- func (kbd *Keyboard) ClearKeycodes()
- func (kbd *Keyboard) ConfigureFilesystem() (err error)
- func (kbd *Keyboard) EnableConsole(serialer Serialer, cmds ...console.Commands)
- func (kbd *Keyboard) EnterBootloader() error
- func (kbd *Keyboard) FS() tinyfs.Filesystem
- func (kbd *Keyboard) GetLayerCount() uint8
- func (kbd *Keyboard) GetMatrixRowState(idx int) uint32
- func (kbd *Keyboard) LEDs() LEDs
- func (kbd *Keyboard) LoadKeymapFromFile(filename string) (n int64, err error)
- func (kbd *Keyboard) LoadMacrosFromFile(filename string) (n int64, err error)
- func (kbd *Keyboard) MacrosEnabled() bool
- func (kbd *Keyboard) MapKey(layer, row, col int) keycodes.Keycode
- func (kbd *Keyboard) MatrixCols() uint8
- func (kbd *Keyboard) MatrixRows() uint8
- func (kbd *Keyboard) Modifiers() KeyboardModifier
- func (kbd *Keyboard) ProcessKeycode(key keycodes.Keycode, made bool)
- func (kbd *Keyboard) RTCInitialized() bool
- func (kbd *Keyboard) RTCSet(t time.Time) (err error)
- func (kbd *Keyboard) RTCTime() (time.Time, error)
- func (kbd *Keyboard) SaveKeymapToFile(filename string) (n int64, err error)
- func (kbd *Keyboard) SaveMacrosToFile(filename string) (n int64, err error)
- func (kbd *Keyboard) SetActiveLayer(index uint8)
- func (kbd *Keyboard) SetBacklight(bl Backlight)
- func (kbd *Keyboard) SetCPUResetFunc(fn EnterBootloaderFunc)
- func (kbd *Keyboard) SetEncoders(encs []Encoder, subscriber EncodersSubscriber)
- func (kbd *Keyboard) SetEnterBootloaderFunc(fn EnterBootloaderFunc)
- func (kbd *Keyboard) SetFS(fs tinyfs.Filesystem)
- func (kbd *Keyboard) SetKey(layer, row, col int, kc keycodes.Keycode) bool
- func (kbd *Keyboard) SetKeyAction(action KeyAction)
- func (kbd *Keyboard) SetMacroDriver(m MacrosDriver)
- func (kbd *Keyboard) SetRTC(dev RTC)
- func (kbd *Keyboard) Task()
- type KeyboardModifier
- type KeycodeProcessor
- type Keymap
- func (keymap Keymap) GetLayerCount() uint8
- func (keymap Keymap) GetMaxKeyCount() int
- func (keymap Keymap) MapKey(layer, row, col int) (kc keycodes.Keycode)
- func (keymap Keymap) NumCols() int
- func (keymap Keymap) NumRows() int
- func (keymap Keymap) ReadFrom(r io.Reader) (n int64, err error)
- func (keymap Keymap) SetKey(layer, row, col int, kc keycodes.Keycode) bool
- func (keymap Keymap) StoredSize() int
- func (keymap Keymap) WriteTo(w io.Writer) (n int64, err error)
- func (keymap Keymap) ZeroFill()
- type LED
- type LEDs
- type Layer
- type MacroCode
- type MacroError
- type Macros
- type MacrosDriver
- type Matrix
- func (m *Matrix) Cols() uint8
- func (m *Matrix) EncoderCount() int
- func (m *Matrix) GetRow(row uint8) Row
- func (m *Matrix) Ghosting() bool
- func (m *Matrix) HasGhostInRow(row uint8) bool
- func (m *Matrix) IsOn(row uint8, col uint8) bool
- func (m *Matrix) MapEncoder(idx int) (ccw Pos, cw Pos, ok bool)
- func (m *Matrix) Rows() uint8
- func (m *Matrix) Scan() (changed bool)
- func (m *Matrix) WithEncoders(encs ...EncoderPos) *Matrix
- func (m *Matrix) WithGhosting(hasGhosting bool) *Matrix
- type MouseButton
- type MouseKeys
- type MouseKeysConfig
- type Pos
- type RTC
- type RTCError
- type Report
- func (r *Report) Break(key keycodes.Keycode)
- func (r *Report) Keyboard(mod KeyboardModifier, keys ...byte)
- func (r *Report) Make(key keycodes.Keycode)
- func (r *Report) Mouse(buttons MouseButton, x int8, y int8, v int8, h int8)
- func (r *Report) String() string
- func (r *Report) Type() ReportType
- func (r *Report) WriteDebug(w io.Writer)
- type ReportType
- type Row
- type RowReader
- type RowReaderFunc
- type Serialer
Constants ¶
View Source
const MacroMagicPrefix uint8 = 1
Variables ¶
This section is empty.
Functions ¶
func DefaultCPUReset ¶
func DefaultCPUReset() error
func DefaultEnterBootloader ¶
func DefaultEnterBootloader() error
Types ¶
type Backlight ¶
type Backlight struct { // BacklightDriver implementation to use; if nil, backlight is disabled. Driver BacklightDriver // Steps is the number of "on" states in between the off and on states. // The default zero value is treated the same as a value of 1. // A value 1 means that only on/off are supported; any value higher than that // will be used to automatically calculate equal "steps" in between the off // and fully on state. Steps uint8 // Default backlight mode to use when not explicitly set DefaultMode BacklightMode // Default backlight level to use when not explicitly set DefaultLevel BacklightLevel // Whether or not backlight "breathing" is enabled SupportsBreathing bool // Whether or not to include "breathing" mode when iterating backlight steps IncludeBreathingInSteps bool // contains filtered or unexported fields }
type BacklightColorStrip ¶
type BacklightColorStrip struct { // ColorStrip ColorPixeler // Interval time.Duration // DoubleSyncHack is a temporary workaround for Macropad RP2040 DoubleSyncHack bool // contains filtered or unexported fields }
func (*BacklightColorStrip) Configure ¶
func (bl *BacklightColorStrip) Configure()
func (*BacklightColorStrip) SetBacklight ¶
func (bl *BacklightColorStrip) SetBacklight(mode BacklightMode, color hsv.Color)
func (*BacklightColorStrip) Task ¶
func (bl *BacklightColorStrip) Task()
type BacklightDriver ¶
type BacklightDriver interface { Configure() SetBacklight(mode BacklightMode, color hsv.Color) Task() }
type BacklightLevel ¶
type BacklightLevel uint8
type BacklightMode ¶
type BacklightMode uint8
const ( BacklightOff BacklightMode = iota BacklightOn BacklightBreathing )
type BootloaderError ¶
type BootloaderError int
const ( ErrBootloaderNotSet BootloaderError = iota + 1 ErrBootloaderNoDefault )
func (BootloaderError) Error ¶
func (err BootloaderError) Error() string
type ColorPixeler ¶
type ColorStrip ¶
type ColorStrip struct { Writer ColorWriter Pixels []color.RGBA }
func (*ColorStrip) NumPixels ¶
func (ind *ColorStrip) NumPixels() int
func (*ColorStrip) SyncPixels ¶
func (ind *ColorStrip) SyncPixels()
type ColorWriter ¶
type ConsumerKey ¶
type ConsumerKey uint16
type EncoderPos ¶
type EncodersSubscriber ¶
type EncodersSubscriberFunc ¶
func (EncodersSubscriberFunc) EncoderChanged ¶
func (fn EncodersSubscriberFunc) EncoderChanged(index int, clockwise bool)
type EnterBootloaderFunc ¶
type EnterBootloaderFunc func() error
type EventReceiver ¶
type EventReceiver interface { // ReceiveEvent is called by the keyboard task loop for matrix state change // events. Return value of true indicates that the event is considered to be // handled and should not be propagated for handling by the keyboard, and a // return value of false indicates the event should be processed normally. ReceiveEvent(ev Event) (bool, error) }
type EventReceiverFunc ¶
func (EventReceiverFunc) ReceiveEvent ¶
func (recv EventReceiverFunc) ReceiveEvent(ev Event) (bool, error)
type KeyActionFunc ¶
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
func (*Keyboard) ActiveLayer ¶
func (*Keyboard) AddEventReceiver ¶
func (kbd *Keyboard) AddEventReceiver(receiver EventReceiver)
func (*Keyboard) BacklightColor ¶
func (*Keyboard) BacklightDriver ¶
func (kbd *Keyboard) BacklightDriver() BacklightDriver
func (*Keyboard) BacklightEnabled ¶
func (*Keyboard) BacklightMode ¶
func (kbd *Keyboard) BacklightMode() BacklightMode
func (*Keyboard) BacklightUpdate ¶
func (kbd *Keyboard) BacklightUpdate(mode BacklightMode, color hsv.Color, force bool)
func (*Keyboard) ClearKeycodes ¶
func (kbd *Keyboard) ClearKeycodes()
func (*Keyboard) ConfigureFilesystem ¶
func (*Keyboard) EnableConsole ¶
func (*Keyboard) EnterBootloader ¶
func (*Keyboard) FS ¶
func (kbd *Keyboard) FS() tinyfs.Filesystem
func (*Keyboard) GetLayerCount ¶
func (*Keyboard) GetMatrixRowState ¶
func (*Keyboard) LoadKeymapFromFile ¶
LoadKeymapFromFile updates the current in-memory keymap from the filesystem
func (*Keyboard) LoadMacrosFromFile ¶
LoadMacrosFromFile updates the current in-memory macros from the filesystem
func (*Keyboard) MacrosEnabled ¶
func (*Keyboard) MatrixCols ¶
func (*Keyboard) MatrixRows ¶
func (*Keyboard) Modifiers ¶
func (kbd *Keyboard) Modifiers() KeyboardModifier
func (*Keyboard) ProcessKeycode ¶
func (*Keyboard) RTCInitialized ¶
func (*Keyboard) SaveKeymapToFile ¶
SaveKeymapToFile write the current in-memory keymap to the filesystem
func (*Keyboard) SaveMacrosToFile ¶
SaveMacrosToFile write the current in-memory macros to the filesystem
func (*Keyboard) SetActiveLayer ¶
func (*Keyboard) SetBacklight ¶
func (*Keyboard) SetCPUResetFunc ¶
func (kbd *Keyboard) SetCPUResetFunc(fn EnterBootloaderFunc)
func (*Keyboard) SetEncoders ¶
func (kbd *Keyboard) SetEncoders(encs []Encoder, subscriber EncodersSubscriber)
func (*Keyboard) SetEnterBootloaderFunc ¶
func (kbd *Keyboard) SetEnterBootloaderFunc(fn EnterBootloaderFunc)
func (*Keyboard) SetFS ¶
func (kbd *Keyboard) SetFS(fs tinyfs.Filesystem)
func (*Keyboard) SetKeyAction ¶
func (*Keyboard) SetMacroDriver ¶
func (kbd *Keyboard) SetMacroDriver(m MacrosDriver)
type KeyboardModifier ¶
type KeyboardModifier byte
const ( KbdModNone KeyboardModifier = 0x0 KbdModCtrlLeft KeyboardModifier = 1 << 0 KbdModShiftLeft KeyboardModifier = 1 << 1 KbdModAltLeft KeyboardModifier = 1 << 2 KbdModGuiLeft KeyboardModifier = 1 << 3 KbdModCtrlRight KeyboardModifier = 1 << 4 KbdModShiftRight KeyboardModifier = 1 << 5 KbdModAltRight KeyboardModifier = 1 << 6 KbdModGuiRight KeyboardModifier = 1 << 7 )
type KeycodeProcessor ¶
type KeycodeProcessor interface { ProcessKeycode(kc keycodes.Keycode, made bool) ClearKeycodes() Modifiers() KeyboardModifier }
type Keymap ¶
type Keymap []Layer
func (Keymap) GetLayerCount ¶
func (Keymap) GetMaxKeyCount ¶
func (Keymap) StoredSize ¶
type MacroError ¶
type MacroError uint8
const (
MacroErrInvalidNum MacroError = iota + 1
)
func (MacroError) Error ¶
func (err MacroError) Error() string
type Macros ¶
type Macros struct { // MacroDriver implementation to use; if nil, macros are disabled. Driver MacrosDriver }
type MacrosDriver ¶
type MacrosDriver interface { Configure() Count() uint8 RunMacro(macroNum uint8) (err error) Task(proc KeycodeProcessor) io.ReaderFrom io.WriterTo ZeroFill() }
func NewDefaultMacroDriver ¶
func NewDefaultMacroDriver(count uint8, bufferSize uint16) MacrosDriver
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
func (*Matrix) EncoderCount ¶
func (*Matrix) HasGhostInRow ¶
func (*Matrix) WithEncoders ¶
func (m *Matrix) WithEncoders(encs ...EncoderPos) *Matrix
func (*Matrix) WithGhosting ¶
type MouseButton ¶
type MouseButton byte
const ( MouseBtnLeft MouseButton = 0x01 MouseBtnRight MouseButton = 0x02 MouseBtnMiddle MouseButton = 0x04 )
type MouseKeys ¶
type MouseKeys struct {
// contains filtered or unexported fields
}
func NewMouseKeys ¶
func NewMouseKeys(config MouseKeysConfig) *MouseKeys
type MouseKeysConfig ¶
type MouseKeysConfig struct { MoveDelta uint16 MoveMaxSpeed uint16 MoveTimeToMax uint16 WheelDelta uint16 WheelMaxSpeed uint16 WheelTimeToMax uint16 Delay time.Duration Interval time.Duration }
func DefaultMouseKeysConfig ¶
func DefaultMouseKeysConfig() MouseKeysConfig
https://github.com/bgould/costar_tmk_keyboard/blob/master/config.h#L42-L49
type Report ¶
type Report [8]byte
func (*Report) Keyboard ¶
func (r *Report) Keyboard(mod KeyboardModifier, keys ...byte)
func (*Report) Type ¶
func (r *Report) Type() ReportType
func (*Report) WriteDebug ¶
type ReportType ¶
type ReportType byte
const ( RptKeyboard ReportType = 0x0 RptMouse ReportType = 0x2 RptConsumer ReportType = 0x3 )
func (ReportType) String ¶
func (t ReportType) String() string
type RowReaderFunc ¶
func (RowReaderFunc) ReadRow ¶
func (fn RowReaderFunc) ReadRow(rowIndex uint8) Row
type Serialer ¶
type Serialer interface { io.Writer io.ByteReader io.ByteWriter Buffered() int }
Source Files ¶
- actions.go
- backlight.go
- backlight_colorstrip.go
- bootloader.go
- bootloader_none.go
- colorstrip.go
- commands.go
- consumer.go
- encoders.go
- event.go
- filesystem.go
- keyboard.go
- keymap.go
- layers.go
- leds.go
- macrocode_string.go
- macros.go
- macros_default.go
- matrix.go
- mousekey.go
- report.go
- rgb.go
- row.go
- rtc.go
- runtime_none.go
- serial.go
- util.go
Click to show internal directories.
Click to hide internal directories.