Skip to content

Commit 54f169e

Browse files
committed
Small changes to work with Circuit Python 8 Beta 4 on Raspberry Pi Pico. board.SPI didn't exist and needed to be changed to busio.SPI. The Dx reference for pins doesn't work and needs updated to be GPx (for the raspberry pi pico at least)
1 parent 59ff9de commit 54f169e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

examples/st7789_172x320_1.47_simpletest.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@
33

44
"""
55
This test will initialize the display using displayio and draw a solid green
6-
background, a smaller purple rectangle, and some yellow text.
6+
background, a smaller purple rectangle, and some yellow text..
77
"""
88
import board
9+
import busio
910
import terminalio
1011
import displayio
1112
from adafruit_display_text import label
1213
from adafruit_st7789 import ST7789
1314

14-
BORDER_WIDTH = 20
15+
BORDER_WIDTH = 28
1516
TEXT_SCALE = 3
1617

1718
# Release any resources currently in use for the displays
1819
displayio.release_displays()
1920

20-
spi = board.SPI()
21-
tft_cs = board.D5
22-
tft_dc = board.D6
23-
tft_rst = board.D9
21+
tft_cs = board.GP5 #board.D5
22+
tft_dc = board.GP6 #board.D6
23+
tft_rst = board.GP7 #board.D7
2424

25+
spi = busio.SPI(board.GP2, board.GP3, board.GP4)
2526
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
2627

2728
display = ST7789(display_bus, width=320, height=172, colstart=34, rotation=270)
@@ -34,12 +35,13 @@
3435
color_palette = displayio.Palette(1)
3536
color_palette[0] = 0x00FF00 # Bright Green
3637
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
37-
splash.append(bg_sprite)
38+
splash.append(bg_sprite)
3839

3940
# Draw a smaller inner rectangle
4041
inner_bitmap = displayio.Bitmap(
4142
display.width - (BORDER_WIDTH * 2), display.height - (BORDER_WIDTH * 2), 1
4243
)
44+
4345
inner_palette = displayio.Palette(1)
4446
inner_palette[0] = 0xAA0088 # Purple
4547
inner_sprite = displayio.TileGrid(
@@ -50,7 +52,7 @@
5052
# Draw a label
5153
text_area = label.Label(
5254
terminalio.FONT,
53-
text="Hello World!",
55+
text="Hello World!!",
5456
color=0xFFFF00,
5557
scale=TEXT_SCALE,
5658
anchor_point=(0.5, 0.5),

0 commit comments

Comments
 (0)