There is a new unified st7789 driver in the works that supports using portrait or landscape. I was able to do both on my Pico Display pack V2.
Unified display drivers · Issue #309 · pimoroni/pimoroni-pico (github.com)
Problem is I can’t use that same trick to run two displays at once?
This works with the old driver
import time
from breakout_colourlcd240x240 import BreakoutColourLCD240x240
display_buffer = bytearray(240 * 240 * 2) # 2-bytes per pixel (RGB565)
display1 = BreakoutColourLCD240x240(display_buffer, cs=(17), bl=(20))
#BreakoutColourLCD240x240(spi = 0, cs = 17, dc = 16, sck = 18, mosi = 19, bl = 20)
display2 = BreakoutColourLCD240x240(display_buffer, cs=(22), bl=(21))
#BreakoutColourLCD240x240(spi = 0, cs = 22, dc = 16, sck = 18, mosi = 19, bl = 21)
"""
import st7789
frame_buffer = bytearray(240 * 240 * 2) # 2-bytes per pixel (RGB565)
display1 = st7789.ST7789(width=240, height=240, *frame_buffer, slot=0) #front
#ST7789(spi = 0, cs = 17, dc = 16, sck = 18, mosi = 19, bl = 20)
display2 = st7789.ST7789(width=240, height=240, *frame_buffer, slot=1) #back
#ST7789(spi = 0, cs = 22, dc = 16, sck = 18, mosi = 19, bl = 21)
"""
display1.set_backlight(1.0)
display2.set_backlight(1.0)
print(display1)
print(display2)
while True:
display1.set_pen(255, 0, 0)
display1.clear()
display1.update()
display1.set_pen(0, 0, 0) # Set pen to black
display1.text("display 1", 10, 10, 240, 5) # landscape
display1.update()
display1.clear()
display2.set_pen(0, 255, 0)
display2.clear()
display2.update()
display2.set_pen(0, 0, 0) # Set pen to black
display2.text("display 2", 10, 10, 240, 5) # landscape
display2.update()
display2.clear()
time.sleep(2.)
display1.set_pen(0, 255, 0)
display1.clear()
display1.update()
display1.set_pen(0, 0, 0) # Set pen to black
display1.text("display 1 slot 0", 10, 10, 240, 5) # landscape
display1.update()
display1.clear()
display2.set_pen(0, 0, 255)
display2.clear()
display2.update()
display2.set_pen(0, 0, 0) # Set pen to black
display2.text("display 2 slot 1", 10, 10, 240, 5) # landscape
display2.update()
display2.clear()
time.sleep(2.)
display1.set_pen(0, 0, 255)
display1.clear()
display1.update()
display1.set_pen(0, 0, 0) # Set pen to black
display1.text("display 1 slot 0 front", 10, 10, 240, 5) # landscape
display1.update()
display1.clear()
display2.set_pen(255, 0, 0)
display2.clear()
display2.update()
display2.set_pen(0, 0, 0) # Set pen to black
display2.text("display 2 slot 1 back", 10, 10, 240, 5) # landscape
display2.update()
display2.clear()
time.sleep(2.)
display1.set_pen(0, 255, 255)
display1.clear()
display1.update()
display1.set_pen(0, 0, 0) # Set pen to black
display1.text("display 1 slot 0 front cs=(17) bl=(20)", 10, 10, 240, 5) # landscape
display1.update()
display1.clear()
display2.set_pen(255, 0, 255)
display2.clear()
display2.update()
display2.set_pen(0, 0, 0) # Set pen to black
display2.text("display 2 slot 1 back cs=(22) bl=(21)", 10, 10, 240, 5) # landscape
display2.update()
display2.clear()
time.sleep(2.)
display1.set_pen(255, 255, 255)
display1.clear()
display1.update()
display1.set_pen(0, 0, 0) # Set pen to black
display1.text("display 1 slot 0 front cs=(17) bl=(20) 240x240", 10, 10, 240, 5) # landscape
display1.update()
display1.clear()
display2.set_pen(255, 255, 255)
display2.clear()
display2.update()
display2.set_pen(0, 0, 0) # Set pen to black
display2.text("display 2 slot 1 back cs=(22) bl=(21) 240x240", 10, 10, 240, 5) # landscape
display2.update()
display2.clear()
time.sleep(2.)
If I try to use the new code I get a memory allocation error.
I can run one display or the other but not both.
Pi Pico, Pico Breakout Garden and two 240x240 LCD breakouts.