cleanup, pre-commit, docs.

This commit is contained in:
foamyguy 2025-08-13 16:36:00 -05:00
parent bb60a849c3
commit 210095f2e2
5 changed files with 61 additions and 31 deletions

View file

@ -37,18 +37,13 @@ or individual libraries can be installed using
`circup <https://github.com/adafruit/circup>`_.
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
image from the assets folder in the PCB's GitHub repo.
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
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
PyPI <https://pypi.org/project/adafruit-circuitpython-uc8253/>`_.
@ -99,8 +94,56 @@ Or the following command to update an existing version:
Usage Example
=============
.. todo:: Add a quick, simple example. It and other examples should live in the
examples folder and be included in docs/examples.rst.
.. code-block:: python
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
=============

View file

@ -15,8 +15,8 @@ Implementation Notes
**Hardware:**
.. todo:: Add links to any specific hardware product page(s), or category page(s).
Use unordered list & hyperlink rST inline format: "* `Link Text <url>`_"
* `3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>`_
* `3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>`_
**Software and Dependencies:**
@ -35,7 +35,7 @@ except ImportError:
_START_SEQUENCE = (
b"\x04\x00" # POWERON
b"\x50\x01\xd7" # VCOM/CDI
b"\x50\x01\xd7" # VCOM/CDI
b"\x00\x02\xcf\x8d" # PANELSETTING: 0b11001111, 0x8D
)
@ -48,7 +48,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_UC8253.git"
class UC8253(EPaperDisplay):
"""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)
if "highlight_color" in kwargs:
@ -75,5 +75,5 @@ class UC8253(EPaperDisplay):
write_color_ram_command=color_ram_command,
refresh_display_command=0x12,
refresh_time=16,
always_toggle_chip_select=True
always_toggle_chip_select=True,
)

View file

@ -24,14 +24,11 @@ Table of Contents
.. toctree::
: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::
:caption: Related Products
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
the toctree above for use later.
3.7" 416x240 Monochrome Black/White eInk / ePaper - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6395>
3.7" 416x240 Tri-Color Red / Black / White eInk - Bare Display - UC8253 Chipset <https://www.adafruit.com/product/6394>
.. toctree::
:caption: Other Links

View file

@ -27,12 +27,7 @@ display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
time.sleep(1)
display = adafruit_uc8253.UC8253(
display_bus,
width=240,
height=416,
busy_pin=epd_busy,
rotation=0,
highlight_color=0xff0000
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, highlight_color=0xFF0000
)
g = displayio.Group()

View file

@ -27,12 +27,7 @@ display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
time.sleep(1)
display = adafruit_uc8253.UC8253(
display_bus,
width=240,
height=416,
busy_pin=epd_busy,
rotation=0,
vcom_cdi=0x97
display_bus, width=240, height=416, busy_pin=epd_busy, rotation=0, vcom_cdi=0x97
)
g = displayio.Group()