Unify all Python trees for both RPi and Jetson Nano, Py2 and Py3
* Move lib files into waveshare_epd package
* Use int() where integer division is needed
* Use logging (debug level) in library files, so they can be used by a
user script without print()s being output
* Use logging (info level) in example files
* Move Font.ttc file into pic directory
* epdconfig.py: Detect RPi or Jetson Nano
* Search for sysfs_software_spi.so in several places
* Include both Jetson and RPi readme files
* Include setup.py for package installation
* Fix few small syntax errors preventing setuptools byte-compiling
This commit is contained in:
parent
0c77852dae
commit
d0918826de
337 changed files with 1009 additions and 19168 deletions
|
|
@ -1,72 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
import sys
|
||||
sys.path.append(r'../lib')
|
||||
|
||||
import epd1in54c
|
||||
import epdconfig
|
||||
import time
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
import traceback
|
||||
|
||||
try:
|
||||
print("epd1in54c Demo")
|
||||
|
||||
epd = epd1in54c.EPD()
|
||||
print("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
time.sleep(1)
|
||||
|
||||
# Drawing on the image
|
||||
print("1.Drawing on the image...")
|
||||
blackimage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
yellowimage = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
|
||||
font = ImageFont.truetype('../lib/Font.ttc', 24)
|
||||
font18 = ImageFont.truetype('../lib/Font.ttc', 18)
|
||||
|
||||
drawblack = ImageDraw.Draw(blackimage)
|
||||
drawyellow = ImageDraw.Draw(yellowimage)
|
||||
drawblack.rectangle((0, 10, 200, 34), fill = 0)
|
||||
drawblack.text((8, 12), 'hello world', font = font, fill = 255)
|
||||
drawblack.text((8, 36), u'微雪电子', font = font, fill = 0)
|
||||
drawblack.line((10, 100, 70, 100), fill = 0)
|
||||
drawblack.line((40, 70, 40, 130), fill = 0)
|
||||
|
||||
drawyellow.rectangle((10, 70, 70, 130), outline = 0)
|
||||
drawyellow.arc((80, 70, 140, 130), 0, 360, fill = 0)
|
||||
drawyellow.chord((90, 80, 130, 120), 0, 360, fill = 0)
|
||||
epd.display(epd.getbuffer(blackimage),epd.getbuffer(yellowimage))
|
||||
time.sleep(1)
|
||||
|
||||
# read bmp file
|
||||
print("2.read bmp file...")
|
||||
blackimage = Image.open('../pic/1in54c-b.bmp')
|
||||
yellowimage = Image.open('../pic/1in54c-y.bmp')
|
||||
epd.display(epd.getbuffer(blackimage),epd.getbuffer(yellowimage))
|
||||
time.sleep(1)
|
||||
|
||||
# read bmp file on window
|
||||
print("3.read bmp file on window...")
|
||||
blackimage1 = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
yellowimage2 = Image.new('1', (epd.width, epd.height), 255)
|
||||
|
||||
newimage = Image.open('../pic/100x100.bmp')
|
||||
blackimage1.paste(newimage, (50,50))
|
||||
epd.display(epd.getbuffer(blackimage1), epd.getbuffer(yellowimage2))
|
||||
|
||||
print("Clear...")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
||||
print("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
except IOError as e:
|
||||
print(e)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("ctrl + c:")
|
||||
epdconfig.module_exit()
|
||||
exit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue