Documentation ¶
Overview ¶
Package inky drives an Inky pHAT, pHAT v2 or wHAT E ink display.
Datasheet ¶
Inky lacks a true datasheet, so the code here is derived from the reference implementation by Pimoroni: https://github.com/pimoroni/inky
The display seems to use a SSD1675 controller: https://www.china-epaper.com/uploads/soft/DEPG0420R01V3.0.pdf
Example ¶
path := flag.String("image", "", "Path to image file (212x104) to display") flag.Parse() f, err := os.Open(*path) if err != nil { log.Fatal(err) } defer f.Close() img, err := png.Decode(f) if err != nil { log.Fatal(err) } if _, err = host.Init(); err != nil { log.Fatal(err) } b, err := spireg.Open("SPI0.0") if err != nil { log.Fatal(err) } dc := gpioreg.ByName("22") reset := gpioreg.ByName("27") busy := gpioreg.ByName("17") dev, err := inky.New(b, dc, reset, busy, &inky.Opts{ Model: inky.PHAT, ModelColor: inky.Red, BorderColor: inky.Black, }) if err != nil { log.Fatal(err) } if err := dev.Draw(img.Bounds(), img, image.Point{}); err != nil { log.Fatal(err) }
Output:
Index ¶
- type Color
- type Dev
- func (d *Dev) Bounds() image.Rectangle
- func (d *Dev) ColorModel() color.Model
- func (d *Dev) Draw(dstRect image.Rectangle, src image.Image, srcPtrs image.Point) error
- func (d *Dev) DrawAll(src image.Image) error
- func (d *Dev) Halt() error
- func (d *Dev) SetBorder(c Color)
- func (d *Dev) SetModelColor(c Color) error
- func (d *Dev) String() string
- type Model
- type Opts
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color int
Color is used to define which model of inky is being used, and also for setting the border color.
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
Dev is a handle to an Inky.
func (*Dev) ColorModel ¶
ColorModel implements display.Drawer Maps white to white, black to black and anything else as red. Red is used as a placeholder for the display's third color, i.e., red or yellow.
func (*Dev) SetBorder ¶
SetBorder changes the border color. This will not take effect until the next Draw().
func (*Dev) SetModelColor ¶
SetModelColor changes the model color. This will not take effect until the next Draw(). Useful if you want to switch between two-color and three-color drawing.
type Model ¶
type Model int
Model lists the supported e-ink display models.