@@ -30,27 +30,39 @@ Usage Example
3030
3131.. code-block :: python
3232
33- from adafruit_st7789 import ST7789
3433 import board
35- import busio
3634 import displayio
37- import time
38-
39- displayio.release_displays()
40-
41- spi = busio.SPI(board.SCL , board.SDA )
42- bus = displayio.FourWire(spi, chip_select = board.D9, command = board.D7, reset = board.D8)
43- display = ST7789(bus, width = 128 , height = 128 )
35+ from adafruit_st7789 import ST7789
4436
45- s = displayio.Shape(10 , 10 )
46- p = displayio.Palette(2 )
47- p[1 ] = 0x ff0000
48- s = displayio.TileGrid(s, pixel_shader = p, x = 0 , y = 0 )
49- everything = displayio.Group(max_size = 10 )
50- everything.append(s)
51- display.show(everything)
37+ spi = board.SPI()
38+ tft_cs = board.D5
39+ tft_dc = board.D6
5240
53- time.sleep(10 )
41+ displayio.release_displays()
42+ display_bus = displayio.FourWire(spi, command = tft_dc, chip_select = tft_cs, reset = board.D9)
43+
44+ display = ST7789(display_bus, width = 240 , height = 240 , rowstart = 80 )
45+
46+ # Make the display context
47+ splash = displayio.Group(max_size = 10 )
48+ display.show(splash)
49+
50+ color_bitmap = displayio.Bitmap(240 , 240 , 1 )
51+ color_palette = displayio.Palette(1 )
52+ color_palette[0 ] = 0x FF0000
53+
54+ try :
55+ bg_sprite = displayio.TileGrid(color_bitmap,
56+ pixel_shader = color_palette,
57+ position = (0 , 0 ))
58+ except TypeError :
59+ bg_sprite = displayio.TileGrid(color_bitmap,
60+ pixel_shader = color_palette,
61+ x = 0 , y = 0 )
62+ splash.append(bg_sprite)
63+
64+ while True :
65+ pass
5466
5567 Contributing
5668============
0 commit comments