epd

package module
v0.0.0-...-84f4fd4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 5 Imported by: 1

README

Waveshare E-paper

Golang driver for Waveshare's 2.9-inch E-paper display module.

Documentation

Overview

Package epd provides driver for Waveshare's E-paper e-ink display

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidImageSize = errors.New("invalid image size")

ErrInvalidImageSize is returned if the given image bounds doesn't fit into display bounds

Functions

This section is empty.

Types

type EPD

type EPD struct {
	// dimensions of the display
	Height int
	Width  int
	// contains filtered or unexported fields
}

EPD defines the base type for the e-paper display driver

func New

func New(rst, dc, cs WriteablePin, busy ReadablePin, transmit Transmit) *EPD

New creates a new EPD device driver

func (*EPD) Clear

func (epd *EPD) Clear(c color.Color)

Clear clears the display and paints the whole display into c color

func (*EPD) Draw

func (epd *EPD) Draw(img image.Image) error

Draw renders the given image onto the display

func (*EPD) Mode

func (epd *EPD) Mode(mode Mode)

mode sets the device's mode (based on the LookupTable) The device can either be in FullUpdate mode where the whole display is updated each time an image is rendered or in PartialUpdate mode where only the changed section is updated (and it doesn't cause any flicker)

Waveshare recommends doing full update of the display at least once per-day to prevent ghost image problems

func (*EPD) Sleep

func (epd *EPD) Sleep()

Sleep puts the device into "deep sleep" mode where it draws zero (0) current

Waveshare recommends putting the device in "deep sleep" mode (or disconnect from power) if doesn't need updating/refreshing.

type Mode

type Mode uint8

LookupTable defines a type holding the instruction lookup table This lookup table is used by the device when performing refreshes

const (
	FullUpdate Mode = iota
	PartialUpdate
)

type ReadablePin

type ReadablePin interface {
	// Read reads from the pin and return the data as a byte
	Read() uint8
}

ReadablePin is a GPIO pin through which the driver can read digital data

type Transmit

type Transmit func(data ...byte)

Transmit is a function that sends the data payload across to the device via the SPI line

type WriteablePin

type WriteablePin interface {
	// High sets the pins output to digital high
	High()

	// Low sets the pins output to digital low
	Low()
}

WriteablePin is a GPIO pin through which the driver can write digital data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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