Simple test

Ensure your device works with this simple test.

examples/st7735_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""
 5This test will initialize the display using displayio
 6and draw a solid red background
 7"""
 8
 9import board
10import displayio
11from adafruit_st7735 import ST7735
12
13# Release any resources currently in use for the displays
14displayio.release_displays()
15
16spi = board.SPI()
17tft_cs = board.D5
18tft_dc = board.D6
19
20display_bus = displayio.FourWire(
21    spi, command=tft_dc, chip_select=tft_cs, reset=board.D9
22)
23
24display = ST7735(display_bus, width=128, height=128)
25
26# Make the display context
27splash = displayio.Group()
28display.show(splash)
29
30color_bitmap = displayio.Bitmap(128, 128, 1)
31color_palette = displayio.Palette(1)
32color_palette[0] = 0xFF0000
33
34bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
35splash.append(bg_sprite)
36
37while True:
38    pass