Hi,
Regarding the XIAO ESP32C3 and ESP32C6 (using CircuitPython beta versions from S3), I use the code below I wrote based on my personal researches here and there.
There is still an issue on how to release pin board.D3. I will update this message if fixed some day!
round_display.py
:
import board
import busio
import displayio
import gc9a01
# Round Display constants:
ROUND_ROUND_WIDTH = 240
ROUND_ROUND_HEIGHT = 240
# Board pins:
ROUND_DISPLAY_TFT_CS = board.D1 # LCD_CS
ROUND_DISPLAY_TFT_DC = board.D3 # LCD_DC
ROUND_DISPLAY_TFT_BL = board.D6 # Note: Backlight, can't be changed on the Round Display
ROUND_DISPLAY_TFT_CLK = board.D8 # Aka board.SCK
ROUND_DISPLAY_SD_MISO = board.D9 # Aka board.MISO, for SPI read/write devices (eg, SDCard)
ROUND_DISPLAY_TFT_MOSI = board.D10 # Aka board.MOSI, for SPI read only devices (eg, Display)
def display_init():
spi_bus = busio.SPI(
clock=ROUND_DISPLAY_TFT_CLK, MOSI=ROUND_DISPLAY_TFT_MOSI,
)
display_conn = displayio.FourWire(
spi_bus,
command=ROUND_DISPLAY_TFT_DC, chip_select=ROUND_DISPLAY_TFT_CS,
)
display = gc9a01.GC9A01(
display_conn, rotation=0,
width=ROUND_ROUND_WIDTH, height=ROUND_ROUND_HEIGHT,
)
return spi_bus, display_conn, display
def display_deinit(spi_bus, display_conn, display):
spi_bus.deinit()
# Don't know yet how to release board.D3 used by display_conn