fw_ledmatrixmodule

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 9 Imported by: 0

README

Framework Led Matrix Module

Super basic and easy to use LED Matrix Module for the Framework 16.

How to install

go get github.com/DwifteJB/fw_ledmatrixmodule

How to use

package main
import (
    "github.com/DwifteJB/fw_ledmatrixmodule"
)
func main() {
    // NewLedMatrix supports PortToSelect of usually 1 or 2. 1 is usually left, 2 is usually right
    // if this is empty, it'll auto select the first one found.
    // It also supports PortName, so you can use ListPorts() and FindPort() to select the correct port type.
    // the FindPort() and ListPorts() can be used to select which port you would like.
	led, err := fw_ledmatrixmodule.NewLedMatrix(fw_ledmatrixmodule.LedMatrixConfig{})
	if err != nil {
		fmt.Println(err.Error())
	}
	err := led.SetBrightness(255)
	// ...
}

Supported Functions

SetBrightness(brightness int) // from 0 -> 255
ActivateBootloader() // activates the bootloader mode
WakeDisplay() // force wakes the display
SleepDisplay() // force sleeps the display
DrawMatrix(matrix Matrix) // draws a matrix of [9][34]bool

// ImageToMatrix
GetMatrixFromFile(fileName) (Matrix, error) // creates a matrix from a image file that is 34x9 

Documentation

Index

Constants

View Source
const (
	BRIGHTNESS_CMD = 0x00
	BOOTLOADER_CMD = 0x02
	SLEEP_CMD      = 0x03
	DRAW_CMD       = 0x06
	DISPLAY_ON_CMD = 0x14
	WIDTH          = 9
	HEIGHT         = 34
)

Variables

View Source
var ALLOWED_PREFIXES = []string{"png", "jpg", "jpeg", "gif"}

Functions

func FindPort

func FindPort(portToSelect int) (string, error)

func ListPorts

func ListPorts() ([]string, error)

func NewLedMatrix

func NewLedMatrix(config LedMatrixConfig) (*ledMatrix, error)

Types

type LedMatrixConfig

type LedMatrixConfig struct {
	PortToSelect int // -1 for auto-select
	PortName     string
}

type Matrix

type Matrix [HEIGHT][WIDTH]bool

func GetMatrixFromFile

func GetMatrixFromFile(fileName string) (Matrix, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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