diff --git a/README.rst b/README.rst index d2ad3f5..5ce1242 100644 --- a/README.rst +++ b/README.rst @@ -36,19 +36,10 @@ This is easily achieved by downloading or individual libraries can be installed using `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. - `Purchase one from the Adafruit shop `_ 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 `_. @@ -99,8 +90,64 @@ 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_jd79661 + + 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_jd79661.JD79661( + display_bus, + width=250, + height=122, + busy_pin=epd_busy, + rotation=270, + colstart=0, + highlight_color=0x00FF00, + highlight_color2=0xFF0000, + ) + + g = displayio.Group() + + pic = displayio.OnDiskBitmap("/display-ruler-640x360.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 ============= diff --git a/adafruit_jd79661.py b/adafruit_jd79661.py index fec2fec..51d7abf 100644 --- a/adafruit_jd79661.py +++ b/adafruit_jd79661.py @@ -56,7 +56,7 @@ _START_SEQUENCE = ( b"\x00\x02\x8f\x29" # Panel setting (128x250 resolution) b"\x01\x02\x07\x00" # Power setting b"\x03\x03\x10\x54\x44" # Power offset - b"\x06\x07\x05\x00\x3F\x0A\x25\x12\x1A" # Booster soft start + b"\x06\x07\x05\x00\x3f\x0a\x25\x12\x1a" # Booster soft start b"\x50\x01\x37" # CDI b"\x60\x02\x02\x02" # TCON b"\x61\x04\x00\x80\x00\xfa" # Resolution (0, 128, 0, 250) @@ -74,9 +74,8 @@ _STOP_SEQUENCE = ( b"\x07\x01\xa5" # Deep sleep ) -_REFRESH_SEQUENCE = ( - b"\x12\x01\x00" # Display refresh -) +_REFRESH_SEQUENCE = b"\x12\x01\x00" # Display refresh + # pylint: disable=too-few-public-methods class JD79661(EPaperDisplay): @@ -103,7 +102,7 @@ class JD79661(EPaperDisplay): # No reset pin defined, so no deep sleeping stop_sequence = b"" - start_sequence = bytearray(_START_SEQUENCE ) + start_sequence = bytearray(_START_SEQUENCE) width = kwargs.get("width", 128) height = kwargs.get("height", 250) @@ -112,7 +111,7 @@ class JD79661(EPaperDisplay): # Update resolution in start sequence (bytes at position for resolution command) # Find the resolution command in the sequence and update it - res_pos = start_sequence.find(b'\x61\x04') + res_pos = start_sequence.find(b"\x61\x04") if res_pos != -1: if height % 4 != 0: height += 4 - height % 4 @@ -135,5 +134,5 @@ class JD79661(EPaperDisplay): write_color_ram_command=None, # JD79661 uses single RAM with 2-bit pixels refresh_display_command=_REFRESH_SEQUENCE, always_toggle_chip_select=True, - address_little_endian=False + address_little_endian=False, ) diff --git a/docs/index.rst b/docs/index.rst index ad51a95..0ca1d46 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,14 +24,10 @@ 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. + 2.13" 250x122 Quad-Color eInk / ePaper .. toctree:: :caption: Other Links