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 2 commits into from
Aug 26, 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
45 changes: 41 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-il91874/>`_. To install for current user:

Expand All @@ -59,7 +56,47 @@ 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 2.7" 264x176 Tri-Color display shield

Supported products:
* Adafruit 2.7" Tri-Color ePaper Display Shield
* https://www.adafruit.com/product/4229
"""

import time
import board
import busio
import displayio
import adafruit_il91874

displayio.release_displays()

spi = board.SPI()
epd_cs = board.D10
epd_dc = board.D9

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000)
time.sleep(1)

display = adafruit_il91874.IL91874(display_bus, width=264, height=176, highlight_color=0xff0000, rotation=90)

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
30 changes: 19 additions & 11 deletions adafruit_il91874.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@

**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 2.7" Tri-Color ePaper Display Shield <https://www.adafruit.com/product/4229>`_

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the supported boards:
* Adafruit CircuitPython firmware (version 5+) for the supported boards:
https://github.com/adafruit/circuitpython/releases

.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies based on the library's use of either.

# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
"""
Expand All @@ -67,11 +64,21 @@
b"\x50\x01\x87" # CDI setting

# Look Up Tables
b"\x20\x2c\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01" # LUT1
b"\x21\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01" # LUTWW
b"\x22\x2a\xa0\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\x0a\x0a\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\x0a\xc0\x23\x00\x00\x00\x01" # LUTBW
b"\x23\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01" # LUTWB
b"\x24\x2a\x90\x1a\x1a\x00\x00\x01\x20\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01" # LUTBB
# LUT1
b"\x20\x2c\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00"
b"\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
# LUTWW
b"\x21\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a"
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
# LUTBW
b"\x22\x2a\xa0\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\x0a\x0a"
b"\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\x0a\xc0\x23\x00\x00\x00\x01"
# LUTWB
b"\x23\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a"
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
# LUTBB
b"\x24\x2a\x90\x1a\x1a\x00\x00\x01\x20\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\x0a\x0a"
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"

b"\x61\x04\x00\x00\x00\x00" # Resolution
b"\x16\x80\x00" # PDRF
Expand Down Expand Up @@ -101,5 +108,6 @@ def __init__(self, bus, **kwargs):
super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
ram_width=320, ram_height=300,
busy_state=False,
write_black_ram_command=0x10, black_bits_inverted=True, write_color_ram_command=0x13,
write_black_ram_command=0x10, black_bits_inverted=True,
write_color_ram_command=0x13,
refresh_display_command=0x12, always_toggle_chip_select=True)
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
7 changes: 3 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ 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 2.7" Tri-Color ePaper Display Shield <https://www.adafruit.com/product/4229>

.. toctree::
:caption: Other Links
Expand Down
39 changes: 39 additions & 0 deletions examples/il91874_simpletest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Simple test script for 2.7" 264x176 Tri-Color display shield

Supported products:
* Adafruit 2.7" Tri-Color ePaper Display Shield
* https://www.adafruit.com/product/4229
"""

import time
import board
import displayio
import adafruit_il91874

displayio.release_displays()

spi = board.SPI()
epd_cs = board.D10
epd_dc = board.D9

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000)
time.sleep(1)

display = adafruit_il91874.IL91874(display_bus, width=264, height=176, highlight_color=0xff0000,
rotation=90)

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)