Skip to content

Commit 880b958

Browse files
sago35deadprogram
authored andcommitted
ili9341: added Feather board support to InitDisplay()
1 parent 24db8b4 commit 880b958

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//go:build feather_m0 || feather_m4 || feather_m4_can || feather_nrf52840 || feather_nrf52840_sense || feather_stm32f405 || feather_rp2040
2+
// +build feather_m0 feather_m4 feather_m4_can feather_nrf52840 feather_nrf52840_sense feather_stm32f405 feather_rp2040
3+
4+
package initdisplay
5+
6+
import (
7+
"machine"
8+
9+
"tinygo.org/x/drivers/ili9341"
10+
)
11+
12+
func InitDisplay() *ili9341.Device {
13+
machine.D5.Configure(machine.PinConfig{Mode: machine.PinOutput})
14+
machine.D6.Configure(machine.PinConfig{Mode: machine.PinOutput})
15+
16+
machine.SPI0.Configure(machine.SPIConfig{
17+
SCK: machine.SPI0_SCK_PIN,
18+
SDO: machine.SPI0_SDO_PIN,
19+
SDI: machine.SPI0_SDI_PIN,
20+
Frequency: 40000000,
21+
})
22+
23+
// configure backlight
24+
backlight := machine.D9
25+
backlight.Configure(machine.PinConfig{machine.PinOutput})
26+
27+
display := ili9341.NewSPI(
28+
machine.SPI0,
29+
machine.D10, // LCD_DC,
30+
machine.D11, // LCD_SS_PIN,
31+
machine.D12, // LCD_RESET,
32+
)
33+
34+
// configure display
35+
display.Configure(ili9341.Config{})
36+
37+
backlight.High()
38+
39+
display.SetRotation(ili9341.Rotation270)
40+
41+
return display
42+
}

0 commit comments

Comments
 (0)