display

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverHD44780 = "hd44780"
)

Variables

View Source
var (
	ErrDisplayUnsupported = errors.New("display type unsupported")
	ErrDisplayDisabled    = errors.New("display disabled")
)

Functions

This section is empty.

Types

type HD44780

type HD44780 struct {
	LCDChannel chan LCDMessage
	// contains filtered or unexported fields
}

func NewHD44780

func NewHD44780(lcdChannel chan LCDMessage, i2cAddress string, i2cBus int) (*HD44780, error)

NewHD44780 Create a new HD44780 struct.

func (*HD44780) Cleanup

func (lcd *HD44780) Cleanup()

Cleanup Close the LCD I2C connection.

func (HD44780) Clear

func (lcd HD44780) Clear()

func (*HD44780) DisplayMessage

func (lcd *HD44780) DisplayMessage(message LCDMessage)

DisplayMessage displays the message on the LCD. Pairs of messages will be displayed for the duration set in LCDMessage.

func (HD44780) GetLcdChannel

func (lcd HD44780) GetLcdChannel() chan<- LCDMessage

func (*HD44780) ListenForMessages

func (lcd *HD44780) ListenForMessages(ctx context.Context)

ListenForMessages Listen for incoming message requests and display the message received.

type LCD

type LCD interface {
	DisplayMessage(message LCDMessage)
	ListenForMessages(ctx context.Context)
	Cleanup()
	Clear()
	GetLcdChannel() chan<- LCDMessage
}

LCD is an abstraction layer for concrete implementation of a display.

func NewDisplay

func NewDisplay(lcdSettings settings.Lcd) (LCD, error)

NewDisplay returns a concrete implementation of an LCD based on the drivers that are supported. The LCD is built with the settings from the settings file.

type LCDMessage

type LCDMessage struct {
	Messages        []string
	MessageDuration time.Duration
}

LCDMessage Object representing the message that will be displayed on the LCD. Each array element in Messages represents a line being displayed on the 16x2 screen.

func NewMessage

func NewMessage(duration time.Duration, messages []string) LCDMessage

NewMessage creates a new message for the LCD.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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