mirror of
https://github.com/pimoroni/st7735-python.git
synced 2025-01-05 22:40:25 +03:00
Update library to support FT232H SPI.
This commit is contained in:
@@ -118,8 +118,8 @@ def image_to_data(image):
|
|||||||
class ILI9341(object):
|
class ILI9341(object):
|
||||||
"""Representation of an ILI9341 TFT LCD."""
|
"""Representation of an ILI9341 TFT LCD."""
|
||||||
|
|
||||||
def __init__(self, dc, spi, rst=None, gpio=GPIO.get_platform_gpio(),
|
def __init__(self, dc, spi, rst=None, gpio=None, width=ILI9341_TFTWIDTH,
|
||||||
width=ILI9341_TFTWIDTH, height=ILI9341_TFTHEIGHT):
|
height=ILI9341_TFTHEIGHT):
|
||||||
"""Create an instance of the display using SPI communication. Must
|
"""Create an instance of the display using SPI communication. Must
|
||||||
provide the GPIO pin number for the D/C pin and the SPI driver. Can
|
provide the GPIO pin number for the D/C pin and the SPI driver. Can
|
||||||
optionally provide the GPIO pin number for the reset pin as the rst
|
optionally provide the GPIO pin number for the reset pin as the rst
|
||||||
@@ -131,14 +131,17 @@ class ILI9341(object):
|
|||||||
self._gpio = gpio
|
self._gpio = gpio
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
|
if self._gpio is None:
|
||||||
|
self._gpio = GPIO.get_platform_gpio()
|
||||||
# Set DC as output.
|
# Set DC as output.
|
||||||
gpio.setup(dc, GPIO.OUT)
|
self._gpio.setup(dc, GPIO.OUT)
|
||||||
# Setup reset as output (if provided).
|
# Setup reset as output (if provided).
|
||||||
if rst is not None:
|
if rst is not None:
|
||||||
gpio.setup(rst, GPIO.OUT)
|
self._gpio.setup(rst, GPIO.OUT)
|
||||||
# Set SPI to mode 0, MSB first.
|
# Set SPI to mode 0, MSB first.
|
||||||
spi.set_mode(0)
|
spi.set_mode(0)
|
||||||
spi.set_bit_order(SPI.MSBFIRST)
|
spi.set_bit_order(SPI.MSBFIRST)
|
||||||
|
spi.set_clock_hz(64000000)
|
||||||
# Create an image buffer.
|
# Create an image buffer.
|
||||||
self.buffer = Image.new('RGB', (width, height))
|
self.buffer = Image.new('RGB', (width, height))
|
||||||
|
|
||||||
|
|||||||
6
setup.py
6
setup.py
@@ -10,12 +10,12 @@ use_setuptools()
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(name = 'Adafruit_ILI9341',
|
setup(name = 'Adafruit_ILI9341',
|
||||||
version = '1.0.0',
|
version = '1.5.0',
|
||||||
author = 'Tony DiCola',
|
author = 'Tony DiCola',
|
||||||
author_email = 'tdicola@adafruit.com',
|
author_email = 'tdicola@adafruit.com',
|
||||||
description = 'Library to control an ILI9341 TFT LCD display.',
|
description = 'Library to control an ILI9341 TFT LCD display.',
|
||||||
license = 'MIT',
|
license = 'MIT',
|
||||||
url = 'https://github.com/adafruit/Adafruit_Python_ILI9341/',
|
url = 'https://github.com/adafruit/Adafruit_Python_ILI9341/',
|
||||||
dependency_links = ['https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.4.0'],
|
dependency_links = ['https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.6.5'],
|
||||||
install_requires = ['Adafruit-GPIO>=0.4.0'],
|
install_requires = ['Adafruit-GPIO>=0.6.5'],
|
||||||
packages = find_packages())
|
packages = find_packages())
|
||||||
|
|||||||
Reference in New Issue
Block a user