epd2in13

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: BSD-3-Clause Imports: 5 Imported by: 17

Documentation

Overview

Package epd2in13 implements a driver for Waveshare 2.13in black and white e-paper device.

Datasheet: https://www.waveshare.com/w/upload/e/e6/2.13inch_e-Paper_Datasheet.pdf

Index

Constants

View Source
const (
	DRIVER_OUTPUT_CONTROL                = 0x01
	BOOSTER_SOFT_START_CONTROL           = 0x0C
	GATE_SCAN_START_POSITION             = 0x0F
	DEEP_SLEEP_MODE                      = 0x10
	DATA_ENTRY_MODE_SETTING              = 0x11
	SW_RESET                             = 0x12
	TEMPERATURE_SENSOR_CONTROL           = 0x1A
	MASTER_ACTIVATION                    = 0x20
	DISPLAY_UPDATE_CONTROL_1             = 0x21
	DISPLAY_UPDATE_CONTROL_2             = 0x22
	WRITE_RAM                            = 0x24
	WRITE_VCOM_REGISTER                  = 0x2C
	WRITE_LUT_REGISTER                   = 0x32
	SET_DUMMY_LINE_PERIOD                = 0x3A
	SET_GATE_TIME                        = 0x3B
	BORDER_WAVEFORM_CONTROL              = 0x3C
	SET_RAM_X_ADDRESS_START_END_POSITION = 0x44
	SET_RAM_Y_ADDRESS_START_END_POSITION = 0x45
	SET_RAM_X_ADDRESS_COUNTER            = 0x4E
	SET_RAM_Y_ADDRESS_COUNTER            = 0x4F
	TERMINATE_FRAME_READ_WRITE           = 0xFF

	NO_ROTATION  = drivers.Rotation0
	ROTATION_90  = drivers.Rotation90 // 90 degrees clock-wise rotation
	ROTATION_180 = drivers.Rotation180
	ROTATION_270 = drivers.Rotation270
)

Registers

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Width        int16 // Width is the display resolution
	Height       int16
	LogicalWidth int16 // LogicalWidth must be a multiple of 8 and same size or bigger than Width
	Rotation     drivers.Rotation
}

type Device

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

func New

func New(bus drivers.SPI, csPin, dcPin, rstPin, busyPin machine.Pin) Device

New returns a new epd2in13x driver. Pass in a fully configured SPI bus.

func (*Device) ClearBuffer

func (d *Device) ClearBuffer()

ClearBuffer sets the buffer to 0xFF (white)

func (*Device) ClearDisplay

func (d *Device) ClearDisplay()

ClearDisplay erases the device SRAM

func (*Device) Configure

func (d *Device) Configure(cfg Config)

Configure sets up the device.

func (*Device) DeepSleep

func (d *Device) DeepSleep()

DeepSleep puts the display into deepsleep

func (*Device) Display

func (d *Device) Display() error

Display sends the buffer to the screen.

func (*Device) DisplayRect

func (d *Device) DisplayRect(x int16, y int16, width int16, height int16) error

DisplayRect sends only an area of the buffer to the screen. The rectangle points need to be a multiple of 8 in the screen. They might not work as expected if the screen is rotated.

func (*Device) IsBusy

func (d *Device) IsBusy() bool

IsBusy returns the busy status of the display

func (*Device) Reset

func (d *Device) Reset()

Reset resets the device

func (*Device) Rotation added in v0.27.0

func (d *Device) Rotation() drivers.Rotation

Rotation returns the current rotation of the device.

func (*Device) SendCommand

func (d *Device) SendCommand(command uint8)

SendCommand sends a command to the display

func (*Device) SendData

func (d *Device) SendData(data uint8)

SendData sends a data byte to the display

func (*Device) SetLUT

func (d *Device) SetLUT(fullUpdate bool)

SetLUT sets the look up tables for full or partial updates

func (*Device) SetPixel

func (d *Device) SetPixel(x int16, y int16, c color.RGBA)

SetPixel modifies the internal buffer in a single pixel. The display have 2 colors: black and white. We use a very simple cutoff to determine whether a pixel is black or white (darker colors are black, lighter colors are white).

func (*Device) SetRotation added in v0.3.0

func (d *Device) SetRotation(rotation drivers.Rotation) error

SetRotation changes the rotation of the device.

func (*Device) Size

func (d *Device) Size() (w, h int16)

Size returns the current size of the display.

func (*Device) Sleep added in v0.27.0

func (d *Device) Sleep(sleepEnabled bool) error

Set the sleep mode of the panel. The display will still show its contents, but will go into a lower-power state.

func (*Device) WaitUntilIdle

func (d *Device) WaitUntilIdle()

WaitUntilIdle waits until the display is ready

type Rotation deprecated added in v0.3.0

type Rotation = drivers.Rotation

Deprecated: use drivers.Rotation instead.

Jump to

Keyboard shortcuts

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