Skip to content

Commit e23c487

Browse files
authored
Merge pull request #34 from markmcgookin/main
Minor changes to the ST7789 1.47 Example that were required to work with raspberry pi pico w
2 parents 7687a85 + 20dc9f3 commit e23c487

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

examples/st7789_172x320_1.47_simpletest.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,29 @@
1111
from adafruit_display_text import label
1212
from adafruit_st7789 import ST7789
1313

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

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

21+
# built-in, silkscreen labelled SPI bus
2022
spi = board.SPI()
2123
tft_cs = board.D5
2224
tft_dc = board.D6
2325
tft_rst = board.D9
2426

27+
# If using a Raspberry Pi Pico or Pico-w
28+
# Uncomment the below code to use GP (General Purpose) pins
29+
# instead of D (Digital)
30+
31+
# import busio
32+
# spi = busio.SPI(board.GP2, board.GP3, board.GP4)
33+
# tft_cs = board.GP5
34+
# tft_dc = board.GP6
35+
# tft_rst = board.GP7
36+
2537
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)
2638

2739
display = ST7789(display_bus, width=320, height=172, colstart=34, rotation=270)
@@ -40,6 +52,7 @@
4052
inner_bitmap = displayio.Bitmap(
4153
display.width - (BORDER_WIDTH * 2), display.height - (BORDER_WIDTH * 2), 1
4254
)
55+
4356
inner_palette = displayio.Palette(1)
4457
inner_palette[0] = 0xAA0088 # Purple
4558
inner_sprite = displayio.TileGrid(

0 commit comments

Comments
 (0)