apa102

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package apa102 implements a driver for the APA102 SPI LED.

Datasheet: https://cdn-shop.adafruit.com/product-files/2343/APA102C.pdf

Index

Constants

View Source
const (
	// BGR aka "Blue Green Red" is the current APA102 LED color order.
	BGR = iota

	// BRG aka "Blue Red Green" is the typical APA102 color order from 2015-2017.
	BRG

	// GRB aka "Green Red Blue" is the typical APA102 color order from pre-2015.
	GRB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Order int
	// contains filtered or unexported fields
}

Device wraps APA102 SPI LEDs.

func New

func New(b machine.SPI) Device

New returns a new APA102 driver. Pass in a fully configured SPI bus.

func (Device) Write

func (d Device) Write(buf []byte) (n int, err error)

Write the raw bytes using the APA102 protocol.

func (Device) WriteColors

func (d Device) WriteColors(cs []color.RGBA) (n int, err error)

WriteColors writes the given RGBA color slice out using the APA102 protocol. The A value (Alpha channel) is used for brightness, set to 0xff (255) for maximum.

Jump to

Keyboard shortcuts

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