Skip to content

Commit cf15aa7

Browse files
committed
DM: working blinka example
1 parent 02e70fa commit cf15aa7

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

adafruit_epd/epd.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ def command(self, cmd, data=None, end=True):
9090

9191
if data is not None:
9292
self.data(data)
93+
else:
94+
self.spi_device.unlock()
9395

94-
elif end:
96+
if end:
9597
self._cs.value = True
96-
97-
self.spi_device.unlock()
98+
9899
return outbuf[0]
99100

100101
def data(self, dat):

adafruit_epd/il0373.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,15 @@ def image(self, image):
179179
# Grab all the pixels from the image, faster than getpixel.
180180
pix = image.load()
181181

182-
for y in xrange(image.size[1]):
183-
for x in xrange(image.size[0]):
182+
for y in iter(range(image.size[1])):
183+
for x in iter(range(image.size[0])):
184184
if x == 0:
185185
x = 1
186186
p = pix[x, y]
187187

188188
addr = int(((self.width - x) * self.height + y)/8)
189-
if color == Adafruit_EPD.RED:
189+
190+
if p == (0xFF, 0, 0):
190191
addr = addr + self.bw_bufsize
191192
current = self.sram.read8(addr)
192193

examples/epd_blinka.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@
1010

1111
# create the spi device and pins we will need
1212
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
13+
while not spi.try_lock():
14+
pass
15+
spi.configure(baudrate=16000000)
16+
spi.unlock()
17+
1318
ecs = digitalio.DigitalInOut(board.D22)
1419
dc = digitalio.DigitalInOut(board.D13)
15-
srcs = digitalio.DigitalInOut(board.D8)
20+
srcs = digitalio.DigitalInOut(board.D6)
1621
rst = digitalio.DigitalInOut(board.D19)
1722
busy = digitalio.DigitalInOut(board.D26)
1823

1924
# give them all to our driver
2025
display = Adafruit_IL0373(152, 152, rst, dc, busy, srcs, ecs, spi)
2126
# Create blank image for drawing.
2227
# Make sure to create image with mode '1' for 1-bit color.
23-
width = disp.width
24-
height = disp.height
28+
width = display.width
29+
height = display.height
2530
image = Image.new('RGB', (width, height))
2631

2732
WHITE = (0xFF, 0xFF, 0xFF)

0 commit comments

Comments
 (0)