From 20022befa0e24fb3a54a23807d72c3e2b0c1cdb3 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:39:44 +0100 Subject: [PATCH 1/2] Pimoroni Display Pack examples - show how to control backlight --- ...9_240x135_simpletest_Pimoroni_Pico_Display_Pack.py | 11 ++++++++++- ...89_320x240_simpletest_Pimoroni_Pico_Display_2_0.py | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py b/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py index 3691a31..3dcce87 100644 --- a/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py +++ b/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py @@ -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 @@ -30,12 +34,17 @@ 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 diff --git a/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py b/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py index 3e8f0e0..4d0ab6f 100644 --- a/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py +++ b/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py @@ -35,6 +35,9 @@ 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 From b88f46e2b3f2e58d4c86ca0b6f743bd77027be33 Mon Sep 17 00:00:00 2001 From: helgibbons <50950368+helgibbons@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:15:55 +0100 Subject: [PATCH 2/2] Pimoroni Display Pack examples - fix formatting --- ...t7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py | 8 +++++++- ...st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py b/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py index 3dcce87..c4209df 100644 --- a/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py +++ b/examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py @@ -39,7 +39,13 @@ 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, backlight_pin=backlight + display_bus, + rotation=270, + width=240, + height=135, + rowstart=40, + colstart=53, + backlight_pin=backlight, ) # Set the backlight diff --git a/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py b/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py index 4d0ab6f..9f92b96 100644 --- a/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py +++ b/examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py @@ -32,7 +32,11 @@ 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