Skip to content

Commit f32ded4

Browse files
sago35conejoninja
authored andcommitted
initdisplay: add support for gopher-badge
1 parent d4e2645 commit f32ded4

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fmt-check:
2020

2121
TARGET = build/examples_epd.hex \
2222
build/examples_hub75.hex \
23+
build/examples_displays_gopher-badge.hex \
2324
build/examples_displays_pybadge.hex \
2425
build/examples_displays_pyportal.hex \
2526
build/examples_displays_wioterminal.hex \
@@ -38,6 +39,10 @@ build/examples_hub75.hex:
3839
$(TINYGO) build -size short -o $@ -target=pybadge ./examples/hub75
3940
@$(MD5SUM) $@
4041

42+
build/examples_displays_gopher-badge.hex:
43+
$(TINYGO) build -size short -o $@ -target=gopher-badge ./examples/displays
44+
@$(MD5SUM) $@
45+
4146
build/examples_displays_pybadge.hex:
4247
$(TINYGO) build -size short -o $@ -target=pybadge ./examples/displays
4348
@$(MD5SUM) $@

examples/initdisplay/gopher-badge.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//go:build gopher_badge
2+
3+
package initdisplay
4+
5+
import (
6+
"image/color"
7+
"machine"
8+
9+
"tinygo.org/x/drivers"
10+
"tinygo.org/x/drivers/st7789"
11+
)
12+
13+
// InitDisplay initializes the display of each board.
14+
func InitDisplay() drivers.Displayer {
15+
machine.SPI0.Configure(machine.SPIConfig{
16+
Frequency: 8000000,
17+
Mode: 0,
18+
})
19+
20+
d := st7789.New(machine.SPI0,
21+
machine.TFT_RST, // TFT_RESET
22+
machine.TFT_WRX, // TFT_DC
23+
machine.TFT_CS, // TFT_CS
24+
machine.TFT_BACKLIGHT) // TFT_LITE
25+
26+
d.Configure(st7789.Config{
27+
Rotation: st7789.NO_ROTATION,
28+
Height: 320,
29+
})
30+
d.FillScreen(color.RGBA{255, 255, 255, 255})
31+
32+
return &d
33+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy