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": "",
"name": "adafruit-circuitpython-rgb-display",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adafruit,rgb,display,hx8353,ili9341,s6d02A1,ssd1331,ssd1351,st7735hardware,micropython,circuitpython",
"author": "",
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/55/ba/6e1e1264a719f64200b0302271bba10a201c5f4d65eaeb25104f9b382788/adafruit-circuitpython-rgb-display-3.12.4.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.4",
"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": "776c7c17e48cb6e0d9fdb70e9c753a86fbfe336c5c0f842e960070881237a47a",
"md5": "b231db0d41d83da879396a1c018b8835",
"sha256": "79e67706764d94bbdf4af0c50cbacaa987c4cbf8f6d7d5ba0feaba6f8f272c82"
},
"downloads": -1,
"filename": "adafruit_circuitpython_rgb_display-3.12.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b231db0d41d83da879396a1c018b8835",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20869,
"upload_time": "2024-02-20T22:22:29",
"upload_time_iso_8601": "2024-02-20T22:22:29.200600Z",
"url": "https://files.pythonhosted.org/packages/77/6c/7c17e48cb6e0d9fdb70e9c753a86fbfe336c5c0f842e960070881237a47a/adafruit_circuitpython_rgb_display-3.12.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "55ba6e1e1264a719f64200b0302271bba10a201c5f4d65eaeb25104f9b382788",
"md5": "f9c42529c868042f3c6f673c7f1b801f",
"sha256": "b1fa959df17e4b180bb257fb5d713cf4f8513b07dac590e07ca0e6e1a8b2c2bb"
},
"downloads": -1,
"filename": "adafruit-circuitpython-rgb-display-3.12.4.tar.gz",
"has_sig": false,
"md5_digest": "f9c42529c868042f3c6f673c7f1b801f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 43467,
"upload_time": "2024-02-20T22:22:30",
"upload_time_iso_8601": "2024-02-20T22:22:30.958498Z",
"url": "https://files.pythonhosted.org/packages/55/ba/6e1e1264a719f64200b0302271bba10a201c5f4d65eaeb25104f9b382788/adafruit-circuitpython-rgb-display-3.12.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-20 22:22:30",
"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": [],
"lcname": "adafruit-circuitpython-rgb-display"
}