ledclient

package
v0.0.0-...-d0bc179 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Socket

func Socket(address string) (*zmq4.Socket, error)

Types

type Canvas

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

Canvas is an array of LEDs, powered by colorful colors.

func NewCanvas

func NewCanvas(width, height int) *Canvas

func (*Canvas) At

func (c *Canvas) At(x, y int) colorful.Color

func (*Canvas) PixelIndex

func (c *Canvas) PixelIndex(x, y int) int

func (*Canvas) Set

func (c *Canvas) Set(x, y int, col colorful.Color)

func (*Canvas) Size

func (c *Canvas) Size() (int, int)

type Strip

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

Strip represents a strip of LEDs.

func NewStrip

func NewStrip(sock *zmq4.Socket, width, height int, refreshRate uint64) *Strip

NewStrip returns Strip.

func (*Strip) BitBlit

func (s *Strip) BitBlit(img *Canvas) error

BitBlit transfers image data from an object implementing the Image interface to a remote LED server.

func (*Strip) Close

func (s *Strip) Close()

Close turns all LEDs black and shuts down the rendering function.

func (*Strip) Index

func (s *Strip) Index(x, y int) uint32

Index returns the physical position of a single LED.

The LEDs are configured in a zig-zag pattern, as drawn below. The LED server only knows a single strand, so we must perform the positional conversion here.

START.........................
                             |
..............................
|
...........................END

func (*Strip) Loop

func (s *Strip) Loop(img *Canvas, freq int)

Loop renders the LEDs periodically. This function never returns until Close() is called, so be sure to call it in a goroutine.

Jump to

Keyboard shortcuts

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