Skip to content

Commit 2ca7c25

Browse files
authored
Merge pull request #1 from tannewt/master
Add example and lint
2 parents c51983c + fd926ee commit 2ca7c25

File tree

5 files changed

+103
-20
lines changed

5 files changed

+103
-20
lines changed

README.rst

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Installing from PyPI
3131
.. note:: This library is not available on PyPI yet. Install documentation is included
3232
as a standard element. Stay tuned for PyPI availability!
3333

34-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
35-
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
36-
3734
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
3835
PyPI <https://pypi.org/project/adafruit-circuitpython-il91874/>`_. To install for current user:
3936

@@ -59,7 +56,47 @@ To install in a virtual environment in your current project:
5956
Usage Example
6057
=============
6158

62-
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
59+
.. code-block:: python
60+
61+
"""Simple test script for 2.7" 264x176 Tri-Color display shield
62+
63+
Supported products:
64+
* Adafruit 2.7" Tri-Color ePaper Display Shield
65+
* https://www.adafruit.com/product/4229
66+
"""
67+
68+
import time
69+
import board
70+
import busio
71+
import displayio
72+
import adafruit_il91874
73+
74+
displayio.release_displays()
75+
76+
spi = board.SPI()
77+
epd_cs = board.D10
78+
epd_dc = board.D9
79+
80+
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000)
81+
time.sleep(1)
82+
83+
display = adafruit_il91874.IL91874(display_bus, width=264, height=176, highlight_color=0xff0000, rotation=90)
84+
85+
g = displayio.Group()
86+
87+
f = open("/display-ruler.bmp", "rb")
88+
89+
pic = displayio.OnDiskBitmap(f)
90+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
91+
g.append(t)
92+
93+
display.show(g)
94+
95+
display.refresh()
96+
97+
print("refreshed")
98+
99+
time.sleep(120)
63100
64101
Contributing
65102
============

adafruit_il91874.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@
3333
3434
**Hardware:**
3535
36-
.. todo:: Add links to any specific hardware product page(s), or category page(s). Use unordered list & hyperlink rST
37-
inline format: "* `Link Text <url>`_"
36+
* `Adafruit 2.7" Tri-Color ePaper Display Shield <https://www.adafruit.com/product/4229>`_
3837
3938
**Software and Dependencies:**
4039
41-
* Adafruit CircuitPython firmware for the supported boards:
40+
* Adafruit CircuitPython firmware (version 5+) for the supported boards:
4241
https://github.com/adafruit/circuitpython/releases
4342
44-
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies based on the library's use of either.
45-
4643
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
4744
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
4845
"""
@@ -67,11 +64,21 @@
6764
b"\x50\x01\x87" # CDI setting
6865

6966
# Look Up Tables
70-
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
71-
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
72-
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
73-
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
74-
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
67+
# LUT1
68+
b"\x20\x2c\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00"
69+
b"\x0a\x0a\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
70+
# LUTWW
71+
b"\x21\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a"
72+
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
73+
# LUTBW
74+
b"\x22\x2a\xa0\x1a\x1a\x00\x00\x01\x00\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\x0a\x0a"
75+
b"\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\x0a\xc0\x23\x00\x00\x00\x01"
76+
# LUTWB
77+
b"\x23\x2a\x90\x1a\x1a\x00\x00\x01\x40\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\x0a\x0a"
78+
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
79+
# LUTBB
80+
b"\x24\x2a\x90\x1a\x1a\x00\x00\x01\x20\x0a\x0a\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\x0a\x0a"
81+
b"\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\x0a\x00\x23\x00\x00\x00\x01"
7582

7683
b"\x61\x04\x00\x00\x00\x00" # Resolution
7784
b"\x16\x80\x00" # PDRF
@@ -101,5 +108,6 @@ def __init__(self, bus, **kwargs):
101108
super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
102109
ram_width=320, ram_height=300,
103110
busy_state=False,
104-
write_black_ram_command=0x10, black_bits_inverted=True, write_color_ram_command=0x13,
111+
write_black_ram_command=0x10, black_bits_inverted=True,
112+
write_color_ram_command=0x13,
105113
refresh_display_command=0x12, always_toggle_chip_select=True)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Uncomment the below if you use native CircuitPython modules such as
2121
# digitalio, micropython and busio. List the modules you use. Without it, the
2222
# autodoc module docs will fail to generate with a warning.
23-
# autodoc_mock_imports = ["digitalio", "busio"]
23+
autodoc_mock_imports = ["displayio"]
2424

2525

2626
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}

docs/index.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26-
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
27-
the toctree above for use later.
26+
Adafruit eInk Display Breakouts <https://learn.adafruit.com/adafruit-eink-display-breakouts>
27+
2828

2929
.. toctree::
3030
:caption: Related Products
3131

32-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
33-
the toctree above for use later.
32+
Adafruit 2.7" Tri-Color ePaper Display Shield <https://www.adafruit.com/product/4229>
3433

3534
.. toctree::
3635
:caption: Other Links

examples/il91874_simpletest.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Simple test script for 2.7" 264x176 Tri-Color display shield
2+
3+
Supported products:
4+
* Adafruit 2.7" Tri-Color ePaper Display Shield
5+
* https://www.adafruit.com/product/4229
6+
"""
7+
8+
import time
9+
import board
10+
import displayio
11+
import adafruit_il91874
12+
13+
displayio.release_displays()
14+
15+
spi = board.SPI()
16+
epd_cs = board.D10
17+
epd_dc = board.D9
18+
19+
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000)
20+
time.sleep(1)
21+
22+
display = adafruit_il91874.IL91874(display_bus, width=264, height=176, highlight_color=0xff0000,
23+
rotation=90)
24+
25+
g = displayio.Group()
26+
27+
f = open("/display-ruler.bmp", "rb")
28+
29+
pic = displayio.OnDiskBitmap(f)
30+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
31+
g.append(t)
32+
33+
display.show(g)
34+
35+
display.refresh()
36+
37+
print("refreshed")
38+
39+
time.sleep(120)

0 commit comments

Comments
 (0)