display library for ILI9486 based SPI displays
Project description
Python ILI9486 Display Driver
Python module to control an ILI9486 LCD. Based upon the deprecated Python ILI9341 from
Adafruit and the adapted version for ILI9486 from
Liqun Hu.
Rewritten to use spidev and either gpiod, lgpio or rpi-gpio instead of the discontinued Adafruit counterpart
libraries.
Supported displays
Installation and use
Call sudo raspi-config and then select Interface Options > SPI to enable SPI.
# config (should be the same for basically all displays you can buy)
DC_PIN = 24
RS_PIN = 25
SPI_BUS = 0
SPI_DEVICE = 0
# create SPI device
from spidev import SpiDev
spi = SpiDev(SPI_BUS, SPI_DEVICE)
spi.mode = 0b10 # [CPOL|CPHA] -> polarity 1, phase 0
spi.max_speed_hz = 64000000
# create GPIO facade (choose the one you already use in your project, or pick `gpiod` or `lgpio`)
from pyili9486.gpio.lgpio_facade import LGPIOFacade
gpio_facade = LGPIOFacade(DC_PIN, RS_PIN)
# create the LCD instance
from pyili9486 import ILI9486
lcd = ILI9486(spi, gpio_facade)
# draw some stuff
from PIL import Image
width, height = lcd.dimensions
red = Image.new(mode='RGB', size=(width // 2, height // 2), color=(255, 0, 0))
green = Image.new(mode='RGB', size=(width // 2, height // 2), color=(0, 255, 0))
blue = Image.new(mode='RGB', size=(width // 2, height // 2), color=(0, 0, 255))
white = Image.new(mode='RGB', size=(width // 2, height // 2), color=(255, 255, 255))
lcd.begin()
lcd.display(red, 0, 0)
lcd.display(green, width // 2, 0)
lcd.display(blue, 0, height // 2)
lcd.display(white, width // 2, height // 2)
Notes
Brightness control is not implemented, because many displays using this driver chip have a hardwired backlight, that
cannot be controlled via the driver chip or a GPIO pin. Implementing it would require some hardware changes on the
display unit. To emulate shutting off the display you can use lcd.clear().display(), which makes the display to show
black pixels.
Original licensing notes
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Tony DiCola for Adafruit Industries.
Adapted for ILI9486 by Liqun Hu.
Modified and maintained by Thorben Yzer.
Support for MHS3528 variant by Craig Lamparter and hemna.
MIT license, all text above must be included in any redistribution
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyili9486-1.0.0.tar.gz.
File metadata
- Download URL: pyili9486-1.0.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c4197574ea9303c2e826c4be748578cd124f9575ef751add176656c00261a0
|
|
| MD5 |
cd6980cd45d7e9624619b9fd0d4c21aa
|
|
| BLAKE2b-256 |
3138a5d62de2f17e1bc38445bde4f623e6ff00c88d40518cf0aaf3722be2c22e
|
File details
Details for the file pyili9486-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyili9486-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ec57b4d8a70df0e7a362ada112df1ec52e732ab0059c0c18d0ff5d5d0dfdf07
|
|
| MD5 |
2c44381eb1eedec2ea49789bd6b4abeb
|
|
| BLAKE2b-256 |
9525ffecaa8b1ae9ff5276e78421c6e7155488dc9ac1a4b0abc003dc50fe4842
|