neopixel

package
v0.0.0-...-6db7017 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChandelierLarge

type ChandelierLarge struct {
	SmallRings []*Ring
	LargeRings []*Ring
	Top        space.Vector // Mounting location for the chandilier
}

ChandelierLarge is a Large Chandelier (6 rings)

func NewChandelierLarge

func NewChandelierLarge(top space.Vector, theta float64) ChandelierLarge

NewChandelierLarge returns a new Large Chandelier

func (ChandelierLarge) Allocate

func (c ChandelierLarge) Allocate(feeling effect.Vibe)

Allocate takes Vibes and Distributes them to the rings

func (ChandelierLarge) PruneEffects

func (c ChandelierLarge) PruneEffects(t time.Time)

PruneEffects removes all effects from the rigns which have ended before a time t

func (ChandelierLarge) Render

func (c ChandelierLarge) Render(t time.Time) []*effect.Light

Render calls render on each of the rings and then appends all the lights

type ChandelierMedium

type ChandelierMedium struct {
	SmallRings []*Ring
	LargeRings []*Ring
	Top        space.Vector // Mounting location for the chandilier
}

ChandelierMedium is a Medium Chandelier (4 rings)

func NewChandelierMedium

func NewChandelierMedium(top space.Vector, theta float64) ChandelierMedium

NewChandelierMedium returns a new Medium Chandelier

func (ChandelierMedium) Allocate

func (c ChandelierMedium) Allocate(feeling effect.Vibe)

Allocate takes Vibes and Distributes them to the rings

func (ChandelierMedium) PruneEffects

func (c ChandelierMedium) PruneEffects(t time.Time)

PruneEffects removes all effects from the rigns which have ended before a time t

func (ChandelierMedium) Render

func (c ChandelierMedium) Render(t time.Time) []*effect.Light

Render calls render on each of the rings and then appends all the lights

type ChandelierSmall

type ChandelierSmall struct {
	SmallRing *Ring
	LargeRing *Ring
	Top       space.Vector // Mounting location for the chandilier
}

ChandelierSmall is a Small Chandelier (2 rings)

func NewChandelierSmall

func NewChandelierSmall(top space.Vector, theta float64) ChandelierSmall

NewChandelierSmall returns a new Small Chandelier

func (ChandelierSmall) Allocate

func (c ChandelierSmall) Allocate(feeling effect.Vibe)

Allocate takes Vibes and Distributes them to the rings

func (ChandelierSmall) PruneEffects

func (c ChandelierSmall) PruneEffects(t time.Time)

PruneEffects removes all effects from the rigns which have ended before a time t

func (ChandelierSmall) Render

func (c ChandelierSmall) Render(t time.Time) []*effect.Light

Render calls render on each of the rings and then appends all the lights

type Line

type Line struct {
	// Row provides the implementation of effect.Allocater
	*Row

	// Start is the location of the first LED in the Line
	Start space.Vector

	// Theta is rotation about Z which the line continues at
	Theta float64
	// Phi is tilt from Z which the line continues at
	Phi float64
}

Line is a representation of a strait line of neopixels. Line implements effect.Device

func NewBar

func NewBar(
	start space.Vector,
	theta float64,
	phi float64,
) *Line

func NewLine

func NewLine(
	start space.Vector,
	theta float64,
	phi float64,
	length int,
) *Line

NewLine creates a new Line

type Ring

type Ring struct {
	// Row provides the implementation of effect.Allocater
	*Row

	// Center is the point about which the Ring is centered
	Center space.Vector
	// Radius is the distance from the Center to any LED
	Radius float64

	// Theta is the rotation about Z of the first LED
	Theta float64
	// Phi is the tilt from Z of the first LED
	Phi float64
}

Ring is a representation of a ring of neopixels. Ring implements effect.Device

func NewRing

func NewRing(
	center space.Vector,
	radius float64,
	theta float64,
	phi float64,
) *Ring

NewRing creates a new Ring

type Row

type Row struct {
	// Length is the number of LEDs in the Row
	Length int

	// Effects is the array of effects from materializing Vibes in calls to Allocate
	Effects []effect.Effect

	GetLights func() []*effect.Light
}

Row holds basic functionality for any neoPixelDevice Row implements effect.Allocater Row partially implements effect.Device with PruneEffect

func NewRow

func NewRow(
	length int,
	getLights func() []*effect.Light,
) *Row

NewRow creates a new Row

func (*Row) Allocate

func (d *Row) Allocate(feeling effect.Vibe)

Allocate takes Vibes and Materializes them into effects This is the bottom of the Allocater hiarchy for neoPixels

func (*Row) PruneEffects

func (d *Row) PruneEffects(t time.Time)

PruneEffects removes all effects which have ended before a time t

func (*Row) Render

func (d *Row) Render(t time.Time) []*effect.Light

Render uses the stored effects from allocate(feeling)s to produce an array of lights

Jump to

Keyboard shortcuts

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