Skip to content

Commit aa0df8d

Browse files
authored
Merge pull request #16 from tannewt/little_endian
Fix partial RAM updates
2 parents 05afbed + b6a28f5 commit aa0df8d

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 terminalio
17+
import adafruit_ssd1675
18+
19+
displayio.release_displays()
20+
21+
# This pinout works on a Feather RP2040 EPD and may need to be altered for other
22+
# boards. The older SSD1675 version with HINK on the ribbon cable 2.13" dual color
23+
# is connected directly via the ribbon cable.
24+
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
25+
epd_cs = board.EPD_CS
26+
epd_dc = board.EPD_DC
27+
epd_reset = board.EPD_RESET
28+
epd_busy = board.EPD_BUSY
29+
30+
display_bus = displayio.FourWire(
31+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
32+
)
33+
display = adafruit_ssd1675.SSD1675(
34+
display_bus,
35+
width=250,
36+
height=122,
37+
busy_pin=epd_busy,
38+
rotation=270,
39+
seconds_per_frame=10,
40+
)
41+
42+
# Make the display context
43+
main_group = displayio.Group()
44+
display.show(main_group)
45+
46+
palette = displayio.Palette(2)
47+
palette[0] = 0x000000
48+
palette[1] = 0xFFFFFF
49+
50+
zero_glyph = terminalio.FONT.get_glyph(ord("0"))
51+
52+
padding = max(zero_glyph.height, zero_glyph.width) + 1
53+
label = displayio.TileGrid(
54+
terminalio.FONT.bitmap,
55+
pixel_shader=palette,
56+
tile_width=zero_glyph.width,
57+
tile_height=zero_glyph.height,
58+
)
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)