/ README.rst
README.rst
  1  Introduction
  2  ============
  3  
  4  .. image:: https://readthedocs.org/projects/adafruit-circuitpython-il0398/badge/?version=latest
  5      :target: https://circuitpython.readthedocs.io/projects/il0398/en/latest/
  6      :alt: Documentation Status
  7  
  8  .. image:: https://img.shields.io/discord/327254708534116352.svg
  9      :target: https://adafru.it/discord
 10      :alt: Discord
 11  
 12  .. image:: https://github.com/adafruit/Adafruit_CircuitPython_IL0398/workflows/Build%20CI/badge.svg
 13      :target: https://github.com/adafruit/Adafruit_CircuitPython_IL0398/actions
 14      :alt: Build Status
 15  
 16  CircuitPython displayio drivers for IL0398 driven e-paper displays
 17  
 18  
 19  Dependencies
 20  =============
 21  This driver depends on:
 22  
 23  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 24  
 25  Please ensure all dependencies are available on the CircuitPython filesystem.
 26  This is easily achieved by downloading
 27  `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
 28  
 29  Installing from PyPI
 30  =====================
 31  .. note:: This library is not available on PyPI yet. Install documentation is included
 32     as a standard element. Stay tuned for PyPI availability!
 33  
 34  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 35  PyPI <https://pypi.org/project/adafruit-circuitpython-il0398/>`_. To install for current user:
 36  
 37  .. code-block:: shell
 38  
 39      pip3 install adafruit-circuitpython-il0398
 40  
 41  To install system-wide (this may be required in some cases):
 42  
 43  .. code-block:: shell
 44  
 45      sudo pip3 install adafruit-circuitpython-il0398
 46  
 47  To install in a virtual environment in your current project:
 48  
 49  .. code-block:: shell
 50  
 51      mkdir project-name && cd project-name
 52      python3 -m venv .env
 53      source .env/bin/activate
 54      pip3 install adafruit-circuitpython-il0398
 55  
 56  Usage Example
 57  =============
 58  
 59  .. code-block:: python
 60  
 61      """Simple test script for 4.2" 400x300 black and white displays.
 62  
 63      Supported products:
 64        * WaveShare 4.2" Black and White
 65          * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper.htm
 66          * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-module.htm
 67        """
 68  
 69      import time
 70      import board
 71      import displayio
 72      import adafruit_il0398
 73  
 74      displayio.release_displays()
 75  
 76      # This pinout works on a Feather M4 and may need to be altered for other boards.
 77      spi = board.SPI() # Uses SCK and MOSI
 78      epd_cs = board.D9
 79      epd_dc = board.D10
 80      epd_reset = board.D5
 81      epd_busy = board.D6
 82  
 83      display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
 84                                       baudrate=1000000)
 85      time.sleep(1)
 86  
 87      display = adafruit_il0398.IL0398(display_bus, width=400, height=300, seconds_per_frame=20,
 88                                       busy_pin=epd_busy)
 89  
 90      g = displayio.Group()
 91  
 92      f = open("/display-ruler.bmp", "rb")
 93  
 94      pic = displayio.OnDiskBitmap(f)
 95      t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
 96      g.append(t)
 97  
 98      display.show(g)
 99  
100      display.refresh()
101  
102      time.sleep(120)
103  
104  Contributing
105  ============
106  
107  Contributions are welcome! Please read our `Code of Conduct
108  <https://github.com/adafruit/Adafruit_CircuitPython_IL0398/blob/master/CODE_OF_CONDUCT.md>`_
109  before contributing to help this project stay welcoming.
110  
111  Documentation
112  =============
113  
114  For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.