Skip to content

Commit bdda668

Browse files
committed
get rid of clear_display/clear_buffer and replace with just fill()
1 parent f447249 commit bdda668

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

adafruit_epd/epd.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Adafruit_EPD:
4242

4343
# pylint: disable=too-many-arguments
4444
def __init__(self, width, height, rst_pin, dc_pin, busy_pin, srcs_pin, cs_pin, spi):
45+
# pylint: enable=too-many-arguments
4546
self.width = width
4647
self.height = height
4748

@@ -56,22 +57,18 @@ def __init__(self, width, height, rst_pin, dc_pin, busy_pin, srcs_pin, cs_pin, s
5657
# Setup dc pin.
5758
self._dc = dc_pin
5859
self._dc.direction = digitalio.Direction.OUTPUT
60+
self._dc.value = False
5961

6062
# Setup cs pin.
6163
self._cs = cs_pin
6264
self._cs.direction = digitalio.Direction.OUTPUT
65+
self._cs.value = True
6366

6467
self.spi_device = spi
6568

6669
self.sram = mcp_sram.Adafruit_MCP_SRAM(srcs_pin, spi)
67-
# pylint: enable=too-many-arguments
68-
69-
def begin(self, reset=True):
70-
"""Begin display and reset if desired."""
71-
self._cs.value = True
72-
self._dc.value = False
7370

74-
if reset:
71+
if self._rst:
7572
self._rst.value = False
7673
time.sleep(.1)
7774
self._rst.value = True

adafruit_epd/il0373.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ def __init__(self, width, height, rst_pin, dc_pin, busy_pin, srcs_pin, cs_pin, s
6565

6666
self.bw_bufsize = int(width * height / 8)
6767
self.red_bufsize = int(width * height / 8)
68-
69-
self.begin()
7068
# pylint: enable=too-many-arguments
7169

7270
def begin(self, reset=True):
@@ -221,12 +219,14 @@ def draw_pixel(self, x, y, color):
221219
self.sram.write8(addr, current)
222220
return
223221

224-
def clear_buffer(self):
225-
"""clear the display buffer"""
226-
self.sram.erase(0x00, self.bw_bufsize, 0xFF)
227-
self.sram.erase(self.bw_bufsize, self.red_bufsize, 0xFF)
228-
229-
def clear_display(self):
230-
"""clear the entire display"""
231-
self.clear_buffer()
232-
self.display()
222+
def fill(self, color):
223+
"""fill the screen with the passed color"""
224+
print("ffffil")
225+
red_fill = 0xFF
226+
black_fill = 0xFF
227+
if color == Adafruit_EPD.BLACK:
228+
black_fill = 0x00
229+
if color == Adafruit_EPD.RED:
230+
red_fill = 0x00
231+
self.sram.erase(0x00, self.bw_bufsize, black_fill)
232+
self.sram.erase(self.bw_bufsize, self.red_bufsize, red_fill)

0 commit comments

Comments
 (0)