matrix

package
v0.0.0-...-57c47e7 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EmulatorENV = "MATRIX_EMULATOR"

Variables

View Source
var DefaultConfig = HardwareConfig{
	Rows:              32,
	Cols:              32,
	ChainLength:       1,
	Parallel:          1,
	PWMBits:           11,
	PWMLSBNanoseconds: 130,
	Brightness:        100,
	ScanMode:          Progressive,
}

DefaultConfig default WS281x configuration

Functions

func NewRGBLedMatrix

func NewRGBLedMatrix(config *HardwareConfig) (c canvas.Matrix, err error)

NewRGBLedMatrix returns a new matrix using the given size and config

Types

type HardwareConfig

type HardwareConfig struct {
	// Rows the number of rows supported by the display, so 32 or 16.
	Rows int
	// Cols the number of columns supported by the display, so 32 or 64 .
	Cols int
	// ChainLengthis the number of displays daisy-chained together
	// (output of one connected to input of next).
	ChainLength int
	// Parallel is the number of parallel chains connected to the Pi; in old Pis
	// with 26 GPIO pins, that is 1, in newer Pis with 40 interfaces pins, that
	// can also be 2 or 3. The effective number of pixels in vertical direction is
	// then thus rows * parallel.
	Parallel int
	// Set PWM bits used for output. Default is 11, but if you only deal with
	// limited comic-colors, 1 might be sufficient. Lower require less CPU and
	// increases refresh-rate.
	PWMBits int
	// Change the base time-unit for the on-time in the lowest significant bit in
	// nanoseconds.  Higher numbers provide better quality (more accurate color,
	// less ghosting), but have a negative impact on the frame rate.
	PWMLSBNanoseconds int // the DMA channel to use
	// Brightness is the initial brightness of the panel in percent. Valid range
	// is 1..100
	Brightness int
	// ScanMode progressive or interlaced
	ScanMode ScanMode // strip color layout
	// Disable the PWM hardware subsystem to create pulses. Typically, you don't
	// want to disable hardware pulsing, this is mostly for debugging and figuring
	// out if there is interference with the sound system.
	// This won't do anything if output enable is not connected to GPIO 18 in
	// non-standard wirings.
	DisableHardwarePulsing bool

	ShowRefreshRate bool
	InverseColors   bool

	// Name of GPIO mapping used
	HardwareMapping string

	Multiplexing int
	PixelMapping string

	SlowdownGPIO   int
	Daemon         bool
	DropPrivileges bool
	DoGPIOInit     bool
}

HardwareConfig rgb-led-matrix configuration

type RGBLedMatrix

type RGBLedMatrix struct {
	Config *HardwareConfig
	// contains filtered or unexported fields
}

RGBLedMatrix matrix representation for ws281x

func (*RGBLedMatrix) Apply

func (c *RGBLedMatrix) Apply(leds []color.Color) error

Apply set all the pixels to the values contained in leds

func (*RGBLedMatrix) At

func (c *RGBLedMatrix) At(position int) color.Color

At return an Color which allows access to the LED display data as if it were a sequence of 24-bit RGB values.

func (*RGBLedMatrix) Close

func (c *RGBLedMatrix) Close() error

Close finalizes the ws281x interface

func (*RGBLedMatrix) DrawCircle

func (c *RGBLedMatrix) DrawCircle(x, y, radius int, col color.Color)

DrawCircle - requires rendering before it is called.

func (*RGBLedMatrix) Geometry

func (c *RGBLedMatrix) Geometry() (width, height int)

Geometry returns the width and the height of the matrix

func (*RGBLedMatrix) Render

func (c *RGBLedMatrix) Render() error

Render update the display with the data from the LED buffer

func (*RGBLedMatrix) Set

func (c *RGBLedMatrix) Set(position int, color color.Color)

Set set LED at position x,y to the provided 24-bit color value.

func (*RGBLedMatrix) SetBrightness

func (c *RGBLedMatrix) SetBrightness(b uint8) error

SetBrightness - sets brightness in real time. Issue with network activity still remains.

type ScanMode

type ScanMode int8
const (
	Progressive ScanMode = 0
	Interlaced  ScanMode = 1
)

Jump to

Keyboard shortcuts

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