From a410e4dc11c4c9969cd2fce7eba7c7a2e19acafd Mon Sep 17 00:00:00 2001 From: lady ada Date: Fri, 10 Jul 2020 13:38:31 -0400 Subject: [PATCH 1/6] blinka image --- examples/epd_bonnet.py | 3 ++- examples/epd_bonnet_blinka_250x122.bmp | Bin 0 -> 91798 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 examples/epd_bonnet_blinka_250x122.bmp diff --git a/examples/epd_bonnet.py b/examples/epd_bonnet.py index e04a431..1c9e060 100644 --- a/examples/epd_bonnet.py +++ b/examples/epd_bonnet.py @@ -106,7 +106,8 @@ time.sleep(0.01) if not switch2.value: print("Switch 2") - display.fill(Adafruit_EPD.WHITE) + blinkaimage = Image.open('epd_bonnet_blinka_250x122.bmp') + display.image(blinkaimage) display.display() while not switch2.value: time.sleep(0.01) diff --git a/examples/epd_bonnet_blinka_250x122.bmp b/examples/epd_bonnet_blinka_250x122.bmp new file mode 100644 index 0000000000000000000000000000000000000000..389e32f0fbe2a8f386314250b0297d6dfd7f9379 GIT binary patch literal 91798 zcmeI5&5>oft%SSRZ>N<^cosYZw3iQB$p|?yyXVe~2V=tcp^XGJ)L&!)B*??_b8mOC zBkE2vkw}0b=Bm`82>s=+|Nr-|U;gvw|Lo^~?dPBN^AG#^`sL5|`Q^*sEdHne`SR`O z8(|;+diKxPr9aR1xU2oN6L@Ohm$tl}^wYk@zS#W}xPRZ1!y+e(`T_MGwDpz1Tj&V0u*9G zH3;S^4x!<(f8$|lEy(*->nEex_C98^rAZmDG}NP<1Zp^w;(AwVF1Tls1uzA`Eok6p zfaa=R`5AoAzK0#0Y2=V5`1g)Jn8LZ282G|rKEx{xQ&3I<3@7y}BNw32fU^ds0GOx- zauW1%m7l>k?E4+dqE`w2dQ_QVpJgD!Q8jAS#3A?4k%z6bkZEJRl%UaEO;J8zl{p>? zOok?>XQnBJbda-PvOsf@O@ed#-dqYu?W>0;+jJSu0rX7rsIs!B2_^KHO=cJ-P>Ycn zsFgWNZVthqaR3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d!7av8f)N$3yW>nJyZt9iP_7uA&FdQA&r&|3G_@b75<9rNkUj`_e$A@=76c7aY7?gJW z{rBHZ2FNMSgv6e#$!jjy0Y?&hjPYpR9GvKs6?3q5QB2m-$-2r1Lk0PrE!rf>@+hD1 z4w`&0^#853=>frnV@QOb0f%xAiD#-muUXx9_Up{DUwB>mxzJOs@>6F<^^RR*pCJTK z2u76}RX$+P4dmqUQ0^h|WCIV&(o;;W%y?+7DTl;HV}U zBWr@8xn>;_YvTLh>37qXS*`-8zKPG|W<%U^Xft~POyJzUW8>h^(wW%4FG%TuP@;Dv zy(ifGo`6l@(tV$wsITYDzO%>%dj2z-Uhd{U)db#h-}yaJ7a5%2rwC>7Wb0J*`QKyv~o_FesS>6%!@hS3<-l~UePksA3GZ1Uid6=x%+by43FHaf zyzf>}x6<%$zy0Qn_Y$JvnEQp9SCX>9p1}S4ZZi(MX)CXT4^cm=Amfmd1)JFuXinf2 z`)=FX>}8VN%RV`%Ez1*lYTvE$`8^E|C;z?4!`RGEKY>T~ohdFaY);(E&Qv#;pTM*G zZhalv+@{#c`73Vao&XbgeBZrtvB<*^y>GB5aC8DM+IMerxY{Z>db6$H6UY;I>AusB R?zLhB8|(>OGJ!8&{tez4;H3Zn literal 0 HcmV?d00001 From c225150234a7dccc97426e817ae5577d84b65fd5 Mon Sep 17 00:00:00 2001 From: lady ada Date: Thu, 6 Apr 2023 23:58:53 -0400 Subject: [PATCH 2/6] make optimizations in case we dont have to toggle CS pin on each write. also add examples for u2if versions of feather epd --- adafruit_epd/epd.py | 44 ++++++++----- examples/feather_epd_blinka.py | 33 ++++++++++ examples/feather_epd_blinka_pillow.py | 93 +++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 examples/feather_epd_blinka.py create mode 100644 examples/feather_epd_blinka_pillow.py diff --git a/adafruit_epd/epd.py b/adafruit_epd/epd.py index 902d365..ee36427 100644 --- a/adafruit_epd/epd.py +++ b/adafruit_epd/epd.py @@ -107,8 +107,7 @@ def display(self): # pylint: disable=too-many-branches databyte = self._spi_transfer(databyte) self.sram.cs_pin.value = True else: - for databyte in self._buffer1: - self._spi_transfer(databyte) + self._spi_transfer(self._buffer1) self._cs.value = True self.spi_device.unlock() @@ -140,8 +139,7 @@ def display(self): # pylint: disable=too-many-branches databyte = self._spi_transfer(databyte) self.sram.cs_pin.value = True else: - for databyte in self._buffer2: - self._spi_transfer(databyte) + self._spi_transfer(self._buffer2) self._cs.value = True self.spi_device.unlock() @@ -171,23 +169,39 @@ def command(self, cmd, data=None, end=True): if data is not None: self._dc.value = True - for b in data: - self._spi_transfer(b) + self._spi_transfer(data) if end: self._cs.value = True self.spi_device.unlock() return ret - def _spi_transfer(self, databyte): - """Transfer one byte, toggling the cs pin if required by the EPD chipset""" - self._spibuf[0] = databyte - if self._single_byte_tx: - self._cs.value = False - self.spi_device.write_readinto(self._spibuf, self._spibuf) - if self._single_byte_tx: - self._cs.value = True - return self._spibuf[0] + def _spi_transfer(self, data): + """Transfer one byte or bytearray, toggling the cs pin if required by the EPD chipset""" + if isinstance(data, int): # single byte! + self._spibuf[0] = data + + # easy & fast case: array and no twiddling + if not self._single_byte_tx and isinstance(data, bytearray): + self.spi_device.write(data) + return None + + # if its a single byte + if isinstance(data, int): # single byte! + if self._single_byte_tx: + self._cs.value = False + try: + self.spi_device.write_readinto(self._spibuf, self._spibuf) + except NotImplementedError: + self.spi_device.write(self._spibuf) + if self._single_byte_tx: + self._cs.value = True + return self._spibuf[0] + + if isinstance(data, bytearray): + for x in data: + self._spi_transfer(x) + return None def power_up(self): """Power up the display in preparation for writing RAM and updating. diff --git a/examples/feather_epd_blinka.py b/examples/feather_epd_blinka.py new file mode 100644 index 0000000..4ccd585 --- /dev/null +++ b/examples/feather_epd_blinka.py @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-License-Identifier: MIT + +import digitalio +import busio +import board +from adafruit_epd.epd import Adafruit_EPD +import time + +# create the spi device and pins we will need +spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None) +epd_cs = digitalio.DigitalInOut(board.EPD_CS) +epd_dc = digitalio.DigitalInOut(board.EPD_DC) +epd_reset = digitalio.DigitalInOut(board.EPD_RESET) +epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) +srcs = None + +from adafruit_epd.ssd1680 import Adafruit_SSD1680 +display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc, + sramcs_pin=srcs, rst_pin=epd_reset, + busy_pin=epd_busy) + +display.rotation = 3 +display.fill(Adafruit_EPD.WHITE) + +display.fill_rect(20, 20, 50, 60, Adafruit_EPD.BLACK) +display.hline(80, 30, 60, Adafruit_EPD.BLACK) +display.vline(80, 30, 60, Adafruit_EPD.BLACK) + +# draw repeatedly with pauses +while True: + display.display() + time.sleep(15) diff --git a/examples/feather_epd_blinka_pillow.py b/examples/feather_epd_blinka_pillow.py new file mode 100644 index 0000000..55a6650 --- /dev/null +++ b/examples/feather_epd_blinka_pillow.py @@ -0,0 +1,93 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-License-Identifier: MIT + +import digitalio +import busio +import board +from adafruit_epd.epd import Adafruit_EPD +import time + +from PIL import Image +from PIL import ImageDraw +from PIL import ImageFont + +# create the spi device and pins we will need +spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None) +epd_cs = digitalio.DigitalInOut(board.EPD_CS) +epd_dc = digitalio.DigitalInOut(board.EPD_DC) +epd_reset = digitalio.DigitalInOut(board.EPD_RESET) +epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) +srcs = None + +from adafruit_epd.ssd1680 import Adafruit_SSD1680 +display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc, + sramcs_pin=srcs, rst_pin=epd_reset, + busy_pin=epd_busy) + +display.rotation = 3 +# Create blank image for drawing. +# Make sure to create image with mode '1' for 1-bit color. +width = display.width +height = display.height +image = Image.new("RGB", (width, height)) + +WHITE = (0xFF, 0xFF, 0xFF) +BLACK = (0x00, 0x00, 0x00) + +# clear the display +display.fill(Adafruit_EPD.WHITE) + +# Get drawing object to draw on image. +draw = ImageDraw.Draw(image) +# empty it +draw.rectangle((0, 0, width, height), fill=WHITE) + +# Draw an outline box +draw.rectangle((1, 1, width - 2, height - 2), outline=BLACK, fill=WHITE) +# Draw some shapes. +# First define some constants to allow easy resizing of shapes. +padding = 5 +shape_width = 30 +top = padding +bottom = height - padding +# Move left to right keeping track of the current x position for drawing shapes. +x = padding +# Draw an ellipse. +draw.ellipse((x, top, x + shape_width, bottom), outline=BLACK, fill=WHITE) +x += shape_width + padding +# Draw a rectangle. +draw.rectangle((x, top, x + shape_width, bottom), outline=WHITE, fill=BLACK) +x += shape_width + padding +# Draw a triangle. +draw.polygon( + [(x, bottom), (x + shape_width / 2, top), (x + shape_width, bottom)], + outline=BLACK, + fill=WHITE, +) +x += shape_width + padding +# Draw an X. +draw.line((x, bottom, x + shape_width, top), fill=BLACK) +draw.line((x, top, x + shape_width, bottom), fill=BLACK) +x += shape_width + padding + +# Load default font. +font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20) + +# Alternatively load a TTF font. Make sure the .ttf font +# file is in the same directory as the python script! +# Some other nice fonts to try: http://www.dafont.com/bitmap.php +# font = ImageFont.truetype('Minecraftia.ttf', 8) + +# Write two lines of text. +draw.text((x, top), "Hello", font=font, fill=BLACK) +draw.text((x, top + 20), "World!", font=font, fill=BLACK) + +display.image(image) +display.display() + +time.sleep(10) + +blinkaimage = Image.open('examples/epd_bonnet_blinka_250x122.bmp') +display.image(blinkaimage) +display.display() + From 70279eddae2beb00ab91bfe2c74b6a21ddda5789 Mon Sep 17 00:00:00 2001 From: lady ada Date: Thu, 6 Apr 2023 23:59:55 -0400 Subject: [PATCH 3/6] black bonnet --- examples/epd_bonnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/epd_bonnet.py b/examples/epd_bonnet.py index 1c9e060..131119a 100644 --- a/examples/epd_bonnet.py +++ b/examples/epd_bonnet.py @@ -106,7 +106,7 @@ time.sleep(0.01) if not switch2.value: print("Switch 2") - blinkaimage = Image.open('epd_bonnet_blinka_250x122.bmp') + blinkaimage = Image.open("epd_bonnet_blinka_250x122.bmp") display.image(blinkaimage) display.display() while not switch2.value: From 5d9eeba8ad2830c5245d6db4bbf3180181d4da43 Mon Sep 17 00:00:00 2001 From: Liz Date: Fri, 7 Apr 2023 12:39:45 -0400 Subject: [PATCH 4/6] Linting files for CI --- examples/epd_bonnet.py | 32 +++++++++---------- .../epd_bonnet_blinka_250x122.bmp.license | 2 ++ examples/feather_epd_blinka.py | 19 +++++++---- examples/feather_epd_blinka_pillow.py | 25 +++++++++------ 4 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 examples/epd_bonnet_blinka_250x122.bmp.license diff --git a/examples/epd_bonnet.py b/examples/epd_bonnet.py index 131119a..821b2a7 100644 --- a/examples/epd_bonnet.py +++ b/examples/epd_bonnet.py @@ -61,29 +61,29 @@ draw.rectangle((1, 1, width - 2, height - 2), outline=BLACK, fill=WHITE) # Draw some shapes. # First define some constants to allow easy resizing of shapes. -padding = 5 -shape_width = 30 -top = padding -bottom = height - padding +PADDING = 5 +SHAPE_WIDTH = 30 +TOP = PADDING +bottom = height - PADDING # Move left to right keeping track of the current x position for drawing shapes. -x = padding +x = PADDING # Draw an ellipse. -draw.ellipse((x, top, x + shape_width, bottom), outline=BLACK, fill=WHITE) -x += shape_width + padding +draw.ellipse((x, TOP, x + SHAPE_WIDTH, bottom), outline=BLACK, fill=WHITE) +x += SHAPE_WIDTH + PADDING # Draw a rectangle. -draw.rectangle((x, top, x + shape_width, bottom), outline=WHITE, fill=BLACK) -x += shape_width + padding +draw.rectangle((x, TOP, x + SHAPE_WIDTH, bottom), outline=WHITE, fill=BLACK) +x += SHAPE_WIDTH + PADDING # Draw a triangle. draw.polygon( - [(x, bottom), (x + shape_width / 2, top), (x + shape_width, bottom)], + [(x, bottom), (x + SHAPE_WIDTH / 2, TOP), (x + SHAPE_WIDTH, bottom)], outline=BLACK, fill=WHITE, ) -x += shape_width + padding +x += SHAPE_WIDTH + PADDING # Draw an X. -draw.line((x, bottom, x + shape_width, top), fill=BLACK) -draw.line((x, top, x + shape_width, bottom), fill=BLACK) -x += shape_width + padding +draw.line((x, bottom, x + SHAPE_WIDTH, TOP), fill=BLACK) +draw.line((x, TOP, x + SHAPE_WIDTH, bottom), fill=BLACK) +x += SHAPE_WIDTH + PADDING # Load default font. font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20) @@ -94,8 +94,8 @@ # font = ImageFont.truetype('Minecraftia.ttf', 8) # Write two lines of text. -draw.text((x, top), "Hello", font=font, fill=BLACK) -draw.text((x, top + 20), "World!", font=font, fill=BLACK) +draw.text((x, TOP), "Hello", font=font, fill=BLACK) +draw.text((x, TOP + 20), "World!", font=font, fill=BLACK) while True: if not switch1.value: diff --git a/examples/epd_bonnet_blinka_250x122.bmp.license b/examples/epd_bonnet_blinka_250x122.bmp.license new file mode 100644 index 0000000..bf5cab1 --- /dev/null +++ b/examples/epd_bonnet_blinka_250x122.bmp.license @@ -0,0 +1,2 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/feather_epd_blinka.py b/examples/feather_epd_blinka.py index 4ccd585..1aae116 100644 --- a/examples/feather_epd_blinka.py +++ b/examples/feather_epd_blinka.py @@ -1,24 +1,31 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +import time import digitalio import busio import board from adafruit_epd.epd import Adafruit_EPD -import time +from adafruit_epd.ssd1680 import Adafruit_SSD1680 # create the spi device and pins we will need spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None) epd_cs = digitalio.DigitalInOut(board.EPD_CS) epd_dc = digitalio.DigitalInOut(board.EPD_DC) epd_reset = digitalio.DigitalInOut(board.EPD_RESET) -epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) +epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) srcs = None -from adafruit_epd.ssd1680 import Adafruit_SSD1680 -display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc, - sramcs_pin=srcs, rst_pin=epd_reset, - busy_pin=epd_busy) +display = Adafruit_SSD1680( + 122, + 250, + spi, + cs_pin=epd_cs, + dc_pin=epd_dc, + sramcs_pin=srcs, + rst_pin=epd_reset, + busy_pin=epd_busy, +) display.rotation = 3 display.fill(Adafruit_EPD.WHITE) diff --git a/examples/feather_epd_blinka_pillow.py b/examples/feather_epd_blinka_pillow.py index 55a6650..0ec82b6 100644 --- a/examples/feather_epd_blinka_pillow.py +++ b/examples/feather_epd_blinka_pillow.py @@ -1,28 +1,34 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +import time import digitalio import busio import board -from adafruit_epd.epd import Adafruit_EPD -import time - from PIL import Image from PIL import ImageDraw from PIL import ImageFont +from adafruit_epd.epd import Adafruit_EPD +from adafruit_epd.ssd1680 import Adafruit_SSD1680 # create the spi device and pins we will need spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None) epd_cs = digitalio.DigitalInOut(board.EPD_CS) epd_dc = digitalio.DigitalInOut(board.EPD_DC) epd_reset = digitalio.DigitalInOut(board.EPD_RESET) -epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) +epd_busy = digitalio.DigitalInOut(board.EPD_BUSY) srcs = None -from adafruit_epd.ssd1680 import Adafruit_SSD1680 -display = Adafruit_SSD1680(122, 250, spi, cs_pin=epd_cs, dc_pin=epd_dc, - sramcs_pin=srcs, rst_pin=epd_reset, - busy_pin=epd_busy) +display = Adafruit_SSD1680( + 122, + 250, + spi, + cs_pin=epd_cs, + dc_pin=epd_dc, + sramcs_pin=srcs, + rst_pin=epd_reset, + busy_pin=epd_busy, +) display.rotation = 3 # Create blank image for drawing. @@ -87,7 +93,6 @@ time.sleep(10) -blinkaimage = Image.open('examples/epd_bonnet_blinka_250x122.bmp') +blinkaimage = Image.open("examples/epd_bonnet_blinka_250x122.bmp") display.image(blinkaimage) display.display() - From 3c1bc12358b17f3bee638b5d9e827ff49f0e7195 Mon Sep 17 00:00:00 2001 From: Liz Date: Fri, 7 Apr 2023 12:42:44 -0400 Subject: [PATCH 5/6] black --- adafruit_epd/epd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_epd/epd.py b/adafruit_epd/epd.py index ee36427..fcccc26 100644 --- a/adafruit_epd/epd.py +++ b/adafruit_epd/epd.py @@ -178,7 +178,7 @@ def command(self, cmd, data=None, end=True): def _spi_transfer(self, data): """Transfer one byte or bytearray, toggling the cs pin if required by the EPD chipset""" - if isinstance(data, int): # single byte! + if isinstance(data, int): # single byte! self._spibuf[0] = data # easy & fast case: array and no twiddling @@ -187,7 +187,7 @@ def _spi_transfer(self, data): return None # if its a single byte - if isinstance(data, int): # single byte! + if isinstance(data, int): # single byte! if self._single_byte_tx: self._cs.value = False try: From b55552f6a93a9a57b0aabf3cc2c85f2ac3865199 Mon Sep 17 00:00:00 2001 From: Liz Date: Fri, 7 Apr 2023 12:56:23 -0400 Subject: [PATCH 6/6] fixing bmp license --- examples/epd_bonnet_blinka_250x122.bmp.license | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/epd_bonnet_blinka_250x122.bmp.license b/examples/epd_bonnet_blinka_250x122.bmp.license index bf5cab1..a784acf 100644 --- a/examples/epd_bonnet_blinka_250x122.bmp.license +++ b/examples/epd_bonnet_blinka_250x122.bmp.license @@ -1,2 +1,2 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries -# SPDX-License-Identifier: MIT \ No newline at end of file +# SPDX-License-Identifier: MIT