Skip to content

Commit 98a38de

Browse files
authored
Merge pull request #45 from mikeysklar/grayscale4-2in13-bare-6383
2.13" gray4 for ADA bare eInk #6383
2 parents 7930b45 + 5ec2b80 commit 98a38de

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SPDX-FileCopyrightText: 2026 Mikey Sklar, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
"""4-gray grayscale example for the Adafruit 2.13" 250x122 E-Ink Display (#6383).
6+
7+
Ribbon Identifier: FPC-7528B, colstart=8.
8+
Tested on Adafruit Feather RP2040 ThinkInk.
9+
"""
10+
11+
import time
12+
13+
import board
14+
import busio
15+
import displayio
16+
from fourwire import FourWire
17+
18+
import adafruit_ssd1680
19+
20+
displayio.release_displays()
21+
22+
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI)
23+
display_bus = FourWire(
24+
spi,
25+
command=board.EPD_DC,
26+
chip_select=board.EPD_CS,
27+
reset=board.EPD_RESET,
28+
baudrate=1000000,
29+
)
30+
time.sleep(1)
31+
32+
display = adafruit_ssd1680.SSD1680(
33+
display_bus,
34+
width=250,
35+
height=122,
36+
busy_pin=board.EPD_BUSY,
37+
rotation=270,
38+
colstart=8,
39+
vcom=0x1C,
40+
custom_lut=adafruit_ssd1680.FPC7519_LUT,
41+
grayscale=True,
42+
)
43+
44+
W, H = 250, 122
45+
bmp = displayio.Bitmap(W, H, 4)
46+
pal = displayio.Palette(4)
47+
pal[0] = 0xFFFFFF # white
48+
pal[1] = 0xAAAAAA # light gray
49+
pal[2] = 0x555555 # dark gray
50+
pal[3] = 0x000000 # black
51+
52+
COL = W // 4
53+
for y in range(H):
54+
for x in range(W):
55+
bmp[x, y] = min(x // COL, 3)
56+
57+
g = displayio.Group()
58+
g.append(displayio.TileGrid(bmp, pixel_shader=pal))
59+
display.root_group = g
60+
61+
print("Refreshing...")
62+
display.refresh()
63+
print("Done.")
64+
65+
time.sleep(display.time_to_refresh + 5)
66+
67+
while True:
68+
time.sleep(10)

0 commit comments

Comments
 (0)