Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes to the ST7789 1.47 Example that were required to work with raspberry pi pico w #34

Merged
merged 5 commits into from
Jan 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion examples/st7789_172x320_1.47_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,29 @@
from adafruit_display_text import label
from adafruit_st7789 import ST7789

BORDER_WIDTH = 20

BORDER_WIDTH = 28
TEXT_SCALE = 3

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

# built-in, silkscreen labelled SPI bus
spi = board.SPI()
tft_cs = board.D5
tft_dc = board.D6
tft_rst = board.D9

# If using a Raspberry Pi Pico or Pico-w
# Uncomment the below code to use GP (General Purpose) pins
# instead of D (Digital)

# import busio
# spi = busio.SPI(board.GP2, board.GP3, board.GP4)
# tft_cs = board.GP5
# tft_dc = board.GP6
# tft_rst = board.GP7

display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst)

display = ST7789(display_bus, width=320, height=172, colstart=34, rotation=270)
Expand All @@ -40,6 +52,7 @@
inner_bitmap = displayio.Bitmap(
display.width - (BORDER_WIDTH * 2), display.height - (BORDER_WIDTH * 2), 1
)

inner_palette = displayio.Palette(1)
inner_palette[0] = 0xAA0088 # Purple
inner_sprite = displayio.TileGrid(
Expand Down