Description
For RP2350 (Fruit Jam), there seems to be no way to check the current color depth of a picodvi.Framebuffer
. Detecting width and height works fine, but that's not enough to determine the current video mode. If I understand correctly, it seems like adding a picodvi.Frambuffer.color_depth
property would make it possible to detect the full video mode to decide if re-initializing the display is necessary. Context: allocating a new picodvi display takes a chunk out of the heap and gives it to the supervisor, so it's nice to avoid that when it isn't necessary.
For example, I would like to be able to do something like this in code.py:
from board import CKP, CKN, D0P, D0N, D1P, D1N, D2P, D2N
import displayio
import framebufferio
import gc
import picodvi
import supervisor
width = 320
height = 240
color_depth = 8
display = supervisor.runtime.display
(w, h) = (display.width, display.height)
if (width != w) or (height != h) or (color_depth != display.color_depth):
print("re-initializing display")
displayio.release_displays()
gc.collect()
fb = picodvi.Framebuffer(width, height, clk_dp=CKP, clk_dn=CKN,
red_dp=D0P, red_dn=D0N, green_dp=D1P, green_dn=D1N,
blue_dp=D2P, blue_dn=D2N, color_depth=color_depth)
display = framebufferio.FramebufferDisplay(fb)
else:
print("using existing display")
And, this is an example of using the REPL to check the available properties of supervisor.runtime.display for Fruit Jam with CircuitPython 10.0.0-alpha.6 (note how there's nothing about color_depth
):
Adafruit CircuitPython 10.0.0-alpha.6 on 2025-05-17; Adafruit Fruit Jam with rp2350b
>>> import supervisor
>>> d = supervisor.runtime.display
>>> dir(d)
['__class__', 'auto_refresh', 'fill_row', 'framebuffer', 'height', 'refresh',
'root_group', 'rotation', 'show', 'width']
>>> dir(d.framebuffer)
['__class__', 'deinit', 'height', 'width']
>>> (d.width, d.height)
(320, 240)
>>> (d.framebuffer.width, d.framebuffer.height)
(320, 240)
>>>