/ README.rst
README.rst
  1  Introduction
  2  ============
  3  
  4  .. image:: https://readthedocs.org/projects/adafruit-circuitpython-epd/badge/?version=latest
  5      :target: https://circuitpython.readthedocs.io/projects/epd/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_EPD/workflows/Build%20CI/badge.svg
 13      :target: https://github.com/adafruit/Adafruit_CircuitPython_EPD/actions/
 14      :alt: Build Status
 15  
 16  This library is for using CircuitPython with e-ink displays with built in SRAM.
 17  
 18  Dependencies
 19  =============
 20  This driver depends on:
 21  
 22  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 23  * `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
 24  * `font5x8.bin found in the examples bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_
 25  
 26  Please ensure all dependencies are available on the CircuitPython filesystem.
 27  This is easily achieved by downloading
 28  `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
 29  
 30  Installing from PyPI
 31  ====================
 32  
 33  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 34  PyPI <https://pypi.org/project/adafruit-circuitpython-epd/>`_. To install for current user:
 35  
 36  .. code-block:: shell
 37  
 38      pip3 install adafruit-circuitpython-epd
 39  
 40  To install system-wide (this may be required in some cases):
 41  
 42  .. code-block:: shell
 43  
 44      sudo pip3 install adafruit-circuitpython-epd
 45  
 46  To install in a virtual environment in your current project:
 47  
 48  .. code-block:: shell
 49  
 50      mkdir project-name && cd project-name
 51      python3 -m venv .env
 52      source .env/bin/activate
 53      pip3 install adafruit-circuitpython-epd
 54  
 55  Usage Example
 56  =============
 57  
 58  .. code-block:: python
 59  
 60      import digitalio
 61      import busio
 62      import board
 63      from adafruit_epd.epd import Adafruit_EPD
 64      from adafruit_epd.il0373 import Adafruit_IL0373
 65  
 66      # create the spi device and pins we will need
 67      spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
 68      ecs = digitalio.DigitalInOut(board.D12)
 69      dc = digitalio.DigitalInOut(board.D11)
 70      srcs = digitalio.DigitalInOut(board.D10)    # can be None to use internal memory
 71      rst = digitalio.DigitalInOut(board.D9)    # can be None to not use this pin
 72      busy = digitalio.DigitalInOut(board.D5)   # can be None to not use this pin
 73  
 74      # give them all to our driver
 75      print("Creating display")
 76      display = Adafruit_IL0373(104, 212, spi,          # 2.13" Tri-color display
 77                                cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
 78                                rst_pin=rst, busy_pin=busy)
 79  
 80      display.rotation = 1
 81  
 82      # clear the buffer
 83      print("Clear buffer")
 84      display.fill(Adafruit_EPD.WHITE)
 85      display.pixel(10, 100, Adafruit_EPD.BLACK)
 86  
 87      print("Draw Rectangles")
 88      display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
 89      display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
 90  
 91      print("Draw lines")
 92      display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
 93      display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
 94  
 95      print("Draw text")
 96      display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
 97      display.display()
 98  
 99  
100  Contributing
101  ============
102  
103  Contributions are welcome! Please read our `Code of Conduct
104  <https://github.com/adafruit/Adafruit_CircuitPython_EPD/blob/master/CODE_OF_CONDUCT.md>`_
105  before contributing to help this project stay welcoming.
106  
107  Documentation
108  =============
109  
110  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>`_.