apa102

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: BSD-3-Clause Imports: 3 Imported by: 35

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 drivers.SPI) *Device

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

func NewSoftwareSPI added in v0.6.0

func NewSoftwareSPI(sckPin, sdoPin machine.Pin, delay uint32) *Device

NewSoftwareSPI returns a new APA102 driver that will use a software based implementation of the SPI protocol.

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