From ffa19589a264e7534d24cb330c3a1f9808a99628 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 19:06:15 -0700 Subject: [PATCH 1/4] Initial linting --- README.rst | 51 +++++++++++++++++++++++++++++++--- adafruit_ssd1608.py | 6 ++-- docs/conf.py | 2 +- docs/index.rst | 6 ++-- examples/ssd1608_simpletest.py | 45 ++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 20e6ac8..0175f98 100644 --- a/README.rst +++ b/README.rst @@ -31,9 +31,6 @@ Installing from PyPI .. note:: This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability! -.. todo:: Remove the above note if PyPI version is/will be available at time of release. - If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section. - On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from PyPI `_. To install for current user: @@ -59,7 +56,53 @@ To install in a virtual environment in your current project: Usage Example ============= -.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst. +.. code-block:: python + + """Simple test script for 1.54" 200x200 monochrome display. + + Supported products: + * Adafruit 1.54" Monochrome ePaper Display Breakout + * https://www.adafruit.com/product/4196 + """ + + import time + import board + import busio + import displayio + import adafruit_ssd1608 + + displayio.release_displays() + + # This pinout works on a Metro and may need to be altered for other boards. + + # For breadboarding + spi = busio.SPI(board.SCL, board.SDA) + epd_cs = board.D9 + epd_dc = board.D8 + epd_reset = board.D7 + epd_busy = board.D6 + + display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, + baudrate=1000000) + time.sleep(1) + + display = adafruit_ssd1608.SSD1608(display_bus, width=200, height=200, busy_pin=epd_busy) + + g = displayio.Group() + + f = open("/display-ruler.bmp", "rb") + + pic = displayio.OnDiskBitmap(f) + t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter()) + g.append(t) + + display.show(g) + + display.refresh() + + print("refreshed") + + time.sleep(120) Contributing ============ diff --git a/adafruit_ssd1608.py b/adafruit_ssd1608.py index db26553..ad61f84 100644 --- a/adafruit_ssd1608.py +++ b/adafruit_ssd1608.py @@ -33,8 +33,7 @@ **Hardware:** -.. todo:: Add links to any specific hardware product page(s), or category page(s). Use unordered list & hyperlink rST - inline format: "* `Link Text `_" +* `Adafruit 1.54" Monochrome ePaper Display Breakout _` **Software and Dependencies:** @@ -55,7 +54,8 @@ b"\x3b\x01\x0b" # Set gate line width b"\x11\x01\x03" # Data entry sequence b"\x2c\x01\x70" # Vcom Voltage - b"\x32\x1e\x02\x02\x01\x11\x12\x12\x22\x22\x66\x69\x69\x59\x58\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13\x51\x35\x51\x51\x19\x01\x00" # LUT + b"\x32\x1e\x02\x02\x01\x11\x12\x12\x22\x22\x66\x69\x69\x59\x58\x99\x99\x88\x00\x00\x00\x00\xf8" + b"\xb4\x13\x51\x35\x51\x51\x19\x01\x00" # LUT b"\x22\x01\xc7" # Set DISP ctrl2 ) diff --git a/docs/conf.py b/docs/conf.py index 80c8015..d43a5af 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -# autodoc_mock_imports = ["digitalio", "busio"] +autodoc_mock_imports = ["displayio"] intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} diff --git a/docs/index.rst b/docs/index.rst index 76b6c13..9c2b95e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,14 +23,12 @@ Table of Contents .. toctree:: :caption: Tutorials -.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave - the toctree above for use later. + Adafruit eInk Display Breakouts .. toctree:: :caption: Related Products -.. todo:: Add any product links here. If there are none, then simply delete this todo and leave - the toctree above for use later. + Adafruit 1.54" Monochrome ePaper Display Breakout .. toctree:: :caption: Other Links diff --git a/examples/ssd1608_simpletest.py b/examples/ssd1608_simpletest.py index e69de29..0b3b18b 100644 --- a/examples/ssd1608_simpletest.py +++ b/examples/ssd1608_simpletest.py @@ -0,0 +1,45 @@ +"""Simple test script for 1.54" 200x200 monochrome display. + +Supported products: + * Adafruit 1.54" Monochrome ePaper Display Breakout + * https://www.adafruit.com/product/4196 + """ + +import time +import board +import busio +import displayio +import adafruit_ssd1608 + +displayio.release_displays() + +# This pinout works on a Metro and may need to be altered for other boards. + +# For breadboarding +spi = busio.SPI(board.SCL, board.SDA) +epd_cs = board.D9 +epd_dc = board.D8 +epd_reset = board.D7 +epd_busy = board.D6 + +display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, + baudrate=1000000) +time.sleep(1) + +display = adafruit_ssd1608.SSD1608(display_bus, width=200, height=200, busy_pin=epd_busy) + +g = displayio.Group() + +f = open("/display-ruler.bmp", "rb") + +pic = displayio.OnDiskBitmap(f) +t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter()) +g.append(t) + +display.show(g) + +display.refresh() + +print("refreshed") + +time.sleep(120) From 1afc90e1e983ce9dbce36007af68be0943a20a7c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 19:08:53 -0700 Subject: [PATCH 2/4] Swap chars in rst --- adafruit_ssd1608.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ssd1608.py b/adafruit_ssd1608.py index ad61f84..7199239 100644 --- a/adafruit_ssd1608.py +++ b/adafruit_ssd1608.py @@ -33,7 +33,7 @@ **Hardware:** -* `Adafruit 1.54" Monochrome ePaper Display Breakout _` +* `Adafruit 1.54" Monochrome ePaper Display Breakout `_ **Software and Dependencies:** From 37ac937267804da26e7b4d6bba4ac73c5df1bc5b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 19:11:00 -0700 Subject: [PATCH 3/4] Remove unused var --- adafruit_ssd1608.py | 1 - 1 file changed, 1 deletion(-) diff --git a/adafruit_ssd1608.py b/adafruit_ssd1608.py index 7199239..040f9ac 100644 --- a/adafruit_ssd1608.py +++ b/adafruit_ssd1608.py @@ -67,7 +67,6 @@ class SSD1608(displayio.EPaperDisplay): """SSD1608 driver""" def __init__(self, bus, **kwargs): - color_command = None start_sequence = bytearray(_START_SEQUENCE) width = kwargs["width"] start_sequence[4] = width - 1 From 6a3ac5b0c6f17ac111412218214988cccb65ac86 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 4 Sep 2019 15:04:53 -0700 Subject: [PATCH 4/4] Swap to board.SPI() on a Feather --- README.rst | 11 ++++------- examples/ssd1608_simpletest.py | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index 0175f98..ff85be7 100644 --- a/README.rst +++ b/README.rst @@ -67,19 +67,16 @@ Usage Example import time import board - import busio import displayio import adafruit_ssd1608 displayio.release_displays() - # This pinout works on a Metro and may need to be altered for other boards. - - # For breadboarding - spi = busio.SPI(board.SCL, board.SDA) + # This pinout works on a Feather M4 and may need to be altered for other boards. + spi = board.SPI() # Uses SCK and MOSI epd_cs = board.D9 - epd_dc = board.D8 - epd_reset = board.D7 + epd_dc = board.D10 + epd_reset = board.D5 epd_busy = board.D6 display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, diff --git a/examples/ssd1608_simpletest.py b/examples/ssd1608_simpletest.py index 0b3b18b..8660e83 100644 --- a/examples/ssd1608_simpletest.py +++ b/examples/ssd1608_simpletest.py @@ -7,19 +7,16 @@ import time import board -import busio import displayio import adafruit_ssd1608 displayio.release_displays() -# This pinout works on a Metro and may need to be altered for other boards. - -# For breadboarding -spi = busio.SPI(board.SCL, board.SDA) +# This pinout works on a Feather M4 and may need to be altered for other boards. +spi = board.SPI() # Uses SCK and MOSI epd_cs = board.D9 -epd_dc = board.D8 -epd_reset = board.D7 +epd_dc = board.D10 +epd_reset = board.D5 epd_busy = board.D6 display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,