Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:28:51 +01:00
1 parent 7b6db17870
commit 0295eb1ad2
125 files changed
+59376

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
// Copyright 2018 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package main
import (
"image"
"log"
"git.maze.io/go/harmon/display/ssd1326"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
"periph.io/x/conn/v3/i2c/i2creg"
"periph.io/x/devices/v3/ssd1306/image1bit"
"periph.io/x/host/v3"
)
func main() {
// Make sure periph is initialized.
if _, err := host.Init(); err != nil {
log.Fatal(err)
}
// Use i2creg I²C bus registry to find the first available I²C bus.
b, err := i2creg.Open("")
if err != nil {
log.Fatal(err)
}
defer b.Close()
/*
dev, err := ssd1322.NewI2C(b, &ssd1322.DefaultOpts)
if err != nil {
log.Fatalf("failed to initialize ssd1322: %v", err)
}
*/
dev, err := ssd1326.NewI2C(b, 0x3C)
if err != nil {
log.Fatal(err)
}
//img := image1bit.NewVerticalLSB(dev.Bounds())
f := basicfont.Face7x13
drawer := font.Drawer{
Dst: dev,
Src: &image.Uniform{image1bit.On},
Face: f,
Dot: fixed.P(0, dev.Bounds().Dy()-1-f.Descent),
}
drawer.DrawString("Hello from periph!")
if err := dev.Refresh(); err != nil {
log.Fatal(err)
}
}