display-test/display/mt-12864a.go

44 lines
766 B
Go
Raw Normal View History

package display
import (
2024-08-28 11:14:55 +00:00
"fmt"
"image"
"log"
2024-08-28 11:14:55 +00:00
"gitea.unprism.ru/yotia/display-test/pkg/mt12864a"
"github.com/stianeikeland/go-rpio/v4"
)
2024-08-28 11:14:55 +00:00
type displayMt12864a struct {
logger *log.Logger
// GPIO pins
2024-08-28 11:14:55 +00:00
dev mt12864a.Device
}
func newMt12864a(logger *log.Logger) (Display, error) {
2024-08-28 11:14:55 +00:00
dev, err := mt12864a.New(log.New(logger.Writer(), "display-mt12864 : ", log.LstdFlags))
if err != nil {
return nil, fmt.Errorf("mt12864 create: %w", err)
}
2024-08-28 11:14:55 +00:00
dev.PowerOn()
d := displayMt12864a{
logger: logger,
2024-08-28 11:14:55 +00:00
dev: dev,
}
return &d, nil
}
2024-08-28 11:14:55 +00:00
func (d *displayMt12864a) GetBounds() image.Rectangle {
return image.Rectangle{}
}
2024-08-28 11:14:55 +00:00
func (d *displayMt12864a) Flush(img *image.Gray) error {
return nil
}
2024-08-28 11:14:55 +00:00
func (d *displayMt12864a) Close() error {
return rpio.Close()
}