First commit -> 2025-01-25 15:26:36
This commit is contained in:
parent
183025389f
commit
107de17159
11 changed files with 930 additions and 0 deletions
42
display/display.py
Normal file
42
display/display.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This part of the code exposes functions to interface with the eink display
|
||||
"""
|
||||
|
||||
import display.epd2in13_V4 as eink
|
||||
from PIL import Image
|
||||
import logging
|
||||
|
||||
|
||||
class DisplayHelper:
|
||||
|
||||
def __init__(self, width, height):
|
||||
# Initialise the display
|
||||
self.logger = logging.getLogger('raspagenda')
|
||||
self.screenwidth = width
|
||||
self.screenheight = height
|
||||
self.epd = eink.EPD()
|
||||
self.epd.Init()
|
||||
|
||||
def update(self, img):
|
||||
# Updates the display with the grayscale and red images
|
||||
# start displaying on eink display
|
||||
# self.epd.clear()
|
||||
self.epd.display(mg)
|
||||
self.logger.info('E-Ink display update complete.')
|
||||
|
||||
def calibrate(self, cycles=1):
|
||||
# Calibrates the display to prevent ghosting
|
||||
white = Image.new('1', (self.screenwidth, self.screenheight), 'white')
|
||||
black = Image.new('1', (self.screenwidth, self.screenheight), 'black')
|
||||
for _ in range(cycles):
|
||||
self.epd.display(black, white)
|
||||
self.epd.display(white, black)
|
||||
self.epd.display(white, white)
|
||||
self.logger.info('E-Ink display calibration complete.')
|
||||
|
||||
def sleep(self):
|
||||
# send E-Ink display to deep sleep
|
||||
self.epd.EPD_Sleep()
|
||||
self.logger.info('E-Ink display entered deep sleep.')
|
Loading…
Add table
Add a link
Reference in a new issue