Metadata-Version: 2.3
Name: pyILI9486
Version: 1.0.0
Summary: display library for ILI9486 based SPI displays
Author: Tony Di Cola (tdicola), Liqun Hu (huliqun), Thorben Yzer (SirLefti), Craig Lamparter (craigerl), hemna
Author-email: Thorben Yzer (SirLefti) <62506842+SirLefti@users.noreply.github.com>
License: MIT License
         
         Copyright (c) 2014 Adafruit Industries
         Copyright (c) 2016 Liqun Hu
         Copyright (c) 2022 Thorben Yzer
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: pillow>=12.0.0
Requires-Dist: spidev>=3.8 ; sys_platform == 'linux'
Requires-Dist: numpy>=2.4.0
Requires-Dist: uv-build ; extra == 'build'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: gpiod>=2.4.0 ; extra == 'gpiod'
Requires-Dist: lgpio>=0.2.2.0 ; extra == 'lgpio'
Requires-Dist: rpi-lgpio>=0.6 ; extra == 'rpilgpio'
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/SirLefti/Python_ILI9486
Project-URL: Source, https://github.com/SirLefti/Python_ILI9486
Provides-Extra: build
Provides-Extra: dev
Provides-Extra: gpiod
Provides-Extra: lgpio
Provides-Extra: rpilgpio
Description-Content-Type: text/markdown

Python ILI9486 Display Driver
=============================

Python module to control an ILI9486 LCD. Based upon the deprecated Python ILI9341 from
[Adafruit](https://github.com/adafruit/Adafruit_Python_ILI9341) and the adapted version for ILI9486 from
[Liqun Hu](https://github.com/huliqun/Myway_Python_ILI9486).
Rewritten to use `spidev` and either `gpiod`, `lgpio` or `rpi-gpio` instead of the discontinued Adafruit counterpart
libraries.

## Supported displays
* [MPI3501](https://www.lcdwiki.com/3.5inch_RPi_Display)
* [MHS3528](https://www.lcdwiki.com/MHS-3.5inch_RPi_Display)

## Installation and use

Call `sudo raspi-config` and then select `Interface Options > SPI` to enable SPI.

```py
# 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.<br>
Adapted for ILI9486 by Liqun Hu.<br>
Modified and maintained by Thorben Yzer.<br>
Support for MHS3528 variant by Craig Lamparter and hemna.<br>

MIT license, all text above must be included in any redistribution
