LCD Breakout, rotate possible? PICO running Micro Python

I have a Pico Display Pack and Display Pack V2. I have a need to rotate the image and or switch it to portrait mode? I’m not seeing any way to do it looking at the modules.
I could have easily missed it though. I’m far from any kind of expert on deciphering what’s in those files. I just look for key words and cross my fingers.

EDIT: Keep reading to see why i edited the thread title.

@Tonygo2 Even if you don’t know, you can tag along for the possible answer. ;)

ST7789 driver needed. The Waveshare one is totally Micropython and provides access to register 0x36 which controls rotations and reflections in range 0 to 7. Unfortunately, the Pimoroni UF2 does not provide easy access to this register.

See this post:
Pico Explorer screen corruption and communication crashes - Support - Pimoroni Buccaneers

Right now I have a big chunk of code written using the Pimoroni modules. And want to try and use 2 Pico Display packs. Wiring the two displays up to different CS and BL pins isn’t a big deal. Getting the module to use the alternate pins is. It’s not something you would normally do on a display pack, given how it connects to the PICO.
The LCD breakout driver works on the Display Pack and supports alternate pin use. It rotates the image 270 degrees though? The 240 x 240 LCD breakout is square, and I don’t see any rotate function.
Right now I’m leaning towards just using my two Display Packs side by side in Portrait with the LCD Breakout driver. It’s a minimal code change, just a couple of lines, versus starting all over again.

Hmm, I may have asked the wrong question?

What I need is a rotate function for the ST7789 LCD Breakout module.

My current setup is one 1.54’ 240x240 LCD breakout and one Display Pack V2

from breakout_colourlcd240x240 import BreakoutColourLCD240x240
import picodisplay2 as display2

display_buffer = bytearray(320 * 240 * 2)  # 2-bytes per pixel (RGB565)
display1 = BreakoutColourLCD240x240(display_buffer, cs=(22), bl=(21))
display2.init(display_buffer)

Take a look here:

This Instructable contains the code to run a 320x240 display and it is very easy to change the rotation and reflection to get exactly what you want. (Just strip out the extra demo code while testing.)

In the init_display section(self):

    self.write_cmd(0x36) # MADCTR
    self.write_data(0x70) # change the value of high nibble here

Page 125 of ST7789VW datasheet gives a diagram to help – at 317 pages this is a long read!

You will need to change BL the SPI pins in the code to match the physical pins on Display2 – this code uses the other SPI port as it stands.

This is pure MicroPython – the standard Pi Pico UF2 is all that is needed and that is all included within the Pimoroni UF2.

Access to this register by the user would be very helpful in the Pimoroni driver.

I hope this helps.

Thanks Tony, will give it a look see some time today. Not feeling very well at the moment, chronic pain issues. It curtails my enthusiasm at times. I really appreciate the feedback though. =)

I was wondering why you were up so early. Hope you feel better soon and get this to work.

I bought the Waveshare display instead of the Pimoroni version because the Pirates’ code was still suffering from the pixel corruption problem - now fixed! I’m pretty sure the display and a driver chip are are same.

My dog gets me up around 5 AM, and we go for a walk in the woods around 6 AM. I can let her go off leash then and not bother anybody else using the trail. The only other people I see are other dog owners doing the same thing.

It’s usable as is. It will just look a whole lot better, and give me a little more screen space to play with, with two Display Packs.

Well it looks like I’m going to have to take a serous look at that driver / module you posted.
The BreakoutColourLCD240x240 module isn’t going to work. Even if I set the display buffer for 240x320 and specify the width height manually, it won’t draw anything on the screen outside of a 240 x 240 box.

The main problem I found with my 320x240 screen is the size of the buffer needed for the screen. It leaves little RAM for the program.

I ran into the same issue, barely enough room for one buffer, let alone one for each screen.
I had to do some trickery to make it work.
I do all my draws to display 1, and only display 1
Update display1 , then do a clear display to empty the buffer.
Then do all my draws to display 2. and only display 2
Update display2, then do a clear to empty the buffer.
Wash rinse and repeat.

Quite a work around - but it helps keep the little grey cells working and makes coding such fun.

Just started working with a 64 Neopixel square display and a Pico with MicroPython. Trying to display numbers with 3 x 5 characters - Easy to see from across the room.
Managed -399 to + 399, time (hours and minutes) binary and hex bytes.

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.

import st7789
and
display1 = st7789.ST7789(width=240, height=240, slot=0) #front
or
display2 = st7789.ST7789(width=240, height=240, slot=1) #back
works, just not both.