qls_apa102c

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

README

qls_apa102c

This package provides a hardware driver for the sparkfun Qwiic LED Stick - APA102C that can be used together with TinyGo.

Notes

License

This project is licensed under the BSD 3-Clause "New" license.

Documentation

Index

Constants

View Source
const (
	ADDRESS                     = 0x23
	CHANGE_ADDRESS              = 0xC7
	CHANGE_LED_LENGTH           = 0x70
	WRITE_SINGLE_LED_COLOR      = 0x71
	WRITE_ALL_LED_COLOR         = 0x72
	WRITE_RED_ARRAY             = 0x73
	WRITE_GREEN_ARRAY           = 0x74
	WRITE_BLUE_ARRAY            = 0x75
	WRITE_SINGLE_LED_BRIGHTNESS = 0x76
	WRITE_ALL_LED_BRIGHTNESS    = 0x77
	WRITE_ALL_LED_OFF           = 0x78
)

Constants/addresses used for I2C.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint8
	// contains filtered or unexported fields
}

Device wraps an I2C connection to a Sparkfun Qwiic LED Stick - APA102C.

func New

func New(bus drivers.I2C) Device

New creates a new LED Stick connection. The I2C bus must already be configured. This function only creates the Device object, it does not touch the device.

func (*Device) AllLedOff

func (d *Device) AllLedOff() bool

Turn off all LEDs.

func (*Device) SetAllLedBrightness

func (d *Device) SetAllLedBrightness(brightness uint8) bool

Change the brightness of all LEDs, while keeping their current color. Brightness must be a value between 0-31. To turn all LEDs off but remember their previous color, set brightness to 0.

func (*Device) SetAllLedColor

func (d *Device) SetAllLedColor(red, green, blue uint8) bool

Set the color of all leds to the same RGB color.

func (*Device) SetLedBrightness

func (d *Device) SetLedBrightness(led_number, brightness uint8) bool

Set the brightness of a single LED. LEDs are indexed starting at 0. Brightness must be a value between 0-31.

func (*Device) SetLedColor

func (d *Device) SetLedColor(led_number, red, green, blue uint8) bool

Set the color of a single LED to an RGB color. LEDs are indexed starting at 0.

Jump to

Keyboard shortcuts

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