Documentation ¶
Overview ¶
Datasheet
Inky lacks a true datasheet, so the code here is derived from the reference implementation by Pimoroni: https://github.com/pimoroni/inky
Example ¶
package main import ( "flag" "image" "image/png" "log" "os" "periph.io/x/periph/conn/gpio/gpioreg" "periph.io/x/periph/conn/spi/spireg" "periph.io/x/periph/experimental/devices/inky" "periph.io/x/periph/host" ) func main() { 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.ZP); err != nil { log.Fatal(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( Black = iota Red = iota Yellow = iota White = iota )
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.
Click to show internal directories.
Click to hide internal directories.