Skip to content

Commit

Permalink
Merge pull request #34 from markmcgookin/main
Browse files Browse the repository at this point in the history
Minor changes to the ST7789 1.47 Example that were required to work with raspberry pi pico w
  • Loading branch information
FoamyGuy committed Jan 21, 2023
2 parents 7687a85 + 20dc9f3 commit e23c487
Showing 1 changed file with 14 additions and 1 deletion.
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

0 comments on commit e23c487

Please sign in to comment.