cleanup, pre-commit, docs.
This commit is contained in:
parent
bb60a849c3
commit
210095f2e2
5 changed files with 61 additions and 31 deletions
61
README.rst
61
README.rst
|
|
@ -37,18 +37,13 @@ or individual libraries can be installed using
|
||||||
`circup <https://github.com/adafruit/circup>`_.
|
`circup <https://github.com/adafruit/circup>`_.
|
||||||
|
|
||||||
|
|
||||||
|
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
|
||||||
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
|
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
|
||||||
image from the assets folder in the PCB's GitHub repo.
|
|
||||||
|
|
||||||
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
|
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
|
||||||
|
|
||||||
Installing from PyPI
|
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.
|
|
||||||
|
|
||||||
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
|
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
|
||||||
PyPI <https://pypi.org/project/adafruit-circuitpython-uc8253/>`_.
|
PyPI <https://pypi.org/project/adafruit-circuitpython-uc8253/>`_.
|
||||||
|
|
@ -99,8 +94,56 @@ Or the following command to update an existing version:
|
||||||
Usage Example
|
Usage Example
|
||||||
=============
|
=============
|
||||||
|
|
||||||
.. todo:: Add a quick, simple example. It and other examples should live in the
|
.. code-block:: python
|
||||||
examples folder and be included in docs/examples.rst.
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
import board
|
||||||
|
import busio
|
||||||
|
import displayio
|
||||||
|
from fourwire import FourWire
|
||||||
|
|
||||||
|
import adafruit_uc8253
|
||||||
|
|
||||||
|
displayio.release_displays()
|
||||||
|
|
||||||
|
# This pinout works on a MagTag with the newer screen and may need to be altered for other boards.
|
||||||
|
spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
|
||||||
|
epd_cs = board.EPD_CS
|
||||||
|
epd_dc = board.EPD_DC
|
||||||
|
epd_reset = board.EPD_RESET
|
||||||
|
epd_busy = board.EPD_BUSY
|
||||||
|
|
||||||
|
display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
display = adafruit_uc8253.UC8253(
|
||||||
|
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, vcom_cdi=0x97
|
||||||
|
)
|
||||||
|
|
||||||
|
g = displayio.Group()
|
||||||
|
|
||||||
|
pic = displayio.OnDiskBitmap("/display-ruler-1280x720.bmp")
|
||||||
|
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
|
||||||
|
g.append(t)
|
||||||
|
|
||||||
|
display.root_group = g
|
||||||
|
|
||||||
|
display.refresh()
|
||||||
|
|
||||||
|
print("refreshed")
|
||||||
|
|
||||||
|
time.sleep(display.time_to_refresh + 5)
|
||||||
|
# Always refresh a little longer. It's not a problem to refresh
|
||||||
|
# a few seconds more, but it's terrible to refresh too early
|
||||||
|
# (the display will throw an exception when if the refresh
|
||||||
|
# is too soon)
|
||||||
|
print("waited correct time")
|
||||||
|
|
||||||
|
# Keep the display the same
|
||||||
|
while True:
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
=============
|
=============
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ Implementation Notes
|
||||||
|
|
||||||
**Hardware:**
|
**Hardware:**
|
||||||
|
|
||||||
.. todo:: Add links to any specific hardware product page(s), or category page(s).
|
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
|
||||||
Use unordered list & hyperlink rST inline format: "* `Link Text <url>`_"
|
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
|
||||||
|
|
||||||
**Software and Dependencies:**
|
**Software and Dependencies:**
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ except ImportError:
|
||||||
|
|
||||||
_START_SEQUENCE = (
|
_START_SEQUENCE = (
|
||||||
b"\x04\x00" # POWERON
|
b"\x04\x00" # POWERON
|
||||||
b"\x50\x01\xd7" # VCOM/CDI
|
b"\x50\x01\xd7" # VCOM/CDI
|
||||||
b"\x00\x02\xcf\x8d" # PANELSETTING: 0b11001111, 0x8D
|
b"\x00\x02\xcf\x8d" # PANELSETTING: 0b11001111, 0x8D
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_UC8253.git"
|
||||||
class UC8253(EPaperDisplay):
|
class UC8253(EPaperDisplay):
|
||||||
"""UC8253 ePaper display driver"""
|
"""UC8253 ePaper display driver"""
|
||||||
|
|
||||||
def __init__(self, bus, vcom_cdi=0xd7, **kwargs):
|
def __init__(self, bus, vcom_cdi=0xD7, **kwargs):
|
||||||
start_sequence = bytearray(_START_SEQUENCE)
|
start_sequence = bytearray(_START_SEQUENCE)
|
||||||
|
|
||||||
if "highlight_color" in kwargs:
|
if "highlight_color" in kwargs:
|
||||||
|
|
@ -75,5 +75,5 @@ class UC8253(EPaperDisplay):
|
||||||
write_color_ram_command=color_ram_command,
|
write_color_ram_command=color_ram_command,
|
||||||
refresh_display_command=0x12,
|
refresh_display_command=0x12,
|
||||||
refresh_time=16,
|
refresh_time=16,
|
||||||
always_toggle_chip_select=True
|
always_toggle_chip_select=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,11 @@ Table of Contents
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Tutorials
|
: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.
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Related Products
|
:caption: Related Products
|
||||||
|
|
||||||
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
|
3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>
|
||||||
the toctree above for use later.
|
3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Other Links
|
:caption: Other Links
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,7 @@ display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
display = adafruit_uc8253.UC8253(
|
display = adafruit_uc8253.UC8253(
|
||||||
display_bus,
|
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, highlight_color=0xFF0000
|
||||||
width=240,
|
|
||||||
height=416,
|
|
||||||
busy_pin=epd_busy,
|
|
||||||
rotation=0,
|
|
||||||
highlight_color=0xff0000
|
|
||||||
)
|
)
|
||||||
|
|
||||||
g = displayio.Group()
|
g = displayio.Group()
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,7 @@ display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
display = adafruit_uc8253.UC8253(
|
display = adafruit_uc8253.UC8253(
|
||||||
display_bus,
|
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, vcom_cdi=0x97
|
||||||
width=240,
|
|
||||||
height=416,
|
|
||||||
busy_pin=epd_busy,
|
|
||||||
rotation=0,
|
|
||||||
vcom_cdi=0x97
|
|
||||||
)
|
)
|
||||||
|
|
||||||
g = displayio.Group()
|
g = displayio.Group()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue