adafruit-circuitpython-rgb-display


Nameadafruit-circuitpython-rgb-display JSON
Version 3.12.5 PyPI version JSON
download
home_pageNone
SummaryCircuitPython library for RGB displays.
upload_time2024-08-05 21:48:07
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords adafruit rgb display hx8353 ili9341 s6d02a1 ssd1331 ssd1351 st7735hardware micropython circuitpython
VCS
bugtrack_url
requirements Adafruit-Blinka adafruit-circuitpython-busdevice
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

.. image:: https://readthedocs.org/projects/adafruit-circuitpython-rgb_display/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/rgb_display/en/latest/
    :alt: Documentation Status

.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord

.. image:: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/actions/
    :alt: Build Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

Port of display drivers from https://github.com/adafruit/micropython-adafruit-rgb-display to Adafruit CircuitPython for use on Adafruit's SAMD21-based and other CircuitPython boards.

.. note:: This driver currently won't work on micropython.org firmware, instead you want the micropython-adafruit-rgb-display driver linked above!

This CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, HX8357, ILI9341, S6D02A1, ST7789, SSD1331, SSD1351, and ST7735 (including variants ST7735R and ST7735S).

Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.

For the Pillow Examples, you will need to be running CPython. This means using a Single Board Computer
such as a Raspberry Pi or using a chip such as an FT232H on Linux, Window, or Mac. CircuitPython does
not support PIL/pillow (python imaging library)!

For improved performance consider installing NumPy.

Installing from PyPI
====================

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-rgb-display/>`_. To install for current user:

.. code-block:: shell

    pip3 install adafruit-circuitpython-rgb-display

To install system-wide (this may be required in some cases):

.. code-block:: shell

    sudo pip3 install adafruit-circuitpython-rgb-display

To install in a virtual environment in your current project:

.. code-block:: shell

    mkdir project-name && cd project-name
    python3 -m venv .venv
    source .venv/bin/activate
    pip3 install adafruit-circuitpython-rgb-display

Usage Example
=============

2.2", 2.4", 2.8", 3.2" TFT
---------------------------

.. code-block:: python

  import time
  import busio
  import digitalio
  from board import SCK, MOSI, MISO, D2, D3

  from adafruit_rgb_display import color565
  import adafruit_rgb_display.ili9341 as ili9341


  # Configuration for CS and DC pins:
  CS_PIN = D2
  DC_PIN = D3

  # Setup SPI bus using hardware SPI:
  spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)

  # Create the ILI9341 display:
  display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),
                            dc=digitalio.DigitalInOut(DC_PIN))

  # Main loop:
  while True:
      # Clear the display
      display.fill(0)
      # Draw a red pixel in the center.
      display.pixel(120, 160, color565(255, 0, 0))
      # Pause 2 seconds.
      time.sleep(2)
      # Clear the screen blue.
      display.fill(color565(0, 0, 255))
      # Pause 2 seconds.
      time.sleep(2)


1.14" TFT with Raspbery Pi 4
-----------------------------

With 1.14" `wiring <https://learn.adafruit.com/adafruit-1-14-240x135-color-tft-breakout/python-wiring-and-setup>`_, here is the working code:

.. code-block:: python

  import time
  import busio
  import digitalio
  from board import SCK, MOSI, MISO, CE0, D24, D25

  from adafruit_rgb_display import color565
  from adafruit_rgb_display.st7789 import ST7789


  # Configuration for CS and DC pins:
  CS_PIN = CE0
  DC_PIN = D25
  RESET_PIN = D24
  BAUDRATE = 24000000

  # Setup SPI bus using hardware SPI:
  spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)

  # Create the ST7789 display:
  display = ST7789(
      spi,
      rotation=90,
      width=135,
      height=240,
      x_offset=53,
      y_offset=40,
      baudrate=BAUDRATE,
      cs=digitalio.DigitalInOut(CS_PIN),
      dc=digitalio.DigitalInOut(DC_PIN),
      rst=digitalio.DigitalInOut(RESET_PIN))

  # Main loop: same as above
  while True:
      # Clear the display
      display.fill(0)
      # Draw a red pixel in the center.
      display.pixel(120, 160, color565(255, 0, 0))
      # Pause 2 seconds.
      time.sleep(2)
      # Clear the screen blue.
      display.fill(color565(0, 0, 255))
      # Pause 2 seconds.
      time.sleep(2)


Documentation
=============

