unicornhd

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package unicornhd implements interfacing code to Pimoroni's Unicorn HD hat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

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

Dev represents a Unicorn HAT HD (https://shop.pimoroni.com/products/unicorn-hat-hd) connected over a SPI port.

func NewUnicornhd

func NewUnicornhd(port spi.Port) (*Dev, error)

New returns a unicornHD driver that communicates over SPI.

The SPI port speed must be 9MHz and the SPI mode, 0, as in the python example library.

func (*Dev) Bounds

func (device *Dev) Bounds() image.Rectangle

Bounds implements devices.Display.

Min is guaranteed to be {0, 0}.

func (*Dev) ColorModel

func (device *Dev) ColorModel() color.Model

ColorModel implements devices.Display. There's no surprise, it is color.RGBAModel.

func (*Dev) Draw

func (device *Dev) Draw(dstRect image.Rectangle, src image.Image, srcPts image.Point) error

Draw implements devices.Display.

Using something else than image.NRGBA is 10x slower. When using image.NRGBA, the alpha channel is ignored.

func (*Dev) Halt

func (device *Dev) Halt() error

Halting the unicorn HD sets all the pixels to black. Error is always nil.

func (*Dev) String

func (device *Dev) String() string

Implement display.Drawer

Returns a string with the driver name and the width and height of the display.

Jump to

Keyboard shortcuts

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