<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Thin-Film-Transistor LEDs
Over the SPI interface, you can communicate with various devices using the Minnowboard. In this notebook, you can communicate with a wide variety of TFT LCD screens. You can find some examples such as these two displays
Step1:  Using the TFT Class
The TFT LCD userspace library can run without requiring a kernel module. Using it in this mode will be somewhat slower, suitable for drawing images one-at-a-time.
Step2:  Using the PIL Drawing class
The Python Imaging library makes it easy to draw simple shapes.
Step3:  Using PIL for image files
Additionally, you can display image files on your TFT LCD, supporting different kinds of filetypes such as PNG and JPEG.
<ASSISTANT_TASK:>
Python Code:
# Get the Python Imaging Libraries for drawing shapes and working with images
import Image
import ImageDraw
import ImageFont
# Get our driver and GPIO libraries
import pyDrivers.ILI9341 as TFT
import Adafruit_GPIO.GPIO as GPIO
import Adafruit_GPIO.SPI as SPI
# Minnowboard MAX configuration.
DC = 25 
RST = 26
SPI_PORT = 0
SPI_DEVICE = 0
Explanation: Thin-Film-Transistor LEDs
Over the SPI interface, you can communicate with various devices using the Minnowboard. In this notebook, you can communicate with a wide variety of TFT LCD screens. You can find some examples such as these two displays:
2.8'' ILI9341
3.5'' HXD8357D
Review the wiki page at http://wiki.minnowboard.org/Projects/Maker_TFTLCD for hardware requirements and setup.
End of explanation
# Create TFT LCD display class.
disp = TFT.ILI9341(DC, rst=RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=1000000))
# Initialize display.
disp.begin()
# Clear the display to a red background.
# Can pass any tuple of red, green, blue values (from 0 to 255 each).
disp.clear((255, 0, 0))
# Get a PIL Draw object to start drawing on the display buffer.
draw = disp.draw()
Explanation: Using the TFT Class
The TFT LCD userspace library can run without requiring a kernel module. Using it in this mode will be somewhat slower, suitable for drawing images one-at-a-time.
End of explanation
draw.rectangle((10, 90, 110, 160), outline=(255,255,0), fill=(0,0,255))
# Write buffer to the screen
disp.display()
Explanation: Using the PIL Drawing class
The Python Imaging library makes it easy to draw simple shapes.
End of explanation
image = Image.open('logo.png')
image = image.rotate(90).resize((240,320))
disp.display(image)
Explanation: Using PIL for image files
Additionally, you can display image files on your TFT LCD, supporting different kinds of filetypes such as PNG and JPEG.
End of explanation
<END_TASK>