max7219

package module
v0.0.0-...-2caf997 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 3 Imported by: 8

README

MAX7219 driver and 8 Digit 7 Segment Display

This library written in Go programming language to output a number string to SPI Max 7219 x 8 Seven Segment Display

image

Compatibility

Tested on Raspberry PI 3 (model B+)

Golang usage

package main

import (
	"log"
	"github.com/talkkonnect/max7219"
)

func main() {
	mtx := max7219.NewMatrix(1)
	err := mtx.Open(0, 0, 7)
	if err != nil {
		log.Fatal(err)
	}
	defer mtx.Close()

	mtx.Device.SevenSegmentDisplay("1234")
}

Installation

$ go get -u github.com/talkkonnect/max7219

Credits

This project is mainly a fork of https://github.com/d2r2/go-max7219

Contact

Please use Github issue tracker for filing bugs or feature requests.

License

Go-max7219 is licensed under MIT License.

Documentation

Index

Constants

View Source
const (
	MAX7219_REG_NOOP   Max7219Reg = 0
	MAX7219_REG_DIGIT0            = iota
	MAX7219_REG_DIGIT1
	MAX7219_REG_DIGIT2
	MAX7219_REG_DIGIT3
	MAX7219_REG_DIGIT4
	MAX7219_REG_DIGIT5
	MAX7219_REG_DIGIT6
	MAX7219_REG_DIGIT7
	MAX7219_REG_DECODEMODE
	MAX7219_REG_INTENSITY
	MAX7219_REG_SCANLIMIT
	MAX7219_REG_SHUTDOWN
	MAX7219_REG_DISPLAYTEST = 0x0F
	MAX7219_REG_LASTDIGIT   = MAX7219_REG_DIGIT7
)
View Source
const MAX7219_DIGIT_COUNT = MAX7219_REG_LASTDIGIT -
	MAX7219_REG_DIGIT0 + 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func NewDevice

func NewDevice(cascaded int) *Device

func (*Device) Brightness

func (this *Device) Brightness(intensity byte) error

func (*Device) Clear

func (this *Device) Clear(cascadeId int, redraw bool) error

func (*Device) ClearAll

func (this *Device) ClearAll(redraw bool) error

func (*Device) Close

func (this *Device) Close()

func (*Device) Command

func (this *Device) Command(reg Max7219Reg, value byte) error

func (*Device) Flush

func (this *Device) Flush() error

func (*Device) GetCascadeCount

func (this *Device) GetCascadeCount() int

func (*Device) GetLedLineCount

func (this *Device) GetLedLineCount() int

func (*Device) Open

func (this *Device) Open(spibus int, spidevice int, brightness byte) error

func (*Device) ScrollLeft

func (this *Device) ScrollLeft(redraw bool) error

func (*Device) ScrollRight

func (this *Device) ScrollRight(redraw bool) error

func (*Device) SetBufferLine

func (this *Device) SetBufferLine(cascadeId int,
	position int, value byte, redraw bool) error

func (*Device) SevenSegmentDisplay

func (this *Device) SevenSegmentDisplay(toDisplay string) error

type Matrix

type Matrix struct {
	Device *Device
}

func NewMatrix

func NewMatrix(cascaded int) *Matrix

func (*Matrix) Close

func (this *Matrix) Close()

func (*Matrix) Open

func (this *Matrix) Open(spibus int, spidevice int, brightness byte) error

type Max7219Reg

type Max7219Reg byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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