|
7 | 7 | import math
|
8 | 8 | from random import randint
|
9 | 9 | import time
|
10 |
| -import supervisor |
11 | 10 | import displayio
|
12 | 11 | import picodvi
|
13 | 12 | import board
|
|
23 | 22 | from adafruit_display_shapes.triangle import Triangle
|
24 | 23 | from adafruit_display_shapes.line import Line
|
25 | 24 |
|
26 |
| -displayio.release_displays() |
27 |
| - |
28 |
| -# check for DVI Feather |
29 |
| -if 'CKP' in dir(board): |
30 |
| - try: |
31 |
| - fb = picodvi.Framebuffer(320, 240, |
32 |
| - clk_dp=board.CKP, clk_dn=board.CKN, |
33 |
| - red_dp=board.D0P, red_dn=board.D0N, |
34 |
| - green_dp=board.D1P, green_dn=board.D1N, |
35 |
| - blue_dp=board.D2P, blue_dn=board.D2N, |
36 |
| - color_depth=8) |
37 |
| - except MemoryError as e: |
38 |
| - print("Error:\n", str(e)) |
39 |
| - time.sleep(5) |
40 |
| - supervisor.reload() |
| 25 | +# check for DVI Feather with built-in display |
| 26 | +if 'DISPLAY' in dir(board): |
| 27 | + display = board.DISPLAY |
| 28 | + |
| 29 | +# check for DVI feather without built-in display |
| 30 | +elif 'CKP' in dir(board): |
| 31 | + displayio.release_displays() |
| 32 | + fb = picodvi.Framebuffer(320, 240, |
| 33 | + clk_dp=board.CKP, clk_dn=board.CKN, |
| 34 | + red_dp=board.D0P, red_dn=board.D0N, |
| 35 | + green_dp=board.D1P, green_dn=board.D1N, |
| 36 | + blue_dp=board.D2P, blue_dn=board.D2N, |
| 37 | + color_depth=8) |
| 38 | + display = framebufferio.FramebufferDisplay(fb) |
41 | 39 | # otherwise assume Pico
|
42 | 40 | else:
|
43 |
| - try: |
44 |
| - fb = picodvi.Framebuffer(320, 240, |
45 |
| - clk_dp=board.GP12, clk_dn=board.GP13, |
46 |
| - red_dp=board.GP10, red_dn=board.GP11, |
47 |
| - green_dp=board.GP8, green_dn=board.GP9, |
48 |
| - blue_dp=board.GP6, blue_dn=board.GP7, |
49 |
| - color_depth=8) |
50 |
| - except MemoryError as e: |
51 |
| - print("Error:\n", str(e)) |
52 |
| - time.sleep(5) |
53 |
| - supervisor.reload() |
54 |
| -display = framebufferio.FramebufferDisplay(fb) |
| 41 | + displayio.release_displays() |
| 42 | + fb = picodvi.Framebuffer(320, 240, |
| 43 | + clk_dp=board.GP12, clk_dn=board.GP13, |
| 44 | + red_dp=board.GP10, red_dn=board.GP11, |
| 45 | + green_dp=board.GP8, green_dn=board.GP9, |
| 46 | + blue_dp=board.GP6, blue_dn=board.GP7, |
| 47 | + color_depth=8) |
| 48 | + display = framebufferio.FramebufferDisplay(fb) |
55 | 49 |
|
56 | 50 | bitmap = displayio.Bitmap(display.width, display.height, 3)
|
57 | 51 |
|
|
0 commit comments