Pinball dot-matrix clock animation thingy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

88 lines
2.4 KiB

package driver
import "image/draw"
func DefaultConfig() *Config {
return &Config{
Rows: 32,
Cols: 128,
ChainLength: 1,
Parallel: 1,
PWMBits: 11,
PWMLSBNanoseconds: 130,
Brightness: 100,
ScanMode: 0,
}
}
// Config rgb-led-matrix configuration
type Config 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 int
// 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
}
func (c *Config) Geometry() (width, height int) {
return c.Cols * c.ChainLength, c.Rows * c.Parallel
}
type Matrix interface {
draw.Image
// Close the driver.
Close() error
// Name of the driver.
Name() string
// Swap the render buffer.
Swap(leds []Color) (prev []Color, err error)
// Render updates the display.
Render() error
// ColorDepth returns the number of color bits.
ColorDepth() int
}