Documentation ¶
Overview ¶
Package ledstrip has control routines for LED strips Author: Tim Scheuermann (https://github.com/noxer)
Index ¶
- Constants
- Variables
- type ChipType
- type Color
- type LedStrip
- func (l *LedStrip) CallbackFrameRendered(handler func(uint16))
- func (l *LedStrip) GetChipType() (ChipType, error)
- func (l *LedStrip) GetClockFrequency() (uint32, error)
- func (l *LedStrip) GetFrameDuration() (uint16, error)
- func (l *LedStrip) GetIdentity() (*helpers.BrickletIdentity, error)
- func (l *LedStrip) GetRGBValues(index uint16, length uint8) ([]Color, error)
- func (l *LedStrip) GetSupplyVoltage() (uint16, error)
- func (l *LedStrip) SetAllRGBValues(index uint16, colors []Color) error
- func (l *LedStrip) SetChipType(chipType ChipType) error
- func (l *LedStrip) SetClockFrequency(frequency uint32) error
- func (l *LedStrip) SetColorMapping(mapping [3]int)
- func (l *LedStrip) SetFrameDuration(ms uint16) error
- func (l *LedStrip) SetRGBValues(index uint16, colors []Color) error
Constants ¶
const ( // WS2801 chip type ID WS2801 ChipType = 2801 // WS2811 chip type ID WS2811 = 2811 // WS2812 chip type ID WS2812 = 2812 )
Variables ¶
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 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 ¶
func New(t tinkerforge.Tinkerforge, uid string) (*LedStrip, error)
New creates a new LED strip control for the bricklet with 'uid'.
func (*LedStrip) CallbackFrameRendered ¶
CallbackFrameRendered is a convenience function for registering a handler to be called when a frame has been rendered.
func (*LedStrip) GetChipType ¶
GetChipType returns the currently set type of the LEDs control chip.
func (*LedStrip) GetClockFrequency ¶
GetClockFrequency returns the currently used clock frequency.
func (*LedStrip) GetFrameDuration ¶
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 ¶
GetRGBValues retrieves the currently set RGB values of the LED strip beginning from 'index' and up to 'length' values.
func (*LedStrip) GetSupplyVoltage ¶
GetSupplyVoltage returns the current voltage the LED strip's LEDs consume in mV.
func (*LedStrip) SetAllRGBValues ¶
SetAllRGBValues sets all color values beginning from 'index' to the values in 'colors'.
func (*LedStrip) SetChipType ¶
SetChipType sets the type of the LEDs control chip.
func (*LedStrip) SetClockFrequency ¶
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 ¶
SetColorMapping sets a color mapping to be applied when getting or setting RGB values.
func (*LedStrip) SetFrameDuration ¶
SetFrameDuration sets the number of milliseconds between frames.