epdfuse

package module
v0.0.0-...-1566a73 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: GPL-2.0 Imports: 8 Imported by: 1

README

epdfuse Travis CI Godoc Reference

epdfuse is a library for interacting with the PaPiRus epaper display using golang and the repaper epd fuse native library.

This library provides the ability to write arbitrary text and images to the display as well as clear the display.

It leverages the goxbm project to convert images to the XBM format used by EPD Fuse.

Example Image

Install and setup

Install Go

Go runs easily on the Raspberry PI. This stackexchange answer provides a quick overview: http://raspberrypi.stackexchange.com/a/46828/167.

If cross compiling on a different computer, use these settings GOARM=5 GOOS=linux GOARCH=arm.

GOARM=5 GOOS=linux GOARCH=arm go build
Install Fuse Driver

The repaper fuse driver is required to use this golang library.

# Install fuse driver
apt-get install libfuse-dev -y
# Install fonts
apt-get install fonts-freefont-ttf -y

rm -R /tmp/papirus
mkdir /tmp/papirus
cd /tmp/papirus
git clone https://github.com/repaper/gratis.git

cd /tmp/papirus/gratis
make rpi EPD_IO=epd_io.h PANEL_VERSION='V231_G2'
make rpi-install EPD_IO=epd_io.h PANEL_VERSION='V231_G2'
systemctl enable epd-fuse.service
systemctl start epd-fuse
Get the go-epdfuse project

Download and install the project with go

go get github.com/wmarbut/go-epdfuse

Run an example

cd $GOPATH/github.com/wmarbut/go-epdfuse/examples/papirus-text
go build
./paprius-text "Hello World!"

Documentation

Index

Examples

Constants

View Source
const DISPLAY_PATH = "/BE/display"
View Source
const EPD_COMMAND_PATH = "/command"
View Source
const EPD_DEFAULT_HEIGHT = 96
View Source
const EPD_DEFAULT_PATH = "/dev/epd"
View Source
const EPD_DEFAULT_WIDTH = 200

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis byte
const (
	AXIS_X Axis = '0'
	AXIS_Y Axis = '1'
)

type EpdCommand

type EpdCommand byte
const (
	// EPD Command to trigger a display update
	COMMAND_UPDATE EpdCommand = 'U'
	// EPD Command to clear display
	COMMAND_CLEAR EpdCommand = 'C'
	// EPD Command to trigger a partial display update
	COMMAND_PARTIAL EpdCommand = 'P'
)

type EpdFuse

type EpdFuse struct {
	EpdPath string
	Width   int
	Height  int
}

Configures EPD Fuse

func NewCustomEpdFuse

func NewCustomEpdFuse(path string, width, height int) EpdFuse

Create a new EpdFuse to interact with your display

Example
NewCustomEpdFuse("/dev/epd", 200, 96)
Output:

func NewEpdFuse

func NewEpdFuse() EpdFuse

Create a new EpdFuse to interact with your display

func (*EpdFuse) Clear

func (epd *EpdFuse) Clear() error

Clear the PaPiRus display

func (*EpdFuse) PartialUpdate

func (epd *EpdFuse) PartialUpdate() error

Perform a partial update

func (*EpdFuse) Update

func (epd *EpdFuse) Update() error

Force an update of the PaPiRus display

func (*EpdFuse) WriteImage

func (epd *EpdFuse) WriteImage(img image.Image) error

Write image to your PaPiRus display

Example
f, err := os.Open("example_image.png")
if err != nil {
	panic(err)
}
defer f.Close()
img, err := png.Decode(f)

fuse := NewEpdFuse()
fuse.WriteImage(img)
Output:

func (*EpdFuse) WriteImagePartial

func (epd *EpdFuse) WriteImagePartial(img image.Image) error

Write partial image to your PaPiRus display

func (*EpdFuse) WriteText

func (epd *EpdFuse) WriteText(text string) error

Write wrapped text to your PaPiRus display

Example
fuse := NewEpdFuse()
fuse.WriteText(`The fault, dear Brutus, is not in our stars,
		But in ourselves, that we are underlings.`)
Output:

type ScalePlan

type ScalePlan byte
const (
	SCALE_NO         ScalePlan = '0'
	SCALE_UP         ScalePlan = '1'
	SCALE_DOWN       ScalePlan = '2'
	SCALE_PLACE_ONLY ScalePlan = '3'
)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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