This commit is contained in:
Bartosz Kościów 2017-05-16 23:04:56 +02:00
parent 626d012021
commit 26178fba20
3 changed files with 43 additions and 20 deletions

View File

@ -37,15 +37,18 @@ o = ILI9486(320, 480, drv)
print("init")
o.init()
# o.driver.reset()
o.color = (255, 120, 0)
o.background_color = (255, 120,0)
o.fill_rect(50, 150, 205, 205)
# exit()
o.color = (255, 255, 255)
o.background_color = (0, 0, 0)
o.fill_rect(10, 150, 205, 205)
for _ in range(0, 50):
hole(random.randint(2,o.width-3), random.randint(2,o.height-3))
# exit()
# for _ in range(0, 50):
# hole(random.randint(2,o.width-3), random.randint(2,o.height-3))
draw_net(o)
# draw_net(o)
print("draw")
o.color = (10, 230, 200)
o.draw_circle(60, 15, 15)

View File

@ -0,0 +1,19 @@
import RPi.GPIO
import sys
from PIL import Image
sys.path.append("../../")
from gfxlcd.driver.ili9486.spi import SPI
from gfxlcd.driver.ili9486.ili9486 import ILI9486
RPi.GPIO.setmode(RPi.GPIO.BCM)
drv = SPI()
lcd_tft = ILI9486(320, 480, drv)
lcd_tft.init()
image_file = Image.open("assets/japan_temple_240x320.jpg")
lcd_tft.draw_image(0, 0, image_file)
numbers_image = Image.open("assets/dsp2017_101_64.png")
lcd_tft.transparency_color = (0, 0, 0)
lcd_tft.draw_image(10, 10, numbers_image)

View File

@ -38,9 +38,13 @@ class ILI9486(Area, Chip):
self.driver.cmd(0x11, None)
#self.driver.cmd(250, None)
self.driver.cmd(0x3a, None)
self.driver.data(0x55, None)
self.driver.cmd(0x36, None)
self.driver.data(0x28, None)
self.driver.cmd(0xc2, None)
self.driver.data(0x44, None)
@ -67,7 +71,7 @@ class ILI9486(Area, Chip):
self.driver.data(0x0D, None)
self.driver.data(0x00, None)
self.driver.cmd(0x10000e1, None)
self.driver.cmd(0xe1, None)
self.driver.data(0x0F, None)
self.driver.data(0x32, None)
self.driver.data(0x2E, None)
@ -84,7 +88,7 @@ class ILI9486(Area, Chip):
self.driver.data(0x20, None)
self.driver.data(0x00, None)
self.driver.cmd(0x10000e2, None)
self.driver.cmd(0xe2, None)
self.driver.data(0x0F, None)
self.driver.data(0x32, None)
self.driver.data(0x2E, None)
@ -117,6 +121,3 @@ class ILI9486(Area, Chip):
self.driver.data(pos_y2 >> 8, None)
self.driver.data(pos_y2 & 0xff, None)
self.driver.cmd(0x2c, None)
# for _ in range(0, pos_x1*pos_y1):
# self.driver.data(0xf00ff, None)