Skip to content

Commit 08088ef

Browse files
committed
Update logic of new Adafruit_SSD1680B class, replacing Adafruit_SSD1680Z
1 parent 8209cb7 commit 08088ef

File tree

2 files changed

+12
-81
lines changed

2 files changed

+12
-81
lines changed

adafruit_epd/ssd1680.py

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
import adafruit_framebuf
1515
from adafruit_epd.epd import Adafruit_EPD
1616

17+
# for backwards compatibility
18+
from adafruit_epd.ssd1680b import ( # pylint: disable=unused-import
19+
Adafruit_SSD1680B as Adafruit_SSD1680Z,
20+
)
21+
1722
try:
1823
"""Needed for type annotations"""
1924
import typing # pylint: disable=unused-import
@@ -211,77 +216,3 @@ def set_ram_address(
211216
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([x + 1]))
212217
# Set RAM Y address counter
213218
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([y, y >> 8]))
214-
215-
216-
class Adafruit_SSD1680Z(Adafruit_SSD1680):
217-
"""Driver for SSD1680Z ePaper display, overriding SSD1680 settings."""
218-
219-
# pylint: disable=too-many-arguments, useless-parent-delegation
220-
def __init__(
221-
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
222-
):
223-
# Call the parent class's __init__() to initialize attributes
224-
super().__init__(
225-
width,
226-
height,
227-
spi,
228-
cs_pin=cs_pin,
229-
dc_pin=dc_pin,
230-
sramcs_pin=sramcs_pin,
231-
rst_pin=rst_pin,
232-
busy_pin=busy_pin,
233-
)
234-
self.busy_pin = busy_pin # Ensure busy_pin is set
235-
236-
# pylint: enable=too-many-arguments, useless-parent-delegation
237-
238-
def power_up(self):
239-
"""Power up sequence specifically for SSD1680Z."""
240-
self.hardware_reset()
241-
self.busy_wait()
242-
self.command(_SSD1680_SW_RESET)
243-
self.busy_wait()
244-
245-
self.command(
246-
_SSD1680_DRIVER_CONTROL,
247-
bytearray([self._height, (self._height) >> 8, 0x00]),
248-
)
249-
self.command(_SSD1680_DATA_MODE, bytearray([0x03]))
250-
251-
# Set voltages
252-
self.command(_SSD1680_WRITE_VCOM_REG, bytearray([0x36]))
253-
self.command(_SSD1680_GATE_VOLTAGE, bytearray([0x17]))
254-
self.command(_SSD1680_SOURCE_VOLTAGE, bytearray([0x41, 0x00, 0x32]))
255-
256-
self.command(_SSD1680_SET_RAMXPOS, bytearray([0x00, (self._width // 8)]))
257-
self.command(
258-
_SSD1680_SET_RAMYPOS,
259-
bytearray([0x00, 0x00, self._height, (self._height) >> 8]),
260-
)
261-
262-
# Set border waveform
263-
self.command(_SSD1680_WRITE_BORDER, bytearray([0x05]))
264-
265-
# Set ram X count
266-
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([0x01]))
267-
# Set ram Y count
268-
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([self._height, 0]))
269-
self.busy_wait()
270-
271-
def update(self):
272-
"""Update the display specifically for SSD1680Z."""
273-
self.command(_SSD1680_DISP_CTRL2, bytearray([0xF7])) # Full update for SSD1680Z
274-
self.command(_SSD1680_MASTER_ACTIVATE)
275-
self.busy_wait()
276-
if not self.busy_pin:
277-
time.sleep(3) # Wait for update to complete
278-
279-
def set_ram_address(
280-
self, x: int, y: int
281-
) -> None: # pylint: disable=unused-argument, no-self-use
282-
"""Set the RAM address location, not used on this chipset but required by
283-
the superclass"""
284-
# Set RAM X address counter
285-
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([x]))
286-
# Set RAM Y address counter
287-
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([y, y >> 8]))

adafruit_epd/ssd1680b.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
`adafruit_epd.ssd1680b` - Adafruit SSD1680B - ePaper display driver
88
====================================================================================
99
CircuitPython driver for Adafruit SSD1680B displays (GDEY0213B74 display module)
10-
* Author(s): Melissa LeBlanc-Williams, Joel Miller
10+
* Author(s): Melissa LeBlanc-Williams, Joel Miller, Mikey Sklar
1111
"""
1212

1313
import time
@@ -158,7 +158,7 @@ def power_up(self) -> None:
158158
# driver output control
159159
self.command(
160160
_SSD1680B_DRIVER_CONTROL,
161-
bytearray([self._height - 1, (self._height - 1) >> 8, 0x00]),
161+
bytearray([self._height, self._height >> 8, 0x00]),
162162
)
163163
# data entry mode
164164
self.command(_SSD1680B_DATA_MODE, bytearray([0x03]))
@@ -169,19 +169,19 @@ def power_up(self) -> None:
169169
self.command(_SSD1680B_SOURCE_VOLTAGE, bytearray([0x41, 0x00, 0x32]))
170170

171171
# Set ram X start/end postion
172-
self.command(_SSD1680B_SET_RAMXPOS, bytearray([0x01, 0x10]))
172+
self.command(_SSD1680B_SET_RAMXPOS, bytearray([0x00, self._width // 8]))
173173
# Set ram Y start/end postion
174174
self.command(
175175
_SSD1680B_SET_RAMYPOS,
176-
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]),
176+
bytearray([0, 0, self._height, self._height >> 8]),
177177
)
178178
# Set border waveform
179179
self.command(_SSD1680B_WRITE_BORDER, bytearray([0x05]))
180180

181181
# Set ram X count
182182
self.command(_SSD1680B_SET_RAMXCOUNT, bytearray([0x01]))
183183
# Set ram Y count
184-
self.command(_SSD1680B_SET_RAMYCOUNT, bytearray([self._height - 1, 0]))
184+
self.command(_SSD1680B_SET_RAMYCOUNT, bytearray([self._height, 0]))
185185
self.busy_wait()
186186

187187
def power_down(self) -> None:
@@ -191,7 +191,7 @@ def power_down(self) -> None:
191191

192192
def update(self) -> None:
193193
"""Update the display from internal memory"""
194-
self.command(_SSD1680B_DISP_CTRL2, bytearray([0xF4]))
194+
self.command(_SSD1680B_DISP_CTRL2, bytearray([0xF7]))
195195
self.command(_SSD1680B_MASTER_ACTIVATE)
196196
self.busy_wait()
197197
if not self._busy:
@@ -212,6 +212,6 @@ def write_ram(self, index: Literal[0, 1]) -> int:
212212
def set_ram_address(self, x: int, y: int) -> None:
213213
"""Set the RAM address location"""
214214
# Set RAM X address counter
215-
self.command(_SSD1680B_SET_RAMXCOUNT, bytearray([x + 1]))
215+
self.command(_SSD1680B_SET_RAMXCOUNT, bytearray([x]))
216216
# Set RAM Y address counter
217217
self.command(_SSD1680B_SET_RAMYCOUNT, bytearray([y, y >> 8]))

0 commit comments

Comments
 (0)