Documentation ¶
Index ¶
- Constants
- func ToCppVarName(s string) string
- type ArduinoErrorConfig
- func (aec *ArduinoErrorConfig) FromFile(path string) error
- func (aec *ArduinoErrorConfig) FromReader(r io.Reader) error
- func (aec *ArduinoErrorConfig) GetDescription(errorCode string) (*ArduinoErrorDescription, error)
- func (aec *ArduinoErrorConfig) ToCppFile(filePath, name string) error
- func (aec *ArduinoErrorConfig) WriteToFile(path string) error
- type ArduinoErrorDescription
- type Config
- type DeviceConfig
- type JSONFileReadWriter
- type PanelConfig
- type SerialConfig
- type StreamConfig
- type TileConfig
- type TileConfigSnakeGenerator
- type TileConfigs
- type Type
Constants ¶
const ( // Print debug print device Print = Type("print") // Serial high level serial tty device Serial = Type("serial") )
const MapFormatString = "%2d"
MapFormatString is the string to format the map[string]int led position mapping
Variables ¶
This section is empty.
Functions ¶
func ToCppVarName ¶ added in v0.1.4
ToCppVarName converts a string with spaces into a valid variable name
Types ¶
type ArduinoErrorConfig ¶ added in v0.1.4
type ArduinoErrorConfig map[string]ArduinoErrorDescription
ArduinoErrorConfig is the arduino config error map
func NewArduinoErrorConfigFromPath ¶ added in v0.1.4
func NewArduinoErrorConfigFromPath(path string) (*ArduinoErrorConfig, error)
NewArduinoErrorConfigFromPath reads a ArduinoErrorConfig from file
func (*ArduinoErrorConfig) FromFile ¶ added in v0.1.4
func (aec *ArduinoErrorConfig) FromFile(path string) error
FromFile reads the config from a file at path
func (*ArduinoErrorConfig) FromReader ¶ added in v0.1.4
func (aec *ArduinoErrorConfig) FromReader(r io.Reader) error
FromReader decodes the config from io.Reader
func (*ArduinoErrorConfig) GetDescription ¶ added in v0.1.4
func (aec *ArduinoErrorConfig) GetDescription(errorCode string) (*ArduinoErrorDescription, error)
GetDescription returns the ArduinoErrorDescription for the key or an error on unknown key
func (*ArduinoErrorConfig) ToCppFile ¶ added in v0.1.4
func (aec *ArduinoErrorConfig) ToCppFile(filePath, name string) error
ToCppFile returns a []byte string to write to a file
func (*ArduinoErrorConfig) WriteToFile ¶ added in v0.1.4
func (aec *ArduinoErrorConfig) WriteToFile(path string) error
WriteToFile writes the config to a file at path
type ArduinoErrorDescription ¶ added in v0.1.4
type ArduinoErrorDescription struct { Name string `json:"name"` Param string `json:"param,omitempty"` Character string `json:"character,omitempty"` }
ArduinoErrorDescription is the description of an single arduino error and its parameters
type Config ¶
type Config interface { JSONFileReadWriter json.Unmarshaler GetTileConfigs() TileConfigs GetDeviceConfig() *DeviceConfig }
Config is the internal full config
func NewConfigFromPanelConfigPath ¶
NewConfigFromPanelConfigPath generates a new internal config struct from panel config file
type DeviceConfig ¶ added in v0.1.4
type DeviceConfig struct { Type Type `json:"type"` SerialConfig *SerialConfig `json:"serialConfig,omitempty"` }
DeviceConfig is the config of the type of device
func NewDeviceConfigFromPath ¶ added in v0.1.4
func NewDeviceConfigFromPath(path string) (*DeviceConfig, error)
func (*DeviceConfig) FromFile ¶ added in v0.1.4
func (dc *DeviceConfig) FromFile(path string) error
FromFile reads the config from a file at path
func (*DeviceConfig) FromReader ¶ added in v0.1.4
func (dc *DeviceConfig) FromReader(r io.Reader) error
FromReader decodes the config from io.Reader
func (*DeviceConfig) WriteToFile ¶ added in v0.1.4
func (dc *DeviceConfig) WriteToFile(path string) error
WriteToFile writes the config to a file at path
type JSONFileReadWriter ¶ added in v0.1.4
type PanelConfig ¶
type PanelConfig struct { TileConfigPaths []string `json:"tileConfigPaths"` DeviceConfigPath string `json:"deviceConfigPath"` ArduinoErrorConfigPath string `json:"arduinoErrorConfigPath,omitempty"` }
PanelConfig is the global panel config
func (*PanelConfig) FromFile ¶ added in v0.1.4
func (pc *PanelConfig) FromFile(path string) error
FromFile reads the config from a file at path
func (*PanelConfig) FromReader ¶ added in v0.1.4
func (pc *PanelConfig) FromReader(r io.Reader) error
FromReader decodes the config from io.Reader
func (*PanelConfig) WriteToFile ¶ added in v0.1.4
func (pc *PanelConfig) WriteToFile(path string) error
WriteToFile writes the config to a file at path
type SerialConfig ¶ added in v0.1.4
type SerialConfig struct { StreamConfig *StreamConfig `json:"streamConfig"` ArduinoErrorConfig *ArduinoErrorConfig `json:"arduinoErrorConfig,omitempty"` Verbose bool `json:"verbose"` ReadBufferSize int `json:"readBufferSize"` InitSleepTime time.Duration `json:"initSleepTime,omitempty"` LatchSleepTime time.Duration `json:"latchSleepTime,omitempty"` CommandSleepTime time.Duration `json:"commandSleepTime,omitempty"` }
func (*SerialConfig) MarshalJSON ¶ added in v0.1.4
func (sc *SerialConfig) MarshalJSON() ([]byte, error)
func (*SerialConfig) UnmarshalJSON ¶ added in v0.1.4
func (sc *SerialConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSONDuration
type StreamConfig ¶ added in v0.1.4
type StreamConfig struct { Name string `json:"name"` Baud int `json:"baud"` Size byte `json:"size"` ReadTimeout time.Duration `json:"readTimeout,omitempty"` Parity serial.Parity `json:"parity,omitempty"` StopBits serial.StopBits `json:"stopBits,omitempty"` }
func (*StreamConfig) MarshalJSON ¶ added in v0.1.4
func (sc *StreamConfig) MarshalJSON() ([]byte, error)
func (*StreamConfig) ToStreamSerialConfig ¶ added in v0.1.4
func (sc *StreamConfig) ToStreamSerialConfig() *serial.Config
func (*StreamConfig) UnmarshalJSON ¶ added in v0.1.4
func (sc *StreamConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSONDuration
type TileConfig ¶
type TileConfig interface { JSONFileReadWriter NumHardwarePixel() int GetBounds() image.Rectangle GetConnectionOrder() int GetLedStripeMap() map[string]int }
TileConfig is the config of a tile or led module
func NewTileConfigFromPath ¶
func NewTileConfigFromPath(path string) (TileConfig, error)
NewTileConfigFromPath creates a new tile from config file path
func NewTileConfigSnakeMapFile ¶
func NewTileConfigSnakeMapFile(g TileConfigSnakeGenerator) (TileConfig, error)
NewTileConfigSnakeMapFile creates a new snake tile config
type TileConfigSnakeGenerator ¶
type TileConfigSnakeGenerator struct {
// contains filtered or unexported fields
}
TileConfigSnakeGenerator struct to generate a tile config with snake pattern
type TileConfigs ¶
type TileConfigs interface { sort.Interface GetSlice() []TileConfig Set(index int, tileConfig *tileConfig) }
TileConfigs is a slice of TileConfig