is31fl3731

package
v0.0.0-...-2e22e3b Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package is31fl3731 provides a driver for the Lumissil IS31FL3731 matrix LED driver.

Driver supports following layouts:

Datasheet:

https://www.lumissil.com/assets/pdf/core/IS31FL3731_DS.pdf

This driver inspired by Adafruit Python driver:

https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731

Index

Constants

View Source
const (
	// AD pin connected to GND
	I2C_ADDRESS_74 uint8 = 0x74
	// AD pin connected to SCL
	I2C_ADDRESS_75 uint8 = 0x75
	// AD pin connected to SDA
	I2C_ADDRESS_76 uint8 = 0x76
	// AD pin connected to VCC
	I2C_ADDRESS_77 uint8 = 0x77

	// Main command register
	COMMAND uint8 = 0xFD

	// Commands for each of 8 frames
	FRAME_0 uint8 = 0x00
	FRAME_1 uint8 = 0x01
	FRAME_2 uint8 = 0x02
	FRAME_3 uint8 = 0x03
	FRAME_4 uint8 = 0x04
	FRAME_5 uint8 = 0x05
	FRAME_6 uint8 = 0x06
	FRAME_7 uint8 = 0x07

	// Command to set configuration
	FUNCTION uint8 = 0x0B

	// Configuration:
	SET_DISPLAY_MODE uint8 = 0x00
	SET_ACTIVE_FRAME uint8 = 0x01
	SET_AUDIOSYNC    uint8 = 0x06
	SET_SHUTDOWN     uint8 = 0x0A

	// Configuration: display mode
	DISPLAY_MODE_PICTURE uint8 = 0x00

	// Configuration: audiosync (enable audio signal to modulate the intensity of
	// the matrix)
	AUDIOSYNC_OFF uint8 = 0x00
	AUDIOSYNC_ON  uint8 = 0x01

	// Configuration: software shutdown
	SOFTWARE_OFF uint8 = 0x00
	SOFTWARE_ON  uint8 = 0x01

	// Frame LEDs
	LED_CONTROL_OFFSET uint8 = 0x00 // to on/off each LED
	LED_PWM_OFFSET     uint8 = 0x24 // to set PWM (0-255) for each LED
)

Registers. Names taken from the datasheet: https://www.lumissil.com/assets/pdf/core/IS31FL3731_DS.pdf

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device implements TinyGo driver for Lumissil IS31FL3731 matrix LED driver

func New

func New(bus drivers.I2C, address uint8) Device

New creates a raw driver w/o any preset board layout. Addresses: - 0x74 (AD pin connected to GND) - 0x75 (AD pin connected to SCL) - 0x76 (AD pin connected to SDA) - 0x77 (AD pin connected to VCC)

func (*Device) Clear

func (d *Device) Clear(frame uint8) (err error)

Clear the whole frame

func (*Device) Configure

func (d *Device) Configure() (err error)

Configure chip for operating as a LED matrix display

func (*Device) DrawPixelIndex

func (d *Device) DrawPixelIndex(frame, index, value uint8) (err error)

DrawPixelIndex draws a single pixel on the selected frame by its index with provided PWM value [0-255]

func (*Device) DrawPixelXY

func (d *Device) DrawPixelXY(frame, x, y, value uint8) (err error)

DrawPixelXY draws a single pixel on the selected frame by its XY coordinates with provided PWM value [0-255]. Raw LEDs layout assumed to be a 16x9 matrix, and can be used with any custom board that has IS31FL3731 driver.

func (*Device) Fill

func (d *Device) Fill(frame, value uint8) (err error)

Fill the whole frame with provided PWM value [0-255]

func (*Device) SetActiveFrame

func (d *Device) SetActiveFrame(frame uint8) (err error)

SetActiveFrame sets frame to display with LEDs

type DeviceAdafruitCharlieWing15x7

type DeviceAdafruitCharlieWing15x7 struct {
	Device
}

DeviceAdafruitCharlieWing15x7 implements TinyGo driver for Lumissil IS31FL3731 matrix LED driver on Adafruit 15x7 CharliePlex LED Matrix FeatherWing (CharlieWing) board: https://www.adafruit.com/product/3163

func NewAdafruitCharlieWing15x7

func NewAdafruitCharlieWing15x7(bus drivers.I2C, address uint8) DeviceAdafruitCharlieWing15x7

NewAdafruitCharlieWing15x7 creates a new driver with Adafruit 15x7 CharliePlex LED Matrix FeatherWing (CharlieWing) layout. Available addresses: - 0x74 (default) - 0x77 (when the address jumper soldered)

func (*DeviceAdafruitCharlieWing15x7) DrawPixelXY

func (d *DeviceAdafruitCharlieWing15x7) DrawPixelXY(frame, x, y, value uint8) (err error)

DrawPixelXY draws a single pixel on the selected frame by its XY coordinates with provided PWM value [0-255]

Jump to

Keyboard shortcuts

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