Documentation ¶
Index ¶
- func CachedPin(pin gpio.PinIO, reinforce int) gpio.PinIO
- type BaseSensor
- type CCS811Config
- type Device
- type DimmerConfig
- type ICCS811
- type IDimmer
- type IInput
- type IInputListener
- type IOutput
- type ISensor
- type ISensorValueListener
- type IShutter
- type IThermostat
- type InputConfig
- type OutputConfig
- type ShutterConfig
- type ShutterStateListener
- type ThermostatRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseSensor ¶
type BaseSensor struct { VUnit string // contains filtered or unexported fields }
BaseSensor is a default implementation of the ISensor interface
func (*BaseSensor) AddListener ¶
func (bs *BaseSensor) AddListener(listener ISensorValueListener)
func (*BaseSensor) NotifyListeners ¶
func (bs *BaseSensor) NotifyListeners(value float64)
func (*BaseSensor) Unit ¶
func (bs *BaseSensor) Unit() string
type CCS811Config ¶
type CCS811Config struct { Address int `ini:"address"` Bus string `ini:"i2cbus"` Duration int `ini:"duration"` }
CCS811Config holds the configuration data of a sensor
type Device ¶
type Device interface { // Tick is called periodically Tick() error // Initialize is called upon startup Initialize() error }
Device is the interface of a periodically operated peripheral controlled by wscgo.
type DimmerConfig ¶
type DimmerConfig struct { PwmPin string `ini:"pwmpin"` OnPin string `ini:"onpin"` Speed int32 `ini:"speed"` OnDelay int `ini:"ondelay"` Inverted bool `ini:"inverted"` }
DimmerConfig is the configuration structure for a dimmer device
type ICCS811 ¶
type ICCS811 interface { Device // ECO2 returns the sensor interface to the "equivalent CO2" measurement value ECO2() ISensor // VOC returns the sensor interface to the "Total Volatile Organic Compound" measuremenr value VOC() ISensor }
ICCS811 denotes a CCS811 environmental sensor
func CreateCCS811 ¶
func CreateCCS811(config *CCS811Config) (ICCS811, error)
CreateCCS811 configures connection the sensor
type IDimmer ¶
IDimmer is a device representing a dimmed light
func CreateDimmer ¶
func CreateDimmer(config *DimmerConfig) (IDimmer, error)
CreateDimmer configures a dimmer device
type IInput ¶
type IInput interface { Device AddListener(IInputListener) }
IInput denotes a pin configued for digital input
func CreateInput ¶
func CreateInput(config *InputConfig) (IInput, error)
CreateInput configures an IInputDevice
type IInputListener ¶
type IInputListener func(bool)
IInputListener function is called on changes of input
type IOutput ¶
IOutput poin configured as active output
func CreateOutput ¶
func CreateOutput(config *OutputConfig) (IOutput, error)
CreateOutput configures an IOutput device
type ISensor ¶
type ISensor interface { // AddListener registers a measurement callback AddListener(ISensorValueListener) // Unit returns the human-readable representation of the measurement unit Unit() string }
ISensor is the interface of a single value sensor
type ISensorValueListener ¶
type ISensorValueListener func(float64)
ISensorValueListener is the signature to the callback called on measurements
type IShutter ¶
type IShutter interface { Device Open() Close() OpenOrStop() CloseOrStop() MoveBy(int) Stop() GetRange() int AddListener(ShutterStateListener) }
IShutter is the interface of a shutter device
func CreateShutter ¶
func CreateShutter(config *ShutterConfig) (IShutter, error)
CreateShutter configures a shutter device
type IThermostat ¶
type IThermostat interface { Device TemperatureRange() ThermostatRange SetTargetTemperature(float64) TargetTemperature() ISensor Temperature() ISensor }
type InputConfig ¶
type InputConfig struct {
Pin string `ini:"pin"`
}
InputConfig holds configuration for an IIinput device
type OutputConfig ¶
type OutputConfig struct {
Pin string `ini:"pin"`
}
OutputConfig hods the configuration for an IOutput device
type ShutterConfig ¶
type ShutterConfig struct { UpPin string `ini:"uppin"` DownPin string `ini:"downpin"` DirSwitchWait int `ini:"dirswitchwait"` Range int `ini:"range"` Inverted bool `ini:"inverted"` }
ShutterConfig holds the configuration values for a shutter
type ShutterStateListener ¶
type ShutterStateListener func(int)
ShutterStateListener is the signature for state callback