adalight

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 5 Imported by: 0

README

adalight

Go package for interacting with Adalight.

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 represents the top-level entrypoint to an Adalight based LED Strip

func New

func New(port string, baud int, ledCount int) *Controller

New creates and returns a new Strip to use

func (*Controller) Run

func (c *Controller) Run(e Effect) error

Run runs a given Effect

func (*Controller) Strip

func (c *Controller) Strip() *Strip

Strip returns the LED Strip model owned by this controller

type Effect

type Effect interface {
	Init(strip *Strip, fps int) (name string)
	Frame(n int) (done bool)
}

Effect is the interface for generic lighting effects.

Init performs Effect initialization, passing the underlying Strip object to the Effect, as well as the approximate number of frames per second the Effect will be run at. The Effect should return its name for logging/debugging purposes

Frame commands the Effect to update the Strip before it is written out to the hardware device. A frame count is provided.

type Strip

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

Strip represents an LED strip, and contains methods for interacting with the LEDs on the strip

func (*Strip) Length

func (s *Strip) Length() int

Length returns the length of the strip (number of LEDs)

func (*Strip) Set

func (s *Strip) Set(i int, c color.Color)

Set sets a specific pixel `i` to a given color value

func (*Strip) SetAll

func (s *Strip) SetAll(c color.Color)

SetAll sets all of the pixels on the strip to the given color.Color value

func (*Strip) SetAllRGB

func (s *Strip) SetAllRGB(rgb color.RGBA)

SetAllRGB sets all of the pixels on the strip to the given color.RGBA value

func (*Strip) SetRGB

func (s *Strip) SetRGB(i int, rgb color.RGBA)

SetRGB sets a specific pixel `i` to a given color.RGBA color value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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