| 4 - Demo Source Code
disp.lcd_clear(WHITE)
image = Image.open('./visionfive.bmp')
disp.lcd_ShowImage(image, 0, 0)
time.sleep(2)
#Add the part of displaying pictures circularly.
while
True:
print(time.strftime("%Y-%m-%d
#Rotate the picture by 90 degrees (anticlockwise).
#To keep consistent with the display direction of other pictures.
image = Image.open('./LCD_2inch4_parrot.bmp')
image = image.transpose(Image.Transpose.ROTATE_90)
disp.lcd_ShowImage(image, 0, 0)
image = Image.open('./LCD_2inch.jpg')
disp.lcd_ShowImage(image, 0, 0)
if
__name__=="__main__":
main()
LCD2inch4_lib.py:
import
os
import
sys
import
time
import
logging
import
VisionFive.spi
as
import
VisionFive.gpio
import
as
numpy
np
from
PIL
import
Image,ImageDraw,ImageFont
class
LCD_2inch4():
width = 240
height = 320
def
__init__(self, rst_pin, dc_pin, dev):
self.rstpin = rst_pin
self.dcpin = dc_pin
self.spidev = dev
spi.getdev(self.spidev)
#Reset the maximum clock frequency of communication.
#The display speed of the picture is positively correlated with the clock frequency.
spi.setmode(40000000, 0, 8)
gpio.setup(self.rstpin, gpio.OUT)
gpio.setup(self.dcpin, gpio.OUT)
def
__del__(self):
spi.freedev()
www.starfivetech.com
%H:%M:%S",time.localtime(time.time())))
spi
as
gpio
© 2018-2022 上海赛昉科技有限公司
版权所有
16
Need help?
Do you have a question about the VisionFive SPI and is the answer not in the manual?