Skip to content

Commit 3f37a78

Browse files
committed
pre-commit & fix docs build
1 parent 2696ca5 commit 3f37a78

File tree

3 files changed

+65
-23
lines changed

3 files changed

+65
-23
lines changed

README.rst

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

39-
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.
43-
4439
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/6373>`_
4540

4641
Installing from PyPI
4742
=====================
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.
5243

5344
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
5445
PyPI <https://pypi.org/project/adafruit-circuitpython-jd79661/>`_.
@@ -99,8 +90,64 @@ Or the following command to update an existing version:
9990
Usage Example
10091
=============
10192

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.
93+
.. code-block:: python
94+
95+
import time
96+
97+
import board
98+
import busio
99+
import displayio
100+
from fourwire import FourWire
101+
102+
import adafruit_jd79661
103+
104+
displayio.release_displays()
105+
106+
# This pinout works on a MagTag with the newer screen and may need to be altered for other boards.
107+
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
108+
epd_cs = board.EPD_CS
109+
epd_dc = board.EPD_DC
110+
epd_reset = board.EPD_RESET
111+
epd_busy = board.EPD_BUSY
112+
113+
display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
114+
time.sleep(1)
115+
116+
display = adafruit_jd79661.JD79661(
117+
display_bus,
118+
width=250,
119+
height=122,
120+
busy_pin=epd_busy,
121+
rotation=270,
122+
colstart=0,
123+
highlight_color=0x00FF00,
124+
highlight_color2=0xFF0000,
125+
)
126+
127+
g = displayio.Group()
128+
129+
pic = displayio.OnDiskBitmap("/display-ruler-640x360.bmp")
130+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
131+
g.append(t)
132+
133+
display.root_group = g
134+
135+
display.refresh()
136+
137+
print("refreshed")
138+
139+
time.sleep(display.time_to_refresh + 5)
140+
# Always refresh a little longer. It's not a problem to refresh
141+
# a few seconds more, but it's terrible to refresh too early
142+
# (the display will throw an exception when if the refresh
143+
# is too soon)
144+
print("waited correct time")
145+
146+
147+
# Keep the display the same
148+
while True:
149+
time.sleep(10)
150+
104151
105152
Documentation
106153
=============

adafruit_jd79661.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
b"\x00\x02\x8f\x29" # Panel setting (128x250 resolution)
5757
b"\x01\x02\x07\x00" # Power setting
5858
b"\x03\x03\x10\x54\x44" # Power offset
59-
b"\x06\x07\x05\x00\x3F\x0A\x25\x12\x1A" # Booster soft start
59+
b"\x06\x07\x05\x00\x3f\x0a\x25\x12\x1a" # Booster soft start
6060
b"\x50\x01\x37" # CDI
6161
b"\x60\x02\x02\x02" # TCON
6262
b"\x61\x04\x00\x80\x00\xfa" # Resolution (0, 128, 0, 250)
@@ -74,9 +74,8 @@
7474
b"\x07\x01\xa5" # Deep sleep
7575
)
7676

77-
_REFRESH_SEQUENCE = (
78-
b"\x12\x01\x00" # Display refresh
79-
)
77+
_REFRESH_SEQUENCE = b"\x12\x01\x00" # Display refresh
78+
8079

8180
# pylint: disable=too-few-public-methods
8281
class JD79661(EPaperDisplay):
@@ -103,7 +102,7 @@ def __init__(self, bus: FourWire, **kwargs) -> None:
103102
# No reset pin defined, so no deep sleeping
104103
stop_sequence = b""
105104

106-
start_sequence = bytearray(_START_SEQUENCE )
105+
start_sequence = bytearray(_START_SEQUENCE)
107106

108107
width = kwargs.get("width", 128)
109108
height = kwargs.get("height", 250)
@@ -112,7 +111,7 @@ def __init__(self, bus: FourWire, **kwargs) -> None:
112111

113112
# Update resolution in start sequence (bytes at position for resolution command)
114113
# Find the resolution command in the sequence and update it
115-
res_pos = start_sequence.find(b'\x61\x04')
114+
res_pos = start_sequence.find(b"\x61\x04")
116115
if res_pos != -1:
117116
if height % 4 != 0:
118117
height += 4 - height % 4
@@ -135,5 +134,5 @@ def __init__(self, bus: FourWire, **kwargs) -> None:
135134
write_color_ram_command=None, # JD79661 uses single RAM with 2-bit pixels
136135
refresh_display_command=_REFRESH_SEQUENCE,
137136
always_toggle_chip_select=True,
138-
address_little_endian=False
137+
address_little_endian=False,
139138
)

docs/index.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ 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+
2.13" 250x122 Quad-Color eInk / ePaper <http://www.adafruit.com/products/6373>
3531

3632
.. toctree::
3733
:caption: Other Links

0 commit comments

Comments
 (0)