-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (44 loc) · 1.22 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"image/color"
"machine"
"time"
"tinygo.org/x/drivers"
)
const clockHz = 133000000
func main() {
time.Sleep(5 * time.Second)
println("Initializing Display")
display := ST7789{
cs: machine.LCD_CS,
dc: machine.LCD_DC,
wr: machine.LCD_WR,
rd: machine.LCD_WR,
d0: machine.LCD_DB0,
bl: machine.LCD_BACKLIGHT,
stateMachineIndex: 0,
dmaChannel: 2,
width: 320,
height: 240,
rotation: drivers.Rotation0,
}
println("Initializing PIO")
display.pio = machine.PIO0
println("Configuring PIO")
display.pio.Configure()
println("Parallel Init")
display.ParallelInit()
// Setup DMA
println("Setting Up DMA")
dmaConfig := getDefaultDMAConfig(display.dmaChannel)
setTransferDataSize(dmaConfig, DMA_SIZE_8)
setBSwap(dmaConfig, false)
setDREQ(dmaConfig, display.pio.Device.GetIRQ())
dmaChannelConfigure(display.dmaChannel, dmaConfig, display.pio.Device.TXF0.Reg, 0, 0, false)
machine.LCD_RD.High()
println("Display Common Init")
display.CommonInit()
println("Making Screen Blue")
blue := color.RGBA{255, 255, 255, 255}
display.FillRectangle(0, 0, 320, 240, blue)
}