Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventHandler ¶
func EventHandler(h func(sw.Switcher, sw.Device)) func(*MPSwitchGPIO)
EventHandler sets a callback function through which the bandswitch will report Events
func Switch ¶
func Switch(sc SwitchConfig) func(*MPSwitchGPIO)
Switch is a functional option to set the switch's configuration.
Types ¶
type MPSwitchGPIO ¶
MPSwitchGPIO contains the state and configuration of a multi purpose GPIO switch
func NewMPSwitchGPIO ¶
func NewMPSwitchGPIO(options ...func(*MPSwitchGPIO)) *MPSwitchGPIO
NewMPSwitchGPIO is the constructor for a Multi Purpose GPIO switch. The constructor takes functional arguments for configuring the MPSwitch.
func (*MPSwitchGPIO) Close ¶
func (g *MPSwitchGPIO) Close()
Close shutsdown the switch and sets all GPIO ports to false.
func (*MPSwitchGPIO) GetPort ¶
func (g *MPSwitchGPIO) GetPort(portName string) (sw.Port, error)
GetPort returns switch.Port struct containing the current state of the requested port.
func (*MPSwitchGPIO) Init ¶
func (g *MPSwitchGPIO) Init() error
Init intializes the Multi Purpose GPIO Switch. If your platform does not support GPIO, an error will be returned.
func (*MPSwitchGPIO) Name ¶
func (g *MPSwitchGPIO) Name() string
Name returns the Name of this Multi Purpose GPIO Switch
func (*MPSwitchGPIO) Serialize ¶
func (g *MPSwitchGPIO) Serialize() sw.Device
Serialize returns a switch.Device struct containing the current state and configuration of this MultiPurpose GPIO switch.
type PortConfig ¶
PortConfig describes a port which is a collection of gpio pins. This struct is injected through the functional option "Port" during construction of BandswitchGPIO.
type SwitchConfig ¶
type SwitchConfig struct { Name string Index int Exclusive bool Ports []PortConfig }
SwitchConfig describes a switch which is a collection of ports.