led

package module
v0.0.0-...-6c26119 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBrightness = 255

	NoColorCorrection      ColorCorrection = 0xFFFFFF
	GenericColorCorrection ColorCorrection = 0xFFB0F0

	DefaultColorTemperature            ColorTemperature = 0xFFFFFF
	TemperatureCandle                  ColorTemperature = 0xFF9329 // 1900 Kelvin
	TemperatureTungsten40W             ColorTemperature = 0xFFC58F // 2600 Kelvin
	TemperatureTungsten100W            ColorTemperature = 0xFFD6AA // 2850 Kelvin
	TemperatureHalogen                 ColorTemperature = 0xFFF1E0 // 3200 Kelvin
	TemperatureCarbonArc               ColorTemperature = 0xFFFAF4 // 5200 Kelvin
	TemperatureHighNoonSun             ColorTemperature = 0xFFFFFB // 5400 Kelvin
	TemperatureDirectSunlight          ColorTemperature = 0xFFFFFF // 6000 Kelvin
	TemperatureOvercastSky             ColorTemperature = 0xC9E2FF // 7000 Kelvin
	TemperatureClearBlueSky            ColorTemperature = 0x409CFF // 20000 Kelvin
	TemperatureWarmFluorescent         ColorTemperature = 0xFFF4E5
	TemperatureStandardFluorescent     ColorTemperature = 0xF4FFFA
	TemperatureCoolWhiteFluorescent    ColorTemperature = 0xD4EBFF
	TemperatureFullSpectrumFluorescent ColorTemperature = 0xFFF4F2
	TemperatureGrowLightFluorescent    ColorTemperature = 0xFFEFF7
	TemperatureBlackLightFluorescent   ColorTemperature = 0xA700FF
	TemperatureMercuryVapor            ColorTemperature = 0xD8F7FF
	TemperatureSodiumVapor             ColorTemperature = 0xFFD1B2
	TemperatureMetalHalide             ColorTemperature = 0xF2FCFF
	TemperatureHighPressureSodium      ColorTemperature = 0xFFB74C
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimateFunc

type AnimateFunc func(leds []color.RGB)

AnimateFunc receives the array of LEDs in the strip and can modify individual elements.

type ColorCorrection

type ColorCorrection uint32

ColorCorrection defines adjust to LED output color.

type ColorTemperature

type ColorTemperature uint32

ColorTemperature defines color temperature of LED output color.

type Controller

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

Controller implements a LEDs strip controller.

func NewController

func NewController(d ws2812.Device, num uint8, opts ...Option) *Controller

NewController returns a new LEDs strip Controller instance, configured with d output WS2812 device and given num of LEDs.

func (*Controller) Animate

func (c *Controller) Animate(fn AnimateFunc) *Controller

Animate method executes the given fn, which receives access the array of LEDs in the strip and can modify LED data.

func (*Controller) Brightness

func (c *Controller) Brightness() uint8

Brightness returns master brightness value.

func (*Controller) Clear

func (c *Controller) Clear() *Controller

Clear sets all LEDs to the black color (turns them off). This method does not output LEDs data.

func (*Controller) ColorCorrection

func (c *Controller) ColorCorrection() ColorCorrection

ColorCorrection returns color correction value.

func (*Controller) ColorTemperature

func (c *Controller) ColorTemperature() ColorTemperature

ColorTemperature returns color temperature value.

func (*Controller) FillColor

func (c *Controller) FillColor(cl color.RGB) *Controller

FillColor sets all LEDs to the given RGB color. This method does not output LEDs data.

func (*Controller) NumLEDs

func (c *Controller) NumLEDs() int

NumLEDs returns a number of configured LEDs in the strip.

func (*Controller) Output

func (c *Controller) Output() error

Output writes LEDs data to the WS2812 device, with the default brightness.

func (*Controller) OutputWithBrightness

func (c *Controller) OutputWithBrightness(brightness uint8) error

OutputWithBrightness writes LEDs data to the WS2812 device, with the given brightness.

func (*Controller) SetBrightness

func (c *Controller) SetBrightness(brightness uint8) *Controller

SetBrightness sets master brightness value. This method does not output LEDs data.

func (*Controller) SetColorCorrection

func (c *Controller) SetColorCorrection(cc ColorCorrection) *Controller

SetColorCorrection sets color correction value, which is applied to all LEDs on output. This method does not output LEDs data.

func (*Controller) SetColorTemperature

func (c *Controller) SetColorTemperature(ct ColorTemperature) *Controller

SetColorTemperature sets color temperature value, which is applied to all LEDs on output. This method does not output LEDs data.

type Option

type Option func(c *Controller)

Option represents a Controller option.

func WithBrightness

func WithBrightness(brightness uint8) Option

WithBrightness sets custom brightness value to the Controller.

func WithColorCorrection

func WithColorCorrection(cc ColorCorrection) Option

WithColorCorrection sets custom color correction value to the Controller.

func WithColorTemperature

func WithColorTemperature(ct ColorTemperature) Option

WithColorTemperature sets custom color temperature value to the Controller.

Directories

Path Synopsis
Package color defines LED RGB color models and provides color utility methods.
Package color defines LED RGB color models and provides color utility methods.

Jump to

Keyboard shortcuts

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