ledstrip

package
v0.0.0-...-5790aad Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package ledstrip has control routines for LED strips Author: Tim Scheuermann (https://github.com/noxer)

Index

Constants

View Source
const (
	// WS2801 chip type ID
	WS2801 ChipType = 2801
	// WS2811 chip type ID
	WS2811 = 2811
	// WS2812 chip type ID
	WS2812 = 2812
)

Variables

View Source
var (
	// ColorMapRGB represents the standard color mapping (R->R, G->G, B->B)
	ColorMapRGB = [3]int{0, 1, 2}
	// ColorMapBGR represents the color mapping needed when red and blue are flipped
	ColorMapBGR = [3]int{2, 1, 0}
)

Functions

This section is empty.

Types

type ChipType

type ChipType uint16

ChipType represents different types of control chips.

type Color

type Color [3]byte

Color represents a three byte value (8 bit for red, green and blue respectively).

type LedStrip

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

LedStrip is a control structure for LED strips

func New

New creates a new LED strip control for the bricklet with 'uid'.

func (*LedStrip) CallbackFrameRendered

func (l *LedStrip) CallbackFrameRendered(handler func(uint16))

CallbackFrameRendered is a convenience function for registering a handler to be called when a frame has been rendered.

func (*LedStrip) GetChipType

func (l *LedStrip) GetChipType() (ChipType, error)

GetChipType returns the currently set type of the LEDs control chip.

func (*LedStrip) GetClockFrequency

func (l *LedStrip) GetClockFrequency() (uint32, error)

GetClockFrequency returns the currently used clock frequency.

func (*LedStrip) GetFrameDuration

func (l *LedStrip) GetFrameDuration() (uint16, error)

GetFrameDuration returns the currently set number of milliseconds between frames.

func (*LedStrip) GetIdentity

func (l *LedStrip) GetIdentity() (*helpers.BrickletIdentity, error)

GetIdentity returns the position information of the bricklet and its identifier.

func (*LedStrip) GetRGBValues

func (l *LedStrip) GetRGBValues(index uint16, length uint8) ([]Color, error)

GetRGBValues retrieves the currently set RGB values of the LED strip beginning from 'index' and up to 'length' values.

func (*LedStrip) GetSupplyVoltage

func (l *LedStrip) GetSupplyVoltage() (uint16, error)

GetSupplyVoltage returns the current voltage the LED strip's LEDs consume in mV.

func (*LedStrip) SetAllRGBValues

func (l *LedStrip) SetAllRGBValues(index uint16, colors []Color) error

SetAllRGBValues sets all color values beginning from 'index' to the values in 'colors'.

func (*LedStrip) SetChipType

func (l *LedStrip) SetChipType(chipType ChipType) error

SetChipType sets the type of the LEDs control chip.

func (*LedStrip) SetClockFrequency

func (l *LedStrip) SetClockFrequency(frequency uint32) error

SetClockFrequency sets the frequency of the clock in hertz. Allowed values range from 10000 (10kHz) to 2000000 (2MHz). The bricklet chooses the next possible frequency automatically.

func (*LedStrip) SetColorMapping

func (l *LedStrip) SetColorMapping(mapping [3]int)

SetColorMapping sets a color mapping to be applied when getting or setting RGB values.

func (*LedStrip) SetFrameDuration

func (l *LedStrip) SetFrameDuration(ms uint16) error

SetFrameDuration sets the number of milliseconds between frames.

func (*LedStrip) SetRGBValues

func (l *LedStrip) SetRGBValues(index uint16, colors []Color) error

SetRGBValues sets up to 16 color values beginning from 'index' to the values in 'colors'.

Jump to

Keyboard shortcuts

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