wally

package
v0.0.0-...-b05bffa Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DFUFlash

func DFUFlash(s *State)

func GetAppVersion

func GetAppVersion() string

GetAppVersion returns the current version number.

func TeensyFlash

func TeensyFlash(s *State)

TeensyFlash flashes Teensy boards. It opens the firmware file at the provided path, checks its integrity, wait for the keyboard to be in Flash mode, flashes it, and reboots the board.

Types

type Device

type Device struct {
	Model Model `json:"model"` // 0 - planck // 1 - ergodox // 2 - moonlander
	Bus   int   `json:"bus"`
	Port  int   `json:"port"`
}

func ProbeDevices

func ProbeDevices(s *State) []Device

type FlashProgress

type FlashProgress struct {
	Total int `json:"total"` // total of firmware bytes to send
	Sent  int `json:"sent"`  // total of bytes sent
}

FlashProgress represents the current flashing state, it gets updated by the flashing methods.

type Model

type Model int

The Model type encodes which type of keyboard is being flashed. Three associated constants are defined for this type: Planck, ErgoDox, and Moonlander

const (
	Planck Model = iota
	ErgoDox
	Moonlander
)

type State

type State struct {
	AppVersion    string        `json:"appVersion"`
	Device        Device        `json:"device"`        // The user selected usb device
	Devices       []Device      `json:"devices"`       // The list of usb devices connected
	Step          Step          `json:"step"`          // The current flashing process step
	FirmwarePath  string        `json:"firmwarePath"`  // The firmware absolute Path selected by the user
	FlashProgress FlashProgress `json:"flashProgress"` // The Flashing state progress
	Logs          []stateLog    `json:"logs"`          // Log object
}

State represents the global state of the application

func NewState

func NewState(step Step, firmwarePath string) (s *State, err error)

func (*State) CompleteFlash

func (s *State) CompleteFlash()

func (*State) FlashFirmware

func (s *State) FlashFirmware()

func (*State) Log

func (s *State) Log(level string, message string)

func (*State) ProbeDevices

func (s *State) ProbeDevices()

func (*State) ResetState

func (s *State) ResetState()

func (*State) SelectDevice

func (s *State) SelectDevice(model Model, bus int, port int)

func (*State) SelectFirmwareWithData

func (s *State) SelectFirmwareWithData(data string)

type Step

type Step int8

Step indicates which step of the firmware flashing process is currently taking place.

const (
	Probing        Step = iota // probing keyboard
	SelectKeyboard             // select keyboard
	FirmwareFile               // select firmware file
	Waiting                    // waiting for keyboard reset
	Flashing                   // flashing
	Complete                   // complete
)

Jump to

Keyboard shortcuts

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