From 1e07941643d61188ff280748e4d40ffcf9b3659b Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 7 Oct 2025 13:51:02 -0400 Subject: [PATCH 1/2] update il0373 for 2.13 flex --- adafruit_epd/il0373.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/adafruit_epd/il0373.py b/adafruit_epd/il0373.py index f4382af..b1c1c03 100644 --- a/adafruit_epd/il0373.py +++ b/adafruit_epd/il0373.py @@ -70,8 +70,10 @@ def __init__( sramcs_pin: DigitalInOut, rst_pin: DigitalInOut, busy_pin: DigitalInOut, + pid: int = 0, # Product ID, defaults to 0 ) -> None: super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin) + self.pid = pid self._buffer1_size = int(width * height / 8) self._buffer2_size = int(width * height / 8) @@ -114,22 +116,29 @@ def power_up(self) -> None: self.hardware_reset() self.busy_wait() - self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09])) - self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) - self.command(_IL0373_POWER_ON) - - self.busy_wait() - time.sleep(0.2) - - self.command(_IL0373_PANEL_SETTING, bytearray([0xCF])) - self.command(_IL0373_CDI, bytearray([0x37])) - self.command(_IL0373_PLL, bytearray([0x29])) - _b1 = self._width & 0xFF - _b2 = (self._height >> 8) & 0xFF - _b3 = self._height & 0xFF - self.command(_IL0373_RESOLUTION, bytearray([_b1, _b2, _b3])) - self.command(_IL0373_VCM_DC_SETTING, bytearray([0x0A])) - time.sleep(0.05) + if self.pid == 4243: # Adafruit 2.13" HD Monochrome eInk Display - 212x104 + self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) + self.command(_IL0373_POWER_ON) + self.busy_wait() + time.sleep(0.2) + self.command(_IL0373_PANEL_SETTING, bytearray([0x1F, 0x0D])) + self.command(_IL0373_CDI, bytearray([0x97])) + else: + # Default IL0373 init sequence + self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09])) + self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) + self.command(_IL0373_POWER_ON) + self.busy_wait() + time.sleep(0.2) + self.command(_IL0373_PANEL_SETTING, bytearray([0xCF])) + self.command(_IL0373_CDI, bytearray([0x37])) + self.command(_IL0373_PLL, bytearray([0x29])) + _b1 = self._width & 0xFF + _b2 = (self._height >> 8) & 0xFF + _b3 = self._height & 0xFF + self.command(_IL0373_RESOLUTION, bytearray([_b1, _b2, _b3])) + self.command(_IL0373_VCM_DC_SETTING, bytearray([0x0A])) + time.sleep(0.05) def power_down(self) -> None: """Power down the display - required when not actively displaying!""" From afd64a99cdbb5b7e766a7b1b490a54993ab90654 Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 7 Oct 2025 15:04:23 -0400 Subject: [PATCH 2/2] subclass il0373 flex --- adafruit_epd/il0373.py | 83 ++++++++++++++++++++++++++------------ examples/epd_simpletest.py | 3 +- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/adafruit_epd/il0373.py b/adafruit_epd/il0373.py index b1c1c03..84f9728 100644 --- a/adafruit_epd/il0373.py +++ b/adafruit_epd/il0373.py @@ -70,10 +70,8 @@ def __init__( sramcs_pin: DigitalInOut, rst_pin: DigitalInOut, busy_pin: DigitalInOut, - pid: int = 0, # Product ID, defaults to 0 ) -> None: super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin) - self.pid = pid self._buffer1_size = int(width * height / 8) self._buffer2_size = int(width * height / 8) @@ -116,29 +114,20 @@ def power_up(self) -> None: self.hardware_reset() self.busy_wait() - if self.pid == 4243: # Adafruit 2.13" HD Monochrome eInk Display - 212x104 - self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) - self.command(_IL0373_POWER_ON) - self.busy_wait() - time.sleep(0.2) - self.command(_IL0373_PANEL_SETTING, bytearray([0x1F, 0x0D])) - self.command(_IL0373_CDI, bytearray([0x97])) - else: - # Default IL0373 init sequence - self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09])) - self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) - self.command(_IL0373_POWER_ON) - self.busy_wait() - time.sleep(0.2) - self.command(_IL0373_PANEL_SETTING, bytearray([0xCF])) - self.command(_IL0373_CDI, bytearray([0x37])) - self.command(_IL0373_PLL, bytearray([0x29])) - _b1 = self._width & 0xFF - _b2 = (self._height >> 8) & 0xFF - _b3 = self._height & 0xFF - self.command(_IL0373_RESOLUTION, bytearray([_b1, _b2, _b3])) - self.command(_IL0373_VCM_DC_SETTING, bytearray([0x0A])) - time.sleep(0.05) + self.command(_IL0373_POWER_SETTING, bytearray([0x03, 0x00, 0x2B, 0x2B, 0x09])) + self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) + self.command(_IL0373_POWER_ON) + self.busy_wait() + time.sleep(0.2) + self.command(_IL0373_PANEL_SETTING, bytearray([0xCF])) + self.command(_IL0373_CDI, bytearray([0x37])) + self.command(_IL0373_PLL, bytearray([0x29])) + _b1 = self._width & 0xFF + _b2 = (self._height >> 8) & 0xFF + _b3 = self._height & 0xFF + self.command(_IL0373_RESOLUTION, bytearray([_b1, _b2, _b3])) + self.command(_IL0373_VCM_DC_SETTING, bytearray([0x0A])) + time.sleep(0.05) def power_down(self) -> None: """Power down the display - required when not actively displaying!""" @@ -168,3 +157,47 @@ def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841 """Set the RAM address location, not used on this chipset but required by the superclass""" return # on this chip it does nothing + + +class Adafruit_IL0373_213_Flex_Mono(Adafruit_IL0373): + """Driver for Adafruit 2.13" Flexible Monochrome 212x104""" + + def __init__( + self, + width: int, + height: int, + spi: SPI, + *, + cs_pin: DigitalInOut, + dc_pin: DigitalInOut, + sramcs_pin: DigitalInOut, + rst_pin: DigitalInOut, + busy_pin: DigitalInOut, + ) -> None: + super().__init__( + width, + height, + spi, + cs_pin=cs_pin, + dc_pin=dc_pin, + sramcs_pin=sramcs_pin, + rst_pin=rst_pin, + busy_pin=busy_pin, + ) + + self.set_black_buffer(1, True) + self.set_color_buffer(0, True) + + def power_up(self) -> None: + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + self.busy_wait() + + self.command(_IL0373_BOOSTER_SOFT_START, bytearray([0x17, 0x17, 0x17])) + self.command(_IL0373_POWER_ON) + + self.busy_wait() + time.sleep(0.2) + + self.command(_IL0373_PANEL_SETTING, bytearray([0x1F, 0x0D])) + self.command(_IL0373_CDI, bytearray([0x97])) diff --git a/examples/epd_simpletest.py b/examples/epd_simpletest.py index 25f3a80..f51939c 100644 --- a/examples/epd_simpletest.py +++ b/examples/epd_simpletest.py @@ -7,7 +7,7 @@ from adafruit_epd.ek79686 import Adafruit_EK79686 from adafruit_epd.epd import Adafruit_EPD -from adafruit_epd.il0373 import Adafruit_IL0373 +from adafruit_epd.il0373 import Adafruit_IL0373, Adafruit_IL0373_213_Flex_Mono from adafruit_epd.il0398 import Adafruit_IL0398 from adafruit_epd.il91874 import Adafruit_IL91874 from adafruit_epd.jd79661 import Adafruit_JD79661 @@ -42,6 +42,7 @@ # display = Adafruit_UC8179(648, 480, # 5.83" mono 648x480 display # display = Adafruit_UC8179(800, 480, # 7.5" mono 800x480 display # display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display IL0373 +# display = Adafruit_IL0373_213_Flex_Mono(104, 212,# 2.13" mono flex display # display = Adafruit_SSD1680(128, 296, # 2.9" Tri-color display SSD1680 # display = Adafruit_SSD1683(400, 300, # 4.2" 300x400 Tri-Color display # display = Adafruit_IL0398(400, 300, # 4.2" Tri-color display