Documentation ¶
Overview ¶
Package devices provides the pico-cs device and configuration types.
Index ¶
Constants ¶
const ( CtCS = "cs" CtLoco = "loco" )
Configuration Types
Variables ¶
var ReservedFctNames = []string{"dir", "speed"}
ReservedFctNames is the list of reserved function names which cannot be used in loco configurations.
Functions ¶
func HTTPHandler ¶ added in v0.7.2
func HTTPHandler(w http.ResponseWriter, r *http.Request)
HTTPHandler is a anlder function providing the main html index for the devices.
Types ¶
type CS ¶
type CS struct {
// contains filtered or unexported fields
}
A CS represents a command station.
type CSConfig ¶
type CSConfig struct { // command station name (used in topic) Name string `json:"name"` // pico_w host in case of WiFi TCP/IP connection Host string `json:"host"` // TCP/IP port (WiFi) or serial port (serial over USB) Port string `json:"port"` // filter of devices for which this command station should be a primary device Primary *Filter `json:"primary"` // filter of devices for which this command station should be a secondary device Secondary *Filter `json:"secondary"` // command station IO mapping (key is used in topic) IOs map[string]CSIOConfig `json:"ios"` }
CSConfig represents configuration data for a command station.
func NewCSConfig ¶ added in v0.7.2
func NewCSConfig() *CSConfig
NewCSConfig returns a new CSConfig instance.
type CSIOConfig ¶
type CSIOConfig struct { // command station GPIO GPIO uint `json:"gpio"` }
CSIOConfig represents configuration data for a command station IO.
type CSSet ¶
type CSSet struct {
// contains filtered or unexported fields
}
CSSet represents a set of command stations.
type Filter ¶
type Filter struct { // list of regular expressions defining which set of devices should be included Incls []string `json:"incls"` // list of regular expressions defining which set of devices should be excluded // excluding regular expressions do have precedence over including regular expressions Excls []string `json:"excls"` }
Filter represents an including and excluding list of device names.
type Loco ¶
type Loco struct {
// contains filtered or unexported fields
}
A Loco represents a loco.
type LocoConfig ¶
type LocoConfig struct { // loco name (used in topic) Name string `json:"name"` // loco decoder address Addr uint `json:"addr"` // loco function mapping (key is used in topic) Fcts map[string]LocoFctConfig `json:"fcts"` }
LocoConfig represents configuration data for a loco.
func NewLocoConfig ¶ added in v0.7.2
func NewLocoConfig() *LocoConfig
NewLocoConfig returns a new LocoConfig instance.
type LocoFctConfig ¶
type LocoFctConfig struct { // loco decoder function number No uint `json:"no"` }
LocoFctConfig represents configuration data for a loco function.
type LocoSet ¶
type LocoSet struct {
// contains filtered or unexported fields
}
LocoSet represents a set of locos.
func NewLocoSet ¶
NewLocoSet creates new loco set instance.