How to use Pico Breakout Garden Base Rear SPI socket?

Any body know what the trick is, in Micro Python, to use the rear SPI socket on the PICO Breakout garden Base? I’ve traced out all the Pins used from the schematic, I just don’t know what code to change in the examples to switch sockets.

Pin GP  Function
5   3   i2c int
6   4   i2c SDA
7   5   i2c SCL

36  3V3
33  GND
29  22  SPI  CE0  CS Back
28  GND
27  21  PWM0 Backlight Back
26  20  PWM1 Backlight Front
25  19  SPI  MOSI  
24  18  SPI  SCLK
23  GND
22  17  SPI  CE1  CS Front 
21  16  SPI  MISO DC

Found this which hints at how to do it.

// SPI 
 static const unsigned int SPI_DEFAULT_MOSI = 19; 
 static const unsigned int SPI_DEFAULT_MISO = 16; 
 static const unsigned int SPI_DEFAULT_SCK = 18; 
  
 static const unsigned int SPI_BG_FRONT_PWM = 20; 
 static const unsigned int SPI_BG_FRONT_CS = 17; 
  
 static const unsigned int SPI_BG_BACK_PWM = 21; 
 static const unsigned int SPI_BG_BACK_CS = 22; 

 ST7789(uint16_t width, uint16_t height, uint16_t *frame_buffer, BG_SPI_SLOT slot) :
      width(width), height(height), frame_buffer(frame_buffer) {
      switch(slot) {
        case PICO_EXPLORER_ONBOARD:
          cs = SPI_BG_FRONT_CS;
          bl = PIN_UNUSED;
          break;
        case BG_SPI_FRONT:
          cs = SPI_BG_FRONT_CS;
          bl = SPI_BG_FRONT_PWM;
          break;
        case BG_SPI_BACK:
          cs = SPI_BG_BACK_CS;
          bl = SPI_BG_BACK_PWM;
          break;
      }
    }

pimoroni-pico/st7789.hpp at main · pimoroni/pimoroni-pico (github.com)

Making this edit switches me from the Pico Explorer driver to the actual display driver.

# Pico Explorer boilerplate
#import picoexplorer as display
#width = display.get_width()
#height = display.get_height()
#display_buffer = bytearray(width * height * 2)
#display.init(display_buffer)

from breakout_colourlcd240x240 import BreakoutColourLCD240x240

width = BreakoutColourLCD240x240.WIDTH
height = BreakoutColourLCD240x240.HEIGHT

display_buffer = bytearray(width * height * 2)  # 2-bytes per pixel (RGB565)
display = BreakoutColourLCD240x240(display_buffer)
display.set_backlight(1.0)

Everything still works on my Breakout Garden Base running the Explorer weather example.

If anybody is wondering why I want to switch sockets, its actually that I want to be able to run two displays at once. Use both the front and back at the same time.
Full file in use at this time is as follows.

# This example lets you plug a BME680 or BME688 breakout into your Pico Explorer to make a little indoor weather station, with barometer style descriptions.

import utime

from breakout_bme68x import BreakoutBME68X
from pimoroni_i2c import PimoroniI2C

from breakout_colourlcd240x240 import BreakoutColourLCD240x240

width = BreakoutColourLCD240x240.WIDTH
height = BreakoutColourLCD240x240.HEIGHT

display_buffer = bytearray(width * height * 2)  # 2-bytes per pixel (RGB565)
display = BreakoutColourLCD240x240(display_buffer)
display.set_backlight(1.0)

i2c = PimoroniI2C(sda=(4), scl=(5))
bme = BreakoutBME68X(i2c)

# lets set up some pen colours to make drawing easier
tempcolour = display.create_pen(255, 255, 255)  # this colour will get changed in a bit
humidcolour = display.create_pen(255, 255, 255)  # this colour will get changed in a bit
presscolour = display.create_pen(255, 255, 255)  # this colour will get changed in a bit
white = display.create_pen(255, 255, 255)
black = display.create_pen(0, 0, 0)
red = display.create_pen(255, 0, 0)


