Documentation ¶
Overview ¶
Package waveshare7in5v2 implements a driver for the waveshare 7in5 V2 e-Paper display to be used on a Raspberry Pi board.
A simple driver Epd is implemented that closely follows the official C/Python examples provided by waveshare. There is also a Canvas that implements draw.Image allowing to use any compatible package to draw to the display.
Datasheet: https://www.waveshare.com/w/upload/6/60/7.5inch_e-Paper_V2_Specification.pdf C code: https://github.com/waveshare/e-Paper/blob/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_7in5_V2.c Python code: https://github.com/waveshare/e-Paper/blob/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd7in5_V2.py
Index ¶
- Constants
- type Canvas
- type Epd
- func (e *Epd) Bounds() image.Rectangle
- func (e *Epd) Clear()
- func (e *Epd) Close()
- func (e *Epd) DisplayImage(img image.Image)
- func (e *Epd) DisplayImageQuick(img image.Image)
- func (e *Epd) GetBuffer(img image.Image, threshold uint8) []byte
- func (e *Epd) Init()
- func (e *Epd) Refresh()
- func (e *Epd) RefreshQuick()
- func (e *Epd) Sleep()
- func (e *Epd) UpdateFrame(buffer []byte)
- func (e *Epd) UpdateFrameAndRefresh(buffer []byte)
- func (e *Epd) UpdateFrameAndRefreshQuick(buffer []byte)
Constants ¶
const ( EPD_WIDTH int = 800 EPD_HEIGHT int = 480 )
const ( PANEL_SETTING byte = 0x00 POWER_SETTING byte = 0x01 POWER_OFF byte = 0x02 POWER_ON byte = 0x04 BOOSTER_SOFT_START byte = 0x06 DEEP_SLEEP byte = 0x07 DISPLAY_START_TRANSMISSION_1 byte = 0x10 DISPLAY_REFRESH byte = 0x12 DISPLAY_START_TRANSMISSION_2 byte = 0x13 DUAL_SPI byte = 0x15 VCOM_DATA_INTERVAL_SETTING byte = 0x50 TCON byte = 0x60 RESOLUTION_SETTING byte = 0x61 GET_STATUS byte = 0x71 VCOM_DC byte = 0x82 )
const MAX_CHUNK_SIZE = 4096
const PIXEL_SIZE = 8
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
The Canvas implements draw.Image and thus allows to use any compatible package to draw on the screen.
func (*Canvas) ColorModel ¶
type Epd ¶
type Epd struct {
// contains filtered or unexported fields
}
The driver to interact with the e-paper display
func New ¶
New creates a new instance of the Epd struct. Set fasterNormalRefresh to true to allow a slightly faster refresh.
func (*Epd) DisplayImage ¶
Allows to easily send an image.Image directly to the screen.
func (*Epd) DisplayImageQuick ¶
DisplayImageQuick allows to easily send an image.Image directly to the screen. This uses the quick update. Use DisplayImage regularly to clean the screen and prevent permanent damage!
func (*Epd) GetBuffer ¶
Converts an image into a buffer array ready to be sent to the display. Due to the display only supporting 2 colors a threshold is applied to convert the image to pure black and white. The returned buffer is ready to be sent using UpdateFrame.
func (*Epd) Refresh ¶
func (e *Epd) Refresh()
Refreshes the display by sending the internal buffer to the screen.
func (*Epd) RefreshQuick ¶
func (e *Epd) RefreshQuick()
RefreshQuick refreshes the display quick by sending the internal buffer to the screen. Use a normal refresh regularly to clean the screen and prevent permanent damage!
func (*Epd) Sleep ¶
func (e *Epd) Sleep()
Puts the display to sleep and powers off. This helps ensure the display longevity since keeping it powered on for long periods of time can damage the screen. After Sleep the display needs to be woken up by running Init again
func (*Epd) UpdateFrame ¶
Updates the internal display buffer.
func (*Epd) UpdateFrameAndRefresh ¶
Updates the internal display buffer and refresh the screen in sequence.