display-test/display/display.go
2024-08-21 19:07:29 +03:00

33 lines
456 B
Go

package display
import (
"fmt"
"image"
"io"
"log"
)
type Display interface {
Flush(img *image.Gray) error
GetBounds() image.Rectangle
io.Closer
}
type DisplayModel int
const (
SSD1306 DisplayModel = iota
MT12864A
)
func New(logger *log.Logger, model DisplayModel) (Display, error) {
switch model {
case SSD1306:
return newSsd1306(logger)
case MT12864A:
return newMt12864a(logger)
}
return nil, fmt.Errorf("invalid display model")
}