Skip to content

Commit

Permalink
Merge pull request #38 from helgibbons/main
Browse files Browse the repository at this point in the history
Pimoroni Display Pack examples - show how to control backlight
  • Loading branch information
FoamyGuy authored Jun 17, 2024
2 parents b069295 + b88f46e commit fd4c53e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
17 changes: 16 additions & 1 deletion examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import busio
import terminalio
Expand Down Expand Up @@ -30,12 +34,23 @@
spi_mosi = board.GP19
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)
backlight = board.GP20

display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(
display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53
display_bus,
rotation=270,
width=240,
height=135,
rowstart=40,
colstart=53,
backlight_pin=backlight,
)

# Set the backlight
display.brightness = 0.8

# Make the display context
splash = displayio.Group()
display.root_group = splash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = ST7789(
display_bus, rotation=270, width=320, height=240, backlight_pin=backlight
display_bus,
rotation=270,
width=320,
height=240,
backlight_pin=backlight,
)

# Set the backlight
display.brightness = 0.8

# Make the display context
splash = displayio.Group()
display.root_group = splash
Expand Down

0 comments on commit fd4c53e

Please sign in to comment.