mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-05 07:27:49 +00:00
8b3075fdba
Signed-off-by: deadprogram <ron@hybridgroup.com>
39 lines
680 B
Go
39 lines
680 B
Go
//go:build wioterminal
|
|
|
|
package initdisplay
|
|
|
|
import (
|
|
"machine"
|
|
|
|
"tinygo.org/x/drivers/ili9341"
|
|
)
|
|
|
|
func InitDisplay() *ili9341.Device {
|
|
machine.SPI3.Configure(machine.SPIConfig{
|
|
SCK: machine.LCD_SCK_PIN,
|
|
SDO: machine.LCD_SDO_PIN,
|
|
SDI: machine.LCD_SDI_PIN,
|
|
Frequency: 40000000,
|
|
})
|
|
|
|
// configure backlight
|
|
backlight := machine.LCD_BACKLIGHT
|
|
backlight.Configure(machine.PinConfig{machine.PinOutput})
|
|
|
|
display := ili9341.NewSPI(
|
|
machine.SPI3,
|
|
machine.LCD_DC,
|
|
machine.LCD_SS_PIN,
|
|
machine.LCD_RESET,
|
|
)
|
|
|
|
// configure display
|
|
display.Configure(ili9341.Config{})
|
|
|
|
backlight.High()
|
|
|
|
display.SetRotation(ili9341.Rotation270)
|
|
|
|
return display
|
|
}
|