From b3fba66e12dfb5f74dab831f4e40a951bcae07e8 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 22 Feb 2021 14:31:38 -0800 Subject: [PATCH 1/6] Added Tri-Color SSD1681 Driver --- adafruit_epd/ssd1681.py | 18 ++-- adafruit_epd/ssd1681b.py | 169 +++++++++++++++++++++++++++++++++++ examples/epd_bitmap.py | 18 ++-- examples/epd_blinka.py | 18 ++-- examples/epd_pillow_demo.py | 2 + examples/epd_pillow_image.py | 2 + examples/epd_simpletest.py | 20 +++-- 7 files changed, 216 insertions(+), 31 deletions(-) create mode 100644 adafruit_epd/ssd1681b.py diff --git a/adafruit_epd/ssd1681.py b/adafruit_epd/ssd1681.py index fca0f57..22ddd02 100644 --- a/adafruit_epd/ssd1681.py +++ b/adafruit_epd/ssd1681.py @@ -6,7 +6,7 @@ `adafruit_epd.ssd1681` - Adafruit SSD1681 - ePaper display driver ==================================================================================== CircuitPython driver for Adafruit SSD1681 display breakouts -* Author(s): Dean Miller, Ladyada +* Author(s): Dean Miller, Ladyada, Melissa LeBlanc-Williams """ import time @@ -66,8 +66,6 @@ _SSD1681_SET_RAMYCOUNT = const(0x4F) _SSD1681_NOP = const(0xFF) -_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long - class Adafruit_SSD1681(Adafruit_EPD): """driver class for Adafruit SSD1681 ePaper display breakouts""" @@ -85,16 +83,22 @@ def __init__( self._height = height self._buffer1_size = int(width * height / 8) + self._buffer2_size = int(width * height / 8) if sramcs_pin: self._buffer1 = self.sram.get_view(0) + self._buffer2 = self.sram.get_view(self._buffer1_size) else: self._buffer1 = bytearray((width * height) // 8) + self._buffer2 = bytearray((width * height) // 8) self._framebuf1 = adafruit_framebuf.FrameBuffer( self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB + ) self.set_black_buffer(0, True) - self.set_color_buffer(0, True) + self.set_color_buffer(1, False) # pylint: enable=too-many-arguments def begin(self, reset=True): @@ -158,7 +162,9 @@ def write_ram(self, index): 0 or 1 for tri-color displays.""" if index == 0: return self.command(_SSD1681_WRITE_BWRAM, end=False) - raise RuntimeError("RAM index must be 0") + if index == 1: + return self.command(_SSD1681_WRITE_REDRAM, end=False) + raise RuntimeError("RAM index must be 0 or 1") def set_ram_address(self, x, y): # pylint: disable=unused-argument, no-self-use """Set the RAM address location, not used on this chipset but required by @@ -166,4 +172,4 @@ def set_ram_address(self, x, y): # pylint: disable=unused-argument, no-self-use # Set RAM X address counter self.command(_SSD1681_SET_RAMXCOUNT, bytearray([x])) # Set RAM Y address counter - self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y >> 8, y])) + self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y, y >> 8])) diff --git a/adafruit_epd/ssd1681b.py b/adafruit_epd/ssd1681b.py new file mode 100644 index 0000000..fca0f57 --- /dev/null +++ b/adafruit_epd/ssd1681b.py @@ -0,0 +1,169 @@ +# SPDX-FileCopyrightText: 2018 Dean Miller for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +""" +`adafruit_epd.ssd1681` - Adafruit SSD1681 - ePaper display driver +==================================================================================== +CircuitPython driver for Adafruit SSD1681 display breakouts +* Author(s): Dean Miller, Ladyada +""" + +import time +from micropython import const +import adafruit_framebuf +from adafruit_epd.epd import Adafruit_EPD + +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git" + +_SSD1681_DRIVER_CONTROL = const(0x01) +_SSD1681_GATE_VOLTAGE = const(0x03) +_SSD1681_SOURCE_VOLTAGE = const(0x04) +_SSD1681_INIT_SETTING = const(0x08) +_SSD1681_INIT_WRITE_REG = const(0x09) +_SSD1681_INIT_READ_REG = const(0x0A) +_SSD1681_BOOSTER_SOFT_START = const(0x0C) +_SSD1681_DEEP_SLEEP = const(0x10) +_SSD1681_DATA_MODE = const(0x11) +_SSD1681_SW_RESET = const(0x12) +_SSD1681_HV_DETECT = const(0x14) +_SSD1681_VCI_DETECT = const(0x15) +_SSD1681_TEMP_CONTROL = const(0x18) +_SSD1681_TEMP_WRITE = const(0x1A) +_SSD1681_TEMP_READ = const(0x1B) +_SSD1681_EXTTEMP_WRITE = const(0x1C) +_SSD1681_MASTER_ACTIVATE = const(0x20) +_SSD1681_DISP_CTRL1 = const(0x21) +_SSD1681_DISP_CTRL2 = const(0x22) +_SSD1681_WRITE_BWRAM = const(0x24) +_SSD1681_WRITE_REDRAM = const(0x26) +_SSD1681_READ_RAM = const(0x27) +_SSD1681_VCOM_SENSE = const(0x28) +_SSD1681_VCOM_DURATION = const(0x29) +_SSD1681_WRITE_VCOM_OTP = const(0x2A) +_SSD1681_WRITE_VCOM_CTRL = const(0x2B) +_SSD1681_WRITE_VCOM_REG = const(0x2C) +_SSD1681_READ_OTP = const(0x2D) +_SSD1681_READ_USERID = const(0x2E) +_SSD1681_READ_STATUS = const(0x2F) +_SSD1681_WRITE_WS_OTP = const(0x30) +_SSD1681_LOAD_WS_OTP = const(0x31) +_SSD1681_WRITE_LUT = const(0x32) +_SSD1681_CRC_CALC = const(0x34) +_SSD1681_CRC_READ = const(0x35) +_SSD1681_PROG_OTP = const(0x36) +_SSD1681_WRITE_DISPLAY_OPT = const(0x37) +_SSD1681_WRITE_USERID = const(0x38) +_SSD1681_OTP_PROGMODE = const(0x39) +_SSD1681_WRITE_BORDER = const(0x3C) +_SSD1681_END_OPTION = const(0x3F) +_SSD1681_SET_RAMXPOS = const(0x44) +_SSD1681_SET_RAMYPOS = const(0x45) +_SSD1681_AUTOWRITE_RED = const(0x46) +_SSD1681_AUTOWRITE_BW = const(0x47) +_SSD1681_SET_RAMXCOUNT = const(0x4E) +_SSD1681_SET_RAMYCOUNT = const(0x4F) +_SSD1681_NOP = const(0xFF) + +_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long + + +class Adafruit_SSD1681(Adafruit_EPD): + """driver class for Adafruit SSD1681 ePaper display breakouts""" + + # pylint: disable=too-many-arguments + def __init__( + self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ): + super().__init__( + width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ) + + if height % 8 != 0: + height += 8 - height % 8 + self._height = height + + self._buffer1_size = int(width * height / 8) + + if sramcs_pin: + self._buffer1 = self.sram.get_view(0) + else: + self._buffer1 = bytearray((width * height) // 8) + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self.set_black_buffer(0, True) + self.set_color_buffer(0, True) + # pylint: enable=too-many-arguments + + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + self.busy_wait() + self.command(_SSD1681_SW_RESET) + self.busy_wait() + # driver output control + self.command( + _SSD1681_DRIVER_CONTROL, + bytearray([self._width - 1, (self._width - 1) >> 8, 0x00]), + ) + # data entry mode + self.command(_SSD1681_DATA_MODE, bytearray([0x03])) + # Set ram X start/end postion + self.command(_SSD1681_SET_RAMXPOS, bytearray([0x00, self._height // 8 - 1])) + # Set ram Y start/end postion + self.command( + _SSD1681_SET_RAMYPOS, + bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]), + ) + # Set border waveform + self.command(_SSD1681_WRITE_BORDER, bytearray([0x05])) + # Set temperature control + self.command(_SSD1681_TEMP_CONTROL, bytearray([0x80])) + + self.busy_wait() + + def power_down(self): + """Power down the display - required when not actively displaying!""" + self.command(_SSD1681_DEEP_SLEEP, bytearray([0x01])) + time.sleep(0.1) + + def update(self): + """Update the display from internal memory""" + self.command(_SSD1681_DISP_CTRL2, bytearray([0xF7])) + self.command(_SSD1681_MASTER_ACTIVATE) + self.busy_wait() + if not self._busy: + time.sleep(3) # wait 3 seconds + + def write_ram(self, index): + """Send the one byte command for starting the RAM write process. Returns + the byte read at the same time over SPI. index is the RAM buffer, can be + 0 or 1 for tri-color displays.""" + if index == 0: + return self.command(_SSD1681_WRITE_BWRAM, end=False) + raise RuntimeError("RAM index must be 0") + + def set_ram_address(self, x, y): # pylint: disable=unused-argument, no-self-use + """Set the RAM address location, not used on this chipset but required by + the superclass""" + # Set RAM X address counter + self.command(_SSD1681_SET_RAMXCOUNT, bytearray([x])) + # Set RAM Y address counter + self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y >> 8, y])) diff --git a/examples/epd_bitmap.py b/examples/epd_bitmap.py index de97a09..23a027e 100644 --- a/examples/epd_bitmap.py +++ b/examples/epd_bitmap.py @@ -10,6 +10,7 @@ from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import +from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import # create the spi device and pins we will need @@ -22,16 +23,17 @@ # give them all to our driver print("Creating display") -# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display -# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display -# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display -# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display -# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display -# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display +# display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display +# display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display +# display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display +# display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display +# display = Adafruit_IL0373(152, 152, # 1.54" Tri-color display +# display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display +# display = Adafruit_IL0398(400, 300, # 4.2" Tri-color display display = Adafruit_IL0373( 104, - 212, - spi, # 2.13" Tri-color display + 212, # 2.13" Tri-color display + spi, cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs, diff --git a/examples/epd_blinka.py b/examples/epd_blinka.py index ebd4d12..c87120c 100644 --- a/examples/epd_blinka.py +++ b/examples/epd_blinka.py @@ -16,6 +16,7 @@ from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import from adafruit_epd.ssd1675b import Adafruit_SSD1675B # pylint: disable=unused-import from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import +from adafruit_epd.ssd1681b import Adafruit_SSD1681B # pylint: disable=unused-import # create the spi device and pins we will need spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) @@ -31,14 +32,15 @@ # give them all to our driver print("Creating display") -# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display -# display = Adafruit_SSD1681(200, 200, spi, # 1.54" HD mono display (alt) -# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display -# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display -# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display -# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display -# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display -# display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display +# display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display +# display = Adafruit_SSD1681B(200, 200, # 1.54" HD mono display (alt) +# display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display +# display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display +# display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display +# display = Adafruit_IL0373(152, 152, # 1.54" Tri-color display +# display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display +# display = Adafruit_IL0398(400, 300, # 4.2" Tri-color display +# display = Adafruit_IL0373(104, 212, # 2.13" Tri-color display display = Adafruit_SSD1675B( 122, 250, diff --git a/examples/epd_pillow_demo.py b/examples/epd_pillow_demo.py index 6a4195e..0509cf5 100644 --- a/examples/epd_pillow_demo.py +++ b/examples/epd_pillow_demo.py @@ -15,6 +15,7 @@ from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import +from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import # First define some color constants WHITE = (0xFF, 0xFF, 0xFF) @@ -39,6 +40,7 @@ # give them all to our driver # display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display # display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display +# display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display # display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display # display = Adafruit_IL0373(152, 152, # 1.54" Tri-color display # display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display diff --git a/examples/epd_pillow_image.py b/examples/epd_pillow_image.py index 9ef54cd..6c0e24a 100644 --- a/examples/epd_pillow_image.py +++ b/examples/epd_pillow_image.py @@ -17,6 +17,7 @@ from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import +from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import # create the spi device and pins we will need @@ -30,6 +31,7 @@ # give them all to our driver # display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display # display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display +# display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display # display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display # display = Adafruit_IL0373(152, 152, # 1.54" Tri-color display # display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display diff --git a/examples/epd_simpletest.py b/examples/epd_simpletest.py index 8236abe..62d6e93 100644 --- a/examples/epd_simpletest.py +++ b/examples/epd_simpletest.py @@ -10,6 +10,7 @@ from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import +from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import # create the spi device and pins we will need spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) @@ -19,18 +20,19 @@ rst = digitalio.DigitalInOut(board.D9) # can be None to not use this pin busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin -# give them all to our driver +# give them all to our drivers print("Creating display") -# display = Adafruit_SSD1608(200, 200, spi, # 1.54" HD mono display -# display = Adafruit_SSD1675(122, 250, spi, # 2.13" HD mono display -# display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display -# display = Adafruit_IL0373(152, 152, spi, # 1.54" Tri-color display -# display = Adafruit_IL0373(128, 296, spi, # 2.9" Tri-color display -# display = Adafruit_IL0398(400, 300, spi, # 4.2" Tri-color display +# display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display +# display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display +# display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display +# display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display +# display = Adafruit_IL0373(152, 152, # 1.54" Tri-color display +# display = Adafruit_IL0373(128, 296, # 2.9" Tri-color display +# display = Adafruit_IL0398(400, 300, # 4.2" Tri-color display display = Adafruit_IL0373( 104, - 212, - spi, # 2.13" Tri-color display + 212, # 2.13" Tri-color display + spi, cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs, From 3040121a5d0616867d5ebd9d52eda19cb3d85c6b Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 22 Feb 2021 14:39:22 -0800 Subject: [PATCH 2/6] Disable duplicate code check --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 5c31f66..04afe0e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -56,7 +56,7 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" # disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call -disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation +disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,duplicate-code # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option From 7753b3e6d3f9e0439fd1413a1b6fde1ea8487dca Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 22 Feb 2021 15:54:44 -0800 Subject: [PATCH 3/6] Remove SSD1681B --- adafruit_epd/ssd1681b.py | 169 --------------------------------------- examples/epd_blinka.py | 2 - 2 files changed, 171 deletions(-) delete mode 100644 adafruit_epd/ssd1681b.py diff --git a/adafruit_epd/ssd1681b.py b/adafruit_epd/ssd1681b.py deleted file mode 100644 index fca0f57..0000000 --- a/adafruit_epd/ssd1681b.py +++ /dev/null @@ -1,169 +0,0 @@ -# SPDX-FileCopyrightText: 2018 Dean Miller for Adafruit Industries -# -# SPDX-License-Identifier: MIT - -""" -`adafruit_epd.ssd1681` - Adafruit SSD1681 - ePaper display driver -==================================================================================== -CircuitPython driver for Adafruit SSD1681 display breakouts -* Author(s): Dean Miller, Ladyada -""" - -import time -from micropython import const -import adafruit_framebuf -from adafruit_epd.epd import Adafruit_EPD - -__version__ = "0.0.0-auto.0" -__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git" - -_SSD1681_DRIVER_CONTROL = const(0x01) -_SSD1681_GATE_VOLTAGE = const(0x03) -_SSD1681_SOURCE_VOLTAGE = const(0x04) -_SSD1681_INIT_SETTING = const(0x08) -_SSD1681_INIT_WRITE_REG = const(0x09) -_SSD1681_INIT_READ_REG = const(0x0A) -_SSD1681_BOOSTER_SOFT_START = const(0x0C) -_SSD1681_DEEP_SLEEP = const(0x10) -_SSD1681_DATA_MODE = const(0x11) -_SSD1681_SW_RESET = const(0x12) -_SSD1681_HV_DETECT = const(0x14) -_SSD1681_VCI_DETECT = const(0x15) -_SSD1681_TEMP_CONTROL = const(0x18) -_SSD1681_TEMP_WRITE = const(0x1A) -_SSD1681_TEMP_READ = const(0x1B) -_SSD1681_EXTTEMP_WRITE = const(0x1C) -_SSD1681_MASTER_ACTIVATE = const(0x20) -_SSD1681_DISP_CTRL1 = const(0x21) -_SSD1681_DISP_CTRL2 = const(0x22) -_SSD1681_WRITE_BWRAM = const(0x24) -_SSD1681_WRITE_REDRAM = const(0x26) -_SSD1681_READ_RAM = const(0x27) -_SSD1681_VCOM_SENSE = const(0x28) -_SSD1681_VCOM_DURATION = const(0x29) -_SSD1681_WRITE_VCOM_OTP = const(0x2A) -_SSD1681_WRITE_VCOM_CTRL = const(0x2B) -_SSD1681_WRITE_VCOM_REG = const(0x2C) -_SSD1681_READ_OTP = const(0x2D) -_SSD1681_READ_USERID = const(0x2E) -_SSD1681_READ_STATUS = const(0x2F) -_SSD1681_WRITE_WS_OTP = const(0x30) -_SSD1681_LOAD_WS_OTP = const(0x31) -_SSD1681_WRITE_LUT = const(0x32) -_SSD1681_CRC_CALC = const(0x34) -_SSD1681_CRC_READ = const(0x35) -_SSD1681_PROG_OTP = const(0x36) -_SSD1681_WRITE_DISPLAY_OPT = const(0x37) -_SSD1681_WRITE_USERID = const(0x38) -_SSD1681_OTP_PROGMODE = const(0x39) -_SSD1681_WRITE_BORDER = const(0x3C) -_SSD1681_END_OPTION = const(0x3F) -_SSD1681_SET_RAMXPOS = const(0x44) -_SSD1681_SET_RAMYPOS = const(0x45) -_SSD1681_AUTOWRITE_RED = const(0x46) -_SSD1681_AUTOWRITE_BW = const(0x47) -_SSD1681_SET_RAMXCOUNT = const(0x4E) -_SSD1681_SET_RAMYCOUNT = const(0x4F) -_SSD1681_NOP = const(0xFF) - -_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long - - -class Adafruit_SSD1681(Adafruit_EPD): - """driver class for Adafruit SSD1681 ePaper display breakouts""" - - # pylint: disable=too-many-arguments - def __init__( - self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ): - super().__init__( - width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ) - - if height % 8 != 0: - height += 8 - height % 8 - self._height = height - - self._buffer1_size = int(width * height / 8) - - if sramcs_pin: - self._buffer1 = self.sram.get_view(0) - else: - self._buffer1 = bytearray((width * height) // 8) - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self.set_black_buffer(0, True) - self.set_color_buffer(0, True) - # pylint: enable=too-many-arguments - - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() - self.busy_wait() - self.command(_SSD1681_SW_RESET) - self.busy_wait() - # driver output control - self.command( - _SSD1681_DRIVER_CONTROL, - bytearray([self._width - 1, (self._width - 1) >> 8, 0x00]), - ) - # data entry mode - self.command(_SSD1681_DATA_MODE, bytearray([0x03])) - # Set ram X start/end postion - self.command(_SSD1681_SET_RAMXPOS, bytearray([0x00, self._height // 8 - 1])) - # Set ram Y start/end postion - self.command( - _SSD1681_SET_RAMYPOS, - bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]), - ) - # Set border waveform - self.command(_SSD1681_WRITE_BORDER, bytearray([0x05])) - # Set temperature control - self.command(_SSD1681_TEMP_CONTROL, bytearray([0x80])) - - self.busy_wait() - - def power_down(self): - """Power down the display - required when not actively displaying!""" - self.command(_SSD1681_DEEP_SLEEP, bytearray([0x01])) - time.sleep(0.1) - - def update(self): - """Update the display from internal memory""" - self.command(_SSD1681_DISP_CTRL2, bytearray([0xF7])) - self.command(_SSD1681_MASTER_ACTIVATE) - self.busy_wait() - if not self._busy: - time.sleep(3) # wait 3 seconds - - def write_ram(self, index): - """Send the one byte command for starting the RAM write process. Returns - the byte read at the same time over SPI. index is the RAM buffer, can be - 0 or 1 for tri-color displays.""" - if index == 0: - return self.command(_SSD1681_WRITE_BWRAM, end=False) - raise RuntimeError("RAM index must be 0") - - def set_ram_address(self, x, y): # pylint: disable=unused-argument, no-self-use - """Set the RAM address location, not used on this chipset but required by - the superclass""" - # Set RAM X address counter - self.command(_SSD1681_SET_RAMXCOUNT, bytearray([x])) - # Set RAM Y address counter - self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y >> 8, y])) diff --git a/examples/epd_blinka.py b/examples/epd_blinka.py index c87120c..2ea4f46 100644 --- a/examples/epd_blinka.py +++ b/examples/epd_blinka.py @@ -16,7 +16,6 @@ from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import from adafruit_epd.ssd1675b import Adafruit_SSD1675B # pylint: disable=unused-import from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import -from adafruit_epd.ssd1681b import Adafruit_SSD1681B # pylint: disable=unused-import # create the spi device and pins we will need spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) @@ -33,7 +32,6 @@ # give them all to our driver print("Creating display") # display = Adafruit_SSD1608(200, 200, # 1.54" HD mono display -# display = Adafruit_SSD1681B(200, 200, # 1.54" HD mono display (alt) # display = Adafruit_SSD1681(200, 200, # 1.54" HD Tri-color display # display = Adafruit_SSD1675(122, 250, # 2.13" HD mono display # display = Adafruit_IL91874(176, 264, # 2.7" Tri-color display From d448c54ac603231f49fb4e1f0321dde109079052 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 23 Feb 2021 13:16:11 -0800 Subject: [PATCH 4/6] Remove duplicate disable --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 04afe0e..5c31f66 100644 --- a/.pylintrc +++ b/.pylintrc @@ -56,7 +56,7 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" # disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call -disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,duplicate-code +disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option From bd0a513c09a247695d73de303ab13264e4efc01c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 23 Feb 2021 13:48:59 -0800 Subject: [PATCH 5/6] Change minimum similar lines to 50 and jobs to 1 in pylintrc --- .pylintrc | 6 +- errors.txt | 378 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 381 insertions(+), 3 deletions(-) create mode 100644 errors.txt diff --git a/.pylintrc b/.pylintrc index 5c31f66..256ac2f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -22,8 +22,8 @@ ignore-patterns= #init-hook= # Use multiple processes to speed up Pylint. -# jobs=1 -jobs=2 +jobs=1 +# jobs=2 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. @@ -253,7 +253,7 @@ ignore-docstrings=yes ignore-imports=no # Minimum lines number of a similarity. -min-similarity-lines=4 +min-similarity-lines=50 [BASIC] diff --git a/errors.txt b/errors.txt new file mode 100644 index 0000000..6a16d93 --- /dev/null +++ b/errors.txt @@ -0,0 +1,378 @@ +************* Module adafruit_epd.il0398 +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.ssd1675:52 +==adafruit_epd.ssd1675b:78 + def __init__( + self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ): + super().__init__( + width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ) + stride = width + if stride % 8 != 0: + stride += 8 - stride % 8 + + self._buffer1_size = int(stride * height / 8) + self._buffer2_size = self._buffer1_size + + if sramcs_pin: + self._buffer1 = self.sram.get_view(0) + self._buffer2 = self.sram.get_view(self._buffer1_size) + else: + self._buffer1 = bytearray(self._buffer1_size) + self._buffer2 = bytearray(self._buffer2_size) + # since we have *two* framebuffers - one for red and one for black + # we dont subclass but manage manually + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, + width, + height, + stride=stride, + buf_format=adafruit_framebuf.MHMSB, + ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, + width, + height, + stride=stride, + buf_format=adafruit_framebuf.MHMSB, + ) + self.set_black_buffer(0, True) + self.set_color_buffer(0, True) + # pylint: enable=too-many-arguments + + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + time.sleep(0.1) + self.busy_wait() + (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.il0373:49 +==adafruit_epd.il0398:50 + def __init__( + self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ): + super().__init__( + width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ) + + self._buffer1_size = int(width * height / 8) + self._buffer2_size = int(width * height / 8) + + if sramcs_pin: + self._buffer1 = self.sram.get_view(0) + self._buffer2 = self.sram.get_view(self._buffer1_size) + else: + self._buffer1 = bytearray((width * height) // 8) + self._buffer2 = bytearray((width * height) // 8) + # since we have *two* framebuffers - one for red and one for black + # we dont subclass but manage manually + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self.set_black_buffer(0, True) + self.set_color_buffer(1, True) + # pylint: enable=too-many-arguments + + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while not self._busy.value: (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files +==adafruit_epd.il0373:49 +==adafruit_epd.il0398:50 +==adafruit_epd.il91874:57 + def __init__( + self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ): + super().__init__( + width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ) + + self._buffer1_size = int(width * height / 8) + self._buffer2_size = int(width * height / 8) + + if sramcs_pin: + self._buffer1 = self.sram.get_view(0) + self._buffer2 = self.sram.get_view(self._buffer1_size) + else: + self._buffer1 = bytearray((width * height) // 8) + self._buffer2 = bytearray((width * height) // 8) + # since we have *two* framebuffers - one for red and one for black + # we dont subclass but manage manually + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self.set_black_buffer(0, True) (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files +==adafruit_epd.ssd1608:77 +==adafruit_epd.ssd1675:86 +==adafruit_epd.ssd1675b:112 + ) + self.set_black_buffer(0, True) + self.set_color_buffer(0, True) + # pylint: enable=too-many-arguments + + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.ssd1608:82 +==adafruit_epd.ssd1681:103 + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + self.busy_wait() (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files +==adafruit_epd.ssd1675:91 +==adafruit_epd.ssd1675b:117 +==adafruit_epd.ssd1681:103 + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.il0373:81 +==adafruit_epd.il91874:90 + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: + while not self._busy.value: + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.ssd1608:58 +==adafruit_epd.ssd1681:73 + def __init__( + self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ): + super().__init__( + width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin + ) + + if height % 8 != 0: + height += 8 - height % 8 + self._height = height + + self._buffer1_size = int(width * height / 8) (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.il0373:123 +==adafruit_epd.il0398:123 + time.sleep(0.1) + self.busy_wait() + if not self._busy: + time.sleep(15) # wait 15 seconds + + def write_ram(self, index): + """Send the one byte command for starting the RAM write process. Returns + the byte read at the same time over SPI. index is the RAM buffer, can be + 0 or 1 for tri-color displays.""" + if index == 0: (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 6 files +==adafruit_epd.il0373:77 +==adafruit_epd.il0398:78 +==adafruit_epd.ssd1608:82 +==adafruit_epd.ssd1675:91 +==adafruit_epd.ssd1675b:117 +==adafruit_epd.ssd1681:103 + def begin(self, reset=True): + """Begin communication with the display and set basic settings""" + if reset: + self.hardware_reset() + self.power_down() + + def busy_wait(self): + """Wait for display to be done with current task, either by polling the + busy pin, or pausing""" + if self._busy: (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.il0373:88 +==adafruit_epd.il0398:90 + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + self.busy_wait() + (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files +==adafruit_epd.il0373:56 +==adafruit_epd.il0398:57 +==adafruit_epd.il91874:64 +==adafruit_epd.ssd1681:84 + self._buffer1_size = int(width * height / 8) + self._buffer2_size = int(width * height / 8) + + if sramcs_pin: + self._buffer1 = self.sram.get_view(0) + self._buffer2 = self.sram.get_view(self._buffer1_size) + else: + self._buffer1 = bytearray((width * height) // 8) + self._buffer2 = bytearray((width * height) // 8) (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files +==adafruit_epd.ssd1608:136 +==adafruit_epd.ssd1675:158 +==adafruit_epd.ssd1675b:200 +==adafruit_epd.ssd1681:154 + self.busy_wait() + if not self._busy: + time.sleep(3) # wait 3 seconds + + def write_ram(self, index): + """Send the one byte command for starting the RAM write process. Returns + the byte read at the same time over SPI. index is the RAM buffer, can be + 0 or 1 for tri-color displays.""" + if index == 0: (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files +==adafruit_epd.il91874:75 +==adafruit_epd.ssd1681:93 + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self.set_black_buffer(0, True) + self.set_color_buffer(1, False) (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files +==adafruit_epd.il0373:88 +==adafruit_epd.il0398:90 +==adafruit_epd.ssd1608:93 +==adafruit_epd.ssd1681:114 + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() + self.busy_wait() (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 7 files +==adafruit_epd.il0373:11 +==adafruit_epd.il0398:11 +==adafruit_epd.il91874:11 +==adafruit_epd.ssd1608:11 +==adafruit_epd.ssd1675:11 +==adafruit_epd.ssd1675b:11 +==adafruit_epd.ssd1681:11 +import time +from micropython import const +import adafruit_framebuf +from adafruit_epd.epd import Adafruit_EPD + +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git" + (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files +==adafruit_epd.il0373:67 +==adafruit_epd.il0398:68 +==adafruit_epd.ssd1681:93 + self._framebuf1 = adafruit_framebuf.FrameBuffer( + self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self._framebuf2 = adafruit_framebuf.FrameBuffer( + self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB + ) + self.set_black_buffer(0, True) (duplicate-code) +adafruit_epd/il0398.py:1:0: R0801: Similar lines in 7 files +==adafruit_epd.il0373:88 +==adafruit_epd.il0398:90 +==adafruit_epd.il91874:97 +==adafruit_epd.ssd1608:93 +==adafruit_epd.ssd1675:102 +==adafruit_epd.ssd1675b:128 +==adafruit_epd.ssd1681:114 + time.sleep(0.01) + else: + time.sleep(0.5) + + def power_up(self): + """Power up the display in preparation for writing RAM and updating""" + self.hardware_reset() (duplicate-code) + +-------------------------------------------------------------------- +Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) + From 1e85c9162f1c87aa2bb7a35ea9749798d1718344 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 23 Feb 2021 13:51:57 -0800 Subject: [PATCH 6/6] Remove errors.txt --- errors.txt | 378 ----------------------------------------------------- 1 file changed, 378 deletions(-) delete mode 100644 errors.txt diff --git a/errors.txt b/errors.txt deleted file mode 100644 index 6a16d93..0000000 --- a/errors.txt +++ /dev/null @@ -1,378 +0,0 @@ -************* Module adafruit_epd.il0398 -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.ssd1675:52 -==adafruit_epd.ssd1675b:78 - def __init__( - self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ): - super().__init__( - width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ) - stride = width - if stride % 8 != 0: - stride += 8 - stride % 8 - - self._buffer1_size = int(stride * height / 8) - self._buffer2_size = self._buffer1_size - - if sramcs_pin: - self._buffer1 = self.sram.get_view(0) - self._buffer2 = self.sram.get_view(self._buffer1_size) - else: - self._buffer1 = bytearray(self._buffer1_size) - self._buffer2 = bytearray(self._buffer2_size) - # since we have *two* framebuffers - one for red and one for black - # we dont subclass but manage manually - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, - width, - height, - stride=stride, - buf_format=adafruit_framebuf.MHMSB, - ) - self._framebuf2 = adafruit_framebuf.FrameBuffer( - self._buffer2, - width, - height, - stride=stride, - buf_format=adafruit_framebuf.MHMSB, - ) - self.set_black_buffer(0, True) - self.set_color_buffer(0, True) - # pylint: enable=too-many-arguments - - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() - time.sleep(0.1) - self.busy_wait() - (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.il0373:49 -==adafruit_epd.il0398:50 - def __init__( - self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ): - super().__init__( - width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ) - - self._buffer1_size = int(width * height / 8) - self._buffer2_size = int(width * height / 8) - - if sramcs_pin: - self._buffer1 = self.sram.get_view(0) - self._buffer2 = self.sram.get_view(self._buffer1_size) - else: - self._buffer1 = bytearray((width * height) // 8) - self._buffer2 = bytearray((width * height) // 8) - # since we have *two* framebuffers - one for red and one for black - # we dont subclass but manage manually - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self._framebuf2 = adafruit_framebuf.FrameBuffer( - self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self.set_black_buffer(0, True) - self.set_color_buffer(1, True) - # pylint: enable=too-many-arguments - - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while not self._busy.value: (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files -==adafruit_epd.il0373:49 -==adafruit_epd.il0398:50 -==adafruit_epd.il91874:57 - def __init__( - self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ): - super().__init__( - width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ) - - self._buffer1_size = int(width * height / 8) - self._buffer2_size = int(width * height / 8) - - if sramcs_pin: - self._buffer1 = self.sram.get_view(0) - self._buffer2 = self.sram.get_view(self._buffer1_size) - else: - self._buffer1 = bytearray((width * height) // 8) - self._buffer2 = bytearray((width * height) // 8) - # since we have *two* framebuffers - one for red and one for black - # we dont subclass but manage manually - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self._framebuf2 = adafruit_framebuf.FrameBuffer( - self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self.set_black_buffer(0, True) (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files -==adafruit_epd.ssd1608:77 -==adafruit_epd.ssd1675:86 -==adafruit_epd.ssd1675b:112 - ) - self.set_black_buffer(0, True) - self.set_color_buffer(0, True) - # pylint: enable=too-many-arguments - - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.ssd1608:82 -==adafruit_epd.ssd1681:103 - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() - self.busy_wait() (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files -==adafruit_epd.ssd1675:91 -==adafruit_epd.ssd1675b:117 -==adafruit_epd.ssd1681:103 - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.il0373:81 -==adafruit_epd.il91874:90 - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: - while not self._busy.value: - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.ssd1608:58 -==adafruit_epd.ssd1681:73 - def __init__( - self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ): - super().__init__( - width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin - ) - - if height % 8 != 0: - height += 8 - height % 8 - self._height = height - - self._buffer1_size = int(width * height / 8) (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.il0373:123 -==adafruit_epd.il0398:123 - time.sleep(0.1) - self.busy_wait() - if not self._busy: - time.sleep(15) # wait 15 seconds - - def write_ram(self, index): - """Send the one byte command for starting the RAM write process. Returns - the byte read at the same time over SPI. index is the RAM buffer, can be - 0 or 1 for tri-color displays.""" - if index == 0: (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 6 files -==adafruit_epd.il0373:77 -==adafruit_epd.il0398:78 -==adafruit_epd.ssd1608:82 -==adafruit_epd.ssd1675:91 -==adafruit_epd.ssd1675b:117 -==adafruit_epd.ssd1681:103 - def begin(self, reset=True): - """Begin communication with the display and set basic settings""" - if reset: - self.hardware_reset() - self.power_down() - - def busy_wait(self): - """Wait for display to be done with current task, either by polling the - busy pin, or pausing""" - if self._busy: (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.il0373:88 -==adafruit_epd.il0398:90 - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() - self.busy_wait() - (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files -==adafruit_epd.il0373:56 -==adafruit_epd.il0398:57 -==adafruit_epd.il91874:64 -==adafruit_epd.ssd1681:84 - self._buffer1_size = int(width * height / 8) - self._buffer2_size = int(width * height / 8) - - if sramcs_pin: - self._buffer1 = self.sram.get_view(0) - self._buffer2 = self.sram.get_view(self._buffer1_size) - else: - self._buffer1 = bytearray((width * height) // 8) - self._buffer2 = bytearray((width * height) // 8) (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files -==adafruit_epd.ssd1608:136 -==adafruit_epd.ssd1675:158 -==adafruit_epd.ssd1675b:200 -==adafruit_epd.ssd1681:154 - self.busy_wait() - if not self._busy: - time.sleep(3) # wait 3 seconds - - def write_ram(self, index): - """Send the one byte command for starting the RAM write process. Returns - the byte read at the same time over SPI. index is the RAM buffer, can be - 0 or 1 for tri-color displays.""" - if index == 0: (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 2 files -==adafruit_epd.il91874:75 -==adafruit_epd.ssd1681:93 - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self._framebuf2 = adafruit_framebuf.FrameBuffer( - self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self.set_black_buffer(0, True) - self.set_color_buffer(1, False) (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 4 files -==adafruit_epd.il0373:88 -==adafruit_epd.il0398:90 -==adafruit_epd.ssd1608:93 -==adafruit_epd.ssd1681:114 - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() - self.busy_wait() (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 7 files -==adafruit_epd.il0373:11 -==adafruit_epd.il0398:11 -==adafruit_epd.il91874:11 -==adafruit_epd.ssd1608:11 -==adafruit_epd.ssd1675:11 -==adafruit_epd.ssd1675b:11 -==adafruit_epd.ssd1681:11 -import time -from micropython import const -import adafruit_framebuf -from adafruit_epd.epd import Adafruit_EPD - -__version__ = "0.0.0-auto.0" -__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git" - (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 3 files -==adafruit_epd.il0373:67 -==adafruit_epd.il0398:68 -==adafruit_epd.ssd1681:93 - self._framebuf1 = adafruit_framebuf.FrameBuffer( - self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self._framebuf2 = adafruit_framebuf.FrameBuffer( - self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB - ) - self.set_black_buffer(0, True) (duplicate-code) -adafruit_epd/il0398.py:1:0: R0801: Similar lines in 7 files -==adafruit_epd.il0373:88 -==adafruit_epd.il0398:90 -==adafruit_epd.il91874:97 -==adafruit_epd.ssd1608:93 -==adafruit_epd.ssd1675:102 -==adafruit_epd.ssd1675b:128 -==adafruit_epd.ssd1681:114 - time.sleep(0.01) - else: - time.sleep(0.5) - - def power_up(self): - """Power up the display in preparation for writing RAM and updating""" - self.hardware_reset() (duplicate-code) - --------------------------------------------------------------------- -Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) -