API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/rgb_display/en/latest/>`_.

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>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "adafruit-circuitpython-rgb-display",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "adafruit, rgb, display, hx8353, ili9341, s6d02A1, ssd1331, ssd1351, st7735hardware, micropython, circuitpython",
    "author": null,
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/89/a8/ed9cc5547f2072ab35a7d07ef8f52a9cd9dd647ee5c990fc2b92081319f3/adafruit_circuitpython_rgb_display-3.12.5.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-rgb_display/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/rgb_display/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nPort of display drivers from https://github.com/adafruit/micropython-adafruit-rgb-display to Adafruit CircuitPython for use on Adafruit's SAMD21-based and other CircuitPython boards.\n\n.. note:: This driver currently won't work on micropython.org firmware, instead you want the micropython-adafruit-rgb-display driver linked above!\n\nThis CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, HX8357, ILI9341, S6D02A1, ST7789, SSD1331, SSD1351, and ST7735 (including variants ST7735R and ST7735S).\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.\n\nFor the Pillow Examples, you will need to be running CPython. This means using a Single Board Computer\nsuch as a Raspberry Pi or using a chip such as an FT232H on Linux, Window, or Mac. CircuitPython does\nnot support PIL/pillow (python imaging library)!\n\nFor improved performance consider installing NumPy.\n\nInstalling from PyPI\n====================\n\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI <https://pypi.org/project/adafruit-circuitpython-rgb-display/>`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-rgb-display\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-rgb-display\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name && cd project-name\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip3 install adafruit-circuitpython-rgb-display\n\nUsage Example\n=============\n\n2.2\", 2.4\", 2.8\", 3.2\" TFT\n---------------------------\n\n.. code-block:: python\n\n  import time\n  import busio\n  import digitalio\n  from board import SCK, MOSI, MISO, D2, D3\n\n  from adafruit_rgb_display import color565\n  import adafruit_rgb_display.ili9341 as ili9341\n\n\n  # Configuration for CS and DC pins:\n  CS_PIN = D2\n  DC_PIN = D3\n\n  # Setup SPI bus using hardware SPI:\n  spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)\n\n  # Create the ILI9341 display:\n  display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),\n                            dc=digitalio.DigitalInOut(DC_PIN))\n\n  # Main loop:\n  while True:\n      # Clear the display\n      display.fill(0)\n      # Draw a red pixel in the center.\n      display.pixel(120, 160, color565(255, 0, 0))\n      # Pause 2 seconds.\n      time.sleep(2)\n      # Clear the screen blue.\n      display.fill(color565(0, 0, 255))\n      # Pause 2 seconds.\n      time.sleep(2)\n\n\n1.14\" TFT with Raspbery Pi 4\n-----------------------------\n\nWith 1.14\" `wiring <https://learn.adafruit.com/adafruit-1-14-240x135-color-tft-breakout/python-wiring-and-setup>`_, here is the working code:\n\n.. code-block:: python\n\n  import time\n  import busio\n  import digitalio\n  from board import SCK, MOSI, MISO, CE0, D24, D25\n\n  from adafruit_rgb_display import color565\n  from adafruit_rgb_display.st7789 import ST7789\n\n\n  # Configuration for CS and DC pins:\n  CS_PIN = CE0\n  DC_PIN = D25\n  RESET_PIN = D24\n  BAUDRATE = 24000000\n\n  # Setup SPI bus using hardware SPI:\n  spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)\n\n  # Create the ST7789 display:\n  display = ST7789(\n      spi,\n      rotation=90,\n      width=135,\n      height=240,\n      x_offset=53,\n      y_offset=40,\n      baudrate=BAUDRATE,\n      cs=digitalio.DigitalInOut(CS_PIN),\n      dc=digitalio.DigitalInOut(DC_PIN),\n      rst=digitalio.DigitalInOut(RESET_PIN))\n\n  # Main loop: same as above\n  while True:\n      # Clear the display\n      display.fill(0)\n      # Draw a red pixel in the center.\n      display.pixel(120, 160, color565(255, 0, 0))\n      # Pause 2 seconds.\n      time.sleep(2)\n      # Clear the screen blue.\n      display.fill(color565(0, 0, 255))\n      # Pause 2 seconds.\n      time.sleep(2)\n\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/rgb_display/en/latest/>`_.\n\nFor 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>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CircuitPython library for RGB displays.",
    "version": "3.12.5",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display"
    },
    "split_keywords": [
        "adafruit",
        " rgb",
        " display",
        " hx8353",
        " ili9341",
        " s6d02a1",
        " ssd1331",
        " ssd1351",
        " st7735hardware",
        " micropython",
        " circuitpython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc94c6d1842dcd9e655069cd976ae22716c08cd22014e5dd5f24ed79b2370f79",
                "md5": "4b8eca06724d984b54f460f9884e5b36",
                "sha256": "02165b8753c023b73087ed506a9b09184ebc8c13b2b4701c72ebb1e0f8965e1a"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_rgb_display-3.12.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4b8eca06724d984b54f460f9884e5b36",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 20860,
            "upload_time": "2024-08-05T21:48:05",
            "upload_time_iso_8601": "2024-08-05T21:48:05.702085Z",
            "url": "https://files.pythonhosted.org/packages/dc/94/c6d1842dcd9e655069cd976ae22716c08cd22014e5dd5f24ed79b2370f79/adafruit_circuitpython_rgb_display-3.12.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89a8ed9cc5547f2072ab35a7d07ef8f52a9cd9dd647ee5c990fc2b92081319f3",
                "md5": "ae5b086af2f3eb58a57b50d9e9e08941",
                "sha256": "d291caa59c6489f6f19898baed13a6bfd0693480b839342e41620982854c75c4"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_rgb_display-3.12.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ae5b086af2f3eb58a57b50d9e9e08941",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 43464,
            "upload_time": "2024-08-05T21:48:07",
            "upload_time_iso_8601": "2024-08-05T21:48:07.771318Z",
            "url": "https://files.pythonhosted.org/packages/89/a8/ed9cc5547f2072ab35a7d07ef8f52a9cd9dd647ee5c990fc2b92081319f3/adafruit_circuitpython_rgb_display-3.12.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-05 21:48:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_RGB_Display",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Adafruit-Blinka",
            "specs": []
        },
        {
            "name": "adafruit-circuitpython-busdevice",
            "specs": []
        }
    ],
    "lcname": "adafruit-circuitpython-rgb-display"
}
        
Elapsed time: 0.33323s