Skip to content

Commit c7fedd3

Browse files
authored
Merge pull request #2 from makermelissa/master
Created an example that uses displayio
2 parents c186ce7 + d7d3fbe commit c7fedd3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

examples/ili9341_simpletest.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
This test will initialize the display using displayio
3+
and draw a solid red background
4+
"""
5+
6+
import board
7+
import displayio
8+
import adafruit_ili9341
9+
10+
spi = board.SPI()
11+
tft_cs = board.D9
12+
tft_dc = board.D10
13+
14+
displayio.release_displays()
15+
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
16+
17+
display = adafruit_ili9341.ILI9341(display_bus)
18+
19+
# Make the display context
20+
splash = displayio.Group(max_size=10)
21+
display.show(splash)
22+
23+
color_bitmap = displayio.Bitmap(320, 240, 1)
24+
color_palette = displayio.Palette(1)
25+
color_palette[0] = 0xFF0000
26+
27+
try:
28+
bg_sprite = displayio.TileGrid(color_bitmap,
29+
pixel_shader=color_palette,
30+
position=(0, 0))
31+
except TypeError:
32+
bg_sprite = displayio.TileGrid(color_bitmap,
33+
pixel_shader=color_palette,
34+
x=0, y=0)
35+
splash.append(bg_sprite)
36+
37+
while True:
38+
pass

0 commit comments

Comments
 (0)