Skip to content

Commit e3eee2c

Browse files
committed
Fix partial RAM updates
Addresses are little endian. Needs CircuitPython 8.1.0+ to work.
1 parent 05afbed commit e3eee2c

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

adafruit_ssd1675.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
7575
write_black_ram_command=0x24,
7676
refresh_display_command=0x20,
7777
refresh_time=2.2,
78+
address_little_endian=True
7879
)

examples/ssd1675_four_corners.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: Unlicense
5+
6+
"""Test partial updates by moving a simple label around each of the four corners."""
7+
8+
# The top left is 0 or 4, top right is 1 or 5, bottom left is 2 or 6 and bottom
9+
# right is 3 or 7. (It does % 8 for the label and % 4 for position.)
10+
# pylint: disable=no-member
11+
12+
import time
13+
import board
14+
import busio
15+
import displayio
16+
import digitalio
17+
import terminalio
18+
import adafruit_ssd1675
19+
20+
displayio.release_displays()
21+
22+
# This pinout works on a Feather RP2040 EPD and may need to be altered for other
23+
# boards. The older SSD1675 version with HINK on the ribbon cable 2.13" dual color
24+
# is connected directly via the ribbon cable.
25+
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
26+
epd_cs = board.EPD_CS
27+
epd_dc = board.EPD_DC
28+
epd_reset = board.EPD_RESET
29+
epd_busy = board.EPD_BUSY
30+
31+
display_bus = displayio.FourWire(
32+
spi,
33+
command=epd_dc,
34+
chip_select=epd_cs,
35+
reset=epd_reset,
36+
baudrate=1000000
37+
)
38+
display = adafruit_ssd1675.SSD1675(
39+
display_bus,
40+
width=250,
41+
height=122,
42+
busy_pin=epd_busy,
43+
rotation=270,
44+
seconds_per_frame=10
45+
)
46+
47+
# Make the display context
48+
main_group = displayio.Group()
49+
display.show(main_group)
50+
51+
palette = displayio.Palette(2)
52+
palette[0] = 0x000000
53+
palette[1] = 0xffffff
54+
55+
zero_glyph = terminalio.FONT.get_glyph(ord('0'))
56+
57+
padding = max(zero_glyph.height, zero_glyph.width) + 1
58+
label = displayio.TileGrid(terminalio.FONT.bitmap, pixel_shader=palette, tile_width=zero_glyph.width, tile_height=zero_glyph.height)
59+
main_group.append(label)
60+
61+
# Number each of the 4 corners
62+
i = 0
63+
while True:
64+
if i % 2 == 0:
65+
label.x = padding
66+
else:
67+
label.x = display.width - padding - zero_glyph.width
68+
if (i % 4) // 2 == 0:
69+
label.y = padding
70+
else:
71+
label.y = display.height - padding - zero_glyph.height
72+
73+
label[0] = zero_glyph.tile_index + i
74+
75+
# update text property to change the text showing on the display
76+
sleep_time = display.time_to_refresh
77+
print(f"Sleeping {sleep_time} seconds")
78+
time.sleep(sleep_time)
79+
80+
print(f"{i % 8} @ ({label.x}, {label.y})")
81+
display.refresh()
82+
83+
i += 1
84+
i %= 8

0 commit comments

Comments
 (0)