2022-04-02 01:30:17 +02:00
|
|
|
#!python3
|
2020-06-18 16:21:53 +02:00
|
|
|
"""
|
|
|
|
9.7" driver class
|
2023-06-03 16:16:07 +02:00
|
|
|
Copyright by aceinnolab
|
2020-06-18 16:21:53 +02:00
|
|
|
"""
|
2022-04-14 06:38:22 +02:00
|
|
|
from subprocess import run
|
|
|
|
from inkycal.custom import image_folder, top_level
|
2020-12-07 11:36:01 +01:00
|
|
|
from os.path import exists
|
2020-06-18 16:21:53 +02:00
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
# Display resolution
|
2022-04-02 01:30:17 +02:00
|
|
|
EPD_WIDTH = 1200
|
|
|
|
EPD_HEIGHT = 825
|
2020-06-18 16:21:53 +02:00
|
|
|
|
2022-04-14 06:38:22 +02:00
|
|
|
# Please insert VCOM of your display. The Minus sign before is not required
|
|
|
|
VCOM = "2.0"
|
|
|
|
|
|
|
|
driver_dir = top_level + '/inkycal/display/drivers/parallel_drivers/'
|
|
|
|
|
|
|
|
command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}'
|
2020-06-18 16:21:53 +02:00
|
|
|
|
|
|
|
|
2022-04-02 01:30:17 +02:00
|
|
|
class EPD:
|
2020-06-18 16:21:53 +02:00
|
|
|
|
2022-04-02 01:30:17 +02:00
|
|
|
def __init__(self):
|
|
|
|
"""9.7" epaper class"""
|
2022-04-14 06:38:22 +02:00
|
|
|
pass
|
2022-04-02 01:30:17 +02:00
|
|
|
|
|
|
|
def init(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def display(self, command):
|
|
|
|
"""displays an image"""
|
|
|
|
try:
|
|
|
|
run_command = command.split()
|
|
|
|
run(run_command)
|
|
|
|
except:
|
|
|
|
print("oops, something didn't work right :/")
|
|
|
|
|
|
|
|
def getbuffer(self, image):
|
|
|
|
"""ad-hoc"""
|
|
|
|
image = image.rotate(90, expand=True)
|
2022-04-14 06:38:22 +02:00
|
|
|
image.convert('RGB').save(image_folder + 'canvas.bmp', 'BMP')
|
|
|
|
command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}'
|
|
|
|
print(command)
|
2022-04-02 01:30:17 +02:00
|
|
|
return command
|
|
|
|
|
|
|
|
def sleep(self):
|
|
|
|
pass
|