|
7 | 7 | import math
|
8 | 8 | from random import randint
|
9 | 9 | import time
|
| 10 | +import supervisor |
10 | 11 | import displayio
|
11 | 12 | import picodvi
|
12 | 13 | import board
|
|
26 | 27 |
|
27 | 28 | # check for DVI Feather
|
28 | 29 | if 'CKP' in dir(board):
|
29 |
| - fb = picodvi.Framebuffer(320, 240, |
30 |
| - clk_dp=board.CKP, clk_dn=board.CKN, |
31 |
| - red_dp=board.D0P, red_dn=board.D0N, |
32 |
| - green_dp=board.D1P, green_dn=board.D1N, |
33 |
| - blue_dp=board.D2P, blue_dn=board.D2N, |
34 |
| - color_depth=8) |
| 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() |
35 | 41 | # otherwise assume Pico
|
36 | 42 | else:
|
37 |
| - fb = picodvi.Framebuffer(320, 240, |
38 |
| - clk_dp=board.GP12, clk_dn=board.GP13, |
39 |
| - red_dp=board.GP10, red_dn=board.GP11, |
40 |
| - green_dp=board.GP8, green_dn=board.GP9, |
41 |
| - blue_dp=board.GP6, blue_dn=board.GP7, |
42 |
| - color_depth=8) |
| 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() |
43 | 54 | display = framebufferio.FramebufferDisplay(fb)
|
44 | 55 |
|
45 | 56 | bitmap = displayio.Bitmap(display.width, display.height, 3)
|
|
0 commit comments