epd7in5

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT, MIT Imports: 12 Imported by: 4

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+ 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+ with Raspbian Stretch.

For more information please check the examples and doc folders.

Index

Constants

View Source
const (
	EPD_WIDTH  int = 640
	EPD_HEIGHT int = 384
)
View Source
const (
	PANEL_SETTING                  byte = 0x00
	POWER_SETTING                  byte = 0x01
	POWER_OFF                      byte = 0x02
	POWER_OFF_SEQUENCE_SETTING     byte = 0x03
	POWER_ON                       byte = 0x04
	POWER_ON_MEASURE               byte = 0x05
	BOOSTER_SOFT_START             byte = 0x06
	DEEP_SLEEP                     byte = 0x07
	DATA_START_TRANSMISSION_1      byte = 0x10
	DATA_STOP                      byte = 0x11
	DISPLAY_REFRESH                byte = 0x12
	IMAGE_PROCESS                  byte = 0x13
	LUT_FOR_VCOM                   byte = 0x20
	LUT_BLUE                       byte = 0x21
	LUT_WHITE                      byte = 0x22
	LUT_GRAY_1                     byte = 0x23
	LUT_GRAY_2                     byte = 0x24
	LUT_RED_0                      byte = 0x25
	LUT_RED_1                      byte = 0x26
	LUT_RED_2                      byte = 0x27
	LUT_RED_3                      byte = 0x28
	LUT_XON                        byte = 0x29
	PLL_CONTROL                    byte = 0x30
	TEMPERATURE_SENSOR_COMMAND     byte = 0x40
	TEMPERATURE_CALIBRATION        byte = 0x41
	TEMPERATURE_SENSOR_WRITE       byte = 0x42
	TEMPERATURE_SENSOR_READ        byte = 0x43
	VCOM_AND_DATA_INTERVAL_SETTING byte = 0x50
	LOW_POWER_DETECTION            byte = 0x51
	TCON_SETTING                   byte = 0x60
	TCON_RESOLUTION                byte = 0x61
	SPI_FLASH_CONTROL              byte = 0x65
	REVISION                       byte = 0x70
	GET_STATUS                     byte = 0x71
	AUTO_MEASUREMENT_VCOM          byte = 0x80
	READ_VCOM_VALUE                byte = 0x81
	VCM_DC_SETTING                 byte = 0x82
)

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()

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)

Display takes a byte buffer and updates the screen.

func (*Epd) Init

func (e *Epd) Init()

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) Reset

func (e *Epd) Reset()

Reset can be also used to awaken the device.

func (*Epd) Sleep

func (e *Epd) Sleep()

Sleep put 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