Merge pull request #1 from tannewt/master

Add example and lint
This commit is contained in:
Melissa LeBlanc-Williams 2019-09-04 15:13:05 -07:00 committed by GitHub
commit 99adf0f1ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 13 deletions

View file

@ -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:
@ -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
============

View file

@ -33,8 +33,7 @@ Implementation Notes
**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:**
@ -55,7 +54,8 @@ _START_SEQUENCE = (
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
)
@ -67,7 +67,6 @@ _STOP_SEQUENCE = (
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

View file

@ -20,7 +20,7 @@ extensions = [
# 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)}

View file

@ -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

View file

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