Skip to content

Instantly share code, notes, and snippets.

@Neradoc
Created March 14, 2023 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neradoc/0d5106ac93a978d8be36ecf7b8dd9683 to your computer and use it in GitHub Desktop.
Save Neradoc/0d5106ac93a978d8be36ecf7b8dd9683 to your computer and use it in GitHub Desktop.
Test a builtin display with a grid to check colstart/rowstart and such
import board
import displayio
import time
import vectorio
display = board.DISPLAY
splash = displayio.Group(x=0, y=0, scale=1)
display.show(splash)
color_palette = displayio.Palette(2)
color_palette[0] = 0
color_palette[1] = 0xFFFFFF
lines = displayio.Group()
lines.append(vectorio.Rectangle(pixel_shader=color_palette, color_index=1,
x=0, y=0, width=display.width, height=display.height,
))
lines.append(vectorio.Rectangle(pixel_shader=color_palette, color_index=0,
x=1, y=1, width=display.width-2, height=display.height-2,
))
for y in range(0, display.height+1, 16):
lines.append(vectorio.Rectangle(pixel_shader=color_palette,
width=display.width, height=1, x=0, y=y, color_index=1,
))
for x in range(0, display.width+1, 16):
lines.append(vectorio.Rectangle(pixel_shader=color_palette,
width=1, height=display.height, x=x, y=0, color_index=1,
))
splash.append(lines)
# this must not crash with a "pin in use" error
i2c = board.I2C()
while True:
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment