Skip to content

Commit 210095f

Browse files
committed
cleanup, pre-commit, docs.
1 parent bb60a84 commit 210095f

File tree

5 files changed

+61
-31
lines changed

5 files changed

+61
-31
lines changed

README.rst

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,13 @@ or individual libraries can be installed using
3737
`circup <https://github.com/adafruit/circup>`_.
3838

3939

40-
41-
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
42-
image from the assets folder in the PCB's GitHub repo.
40+
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
41+
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
4342

4443
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
4544

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

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

102-
.. todo:: Add a quick, simple example. It and other examples should live in the
103-
examples folder and be included in docs/examples.rst.
97+
.. code-block:: python
98+
99+
import time
100+
101+
import board
102+
import busio
103+
import displayio
104+
from fourwire import FourWire
105+
106+
import adafruit_uc8253
107+
108+
displayio.release_displays()
109+
110+
# This pinout works on a MagTag with the newer screen and may need to be altered for other boards.
111+
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
112+
epd_cs = board.EPD_CS
113+
epd_dc = board.EPD_DC
114+
epd_reset = board.EPD_RESET
115+
epd_busy = board.EPD_BUSY
116+
117+
display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
118+
time.sleep(1)
119+
120+
display = adafruit_uc8253.UC8253(
121+
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, vcom_cdi=0x97
122+
)
123+
124+
g = displayio.Group()
125+
126+
pic = displayio.OnDiskBitmap("/display-ruler-1280x720.bmp")
127+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
128+
g.append(t)
129+
130+
display.root_group = g
131+
132+
display.refresh()
133+
134+
print("refreshed")
135+
136+
time.sleep(display.time_to_refresh + 5)
137+
# Always refresh a little longer. It's not a problem to refresh
138+
# a few seconds more, but it's terrible to refresh too early
139+
# (the display will throw an exception when if the refresh
140+
# is too soon)
141+
print("waited correct time")
142+
143+
# Keep the display the same
144+
while True:
145+
time.sleep(10)
146+
104147
105148
Documentation
106149
=============

adafruit_uc8253.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
1616
**Hardware:**
1717
18-
.. todo:: Add links to any specific hardware product page(s), or category page(s).
19-
Use unordered list & hyperlink rST inline format: "* `Link Text <url>`_"
18+
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
19+
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
2020
2121
**Software and Dependencies:**
2222
@@ -35,7 +35,7 @@
3535

3636
_START_SEQUENCE = (
3737
b"\x04\x00" # POWERON
38-
b"\x50\x01\xd7" # VCOM/CDI
38+
b"\x50\x01\xd7" # VCOM/CDI
3939
b"\x00\x02\xcf\x8d" # PANELSETTING: 0b11001111, 0x8D
4040
)
4141

@@ -48,7 +48,7 @@
4848
class UC8253(EPaperDisplay):
4949
"""UC8253 ePaper display driver"""
5050

51-
def __init__(self, bus, vcom_cdi=0xd7, **kwargs):
51+
def __init__(self, bus, vcom_cdi=0xD7, **kwargs):
5252
start_sequence = bytearray(_START_SEQUENCE)
5353

5454
if "highlight_color" in kwargs:
@@ -75,5 +75,5 @@ def __init__(self, bus, vcom_cdi=0xd7, **kwargs):
7575
write_color_ram_command=color_ram_command,
7676
refresh_display_command=0x12,
7777
refresh_time=16,
78-
always_toggle_chip_select=True
78+
always_toggle_chip_select=True,
7979
)

docs/index.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ 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.
29-
3027
.. toctree::
3128
:caption: Related Products
3229

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.
30+
3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>
31+
3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>
3532

3633
.. toctree::
3734
:caption: Other Links

examples/uc8253_ThinkInk_370_Tricolor_BABMFGNR.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@
2727
time.sleep(1)
2828

2929
display = adafruit_uc8253.UC8253(
30-
display_bus,
31-
width=240,
32-
height=416,
33-
busy_pin=epd_busy,
34-
rotation=0,
35-
highlight_color=0xff0000
30+
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, highlight_color=0xFF0000
3631
)
3732

3833
g = displayio.Group()

examples/uc8253_simpletest.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@
2727
time.sleep(1)
2828

2929
display = adafruit_uc8253.UC8253(
30-
display_bus,
31-
width=240,
32-
height=416,
33-
busy_pin=epd_busy,
34-
rotation=0,
35-
vcom_cdi=0x97
30+
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, vcom_cdi=0x97
3631
)
3732

3833
g = displayio.Group()

0 commit comments

Comments
 (0)