# converts the temperature into a barometer-type description and pen colour
def describe_temperature(temperature):
    global tempcolour
    if temperature < 0:
        description = "very cold"
        tempcolour = display.create_pen(0, 0, 255)
    elif 0 <= temperature < 20:
        description = "cold"
        tempcolour = display.create_pen(255, 255, 0)
    elif 13 <= temperature < 25:
        description = "temperate"
        tempcolour = display.create_pen(0, 255, 0)
    elif 25 <= temperature < 30:
        description = "hot"
        tempcolour = display.create_pen(255, 140, 0)
    elif temperature >= 30:
        description = "very hot"
        tempcolour = display.create_pen(255, 0, 0)
    else:
        description = ""
        tempcolour = display.create_pen(0, 0, 0)
    return description

# converts pressure into barometer-type description
def describe_pressure(pressure):
    global presscolour
    if pressure < 982:
        description = "storm"
        presscolour = display.create_pen(255, 0, 0)
    elif 982 <= pressure < 1004:
        description = "rain"
        presscolour = display.create_pen(255, 255, 0)
    elif 1004 <= pressure < 1026:
        description = "change"
        presscolour = display.create_pen(0, 255, 0)
    elif 1026 <= pressure < 1048:
        description = "fair"
        presscolour = display.create_pen(0, 0, 255)
    elif pressure >= 1048:
        description = "dry"
        presscolour = display.create_pen(255, 140, 0)
    else:
        description = ""
        presscolour = display.create_pen(0, 0, 0)
    return description


# converts humidity into good/bad description
def describe_humidity(humidity):
    global humidcolour
    if humidity < 30:
        description = "dry"
        humidcolour = display.create_pen(255, 140, 0)
    elif 30 <= humidity <= 60:
        description = "good"
        humidcolour = display.create_pen(0, 255, 0)
    elif 60 < humidity < 80:
        description = "humid"
        humidcolour = display.create_pen(255, 255, 0)
    elif humidity >= 80:
        description = "humid"
        humidcolour = display.create_pen(255, 0, 0)        
        
    return description


while True:
    # read the sensors
    temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read()

    # pressure comes in pascals which is a reight long number, lets convert it to the more manageable hPa
    pressurehpa = pressure / 100

    # draw a thermometer/barometer thingy
    display.set_pen(125, 125, 125)
    display.circle(190, 190, 40)
    display.rectangle(180, 45, 20, 140)

    # switch to red to draw the 'mercury'
    display.set_pen(red)
    display.circle(190, 190, 30)
    thermometerheight = int(120 / 30 * temperature)
    if thermometerheight > 120:
        thermometerheight = 120
    if thermometerheight < 1:
        thermometerheight = 1
    display.rectangle(186, 50 + 120 - thermometerheight, 10, thermometerheight)

    # drawing the temperature text
    display.set_pen(white)
    display.text("temperature:", 10, 10, 240, 3)
    display.set_pen(tempcolour)
    display.text('{:.1f}'.format(temperature) + 'C', 10, 30, 240, 5)
    display.set_pen(white)
    display.text(describe_temperature(temperature), 10, 60, 240, 3)

    # and the pressure text
    display.set_pen(white)
    display.text("pressure:", 10, 90, 240, 3)
    display.set_pen(presscolour)
    display.text('{:.0f}'.format(pressurehpa) + 'mb', 10, 110, 240, 5)
    display.set_pen(white)
    display.text(describe_pressure(pressurehpa), 10, 140, 240, 3)

    # and the humidity text
    display.set_pen(white)
    display.text("humidity:", 10, 170, 240, 3)
    display.set_pen(humidcolour)
    display.text('{:.0f}'.format(humidity) + '%', 10, 190, 240, 5)
    display.set_pen(white)
    display.text(describe_humidity(humidity), 10, 220, 240, 3)

    # time to update the display
    display.update()

    # waits for 1 second and clears to black
    utime.sleep(1)
    display.set_pen(black)
    display.clear()

Figured it out. =)
For the front its
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
display = BreakoutColourLCD240x240(display_buffer, cs=(17), bl=(20))
and for the back slot its
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
display = BreakoutColourLCD240x240(display_buffer, cs=(22), bl=(21))

To use both at once it would be something like this

display_buffer = bytearray(width * height * 2)  # 2-bytes per pixel (RGB565)
display_front = BreakoutColourLCD240x240(display_buffer, cs=(17), bl=(20)) 
display_back = BreakoutColourLCD240x240(display_buffer, cs=(22), bl=(21)) 

Then change any reference to “display” in your code to either display_front or display_back.