Skip to content

Commit 42c745b

Browse files
committed
Add Copyrighttext and license identifier
1 parent 8de8522 commit 42c745b

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

examples/uc8151d_grayscale_test.py

+28-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# SPDX-FileCopyrightText: 2022 Martin Refseth, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
"""Simple test script for 1.54" 152x152 grayscale display.
6+
7+
Supported products:
8+
* 1.54" Grayscale Display (GDEW0154T8D)
9+
"""
10+
# pylint: disable=no-member
11+
112
import time
213
import board
314
import displayio
@@ -6,6 +17,7 @@
617

718
displayio.release_displays()
819

20+
# Pinout intended for use with a Raspberry Pi Pico
921
clk = board.GP10
1022
si = board.GP11
1123
dc = board.GP8
@@ -27,30 +39,30 @@
2739
bitmap = displayio.Bitmap(152, 152, 4)
2840

2941
# Draw Black
30-
for x in range(0,152):
31-
for y in range(0,38):
42+
for x in range(0, 152):
43+
for y in range(0, 38):
3244
bitmap[x, y] = 0
33-
#Draw Dark Gray
34-
for x in range(0,152):
35-
for y in range(38,76):
45+
# Draw Dark Gray
46+
for x in range(0, 152):
47+
for y in range(38, 76):
3648
bitmap[x, y] = 1
37-
#Draw Light Gray
38-
for x in range(0,152):
39-
for y in range(76,114):
49+
# Draw Light Gray
50+
for x in range(0, 152):
51+
for y in range(76, 114):
4052
bitmap[x, y] = 2
41-
#Draw White
42-
for x in range(0,152):
43-
for y in range(114,152):
53+
# Draw White
54+
for x in range(0, 152):
55+
for y in range(114, 152):
4456
bitmap[x, y] = 3
4557

4658
palette = displayio.Palette(4)
47-
palette[0] = 0x000000 # Black
48-
palette[1] = 0x404040 # Dark Gray
49-
palette[2] = 0x808080 # Light Gray
50-
palette[3] = 0xFFFFFF # White
59+
palette[0] = 0x000000 # Black
60+
palette[1] = 0x404040 # Dark Gray
61+
palette[2] = 0x808080 # Light Gray
62+
palette[3] = 0xFFFFFF # White
5163

5264
g = displayio.Group()
5365
t = displayio.TileGrid(bitmap, pixel_shader=palette)
5466
g.append(t)
5567
display.show(g)
56-
display.refresh()
68+
display.refresh()

0 commit comments

Comments
 (0)