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

Pimoroni Display Pack examples - show how to control backlight #38

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading