Add Copyrighttext and license identifier

This commit is contained in:
Martin Refseth 2022-05-21 18:05:12 +02:00
parent 8de8522776
commit 42c745b3b6

View file

@ -1,3 +1,14 @@
# SPDX-FileCopyrightText: 2022 Martin Refseth, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""Simple test script for 1.54" 152x152 grayscale display.
Supported products:
* 1.54" Grayscale Display (GDEW0154T8D)
"""
# pylint: disable=no-member
import time
import board
import displayio
@ -6,6 +17,7 @@ import adafruit_uc8151d
displayio.release_displays()
# Pinout intended for use with a Raspberry Pi Pico
clk = board.GP10
si = board.GP11
dc = board.GP8
@ -27,30 +39,30 @@ display = adafruit_uc8151d.UC8151D(
bitmap = displayio.Bitmap(152, 152, 4)
# Draw Black
for x in range(0,152):
for y in range(0,38):
for x in range(0, 152):
for y in range(0, 38):
bitmap[x, y] = 0
#Draw Dark Gray
for x in range(0,152):
for y in range(38,76):
# Draw Dark Gray
for x in range(0, 152):
for y in range(38, 76):
bitmap[x, y] = 1
#Draw Light Gray
for x in range(0,152):
for y in range(76,114):
# Draw Light Gray
for x in range(0, 152):
for y in range(76, 114):
bitmap[x, y] = 2
#Draw White
for x in range(0,152):
for y in range(114,152):
# Draw White
for x in range(0, 152):
for y in range(114, 152):
bitmap[x, y] = 3
palette = displayio.Palette(4)
palette[0] = 0x000000 # Black
palette[1] = 0x404040 # Dark Gray
palette[2] = 0x808080 # Light Gray
palette[3] = 0xFFFFFF # White
palette[0] = 0x000000 # Black
palette[1] = 0x404040 # Dark Gray
palette[2] = 0x808080 # Light Gray
palette[3] = 0xFFFFFF # White
g = displayio.Group()
t = displayio.TileGrid(bitmap, pixel_shader=palette)
g.append(t)
display.show(g)
display.refresh()
display.refresh()