Skip to content

Add example and lint #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://pypi.org/project/adafruit-circuitpython-ssd1608/>`_. To install for current user:

Expand All @@ -59,7 +56,50 @@ 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 displayio
import adafruit_ssd1608

displayio.release_displays()

# 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.D10
epd_reset = board.D5
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
============
Expand Down
7 changes: 3 additions & 4 deletions adafruit_ssd1608.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <url>`_"
* `Adafruit 1.54" Monochrome ePaper Display Breakout <https://www.adafruit.com/product/4196>`_

**Software and Dependencies:**

Expand All @@ -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
)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
6 changes: 2 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://learn.adafruit.com/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 <https://www.adafruit.com/product/4196>

.. toctree::
:caption: Other Links
Expand Down
42 changes: 42 additions & 0 deletions examples/ssd1608_simpletest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""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 displayio
import adafruit_ssd1608

displayio.release_displays()

# 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.D10
epd_reset = board.D5
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)