Skip to content

Commit dd6ea57

Browse files
authored
Merge pull request #1 from makermelissa/main
Adding the UC8151D driver for eInk Displays
2 parents c28c756 + f4c9918 commit dd6ea57

File tree

9 files changed

+51
-21
lines changed

9 files changed

+51
-21
lines changed

README.rst

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,13 @@ This is easily achieved by downloading
3636
or individual libraries can be installed using
3737
`circup <https://github.com/adafruit/circup>`_.
3838

39-
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
40-
image from the assets folder in the PCB's GitHub repo.
39+
Adafruit 2.9" Flexible 296x128 Monochrome eInk / ePaper Display
4140

4241
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/4262>`_
4342

4443

4544
Installing from PyPI
4645
=====================
47-
.. note:: This library is not available on PyPI yet. Install documentation is included
48-
as a standard element. Stay tuned for PyPI availability!
49-
50-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
5146

5247
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
5348
PyPI <https://pypi.org/project/adafruit-circuitpython-uc8151d/>`_.
@@ -100,8 +95,44 @@ Or the following command to update an existing version:
10095
Usage Example
10196
=============
10297

103-
.. todo:: Add a quick, simple example. It and other examples should live in the
104-
examples folder and be included in docs/examples.rst.
98+
.. code-block:: python
99+
100+
import time
101+
import board
102+
import displayio
103+
import adafruit_uc8151d
104+
105+
displayio.release_displays()
106+
107+
# This pinout works on a Feather M4 and may need to be altered for other boards.
108+
spi = board.SPI() # Uses SCK and MOSI
109+
epd_cs = board.D9
110+
epd_dc = board.D10
111+
epd_reset = board.D5
112+
epd_busy = None
113+
114+
display_bus = displayio.FourWire(
115+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
116+
)
117+
time.sleep(1)
118+
119+
display = adafruit_uc8151d.UC8151D(
120+
display_bus, width=296, height=128, rotation=90, busy_pin=epd_busy
121+
)
122+
123+
g = displayio.Group()
124+
125+
with open("/display-ruler.bmp", "rb") as f:
126+
pic = displayio.OnDiskBitmap(f)
127+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
128+
g.append(t)
129+
130+
display.show(g)
131+
132+
display.refresh()
133+
134+
time.sleep(120)
135+
105136
106137
Contributing
107138
============

adafruit_uc8151d.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@
3131
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_UC8151D.git"
3232

3333
_START_SEQUENCE = (
34-
#b"\x01\x05\x03\x00\x2b\x2b\x09" # power setting
35-
#b"\x06\x03\x17\x17\x17" # booster soft start
36-
34+
# b"\x01\x05\x03\x00\x2b\x2b\x09" # power setting
35+
# b"\x06\x03\x17\x17\x17" # booster soft start
3736
b"\x04\x80\xc8" # power on and wait 10 ms
3837
b"\x00\x01\x1f" # panel setting. Further filled in below.
3938
b"\x50\x01\x97" # CDI setting
4039
)
4140

42-
_STOP_SEQUENCE = (
43-
b"\x50\x01\xf7" # CDI setting
44-
b"\x07\x01\xA5" # Deep Sleep
45-
)
41+
_STOP_SEQUENCE = b"\x50\x01\xf7" b"\x07\x01\xA5" # CDI setting # Deep Sleep
4642
# pylint: disable=too-few-public-methods
4743
class UC8151D(displayio.EPaperDisplay):
4844
r"""UC8151D driver

docs/conf.py

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

3030

3131
intersphinx_mapping = {

docs/index.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ Table of Contents
2424
.. toctree::
2525
:caption: Tutorials
2626

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

3029
.. toctree::
3130
:caption: Related Products
3231

33-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
34-
the toctree above for use later.
32+
Adafruit 2.9" Flexible 296x128 Monochrome eInk / ePaper Display <https://www.adafruit.com/product/4262>
3533

3634
.. toctree::
3735
:caption: Other Links

examples/display-ruler.bmp

352 KB
Binary file not shown.

examples/display-ruler.bmp.license

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT

examples/uc8151d_simpletest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Adafruit Flexible 2.9" Monochrome
1010
* https://www.adafruit.com/product/4262
1111
"""
12+
# pylint: disable=no-member
1213

1314
import time
1415
import board

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# SPDX-License-Identifier: MIT
55

66
Adafruit-Blinka
7+
adafruit-blinka-displayio

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
author_email="[email protected]",
3838
install_requires=[
3939
"Adafruit-Blinka",
40+
"adafruit-blinka-displayio",
4041
],
4142
# Choose your license
4243
license="MIT",
@@ -53,7 +54,7 @@
5354
],
5455
# What does your project relate to?
5556
keywords="adafruit blinka circuitpython micropython uc8151d uc8151 us8151d displayio epd "
56-
"epaper flexible",
57+
"epaper flexible",
5758
# You can just specify the packages manually here if your project is
5859
# simple. Or you can use find_packages().
5960
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,

0 commit comments

Comments
 (0)