Documentation ¶
Overview ¶
Package commands contains constants representing different commands to send to the device.
Package epd7in5bhd is for the Waveshare 7.5 inch HD (B/C) e-Paper display.
Index ¶
Constants ¶
const ( // Device width in pixels. DisplayWidth = 880 // Device width in bytes. DisplayWidthBytes = 880 / 8 // Device height in pixels. DisplayHeight = 528 // Full buffer size in bytes. BufSize = DisplayWidthBytes * DisplayHeight )
Variables ¶
var DefaultPins = Pins{
Busy: "P1_18",
CS: "P1_24",
DC: "P1_22",
RST: "P1_11",
}
var DefaultWait = 25 * time.Second
DefaultSleep is the default time to wait for a screen refresh. The official documented refresh time is 22 seconds.
Functions ¶
This section is empty.
Types ¶
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
Display is a client for the e-Paper display.
Standard pin locations are as follows:
Busy - Busy - Pin 18 (GPIO 24) CLK - SPI0 SCLK - Pin 23 (GPIO 11) CS - SPI0 CE0 - Pin 24 (GPIO 8) DC - Data/Cmd - Pin 22 (GPIO 25) DIN - SPI0 MOSI - Pin 19 (GPIO 10) RST - Reset - Pin 11 (GPIO 17)
func New ¶
New creates a Display configured for use.
dcPin, csPin, rstPin, and busyPin all expect valid gpioreg.ByName() values, such as P1_22.
d, err := epd7in5bhd.New("P1_22", "P1_24", "P1_11", "P1_18") if err != nil { // Handle error. }
func (*Display) Init ¶
func (d *Display) Init()
Init initializes the display config. It should be used if the device is asleep and needs reinitialization.
func (*Display) Render ¶
Render updates the screen from the provided io.ByteReaders.
The epd7in5bhd does not support partial refreshes. If the provided buffer is smaller than the image, then the rest will be filled with white.
The epd7in5bhd expects a bit per pixel for each color.
For blackImg, 0b1 is a black pixel, and 0b0 is a white pixel. For redImg, 0b1 is a red pixel, and 0b0 is a not-red pixel (no change will occur).
Black will always be drawn on the screen before red.
func (*Display) RenderImages ¶
RenderImages renders a black image and a red/yellow image on the display.
func (*Display) RenderPaletted ¶
RenderPaletted renders an image in 3 colors (black, white and red/yellow).
If img is a *image.Paletted with exactly 3 colors, each color will be assigned to its nearest by euclidean distance. Otherwise, colors will be assigned by a per-pixel calculation.