display-test/display/display.go

34 lines
466 B
Go
Raw Normal View History

2024-08-20 12:14:10 +00:00
package display
import (
"fmt"
"image"
"io"
"log"
"golang.org/x/image/font"
)
type Display interface {
GetImg() *image.Gray
GetFont() font.Face
Clear() error
PutText(x, y int, text string) error
io.Closer
}
type DisplayModel int
const (
SSD1306 DisplayModel = iota
)
func New(logger *log.Logger, model DisplayModel) (Display, error) {
switch model {
case SSD1306:
return newSsd1306(logger)
}
return nil, fmt.Errorf("invalid display model")
}