tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/gc9a01/main.go (about) 1 package main 2 3 import ( 4 "machine" 5 "time" 6 7 "image/color" 8 9 "tinygo.org/x/drivers/gc9a01" 10 ) 11 12 func main() { 13 machine.SPI0.Configure(machine.SPIConfig{ 14 Frequency: 80000000, 15 }) 16 display := gc9a01.New(machine.SPI0, machine.P6, machine.P7, machine.P8, machine.P9) 17 display.Configure(gc9a01.Config{Orientation: gc9a01.HORIZONTAL, Width: 240, Height: 240}) 18 19 width, height := display.Size() 20 21 white := color.RGBA{255, 255, 255, 255} 22 red := color.RGBA{255, 0, 0, 255} 23 blue := color.RGBA{0, 0, 255, 255} 24 green := color.RGBA{0, 255, 0, 255} 25 black := color.RGBA{0, 0, 0, 255} 26 27 display.FillScreen(black) 28 29 display.FillRectangle(0, 0, width/2, height/2, white) 30 display.FillRectangle(width/2, 0, width/2, height/2, red) 31 display.FillRectangle(0, height/2, width/2, height/2, green) 32 display.FillRectangle(width/2, height/2, width/2, height/2, blue) 33 display.FillRectangle(width/4, height/4, width/2, height/2, black) 34 35 for { 36 time.Sleep(time.Hour) 37 } 38 39 }