Add GP1278 and GP1294 display support and refresh dependencies
This commit is contained in:
5 files changed
+54
-24
No files matched your search
+9
-5
@@ -6,17 +6,21 @@ display {
|
|||||||
# Main display is where all the magic happens.
|
# Main display is where all the magic happens.
|
||||||
main {
|
main {
|
||||||
# Type of display
|
# Type of display
|
||||||
type = "ssd1322"
|
type = "gp1294"
|
||||||
size = "256x64"
|
size = "256x48"
|
||||||
|
reset = "GPIO25"
|
||||||
|
bl = "GPIO24"
|
||||||
|
|
||||||
# Mode (spi or i2c)
|
# Mode (spi or i2c)
|
||||||
mode = "spi"
|
mode = "spi"
|
||||||
|
|
||||||
# SPI settings
|
# SPI settings
|
||||||
port = "spi0.0"
|
port = "spi0.0"
|
||||||
reset = "GPIO25"
|
#type = "ssd1322"
|
||||||
dc = "GPIO24"
|
#size = "256x64"
|
||||||
bl = "GPIO23"
|
#reset = "GPIO25"
|
||||||
|
#dc = "GPIO24"
|
||||||
|
#bl = "GPIO23"
|
||||||
|
|
||||||
# I2C settings
|
# I2C settings
|
||||||
#addr = "3c"
|
#addr = "3c"
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
module github.com/BeatGlow/beatglow
|
module github.com/BeatGlow/beatglow
|
||||||
|
|
||||||
go 1.23.4
|
go 1.23.5
|
||||||
|
|
||||||
replace github.com/BeatGlow/audio => ../audio
|
|
||||||
|
|
||||||
replace github.com/BeatGlow/display => ../display
|
replace github.com/BeatGlow/display => ../display
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/BeatGlow/audio v0.1.2
|
github.com/BeatGlow/audio v0.1.0
|
||||||
github.com/BeatGlow/display v1.1.6
|
github.com/BeatGlow/display v1.1.8
|
||||||
github.com/go-daq/smbus v0.0.0-20201216173259-5725b4593606
|
github.com/go-daq/smbus v0.0.0-20201216173259-5725b4593606
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||||
github.com/hashicorp/hcl/v2 v2.23.0
|
github.com/hashicorp/hcl/v2 v2.23.0
|
||||||
@@ -18,8 +16,8 @@ require (
|
|||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
github.com/urfave/cli/v3 v3.0.0-beta1
|
github.com/urfave/cli/v3 v3.0.0-beta1
|
||||||
github.com/zachomedia/go-bdf v0.0.0-20220611021443-a3af701111be
|
github.com/zachomedia/go-bdf v0.0.0-20220611021443-a3af701111be
|
||||||
golang.org/x/image v0.23.0
|
golang.org/x/image v0.24.0
|
||||||
periph.io/x/conn/v3 v3.7.1
|
periph.io/x/conn/v3 v3.7.2
|
||||||
periph.io/x/host/v3 v3.8.3
|
periph.io/x/host/v3 v3.8.3
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,8 +29,8 @@ require (
|
|||||||
github.com/zclconf/go-cty v1.16.0 // indirect
|
github.com/zclconf/go-cty v1.16.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
|
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
|
||||||
golang.org/x/mod v0.22.0 // indirect
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
golang.org/x/sync v0.10.0 // indirect
|
golang.org/x/sync v0.11.0 // indirect
|
||||||
golang.org/x/sys v0.29.0 // indirect
|
golang.org/x/sys v0.29.0 // indirect
|
||||||
golang.org/x/text v0.21.0 // indirect
|
golang.org/x/text v0.22.0 // indirect
|
||||||
golang.org/x/tools v0.29.0 // indirect
|
golang.org/x/tools v0.29.0 // indirect
|
||||||
)
|
)
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
github.com/BeatGlow/audio v0.1.0 h1:Q5g0Y74RT0sStchYqX7u8wbbTe0F4Emg1Mixki2WC3Y=
|
||||||
|
github.com/BeatGlow/audio v0.1.0/go.mod h1:J0L6Ijc/cftvOZc9OpYZf+cu06HP6+pbe9TxDYRVpWo=
|
||||||
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||||
@@ -45,25 +47,25 @@ github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmB
|
|||||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
|
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
|
||||||
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
|
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
|
||||||
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
|
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
|
||||||
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
|
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
|
||||||
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||||
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||||
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
|
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
|
||||||
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
|
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
periph.io/x/conn/v3 v3.7.1 h1:tMjNv3WO8jEz/ePuXl7y++2zYi8LsQ5otbmqGKy3Myg=
|
periph.io/x/conn/v3 v3.7.2 h1:qt9dE6XGP5ljbFnCKRJ9OOCoiOyBGlw7JZgoi72zZ1s=
|
||||||
periph.io/x/conn/v3 v3.7.1/go.mod h1:c+HCVjkzbf09XzcqZu/t+U8Ss/2QuJj0jgRF6Nye838=
|
periph.io/x/conn/v3 v3.7.2/go.mod h1:Ao0b4sFRo4QOx6c1tROJU1fLJN1hUIYggjOrkIVnpGg=
|
||||||
periph.io/x/host/v3 v3.8.3 h1:v90ozCFDWgEyfNElZ+JnOvq0jAdW0vmgjCUy8dYXDds=
|
periph.io/x/host/v3 v3.8.3 h1:v90ozCFDWgEyfNElZ+JnOvq0jAdW0vmgjCUy8dYXDds=
|
||||||
periph.io/x/host/v3 v3.8.3/go.mod h1:uKrIpfXjELwHkwGBNe6aos//XiQ/3uxDa1P2BmLV6Ok=
|
periph.io/x/host/v3 v3.8.3/go.mod h1:uKrIpfXjELwHkwGBNe6aos//XiQ/3uxDa1P2BmLV6Ok=
|
||||||
@@ -23,6 +23,10 @@ func NewCombined(displays ...display.Display) display.Display {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Combined) String() string {
|
||||||
|
return "combined"
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Combined) At(x, y int) color.Color {
|
func (d *Combined) At(x, y int) color.Color {
|
||||||
if x < 0 || y < 0 || y >= d.size.Y {
|
if x < 0 || y < 0 || y >= d.size.Y {
|
||||||
return color.Black
|
return color.Black
|
||||||
|
|||||||
+24
-2
@@ -3,18 +3,30 @@ package hardware
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"periph.io/x/conn/v3/gpio/gpioreg"
|
"periph.io/x/conn/v3/gpio/gpioreg"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/BeatGlow/beatglow/config"
|
"github.com/BeatGlow/beatglow/config"
|
||||||
"github.com/BeatGlow/display"
|
"github.com/BeatGlow/display"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Display(config *config.DisplayConfig) (display.Display, error) {
|
func Display(config *config.DisplayConfig) (display.Display, error) {
|
||||||
log.Printf("display: %#+v", config)
|
log := logrus.WithFields(logrus.Fields{
|
||||||
|
"driver": config.Type,
|
||||||
|
"mode": config.Mode,
|
||||||
|
"addr": config.Address,
|
||||||
|
"bus": config.Bus,
|
||||||
|
"reset": config.Reset,
|
||||||
|
"dc": config.DC,
|
||||||
|
"cs": config.CS,
|
||||||
|
"bl": config.BL,
|
||||||
|
})
|
||||||
|
log.Debug("setup display")
|
||||||
|
//log.Printf("display: %#+v", config)
|
||||||
var (
|
var (
|
||||||
conn display.Conn
|
conn display.Conn
|
||||||
err error
|
err error
|
||||||
@@ -62,7 +74,17 @@ func Display(config *config.DisplayConfig) (display.Display, error) {
|
|||||||
return nil, fmt.Errorf("display: invalid size %q: %w", config.Size, err)
|
return nil, fmt.Errorf("display: invalid size %q: %w", config.Size, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithFields(logrus.Fields{
|
||||||
|
"reset": options.Reset,
|
||||||
|
"backlight": options.Backlight,
|
||||||
|
"width": options.Width,
|
||||||
|
"height": options.Height,
|
||||||
|
}).Info("loading display driver")
|
||||||
switch strings.ToUpper(config.Type) {
|
switch strings.ToUpper(config.Type) {
|
||||||
|
case "GP1278":
|
||||||
|
return display.GP1278(conn, options)
|
||||||
|
case "GP1294":
|
||||||
|
return display.GP1294(conn, options)
|
||||||
case "SH1106":
|
case "SH1106":
|
||||||
return display.SH1106(conn, options)
|
return display.SH1106(conn, options)
|
||||||
case "SSD1322":
|
case "SSD1322":
|
||||||
|
|||||||
Reference in new issue
Block a user