epd7in5

package
v0.0.0-...-f4dd4eb Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT, MIT Imports: 13 Imported by: 0

README

7 5inch-e-paper-hat-4

License Build Status Go Report Card Go Reference Version

7.5inch e-Paper

This is an interface for the Waveshare 7.5inch e-paper display (wiki).

The GPIO and SPI communication is handled by the awesome Periph.io package; no CGO or other dependecy needed.

Tested on Raspberry Pi 3B / 3B+ / 4B with Raspbian Stretch.

For more information please check the examples and doc folders.

Installation:

go get -u github.com/gandaldf/rpi/

Load an image:

func main() {
	log.Println("Starting...")
	epd, _ := epd7in5.New("P1_22", "P1_24", "P1_11", "P1_18")

	log.Println("Initializing the display...")
	epd.Init()

	log.Println("Clearing...")
	epd.Clear()

	// Test image
	log.Println("Opening test image...")
	imgFile, err := os.Open("mypic.png")
	if err != nil {
		log.Panic(err)
	}

	defer imgFile.Close()

	img, err := png.Decode(imgFile)
	if err != nil {
		log.Panic(err)
	}

	log.Println("Displaying test image...")
	epd.Display(epd.Convert(img))
}

For more information visit:

website: https://www.waveshare.com/

github: https://github.com/waveshare

Documentation

Overview

Package epd7in5 is an interface for the Waveshare 7.5inch e-paper display (wiki).

The GPIO and SPI communication is handled by the awesome Periph.io package; no CGO or other dependecy needed.

Tested on Raspberry Pi 3B / 3B+ / 4B with Raspbian Stretch.

For more information please check the examples and doc folders.

Index

Constants

View Source
const (
	Epd7in5V2Width  = 800
	Epd7in5V2Height = 480
)
View Source
const (
	PanelSetting            byte = 0x00
	PowerSetting            byte = 0x01
	PowerOff                byte = 0x02
	PowerOffSequenceSetting byte = 0x03
	DeepSleep               byte = 0x07
	DataStartTransmission1  byte = 0x10
	DisplayRefresh          byte = 0x12
	AutoMeasurementVcom     byte = 0x80
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Epd

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

Epd is a handle to the display controller.

func New

func New(dcPin, csPin, rstPin, busyPin string) (*Epd, error)

New returns a Epd object that communicates over SPI to the display controller.

func (*Epd) Clear

func (e *Epd) Clear() error

Clear clears the screen.

func (*Epd) Convert

func (e *Epd) Convert(img image.Image) []byte

Convert converts the input image into a ready-to-display byte buffer.

func (*Epd) Display

func (e *Epd) Display(img []byte) error

Display takes a byte buffer and updates the screen.

func (*Epd) Init

func (e *Epd) Init() error

Init initializes the display config. It should be only used when you put the device to sleep and need to re-init the device.

func (*Epd) InitFast

func (e *Epd) InitFast() error

func (*Epd) InitPart

func (e *Epd) InitPart() error

func (*Epd) Reset

func (e *Epd) Reset() error

Reset can be also used to awaken the device.

func (*Epd) Sleep

func (e *Epd) Sleep() error

Sleep puts the display in power-saving mode. You can use Reset() to awaken and Init() to re-initialize the display.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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