diff --git a/README.rst b/README.rst index ef36982..d229b2d 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,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 ============ diff --git a/adafruit_il91874.py b/adafruit_il91874.py index 878e1c7..3b032d0 100644 --- a/adafruit_il91874.py +++ b/adafruit_il91874.py @@ -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 `_" +* `Adafruit 2.7" Tri-Color ePaper Display Shield `_ **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 """ @@ -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 @@ -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) diff --git a/docs/conf.py b/docs/conf.py index cab5957..6e80aaa 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 672e8ec..98c3f60 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 + .. 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 .. toctree:: :caption: Other Links diff --git a/examples/il91874_simpletest.py b/examples/il91874_simpletest.py index e69de29..276776d 100644 --- a/examples/il91874_simpletest.py +++ b/examples/il91874_simpletest.py @@ -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)