lights

package
v0.0.0-...-09da918 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the controller for the lights

func NewController

func NewController(i2cBus string, boards []uint8) (*Controller, error)

NewController returns a new controller on the i2c bus

func (*Controller) Boards

func (c *Controller) Boards() []uint8

func (*Controller) IsOn

func (c *Controller) IsOn(addr internal.LightAddress) (bool, error)

IsOn returns true when light is on or false in the oposite case

func (*Controller) Reset

func (c *Controller) Reset() error

func (*Controller) Set

func (c *Controller) Set(addr internal.LightAddress, isON bool) (err error)

On turns on/off the light

func (*Controller) Subscribe

func (c *Controller) Subscribe(ch chan<- internal.PinState)

Subscribe returns a channel to subscribe for the light changes

type ControllerI

type ControllerI interface {
	Set(addr internal.LightAddress, isON bool) error
	IsOn(addr internal.LightAddress) (bool, error)
	Subscribe(chan<- internal.PinState)
	Boards() []uint8
	Reset() error
}

type TestController

type TestController struct {
	// contains filtered or unexported fields
}

TestController is a fake implementation for development without real board TestController always returns no error for the set command

func NewTestController

func NewTestController(boards []uint8) *TestController

func (*TestController) Boards

func (c *TestController) Boards() []uint8

func (*TestController) IsOn

func (c *TestController) IsOn(addr internal.LightAddress) (bool, error)

func (*TestController) Reset

func (c *TestController) Reset() error

func (*TestController) Set

func (c *TestController) Set(addr internal.LightAddress, isON bool) error

func (*TestController) Subscribe

func (c *TestController) Subscribe(ch chan<- internal.PinState)

Jump to

Keyboard shortcuts

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