Skip to content

Commit 1b83a7d

Browse files
authored
Merge pull request #2747 from adafruit/dvi_supervisor
adding try/except to DVI hello world
2 parents fdc0828 + 2d4f747 commit 1b83a7d

File tree

1 file changed

+9
-4
lines changed
  • CircuitPython_DVI_Hello_World

1 file changed

+9
-4
lines changed

CircuitPython_DVI_Hello_World/code.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,30 @@
2222
from adafruit_display_shapes.triangle import Triangle
2323
from adafruit_display_shapes.line import Line
2424

25-
displayio.release_displays()
25+
# check for DVI Feather with built-in display
26+
if 'DISPLAY' in dir(board):
27+
display = board.DISPLAY
2628

27-
# check for DVI Feather
28-
if 'CKP' in dir(board):
29+
# check for DVI feather without built-in display
30+
elif 'CKP' in dir(board):
31+
displayio.release_displays()
2932
fb = picodvi.Framebuffer(320, 240,
3033
clk_dp=board.CKP, clk_dn=board.CKN,
3134
red_dp=board.D0P, red_dn=board.D0N,
3235
green_dp=board.D1P, green_dn=board.D1N,
3336
blue_dp=board.D2P, blue_dn=board.D2N,
3437
color_depth=8)
38+
display = framebufferio.FramebufferDisplay(fb)
3539
# otherwise assume Pico
3640
else:
41+
displayio.release_displays()
3742
fb = picodvi.Framebuffer(320, 240,
3843
clk_dp=board.GP12, clk_dn=board.GP13,
3944
red_dp=board.GP10, red_dn=board.GP11,
4045
green_dp=board.GP8, green_dn=board.GP9,
4146
blue_dp=board.GP6, blue_dn=board.GP7,
4247
color_depth=8)
43-
display = framebufferio.FramebufferDisplay(fb)
48+
display = framebufferio.FramebufferDisplay(fb)
4449

4550
bitmap = displayio.Bitmap(display.width, display.height, 3)
4651

0 commit comments

Comments
 (0)