From 1138f2d8626b86a1c5a8643deb18393ac15c3b93 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 13 Dec 2023 13:14:59 +0100 Subject: [PATCH 01/24] add parameter for dithering --- inkycal/modules/inkycal_image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inkycal/modules/inkycal_image.py b/inkycal/modules/inkycal_image.py index 37b4a1a..da246e4 100755 --- a/inkycal/modules/inkycal_image.py +++ b/inkycal/modules/inkycal_image.py @@ -63,6 +63,9 @@ class Inkyimage(inkycal_module): self.palette = config['palette'] self.autoflip = config['autoflip'] self.orientation = config['orientation'] + self.dither = True + if 'dither' in config and config["dither"] == False: + self.dither = False # give an OK message print(f'{__name__} loaded') @@ -94,7 +97,7 @@ class Inkyimage(inkycal_module): im.resize(width=im_width, height=im_height) # convert images according to specified palette - im_black, im_colour = im.to_palette(self.palette) + im_black, im_colour = im.to_palette(self.palette, self.dither) # with the images now send, clear the current image im.clear() From a7e2a852e99d4d03c7f4a470f62e901699918810 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 14 Dec 2023 01:51:10 +0100 Subject: [PATCH 02/24] Implement 16 grayscale support for image module --- docsource/inkycal.rst | 17 ----------------- inkycal/custom/functions.py | 5 +++-- inkycal/display/display.py | 16 +++++++++++++--- inkycal/modules/inky_image.py | 8 +++++++- tests/test_inkycal_image.py | 6 +++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docsource/inkycal.rst b/docsource/inkycal.rst index caacd6e..4ab9037 100644 --- a/docsource/inkycal.rst +++ b/docsource/inkycal.rst @@ -13,23 +13,6 @@ Display :members: -Modules -=========================== -- Agenda - -.. automodule:: inkycal.modules.inkycal_agenda.Agenda - :members: - -- Calendar - -.. automodule:: inkycal.modules.inkycal_calendar.Calendar - :members: - -- Feeds Module (RSS & Atom) -.. automodule:: inkycal.modules.inkycal_feeds.Feeds - :members: - - Custom functions =========================== .. automodule:: inkycal.custom.functions diff --git a/inkycal/custom/functions.py b/inkycal/custom/functions.py index ac1e24d..8eddd4e 100644 --- a/inkycal/custom/functions.py +++ b/inkycal/custom/functions.py @@ -8,6 +8,7 @@ import os import time import traceback +import PIL import requests from PIL import ImageFont, ImageDraw, Image @@ -335,10 +336,10 @@ def draw_border(image, xy, size, radius=5, thickness=1, shrinkage=(0.1, 0.1)): draw.arc((c7, c8), 90, 180, fill=colour, width=thickness) -def draw_border_2(im: Image, xy: tuple, size: tuple, radius: int): +def draw_border_2(im: PIL.Image, xy: tuple, size: tuple, radius: int): draw = ImageDraw.Draw(im) x, y = xy w, h = size - draw.rounded_rectangle(xy=(x, y, x + w, y + h), outline="black", radius=radius) \ No newline at end of file + draw.rounded_rectangle(xy=(x, y, x + w, y + h), outline="black", radius=radius) diff --git a/inkycal/display/display.py b/inkycal/display/display.py index a0a0122..e9fd834 100644 --- a/inkycal/display/display.py +++ b/inkycal/display/display.py @@ -2,18 +2,21 @@ Inkycal ePaper driving functions Copyright by aceisace """ -import os import logging +import os import traceback from importlib import import_module + +import PIL from PIL import Image from inkycal.custom import top_level -import glob + def import_driver(model): return import_module(f'inkycal.display.drivers.{model}') + class Display: """Display class for inkycal @@ -44,7 +47,14 @@ class Display: except FileNotFoundError: raise Exception('SPI could not be found. Please check if SPI is enabled') - def render(self, im_black: Image, im_colour:Image or None=None) -> None: + + def test(self) -> None: + """Test the display by showing a test image""" + # TODO implement test image + raise NotImplementedError("Devs were too lazy again, sorry, please try again later") + + + def render(self, im_black: PIL.Image, im_colour: PIL.Image or None) -> None: """Renders an image on the selected E-Paper display. Initlializes the E-Paper display, sends image data and executes command diff --git a/inkycal/modules/inky_image.py b/inkycal/modules/inky_image.py index 70ca8fc..785f6d6 100755 --- a/inkycal/modules/inky_image.py +++ b/inkycal/modules/inky_image.py @@ -10,6 +10,8 @@ Copyright by aceinnolab """ import logging import os + +import PIL import numpy import requests @@ -215,7 +217,7 @@ class Inkyimage: return image1 - def to_palette(self, palette, dither=True) -> (Image, Image): + def to_palette(self, palette, dither=True) -> (PIL.Image, PIL.Image): """Maps an image to a given colour palette. Maps each pixel from the image to a colour from the palette. @@ -235,6 +237,7 @@ class Inkyimage: >>> 'bwr' # black-white-red >>> 'bwy' # black-white-yellow >>> 'bw' # black-white + >>> '16gray' # 16 shades of gray """ # Check if an image is loaded if self._image_loaded(): @@ -252,6 +255,9 @@ class Inkyimage: elif palette == 'bw': pal = None + elif palette == '16gray': + pal = [x for x in range(0, 256, 16)] * 3 + pal.sort() else: logger.error('The given palette is unsupported.') diff --git a/tests/test_inkycal_image.py b/tests/test_inkycal_image.py index 4ee3e49..fa5289b 100755 --- a/tests/test_inkycal_image.py +++ b/tests/test_inkycal_image.py @@ -14,7 +14,7 @@ from tests import Config preview = Inkyimage.preview merge = Inkyimage.merge -url = "https://github.com/aceinnolab/Inkycal/raw/assets/Repo/coffee.png" +url ="https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/mark-harpur-unsplash.jpg" im = Image.open(requests.get(url, stream=True).raw) im.save("test.png", "PNG") @@ -27,9 +27,9 @@ tests = [ { "name": "Inkyimage", "config": { - "size": [400, 200], + "size": [800, 600], "path": test_path, - "palette": "bwr", + "palette": "16gray", "autoflip": True, "orientation": "vertical", "padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en" From b78a3f9708bafb7832bcee69df9bb4be30a3fafb Mon Sep 17 00:00:00 2001 From: mygrexit Date: Thu, 14 Dec 2023 22:19:30 +0100 Subject: [PATCH 03/24] make calibration optional this should work with the newly added option to not add any calibration hours. --- inkycal/main.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/inkycal/main.py b/inkycal/main.py index b97e913..a2145b1 100644 --- a/inkycal/main.py +++ b/inkycal/main.py @@ -98,6 +98,8 @@ class Inkycal: except FileNotFoundError: raise SettingsFileNotFoundError + self.disable_calibration = self.settings.get('disable_calibration', False) + if not os.path.exists(image_folder): os.mkdir(image_folder) @@ -541,11 +543,16 @@ class Inkycal: def _calibration_check(self): """Calibration scheduler - uses calibration hours from settings file to check if calibration is due""" + uses calibration hours from settings file to check if calibration is due. + If no calibration hours are set, calibration is skipped.""" + + # Check if calibration hours are not set or the list is empty + if not self._calibration_hours: + print("No calibration hours set. Skipping calibration.") + return + now = arrow.now() - # print('hour:', now.hour, 'hours:', self._calibration_hours) - # print('state:', self._calibration_state) - if now.hour in self._calibration_hours and self._calibration_state == False: + if now.hour in self._calibration_hours and not self._calibration_state: self.calibrate() self._calibration_state = True else: From bbfdc7d13a42c04278147a1826a9a7df83322d30 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 14 Dec 2023 21:27:29 +0000 Subject: [PATCH 04/24] update docs [bot] --- docs/_sources/inkycal.rst.txt | 17 ----------------- docs/about.html | 1 - docs/dev_doc.html | 1 - docs/genindex.html | 32 ++------------------------------ docs/index.html | 2 -- docs/inkycal.html | 20 +------------------- docs/objects.inv | Bin 663 -> 632 bytes docs/py-modindex.html | 16 ---------------- docs/quickstart.html | 1 - docs/search.html | 1 - docs/searchindex.js | 2 +- 11 files changed, 4 insertions(+), 89 deletions(-) diff --git a/docs/_sources/inkycal.rst.txt b/docs/_sources/inkycal.rst.txt index caacd6e..4ab9037 100644 --- a/docs/_sources/inkycal.rst.txt +++ b/docs/_sources/inkycal.rst.txt @@ -13,23 +13,6 @@ Display :members: -Modules -=========================== -- Agenda - -.. automodule:: inkycal.modules.inkycal_agenda.Agenda - :members: - -- Calendar - -.. automodule:: inkycal.modules.inkycal_calendar.Calendar - :members: - -- Feeds Module (RSS & Atom) -.. automodule:: inkycal.modules.inkycal_feeds.Feeds - :members: - - Custom functions =========================== .. automodule:: inkycal.custom.functions diff --git a/docs/about.html b/docs/about.html index 71bc234..1fcec64 100644 --- a/docs/about.html +++ b/docs/about.html @@ -49,7 +49,6 @@ - diff --git a/docs/index.html b/docs/index.html index a193902..64f9fc7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -48,7 +48,6 @@
  • Display
  • -
  • Modules
  • Custom functions
    • auto_fontsize()
    • draw_border()
    • diff --git a/docs/inkycal.html b/docs/inkycal.html index b7cee3a..466ee2e 100644 --- a/docs/inkycal.html +++ b/docs/inkycal.html @@ -58,7 +58,6 @@
  • Display
  • -
  • Modules
  • Custom functions
    • auto_fontsize()
    • draw_border()
    • @@ -195,24 +194,6 @@ rendering images and calibrating the E-Paper display

      -
      -

      Modules

      -
        -
      • Agenda

      • -
      -

      Agenda class -Create agenda and show events from given icalendars

      -
        -
      • Calendar

      • -
      -

      Calendar class -Create monthly calendar and show events from given icalendars

      -
        -
      • Feeds Module (RSS & Atom)

      • -
      -

      RSS class -parses rss/atom feeds from given urls

      -

      Custom functions

      Inkycal custom-functions for ease-of-use

      @@ -567,6 +548,7 @@ white pixels.

      >>> 'bwr' # black-white-red
       >>> 'bwy' # black-white-yellow
       >>> 'bw'  # black-white
      +>>> '16gray' # 16 shades of gray
       
      diff --git a/docs/objects.inv b/docs/objects.inv index 8624dd03c4d1177b1468bd6f3b5f44616f6cbc94..97338b16590beb2fa0ac7ba3a2b019e554eb5ea3 100644 GIT binary patch delta 522 zcmV+l0`>iu1^5Jzd4Jn549D+&3Ip3U#(M2-ST8*c=&%P67>kaD>T42Z*M0iQmh)k( zOC3jtAQ8#`&lE#i68d$hK~{C}WK`7zU6U}{mv(qmh6jn|w^GbOEh+gWS$AK{T_OG> zt{{+MjnU-AJC3NMt9)3(u2Q&zp6!j}=r%JBNGXxK2!8N{iht4jW{S{+PDd1UASCSN z_OcMZ5$he;&4k_wTK#-3yp=FiPwD%n#!w*i&4TJVEkUx^udijgXj)7@W+(@~!DJR?i!EYs1Gi6ABKv zt=~`bY3NR%_3i!vU^?6yDeTs*T%e|I&%nu)&e%H{FbdrPGjOcKPGFyb7ye4B*veu8q89<53HJpL@sVKaXbkxuRZSTm5cR7kaEs!etx5Uov@U#{*ScLkDcMr!@8o}p Me{S&?CkkC{+# zz_fZl$%m#pf!3G%7l7e#tE8w?moh^Q)xH5|qi{m)Y=BW{54ZuRw%7{nHXvD4rbPy_ zKEfur>0Waq$lsD`-yK8=u+UVoa##Ee|EoB#Hx1>E z_yad(zPrx{!{C-b4s+w7nQ?4c@R|9Jrs)0Tw<~FCe?WRuqx{wd;ewO-3<=HgeGvNl z7s?==tWo>{~mYgGO|jWg%>qw=`?QnW?aKXLxW7hd)Wk9}=b6B-&l diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 4ce183d..4c8bc79 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -49,7 +49,6 @@
      • Inkycal
      • Display
      • -
      • Modules
      • Custom functions
      • Helper classes
      • About Inkycal
      • @@ -122,21 +121,6 @@     inkycal.modules.inky_image - - -     - inkycal.modules.inkycal_agenda.Agenda - - - -     - inkycal.modules.inkycal_calendar.Calendar - - - -     - inkycal.modules.inkycal_feeds.Feeds - diff --git a/docs/quickstart.html b/docs/quickstart.html index 8b84d6e..806b1ee 100644 --- a/docs/quickstart.html +++ b/docs/quickstart.html @@ -49,7 +49,6 @@
        • Inkycal
        • Display
        • -
        • Modules
        • Custom functions
        • Helper classes
        • About Inkycal
        • diff --git a/docs/search.html b/docs/search.html index 5a4105f..adf6312 100644 --- a/docs/search.html +++ b/docs/search.html @@ -49,7 +49,6 @@
          • Inkycal
          • Display
          • -
          • Modules
          • Custom functions
          • Helper classes
          • About Inkycal
          • diff --git a/docs/searchindex.js b/docs/searchindex.js index e254054..4fe3887 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["about", "dev_doc", "index", "inkycal", "quickstart"], "filenames": ["about.md", "dev_doc.md", "index.rst", "inkycal.rst", "quickstart.md"], "titles": ["About Inkycal", "Developer documentation", "Inkycal documentation", "Inkycal", "Quickstart"], "terms": {"i": [0, 1, 3], "python3": [0, 3], "softwar": 0, "select": [0, 3], "e": [0, 3, 4], "paper": [0, 3], "displai": [0, 2], "It": 0, "": [0, 3], "open": 0, "sourc": 0, "non": [0, 3], "commerci": 0, "fulli": 0, "modular": 0, "user": 0, "friendli": 0, "even": 0, "run": [0, 3], "well": 0, "raspberri": [0, 4], "pi": [0, 3, 4], "zero": 0, "ha": [0, 3], "web": [0, 4], "ui": [0, 4], "which": [0, 3], "take": [0, 3], "care": [0, 3], "ad": 0, "your": [0, 3, 4], "detail": 0, "No": 0, "more": [0, 3, 4], "edit": 0, "file": [0, 2, 3], "yai": 0, "parti": [0, 1], "_": 0, "face": 0, "The": [0, 3], "main": [0, 3], "idea": 0, "behind": 0, "wa": [0, 3], "creat": [0, 1, 2, 3], "dashboard": 0, "blend": 0, "its": 0, "environ": 0, "show": [0, 3], "you": 0, "all": [0, 3], "inform": 0, "without": [0, 3], "have": [0, 3], "look": [0, 3], "them": [0, 3], "up": 0, "sever": 0, "built": 0, "modul": [0, 1, 2], "help": 0, "stai": 0, "organis": 0, "provid": 0, "weather": 0, "forecast": 0, "full": [0, 3], "week": 0, "next": [0, 3], "few": 0, "hour": 0, "get": [0, 3], "latest": [0, 3], "new": [0, 3], "from": [0, 3], "atom": [0, 3], "rss": [0, 3], "feed": [0, 3], "icalendar": [0, 2, 3], "agenda": [0, 3], "mai": 0, "synchronis": 0, "phone": 0, "monthli": [0, 3], "calendar": [0, 3], "also": 0, "event": [0, 3], "sync": 0, "googl": [0, 3], "etc": 0, "fetch": 0, "some": 0, "joke": 0, "form": 0, "smile": 0, "what": 0, "compat": 0, "third": [0, 1], "someth": [0, 3], "miss": 0, "can": [0, 3], "write": [0, 2, 3], "own": 0, "share": 0, "commun": 0, "discord": 0, "case": 0, "re": 0, "pinch": 0, "set": [0, 2, 3], "noob": 0, "welcom": 0, "too": 0, "cours": 0, "develop": [0, 2], "mainli": [0, 1], "aceisac": 0, "univers": 0, "student": 0, "other": [0, 3], "free": 0, "time": [0, 3], "mean": 0, "we": 0, "work": [0, 3], "noth": 0, "doesn": [0, 3], "t": [0, 3], "don": 0, "need": 0, "anyth": 0, "invest": 0, "larg": 0, "amount": 0, "effort": 0, "coffe": 0, "pleas": [0, 4], "support": [0, 3], "via": [0, 4], "donat": 0, "u": 0, "keep": 0, "thi": [0, 1, 3], "project": [0, 3], "aliv": 0, "thank": 0, "who": 1, "wish": 1, "custom": 2, "function": 2, "auto_fonts": [2, 3], "draw_bord": [2, 3], "get_font": [2, 3], "get_system_tz": [2, 3], "internet_avail": [2, 3], "text_wrap": [2, 3], "helper": 2, "class": 2, "inkyimag": [2, 3], "about": 2, "quickstart": 2, "instal": 2, "index": 2, "search": [2, 3], "page": 2, "copyright": 3, "aceinnolab": [3, 4], "settings_path": 3, "str": 3, "none": 3, "render": 3, "bool": 3, "true": 3, "test": 3, "program": 3, "arg": 3, "path": 3, "json": 3, "given": 3, "tri": 3, "boot": 3, "folder": [3, 4], "fals": 3, "imag": 3, "epap": 3, "attribut": 3, "optim": 3, "reduc": 3, "number": 3, "colour": 3, "gener": [3, 4], "improv": 3, "9": 3, "7": 3, "calibr": 3, "us": 3, "default": 3, "3": 3, "cycl": 3, "after": 3, "refresh": 3, "shown": 3, "countdown": 3, "interval_min": 3, "return": 3, "remain": 3, "second": 3, "until": 3, "updat": 3, "async": 3, "nonstop": 3, "mode": 3, "an": 3, "infin": 3, "loop": 3, "assembl": 3, "one": 3, "sleep": 3, "schedul": 3, "issu": 3, "attempt": 3, "import": 3, "name": 3, "load": 3, "config": 3, "each": 3, "initi": 3, "check": 3, "could": 3, "correctli": 3, "found": 3, "instanc": 3, "driver": 3, "model": 3, "allow": 3, "epaper_model": 3, "pars": 3, "url": 3, "eas": 3, "font": 3, "max_height": 3, "scale": 3, "80": 3, "height": 3, "fill": 3, "A": 3, "pil": 3, "object": 3, "integ": 3, "repres": 3, "adjust": 3, "should": 3, "modifi": 3, "xy": 3, "size": 3, "radiu": 3, "5": 3, "thick": 3, "1": 3, "shrinkag": 3, "0": 3, "draw": 3, "border": 3, "coordin": 3, "drawn": 3, "usual": 3, "im_black": 3, "im_colour": 3, "tupl": 3, "top": 3, "left": 3, "corner": 3, "g": 3, "32": 3, "100": 3, "where": 3, "x": 3, "co": 3, "ordin": 3, "y": 3, "width": 3, "plain": 3, "rectangl": 3, "round": 3, "pixel": 3, "contain": 3, "decim": 3, "present": 3, "percentag": 3, "shrink": 3, "width_shrink_percentag": 3, "height_shrink_percentag": 3, "2": 3, "10": 3, "20": 3, "print": 3, "avail": 3, "output": 3, "To": 3, "access": 3, "fontfil": 3, "dictionari": 3, "fontnam": 3, "follow": 3, "sytax": 3, "imagefont": 3, "truetyp": 3, "system": 3, "timezon": 3, "extract": 3, "local": 3, "instead": 3, "utc": 3, "arrow": 3, "now": 3, "awar": 3, "tz": 3, "internet": 3, "connect": 3, "com": [3, 4], "timeout": 3, "network": 3, "reach": 3, "establish": 3, "add": 3, "do": 3, "requir": 3, "text": 3, "max_width": 3, "split": 3, "veri": 3, "long": 3, "smaller": 3, "part": 3, "line": 3, "fit": 3, "accur": 3, "calcul": 3, "string": 3, "int": 3, "defin": 3, "maximum": 3, "befor": 3, "chunk": 3, "list": 3, "box_siz": 3, "kwarg": 3, "posit": 3, "specifi": 3, "box": 3, "actual": 3, "option": 3, "align": 3, "center": 3, "right": 3, "autofit": 3, "automat": 3, "increas": 3, "fontsiz": 3, "much": 3, "possibl": 3, "black": 3, "chang": 3, "caus": 3, "rotat": 3, "angl": 3, "anti": 3, "clockwis": 3, "fill_width": 3, "90": 3, "fill_height": 3, "ical_pars": 3, "moudul": 3, "static": 3, "all_dai": 3, "dai": 3, "els": 3, "clear_ev": 3, "clear": 3, "previous": 3, "get_ev": 3, "timeline_start": 3, "timeline_end": 3, "input": 3, "begin": 3, "timelin": 3, "end": 3, "format": 3, "sort": 3, "date": 3, "load_from_fil": 3, "filepath": 3, "valid": 3, "exampl": 3, "path1": 3, "singl": 3, "OR": 3, "path2": 3, "multipl": 3, "raw": 3, "load_url": 3, "usernam": 3, "password": 3, "url1": 3, "url2": 3, "protect": 3, "show_ev": 3, "fmt": 3, "dd": 3, "mmm": 3, "yy": 3, "hh": 3, "mm": 3, "readabl": 3, "wai": 3, "paramet": 3, "see": 3, "http": [3, 4], "readthedoc": 3, "io": 3, "en": 3, "token": 3, "info": 3, "order": 3, "handl": 3, "made": 3, "inky_imag": 3, "imga": 3, "written": 3, "commonli": 3, "oper": 3, "autoflip": 3, "layout": 3, "flip": 3, "choos": 3, "horizont": 3, "vertic": 3, "In": 3, "greater": 3, "than": 3, "remov": 3, "current": 3, "save": 3, "180": 3, "270": 3, "360": 3, "sampl": 3, "logo": 3, "png": 3, "home": 3, "download": [3, 4], "nice_p": 3, "rais": 3, "filenotfounderror": 3, "except": 3, "when": 3, "oserror": 3, "point": 3, "correct": 3, "typeerror": 3, "start": 3, "htpp": 3, "merg": 3, "image1": 3, "image2": 3, "two": 3, "replac": 3, "white": 3, "first": 3, "transpar": 3, "ones": 3, "Then": 3, "past": 3, "rgba": 3, "preview": 3, "gpicview": 3, "onli": 3, "rapsbian": 3, "desktop": 3, "remove_alpha": 3, "alpha": 3, "band": 3, "resiz": 3, "desir": 3, "to_palett": 3, "palett": 3, "dither": 3, "runner": 3, "venv": 3, "lib": 3, "11": 3, "site": 3, "packag": 3, "py": 3, "map": 3, "below": 3, "solid": 3, "valueerror": 3, "bwr": 3, "red": 3, "bwy": 3, "yellow": 3, "bw": 3, "directli": 4, "github": 4, "repo": 4, "clone": 4, "git": 4, "go": 4, "cd": 4, "pip3": 4, "navig": 4, "copi": 4, "come": 4, "soon": 4}, "objects": {"inkycal.custom": [[3, 0, 0, "-", "functions"]], "inkycal.custom.functions": [[3, 1, 1, "", "auto_fontsize"], [3, 1, 1, "", "draw_border"], [3, 1, 1, "", "get_fonts"], [3, 1, 1, "", "get_system_tz"], [3, 1, 1, "", "internet_available"], [3, 1, 1, "", "text_wrap"], [3, 1, 1, "", "write"]], "inkycal.display": [[3, 0, 0, "-", "Display"]], "inkycal": [[3, 0, 0, "-", "main"]], "inkycal.main": [[3, 2, 1, "", "Inkycal"]], "inkycal.main.Inkycal": [[3, 3, 1, "", "calibrate"], [3, 3, 1, "", "countdown"], [3, 3, 1, "", "run"], [3, 3, 1, "", "test"]], "inkycal.modules": [[3, 0, 0, "-", "ical_parser"], [3, 0, 0, "-", "inky_image"]], "inkycal.modules.ical_parser": [[3, 2, 1, "", "iCalendar"]], "inkycal.modules.ical_parser.iCalendar": [[3, 3, 1, "", "all_day"], [3, 3, 1, "", "clear_events"], [3, 3, 1, "", "get_events"], [3, 3, 1, "", "get_system_tz"], [3, 3, 1, "", "load_from_file"], [3, 3, 1, "", "load_url"], [3, 3, 1, "", "show_events"], [3, 3, 1, "", "sort"]], "inkycal.modules.inky_image": [[3, 2, 1, "", "Inkyimage"]], "inkycal.modules.inky_image.Inkyimage": [[3, 3, 1, "", "autoflip"], [3, 3, 1, "", "clear"], [3, 3, 1, "", "flip"], [3, 3, 1, "", "load"], [3, 3, 1, "", "merge"], [3, 3, 1, "", "preview"], [3, 3, 1, "", "remove_alpha"], [3, 3, 1, "", "resize"], [3, 3, 1, "", "to_palette"]], "inkycal.modules.inkycal_agenda": [[3, 0, 0, "-", "Agenda"]], "inkycal.modules.inkycal_calendar": [[3, 0, 0, "-", "Calendar"]], "inkycal.modules.inkycal_feeds": [[3, 0, 0, "-", "Feeds"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"]}, "titleterms": {"about": 0, "inkyc": [0, 2, 3, 4], "develop": 1, "document": [1, 2], "content": 2, "indic": 2, "tabl": 2, "displai": 3, "modul": 3, "custom": 3, "function": 3, "helper": 3, "class": 3, "quickstart": 4, "instal": 4, "creat": 4, "set": 4, "file": 4}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"About Inkycal": [[0, "about-inkycal"]], "Developer documentation": [[1, "developer-documentation"]], "Inkycal documentation": [[2, "inkycal-documentation"]], "Contents:": [[2, null]], "Indices and tables": [[2, "indices-and-tables"]], "Inkycal": [[3, "module-inkycal.main"]], "Display": [[3, "module-inkycal.display.Display"]], "Modules": [[3, "modules"]], "Custom functions": [[3, "module-inkycal.custom.functions"]], "Helper classes": [[3, "module-inkycal.modules.ical_parser"]], "Quickstart": [[4, "quickstart"]], "Installing Inkycal": [[4, "installing-inkycal"]], "Creating settings file": [[4, "creating-settings-file"]]}, "indexentries": {"inkycal (class in inkycal.main)": [[3, "inkycal.main.Inkycal"]], "inkyimage (class in inkycal.modules.inky_image)": [[3, "inkycal.modules.inky_image.Inkyimage"]], "all_day() (inkycal.modules.ical_parser.icalendar static method)": [[3, "inkycal.modules.ical_parser.iCalendar.all_day"]], "auto_fontsize() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.auto_fontsize"]], "autoflip() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.autoflip"]], "calibrate() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.calibrate"]], "clear() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.clear"]], "clear_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.clear_events"]], "countdown() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.countdown"]], "draw_border() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.draw_border"]], "flip() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.flip"]], "get_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.get_events"]], "get_fonts() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.get_fonts"]], "get_system_tz() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.get_system_tz"]], "get_system_tz() (inkycal.modules.ical_parser.icalendar static method)": [[3, "inkycal.modules.ical_parser.iCalendar.get_system_tz"]], "icalendar (class in inkycal.modules.ical_parser)": [[3, "inkycal.modules.ical_parser.iCalendar"]], "inkycal.custom.functions": [[3, "module-inkycal.custom.functions"]], "inkycal.display.display": [[3, "module-inkycal.display.Display"]], "inkycal.main": [[3, "module-inkycal.main"]], "inkycal.modules.ical_parser": [[3, "module-inkycal.modules.ical_parser"]], "inkycal.modules.inky_image": [[3, "module-inkycal.modules.inky_image"]], "inkycal.modules.inkycal_agenda.agenda": [[3, "module-inkycal.modules.inkycal_agenda.Agenda"]], "inkycal.modules.inkycal_calendar.calendar": [[3, "module-inkycal.modules.inkycal_calendar.Calendar"]], "inkycal.modules.inkycal_feeds.feeds": [[3, "module-inkycal.modules.inkycal_feeds.Feeds"]], "internet_available() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.internet_available"]], "load() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.load"]], "load_from_file() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.load_from_file"]], "load_url() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.load_url"]], "merge() (inkycal.modules.inky_image.inkyimage static method)": [[3, "inkycal.modules.inky_image.Inkyimage.merge"]], "module": [[3, "module-inkycal.custom.functions"], [3, "module-inkycal.display.Display"], [3, "module-inkycal.main"], [3, "module-inkycal.modules.ical_parser"], [3, "module-inkycal.modules.inky_image"], [3, "module-inkycal.modules.inkycal_agenda.Agenda"], [3, "module-inkycal.modules.inkycal_calendar.Calendar"], [3, "module-inkycal.modules.inkycal_feeds.Feeds"]], "preview() (inkycal.modules.inky_image.inkyimage static method)": [[3, "inkycal.modules.inky_image.Inkyimage.preview"]], "remove_alpha() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.remove_alpha"]], "resize() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.resize"]], "run() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.run"]], "show_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.show_events"]], "sort() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.sort"]], "test() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.test"]], "text_wrap() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.text_wrap"]], "to_palette() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.to_palette"]], "write() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.write"]]}}) \ No newline at end of file +Search.setIndex({"docnames": ["about", "dev_doc", "index", "inkycal", "quickstart"], "filenames": ["about.md", "dev_doc.md", "index.rst", "inkycal.rst", "quickstart.md"], "titles": ["About Inkycal", "Developer documentation", "Inkycal documentation", "Inkycal", "Quickstart"], "terms": {"i": [0, 1, 3], "python3": [0, 3], "softwar": 0, "select": [0, 3], "e": [0, 3, 4], "paper": [0, 3], "displai": [0, 2], "It": 0, "": [0, 3], "open": 0, "sourc": 0, "non": [0, 3], "commerci": 0, "fulli": 0, "modular": 0, "user": 0, "friendli": 0, "even": 0, "run": [0, 3], "well": 0, "raspberri": [0, 4], "pi": [0, 3, 4], "zero": 0, "ha": [0, 3], "web": [0, 4], "ui": [0, 4], "which": [0, 3], "take": [0, 3], "care": [0, 3], "ad": 0, "your": [0, 3, 4], "detail": 0, "No": 0, "more": [0, 3, 4], "edit": 0, "file": [0, 2, 3], "yai": 0, "parti": [0, 1], "_": 0, "face": 0, "The": [0, 3], "main": [0, 3], "idea": 0, "behind": 0, "wa": [0, 3], "creat": [0, 1, 2, 3], "dashboard": 0, "blend": 0, "its": 0, "environ": 0, "show": [0, 3], "you": 0, "all": [0, 3], "inform": 0, "without": [0, 3], "have": [0, 3], "look": [0, 3], "them": [0, 3], "up": 0, "sever": 0, "built": 0, "modul": [0, 1, 2, 3], "help": 0, "stai": 0, "organis": 0, "provid": 0, "weather": 0, "forecast": 0, "full": [0, 3], "week": 0, "next": [0, 3], "few": 0, "hour": 0, "get": [0, 3], "latest": [0, 3], "new": [0, 3], "from": [0, 3], "atom": 0, "rss": 0, "feed": 0, "icalendar": [0, 2, 3], "agenda": 0, "mai": 0, "synchronis": 0, "phone": 0, "monthli": 0, "calendar": 0, "also": 0, "event": [0, 3], "sync": 0, "googl": [0, 3], "etc": 0, "fetch": 0, "some": 0, "joke": 0, "form": 0, "smile": 0, "what": 0, "compat": 0, "third": [0, 1], "someth": [0, 3], "miss": 0, "can": [0, 3], "write": [0, 2, 3], "own": 0, "share": 0, "commun": 0, "discord": 0, "case": 0, "re": 0, "pinch": 0, "set": [0, 2, 3], "noob": 0, "welcom": 0, "too": 0, "cours": 0, "develop": [0, 2], "mainli": [0, 1], "aceisac": 0, "univers": 0, "student": 0, "other": [0, 3], "free": 0, "time": [0, 3], "mean": 0, "we": 0, "work": [0, 3], "noth": 0, "doesn": [0, 3], "t": [0, 3], "don": 0, "need": 0, "anyth": 0, "invest": 0, "larg": 0, "amount": 0, "effort": 0, "coffe": 0, "pleas": [0, 4], "support": [0, 3], "via": [0, 4], "donat": 0, "u": 0, "keep": 0, "thi": [0, 1, 3], "project": [0, 3], "aliv": 0, "thank": 0, "who": 1, "wish": 1, "custom": 2, "function": 2, "auto_fonts": [2, 3], "draw_bord": [2, 3], "get_font": [2, 3], "get_system_tz": [2, 3], "internet_avail": [2, 3], "text_wrap": [2, 3], "helper": 2, "class": 2, "inkyimag": [2, 3], "about": 2, "quickstart": 2, "instal": 2, "index": 2, "search": [2, 3], "page": 2, "copyright": 3, "aceinnolab": [3, 4], "settings_path": 3, "str": 3, "none": 3, "render": 3, "bool": 3, "true": 3, "test": 3, "program": 3, "arg": 3, "path": 3, "json": 3, "given": 3, "tri": 3, "boot": 3, "folder": [3, 4], "fals": 3, "imag": 3, "epap": 3, "attribut": 3, "optim": 3, "reduc": 3, "number": 3, "colour": 3, "gener": [3, 4], "improv": 3, "9": 3, "7": 3, "calibr": 3, "us": 3, "default": 3, "3": 3, "cycl": 3, "after": 3, "refresh": 3, "shown": 3, "countdown": 3, "interval_min": 3, "return": 3, "remain": 3, "second": 3, "until": 3, "updat": 3, "async": 3, "nonstop": 3, "mode": 3, "an": 3, "infin": 3, "loop": 3, "assembl": 3, "one": 3, "sleep": 3, "schedul": 3, "issu": 3, "attempt": 3, "import": 3, "name": 3, "load": 3, "config": 3, "each": 3, "initi": 3, "check": 3, "could": 3, "correctli": 3, "found": 3, "instanc": 3, "driver": 3, "model": 3, "allow": 3, "epaper_model": 3, "eas": 3, "font": 3, "max_height": 3, "scale": 3, "80": 3, "height": 3, "fill": 3, "A": 3, "pil": 3, "object": 3, "integ": 3, "repres": 3, "adjust": 3, "should": 3, "modifi": 3, "xy": 3, "size": 3, "radiu": 3, "5": 3, "thick": 3, "1": 3, "shrinkag": 3, "0": 3, "draw": 3, "border": 3, "coordin": 3, "drawn": 3, "usual": 3, "im_black": 3, "im_colour": 3, "tupl": 3, "top": 3, "left": 3, "corner": 3, "g": 3, "32": 3, "100": 3, "where": 3, "x": 3, "co": 3, "ordin": 3, "y": 3, "width": 3, "plain": 3, "rectangl": 3, "round": 3, "pixel": 3, "contain": 3, "decim": 3, "present": 3, "percentag": 3, "shrink": 3, "width_shrink_percentag": 3, "height_shrink_percentag": 3, "2": 3, "10": 3, "20": 3, "print": 3, "avail": 3, "output": 3, "To": 3, "access": 3, "fontfil": 3, "dictionari": 3, "fontnam": 3, "follow": 3, "sytax": 3, "imagefont": 3, "truetyp": 3, "system": 3, "timezon": 3, "extract": 3, "local": 3, "instead": 3, "utc": 3, "arrow": 3, "now": 3, "awar": 3, "tz": 3, "internet": 3, "connect": 3, "com": [3, 4], "timeout": 3, "network": 3, "reach": 3, "establish": 3, "add": 3, "do": 3, "requir": 3, "text": 3, "max_width": 3, "split": 3, "veri": 3, "long": 3, "smaller": 3, "part": 3, "line": 3, "fit": 3, "accur": 3, "calcul": 3, "string": 3, "int": 3, "defin": 3, "maximum": 3, "befor": 3, "chunk": 3, "list": 3, "box_siz": 3, "kwarg": 3, "posit": 3, "specifi": 3, "box": 3, "actual": 3, "option": 3, "align": 3, "center": 3, "right": 3, "autofit": 3, "automat": 3, "increas": 3, "fontsiz": 3, "much": 3, "possibl": 3, "black": 3, "chang": 3, "caus": 3, "rotat": 3, "angl": 3, "anti": 3, "clockwis": 3, "fill_width": 3, "90": 3, "fill_height": 3, "pars": 3, "ical_pars": 3, "moudul": 3, "url": 3, "static": 3, "all_dai": 3, "dai": 3, "els": 3, "clear_ev": 3, "clear": 3, "previous": 3, "get_ev": 3, "timeline_start": 3, "timeline_end": 3, "input": 3, "begin": 3, "timelin": 3, "end": 3, "format": 3, "sort": 3, "date": 3, "load_from_fil": 3, "filepath": 3, "valid": 3, "exampl": 3, "path1": 3, "singl": 3, "OR": 3, "path2": 3, "multipl": 3, "raw": 3, "load_url": 3, "usernam": 3, "password": 3, "url1": 3, "url2": 3, "protect": 3, "show_ev": 3, "fmt": 3, "dd": 3, "mmm": 3, "yy": 3, "hh": 3, "mm": 3, "readabl": 3, "wai": 3, "paramet": 3, "see": 3, "http": [3, 4], "readthedoc": 3, "io": 3, "en": 3, "token": 3, "info": 3, "order": 3, "handl": 3, "made": 3, "inky_imag": 3, "imga": 3, "written": 3, "commonli": 3, "oper": 3, "autoflip": 3, "layout": 3, "flip": 3, "choos": 3, "horizont": 3, "vertic": 3, "In": 3, "greater": 3, "than": 3, "remov": 3, "current": 3, "save": 3, "180": 3, "270": 3, "360": 3, "sampl": 3, "logo": 3, "png": 3, "home": 3, "download": [3, 4], "nice_p": 3, "rais": 3, "filenotfounderror": 3, "except": 3, "when": 3, "oserror": 3, "point": 3, "correct": 3, "typeerror": 3, "start": 3, "htpp": 3, "merg": 3, "image1": 3, "image2": 3, "two": 3, "replac": 3, "white": 3, "first": 3, "transpar": 3, "ones": 3, "Then": 3, "past": 3, "rgba": 3, "preview": 3, "gpicview": 3, "onli": 3, "rapsbian": 3, "desktop": 3, "remove_alpha": 3, "alpha": 3, "band": 3, "resiz": 3, "desir": 3, "to_palett": 3, "palett": 3, "dither": 3, "runner": 3, "venv": 3, "lib": 3, "11": 3, "site": 3, "packag": 3, "py": 3, "map": 3, "below": 3, "solid": 3, "valueerror": 3, "bwr": 3, "red": 3, "bwy": 3, "yellow": 3, "bw": 3, "16grai": 3, "16": 3, "shade": 3, "grai": 3, "directli": 4, "github": 4, "repo": 4, "clone": 4, "git": 4, "go": 4, "cd": 4, "pip3": 4, "navig": 4, "copi": 4, "come": 4, "soon": 4}, "objects": {"inkycal.custom": [[3, 0, 0, "-", "functions"]], "inkycal.custom.functions": [[3, 1, 1, "", "auto_fontsize"], [3, 1, 1, "", "draw_border"], [3, 1, 1, "", "get_fonts"], [3, 1, 1, "", "get_system_tz"], [3, 1, 1, "", "internet_available"], [3, 1, 1, "", "text_wrap"], [3, 1, 1, "", "write"]], "inkycal.display": [[3, 0, 0, "-", "Display"]], "inkycal": [[3, 0, 0, "-", "main"]], "inkycal.main": [[3, 2, 1, "", "Inkycal"]], "inkycal.main.Inkycal": [[3, 3, 1, "", "calibrate"], [3, 3, 1, "", "countdown"], [3, 3, 1, "", "run"], [3, 3, 1, "", "test"]], "inkycal.modules": [[3, 0, 0, "-", "ical_parser"], [3, 0, 0, "-", "inky_image"]], "inkycal.modules.ical_parser": [[3, 2, 1, "", "iCalendar"]], "inkycal.modules.ical_parser.iCalendar": [[3, 3, 1, "", "all_day"], [3, 3, 1, "", "clear_events"], [3, 3, 1, "", "get_events"], [3, 3, 1, "", "get_system_tz"], [3, 3, 1, "", "load_from_file"], [3, 3, 1, "", "load_url"], [3, 3, 1, "", "show_events"], [3, 3, 1, "", "sort"]], "inkycal.modules.inky_image": [[3, 2, 1, "", "Inkyimage"]], "inkycal.modules.inky_image.Inkyimage": [[3, 3, 1, "", "autoflip"], [3, 3, 1, "", "clear"], [3, 3, 1, "", "flip"], [3, 3, 1, "", "load"], [3, 3, 1, "", "merge"], [3, 3, 1, "", "preview"], [3, 3, 1, "", "remove_alpha"], [3, 3, 1, "", "resize"], [3, 3, 1, "", "to_palette"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "method", "Python method"]}, "titleterms": {"about": 0, "inkyc": [0, 2, 3, 4], "develop": 1, "document": [1, 2], "content": 2, "indic": 2, "tabl": 2, "displai": 3, "custom": 3, "function": 3, "helper": 3, "class": 3, "quickstart": 4, "instal": 4, "creat": 4, "set": 4, "file": 4}, "envversion": {"sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 60}, "alltitles": {"About Inkycal": [[0, "about-inkycal"]], "Developer documentation": [[1, "developer-documentation"]], "Inkycal documentation": [[2, "inkycal-documentation"]], "Contents:": [[2, null]], "Indices and tables": [[2, "indices-and-tables"]], "Inkycal": [[3, "module-inkycal.main"]], "Display": [[3, "module-inkycal.display.Display"]], "Custom functions": [[3, "module-inkycal.custom.functions"]], "Helper classes": [[3, "module-inkycal.modules.ical_parser"]], "Quickstart": [[4, "quickstart"]], "Installing Inkycal": [[4, "installing-inkycal"]], "Creating settings file": [[4, "creating-settings-file"]]}, "indexentries": {"inkycal (class in inkycal.main)": [[3, "inkycal.main.Inkycal"]], "inkyimage (class in inkycal.modules.inky_image)": [[3, "inkycal.modules.inky_image.Inkyimage"]], "all_day() (inkycal.modules.ical_parser.icalendar static method)": [[3, "inkycal.modules.ical_parser.iCalendar.all_day"]], "auto_fontsize() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.auto_fontsize"]], "autoflip() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.autoflip"]], "calibrate() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.calibrate"]], "clear() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.clear"]], "clear_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.clear_events"]], "countdown() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.countdown"]], "draw_border() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.draw_border"]], "flip() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.flip"]], "get_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.get_events"]], "get_fonts() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.get_fonts"]], "get_system_tz() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.get_system_tz"]], "get_system_tz() (inkycal.modules.ical_parser.icalendar static method)": [[3, "inkycal.modules.ical_parser.iCalendar.get_system_tz"]], "icalendar (class in inkycal.modules.ical_parser)": [[3, "inkycal.modules.ical_parser.iCalendar"]], "inkycal.custom.functions": [[3, "module-inkycal.custom.functions"]], "inkycal.display.display": [[3, "module-inkycal.display.Display"]], "inkycal.main": [[3, "module-inkycal.main"]], "inkycal.modules.ical_parser": [[3, "module-inkycal.modules.ical_parser"]], "inkycal.modules.inky_image": [[3, "module-inkycal.modules.inky_image"]], "internet_available() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.internet_available"]], "load() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.load"]], "load_from_file() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.load_from_file"]], "load_url() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.load_url"]], "merge() (inkycal.modules.inky_image.inkyimage static method)": [[3, "inkycal.modules.inky_image.Inkyimage.merge"]], "module": [[3, "module-inkycal.custom.functions"], [3, "module-inkycal.display.Display"], [3, "module-inkycal.main"], [3, "module-inkycal.modules.ical_parser"], [3, "module-inkycal.modules.inky_image"]], "preview() (inkycal.modules.inky_image.inkyimage static method)": [[3, "inkycal.modules.inky_image.Inkyimage.preview"]], "remove_alpha() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.remove_alpha"]], "resize() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.resize"]], "run() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.run"]], "show_events() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.show_events"]], "sort() (inkycal.modules.ical_parser.icalendar method)": [[3, "inkycal.modules.ical_parser.iCalendar.sort"]], "test() (inkycal.main.inkycal method)": [[3, "inkycal.main.Inkycal.test"]], "text_wrap() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.text_wrap"]], "to_palette() (inkycal.modules.inky_image.inkyimage method)": [[3, "inkycal.modules.inky_image.Inkyimage.to_palette"]], "write() (in module inkycal.custom.functions)": [[3, "inkycal.custom.functions.write"]]}}) \ No newline at end of file From df8b9e402e2ff47907944fe0b560158dcc42bebb Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 14 Dec 2023 22:29:22 +0100 Subject: [PATCH 05/24] flip image right to left by default --- inkycal/display/drivers/10_in_3.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inkycal/display/drivers/10_in_3.py b/inkycal/display/drivers/10_in_3.py index 121c93a..66f55bd 100644 --- a/inkycal/display/drivers/10_in_3.py +++ b/inkycal/display/drivers/10_in_3.py @@ -4,10 +4,11 @@ Copyright by aceinnolab """ from subprocess import run -from inkycal.custom import image_folder, top_level -from os.path import exists + from PIL import Image +from inkycal.custom import image_folder, top_level + # Display resolution EPD_WIDTH = 1872 EPD_HEIGHT = 1404 @@ -19,6 +20,7 @@ driver_dir = top_level + '/inkycal/display/drivers/parallel_drivers/' command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' + class EPD: def __init__(self): @@ -38,7 +40,7 @@ class EPD: def getbuffer(self, image): """ad-hoc""" - image = image.rotate(90, expand=True) + image = image.rotate(90, expand=True).transpose(Image.FLIP_LEFT_RIGHT) image.convert('RGB').save(image_folder + 'canvas.bmp', 'BMP') command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' print(command) From 078dfd656614f32ab2a2446b9d24c93c90a75ce6 Mon Sep 17 00:00:00 2001 From: Ace Date: Sat, 16 Dec 2023 18:59:11 +0100 Subject: [PATCH 06/24] add latest articles related to Inkycal --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8015bbd..059fad8 100644 --- a/README.md +++ b/README.md @@ -280,8 +280,14 @@ perks after confirming 💯 * [raspberrypi.com](https://www.raspberrypi.com/news/ashleys-top-five-projects-for-raspberry-pi-first-timers/) * [hackster.io](https://www.hackster.io/news/ace-innovation-lab-s-inkycal-v3-puts-a-raspberry-pi-powered-modular-epaper-dashboard-on-your-desk-b55a83cc0f46) +* [raspberryme.com](https://www.raspberryme.com/inkycal-v3-est-un-tableau-de-bord-epaper-alimente-par-raspberry-pi-pour-votre-bureau/) +* [ittagesschau.de](https://www.ittagesschau.de/artikel/inkycal-v3-smartes-display-auf-grundlage-des-raspberry-pi-mit-elektronischem-papier-und-vielen-moglichkeiten_365893) * [makeuseof - fantastic projects using an eink display](http://makeuseof.com/fantastic-projects-using-an-e-ink-display/) +* [notebookcheck.com](https://www.notebookcheck.com/Inkycal-V3-Smartes-Display-auf-Grundlage-des-Raspberry-Pi-mit-elektronischem-Papier-und-vielen-Moeglichkeiten.783012.0.html?ref=ittagesschau.de) +* [Waveshare - additional resources](https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT) +* [cnx-software.com](https://www.cnx-software.com/2023/12/13/inkycal-v3-is-a-raspberry-pi-powered-epaper-dashboard-for-your-desk/) * [magpi.de](https://www.magpi.de/news/maginkcal-ein-kalender-mit-epaper-display-und-raspberry-pi) +* [goodreader.com](https://goodereader.com/blog/e-paper/inkycal-v3-is-a-raspberry-pi-powered-e-paper-marvel-for-your-desk) * [goodreader.com](https://goodereader.com/blog/e-paper/five-of-the-most-innovative-e-ink-display-projects?doing_wp_cron=1701869793.2312469482421875000000) * [reddit - Inkycal](https://www.reddit.com/r/InkyCal/) * [schuemann.it](https://schuemann.it/2019/09/11/e-ink-calendar-with-a-raspberry-pi/) From 9216f700c9d054845b6ba9116cea52caa2ddf13f Mon Sep 17 00:00:00 2001 From: Ace Date: Sun, 17 Dec 2023 19:14:51 +0100 Subject: [PATCH 07/24] Add latest Inkycal article --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 059fad8..3e3e96a 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,7 @@ perks after confirming 💯 * [makeuseof - fantastic projects using an eink display](http://makeuseof.com/fantastic-projects-using-an-e-ink-display/) * [notebookcheck.com](https://www.notebookcheck.com/Inkycal-V3-Smartes-Display-auf-Grundlage-des-Raspberry-Pi-mit-elektronischem-Papier-und-vielen-Moeglichkeiten.783012.0.html?ref=ittagesschau.de) * [Waveshare - additional resources](https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT) +* [ereaderpro.co.uk](https://www.ereaderpro.co.uk/blogs/news/e-ink-product-made-in-germany-inkycal-v3) * [cnx-software.com](https://www.cnx-software.com/2023/12/13/inkycal-v3-is-a-raspberry-pi-powered-epaper-dashboard-for-your-desk/) * [magpi.de](https://www.magpi.de/news/maginkcal-ein-kalender-mit-epaper-display-und-raspberry-pi) * [goodreader.com](https://goodereader.com/blog/e-paper/inkycal-v3-is-a-raspberry-pi-powered-e-paper-marvel-for-your-desk) From 03f26ec49ab6fb3964d63def00df58ef09782f56 Mon Sep 17 00:00:00 2001 From: Ace Date: Sun, 17 Dec 2023 23:40:18 +0100 Subject: [PATCH 08/24] Remove semicolons --- .../display/drivers/epd_7_in_5_v2_colour.py | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/inkycal/display/drivers/epd_7_in_5_v2_colour.py b/inkycal/display/drivers/epd_7_in_5_v2_colour.py index bb732b3..f04d5a1 100644 --- a/inkycal/display/drivers/epd_7_in_5_v2_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_v2_colour.py @@ -81,34 +81,34 @@ class EPD: self.reset() - self.send_command(0x01); # POWER SETTING - self.send_data(0x07); - self.send_data(0x07); # VGH=20V,VGL=-20V - self.send_data(0x3f); # VDH=15V - self.send_data(0x3f); # VDL=-15V + self.send_command(0x01) # POWER SETTING + self.send_data(0x07) + self.send_data(0x07) # VGH=20V,VGL=-20V + self.send_data(0x3f) # VDH=15V + self.send_data(0x3f) # VDL=-15V - self.send_command(0x04); # POWER ON - epdconfig.delay_ms(100); - self.ReadBusy(); + self.send_command(0x04) # POWER ON + epdconfig.delay_ms(100) + self.ReadBusy() - self.send_command(0X00); # PANNEL SETTING - self.send_data(0x0F); # KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.send_command(0X00) # PANNEL SETTING + self.send_data(0x0F) # KW-3f KWR-2F BWROTP 0f BWOTP 1f - self.send_command(0x61); # tres - self.send_data(0x03); # source 800 - self.send_data(0x20); - self.send_data(0x01); # gate 480 - self.send_data(0xE0); + self.send_command(0x61) # tres + self.send_data(0x03) # source 800 + self.send_data(0x20) + self.send_data(0x01) # gate 480 + self.send_data(0xE0) - self.send_command(0X15); - self.send_data(0x00); + self.send_command(0X15) + self.send_data(0x00) - self.send_command(0X50); # VCOM AND DATA INTERVAL SETTING - self.send_data(0x11); - self.send_data(0x07); + self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING + self.send_data(0x11) + self.send_data(0x07) - self.send_command(0X60); # TCON SETTING - self.send_data(0x22); + self.send_command(0X60) # TCON SETTING + self.send_data(0x22) return 0 @@ -139,11 +139,11 @@ class EPD: def display(self, imageblack, imagered): self.send_command(0x10) for i in range(0, int(self.width * self.height / 8)): - self.send_data(imageblack[i]); + self.send_data(imageblack[i]) self.send_command(0x13) for i in range(0, int(self.width * self.height / 8)): - self.send_data(~imagered[i]); + self.send_data(~imagered[i]) self.send_command(0x12) epdconfig.delay_ms(100) From 08c8d10815156a67058749381e9c1dce1bd529e7 Mon Sep 17 00:00:00 2001 From: Ace Date: Sun, 17 Dec 2023 23:42:25 +0100 Subject: [PATCH 09/24] Remove semicolons --- inkycal/display/drivers/epd_7_in_5_v3.py | 130 +++++++++++------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/inkycal/display/drivers/epd_7_in_5_v3.py b/inkycal/display/drivers/epd_7_in_5_v3.py index 363ad4d..9fb143b 100644 --- a/inkycal/display/drivers/epd_7_in_5_v3.py +++ b/inkycal/display/drivers/epd_7_in_5_v3.py @@ -79,60 +79,60 @@ class EPD: # EPD hardware init start self.reset() - self.ReadBusy(); - self.send_command(0x12); # SWRESET - self.ReadBusy(); + self.ReadBusy() + self.send_command(0x12) # SWRESET + self.ReadBusy() - self.send_command(0x46); # Auto Write Red RAM - self.send_data(0xf7); - self.ReadBusy(); - self.send_command(0x47); # Auto Write B/W RAM - self.send_data(0xf7); - self.ReadBusy(); + self.send_command(0x46) # Auto Write Red RAM + self.send_data(0xf7) + self.ReadBusy() + self.send_command(0x47) # Auto Write B/W RAM + self.send_data(0xf7) + self.ReadBusy() - self.send_command(0x0C); # Soft start setting - self.send_data(0xAE); - self.send_data(0xC7); - self.send_data(0xC3); - self.send_data(0xC0); - self.send_data(0x40); + self.send_command(0x0C) # Soft start setting + self.send_data(0xAE) + self.send_data(0xC7) + self.send_data(0xC3) + self.send_data(0xC0) + self.send_data(0x40) - self.send_command(0x01); # Set MUX as 527 - self.send_data(0xAF); - self.send_data(0x02); - self.send_data(0x01); # 0x01 + self.send_command(0x01) # Set MUX as 527 + self.send_data(0xAF) + self.send_data(0x02) + self.send_data(0x01) # 0x01 - self.send_command(0x11); # Data entry mode - self.send_data(0x01); + self.send_command(0x11) # Data entry mode + self.send_data(0x01) - self.send_command(0x44); - self.send_data(0x00); # RAM x address start at 0 - self.send_data(0x00); - self.send_data(0x6F); - self.send_data(0x03); - self.send_command(0x45); - self.send_data(0xAF); - self.send_data(0x02); - self.send_data(0x00); - self.send_data(0x00); + self.send_command(0x44) + self.send_data(0x00) # RAM x address start at 0 + self.send_data(0x00) + self.send_data(0x6F) + self.send_data(0x03) + self.send_command(0x45) + self.send_data(0xAF) + self.send_data(0x02) + self.send_data(0x00) + self.send_data(0x00) - self.send_command(0x3C); # VBD - self.send_data(0x05); # LUT1, for white + self.send_command(0x3C) # VBD + self.send_data(0x05) # LUT1, for white - self.send_command(0x18); - self.send_data(0X80); + self.send_command(0x18) + self.send_data(0X80) - self.send_command(0x22); - self.send_data(0XB1); # Load Temperature and waveform setting. - self.send_command(0x20); - self.ReadBusy(); + self.send_command(0x22) + self.send_data(0XB1) # Load Temperature and waveform setting. + self.send_command(0x20) + self.ReadBusy() - self.send_command(0x4E); # set RAM x address count to 0; - self.send_data(0x00); - self.send_data(0x00); - self.send_command(0x4F); - self.send_data(0x00); - self.send_data(0x00); + self.send_command(0x4E) # set RAM x address count to 0 + self.send_data(0x00) + self.send_data(0x00) + self.send_command(0x4F) + self.send_data(0x00) + self.send_data(0x00) # EPD hardware init end return 0 @@ -161,23 +161,23 @@ class EPD: return buf def display(self, image): - self.send_command(0x4F); - self.send_data(0x00); - self.send_data(0x00); - self.send_command(0x24); + self.send_command(0x4F) + self.send_data(0x00) + self.send_data(0x00) + self.send_command(0x24) for i in range(0, int(self.width * self.height / 8)): - self.send_data(image[i]); + self.send_data(image[i]) - self.send_command(0x22); - self.send_data(0xF7); # Load LUT from MCU(0x32) - self.send_command(0x20); - epdconfig.delay_ms(10); - self.ReadBusy(); + self.send_command(0x22) + self.send_data(0xF7) # Load LUT from MCU(0x32) + self.send_command(0x20) + epdconfig.delay_ms(10) + self.ReadBusy() def Clear(self): - self.send_command(0x4F); - self.send_data(0x00); - self.send_data(0x00); + self.send_command(0x4F) + self.send_data(0x00) + self.send_data(0x00) self.send_command(0x24) for i in range(0, int(self.width * self.height / 8)): self.send_data(0xff) @@ -186,15 +186,15 @@ class EPD: for i in range(0, int(self.width * self.height / 8)): self.send_data(0xff) - self.send_command(0x22); - self.send_data(0xF7); # Load LUT from MCU(0x32) - self.send_command(0x20); - epdconfig.delay_ms(10); - self.ReadBusy(); + self.send_command(0x22) + self.send_data(0xF7) # Load LUT from MCU(0x32) + self.send_command(0x20) + epdconfig.delay_ms(10) + self.ReadBusy() def sleep(self): - self.send_command(0x10); - self.send_data(0x01); + self.send_command(0x10) + self.send_data(0x01) epdconfig.module_exit() ### END OF FILE ### From ad0610635ef7ef47b3509912583d1e0a7d39f50b Mon Sep 17 00:00:00 2001 From: Ace Date: Sun, 17 Dec 2023 23:44:22 +0100 Subject: [PATCH 10/24] Remove semicolons --- .../display/drivers/epd_7_in_5_v3_colour.py | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/inkycal/display/drivers/epd_7_in_5_v3_colour.py b/inkycal/display/drivers/epd_7_in_5_v3_colour.py index f808794..a82fed4 100644 --- a/inkycal/display/drivers/epd_7_in_5_v3_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_v3_colour.py @@ -79,59 +79,59 @@ class EPD: self.reset() - self.send_command(0x12); # SWRESET - self.ReadBusy(); # waiting for the electronic paper IC to release the idle signal + self.send_command(0x12) # SWRESET + self.ReadBusy() # waiting for the electronic paper IC to release the idle signal - self.send_command(0x46); # Auto Write RAM - self.send_data(0xF7); - self.ReadBusy(); # waiting for the electronic paper IC to release the idle signal + self.send_command(0x46) # Auto Write RAM + self.send_data(0xF7) + self.ReadBusy() # waiting for the electronic paper IC to release the idle signal - self.send_command(0x47); # Auto Write RAM - self.send_data(0xF7); - self.ReadBusy(); # waiting for the electronic paper IC to release the idle signal + self.send_command(0x47) # Auto Write RAM + self.send_data(0xF7) + self.ReadBusy() # waiting for the electronic paper IC to release the idle signal - self.send_command(0x0C); # Soft start setting - self.send_data(0xAE); - self.send_data(0xC7); - self.send_data(0xC3); - self.send_data(0xC0); - self.send_data(0x40); + self.send_command(0x0C) # Soft start setting + self.send_data(0xAE) + self.send_data(0xC7) + self.send_data(0xC3) + self.send_data(0xC0) + self.send_data(0x40) - self.send_command(0x01); # Set MUX as 527 - self.send_data(0xAF); - self.send_data(0x02); - self.send_data(0x01); + self.send_command(0x01) # Set MUX as 527 + self.send_data(0xAF) + self.send_data(0x02) + self.send_data(0x01) - self.send_command(0x11); # Data entry mode - self.send_data(0x01); + self.send_command(0x11) # Data entry mode + self.send_data(0x01) - self.send_command(0x44); - self.send_data(0x00); # RAM x address start at 0 - self.send_data(0x00); - self.send_data(0x6F); # RAM x address end at 36Fh -> 879 - self.send_data(0x03); - self.send_command(0x45); - self.send_data(0xAF); # RAM y address start at 20Fh; - self.send_data(0x02); - self.send_data(0x00); # RAM y address end at 00h; - self.send_data(0x00); + self.send_command(0x44) + self.send_data(0x00) # RAM x address start at 0 + self.send_data(0x00) + self.send_data(0x6F) # RAM x address end at 36Fh -> 879 + self.send_data(0x03) + self.send_command(0x45) + self.send_data(0xAF) # RAM y address start at 20Fh + self.send_data(0x02) + self.send_data(0x00) # RAM y address end at 00h + self.send_data(0x00) - self.send_command(0x3C); # VBD - self.send_data(0x01); # LUT1, for white + self.send_command(0x3C) # VBD + self.send_data(0x01) # LUT1, for white - self.send_command(0x18); - self.send_data(0X80); - self.send_command(0x22); - self.send_data(0XB1); # Load Temperature and waveform setting. - self.send_command(0x20); - self.ReadBusy(); # waiting for the electronic paper IC to release the idle signal + self.send_command(0x18) + self.send_data(0X80) + self.send_command(0x22) + self.send_data(0XB1) # Load Temperature and waveform setting. + self.send_command(0x20) + self.ReadBusy() # waiting for the electronic paper IC to release the idle signal - self.send_command(0x4E); - self.send_data(0x00); - self.send_data(0x00); - self.send_command(0x4F); - self.send_data(0xAF); - self.send_data(0x02); + self.send_command(0x4E) + self.send_data(0x00) + self.send_data(0x00) + self.send_command(0x4F) + self.send_data(0xAF) + self.send_data(0x02) return 0 @@ -160,44 +160,44 @@ class EPD: return buf def display(self, imageblack, imagered): - self.send_command(0x4F); - self.send_data(0xAf); + self.send_command(0x4F) + self.send_data(0xAf) self.send_command(0x24) for i in range(0, int(self.width * self.height / 8)): - self.send_data(imageblack[i]); + self.send_data(imageblack[i]) self.send_command(0x26) for i in range(0, int(self.width * self.height / 8)): - self.send_data(~imagered[i]); + self.send_data(~imagered[i]) - self.send_command(0x22); - self.send_data(0xC7); # Load LUT from MCU(0x32) - self.send_command(0x20); - epdconfig.delay_ms(200); # !!!The delay here is necessary, 200uS at least!!! - self.ReadBusy(); + self.send_command(0x22) + self.send_data(0xC7) # Load LUT from MCU(0x32) + self.send_command(0x20) + epdconfig.delay_ms(200) # !!!The delay here is necessary, 200uS at least!!! + self.ReadBusy() def Clear(self): - self.send_command(0x4F); - self.send_data(0xAf); + self.send_command(0x4F) + self.send_data(0xAf) self.send_command(0x24) for i in range(0, int(self.width * self.height / 8)): - self.send_data(0xff); + self.send_data(0xff) self.send_command(0x26) for i in range(0, int(self.width * self.height / 8)): - self.send_data(0x00); + self.send_data(0x00) - self.send_command(0x22); - self.send_data(0xC7); # Load LUT from MCU(0x32) - self.send_command(0x20); - epdconfig.delay_ms(200); # !!!The delay here is necessary, 200uS at least!!! - self.ReadBusy(); + self.send_command(0x22) + self.send_data(0xC7) # Load LUT from MCU(0x32) + self.send_command(0x20) + epdconfig.delay_ms(200) # !!!The delay here is necessary, 200uS at least!!! + self.ReadBusy() def sleep(self): - self.send_command(0x10); # deep sleep - self.send_data(0x01); + self.send_command(0x10) # deep sleep + self.send_data(0x01) epdconfig.module_exit() ### END OF FILE ### From e710964e105884aaba23bb558c2ceaeabf849838 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 18 Dec 2023 12:46:33 +0100 Subject: [PATCH 11/24] Best practices & code cleanup --- inkycal/custom/inkycal_exceptions.py | 1 - inkycal/display/drivers/10_in_3.py | 1 - inkycal/display/drivers/7_in_8.py | 4 +- inkycal/display/drivers/9_in_7.py | 4 +- inkycal/display/drivers/epd5in83b_V2.py | 129 ++-- inkycal/display/drivers/epd_12_in_48.py | 448 +++++++------- .../display/drivers/epd_12_in_48_colour.py | 571 +++++++++--------- .../display/drivers/epd_12_in_48_colour_V2.py | 546 +++++++++-------- inkycal/display/drivers/epd_4_in_2.py | 66 +- inkycal/display/drivers/epd_4_in_2_colour.py | 57 +- inkycal/display/drivers/epd_5_in_83.py | 56 +- inkycal/display/drivers/epd_5_in_83_colour.py | 56 +- inkycal/display/drivers/epd_7_in_5.py | 56 +- inkycal/display/drivers/epd_7_in_5_colour.py | 56 +- inkycal/display/drivers/epd_7_in_5_v2.py | 58 +- .../display/drivers/epd_7_in_5_v2_colour.py | 56 +- inkycal/display/drivers/epd_7_in_5_v3.py | 56 +- .../display/drivers/epd_7_in_5_v3_colour.py | 56 +- inkycal/display/drivers/epdconfig.py | 58 +- inkycal/display/drivers/epdconfig_12_in_48.py | 65 +- inkycal/display/drivers/image_file.py | 7 +- inkycal/modules/dev_module.py | 2 - inkycal/modules/inky_image.py | 7 +- inkycal/modules/inkycal_image.py | 5 +- inkycal/modules/inkycal_server.py | 7 +- inkycal/modules/inkycal_slideshow.py | 5 +- inkycal/modules/inkycal_weather.py | 29 +- inkycal/modules/template.py | 4 +- setup.py | 3 +- 29 files changed, 1241 insertions(+), 1228 deletions(-) diff --git a/inkycal/custom/inkycal_exceptions.py b/inkycal/custom/inkycal_exceptions.py index cc9064f..597551d 100644 --- a/inkycal/custom/inkycal_exceptions.py +++ b/inkycal/custom/inkycal_exceptions.py @@ -1,4 +1,3 @@ -#!python3 """ Inkycal custom Exceptions """ diff --git a/inkycal/display/drivers/10_in_3.py b/inkycal/display/drivers/10_in_3.py index 66f55bd..834e2df 100644 --- a/inkycal/display/drivers/10_in_3.py +++ b/inkycal/display/drivers/10_in_3.py @@ -1,4 +1,3 @@ -#!python3 """ 10.3" driver class Copyright by aceinnolab diff --git a/inkycal/display/drivers/7_in_8.py b/inkycal/display/drivers/7_in_8.py index 307c698..fe4d243 100644 --- a/inkycal/display/drivers/7_in_8.py +++ b/inkycal/display/drivers/7_in_8.py @@ -1,12 +1,10 @@ -#!python3 """ 7.8" parallel driver class Copyright by aceinnolab """ from subprocess import run + from inkycal.custom import image_folder, top_level -from os.path import exists -from PIL import Image # Display resolution EPD_WIDTH = 1872 diff --git a/inkycal/display/drivers/9_in_7.py b/inkycal/display/drivers/9_in_7.py index 31c76e2..8c6ec0f 100644 --- a/inkycal/display/drivers/9_in_7.py +++ b/inkycal/display/drivers/9_in_7.py @@ -1,12 +1,10 @@ -#!python3 """ 9.7" driver class Copyright by aceinnolab """ from subprocess import run + from inkycal.custom import image_folder, top_level -from os.path import exists -from PIL import Image # Display resolution EPD_WIDTH = 1200 diff --git a/inkycal/display/drivers/epd5in83b_V2.py b/inkycal/display/drivers/epd5in83b_V2.py index 6c5e4a1..94b9f00 100644 --- a/inkycal/display/drivers/epd5in83b_V2.py +++ b/inkycal/display/drivers/epd5in83b_V2.py @@ -1,42 +1,43 @@ -# ***************************************************************************** -# * | File : epd5in83b_V2.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V1.1 -# * | Date : 2022-08-10 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd5in83b_V2.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V1.1 +* | Date : 2022-08-10 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from . import epdconfig # Display resolution -EPD_WIDTH = 648 -EPD_HEIGHT = 480 +EPD_WIDTH = 648 +EPD_HEIGHT = 480 logger = logging.getLogger(__name__) + class EPD: def __init__(self): self.reset_pin = epdconfig.RST_PIN @@ -49,11 +50,11 @@ class EPD: # Hardware reset def reset(self): epdconfig.digital_write(self.reset_pin, 1) - epdconfig.delay_ms(200) + epdconfig.delay_ms(200) epdconfig.digital_write(self.reset_pin, 0) epdconfig.delay_ms(1) epdconfig.digital_write(self.reset_pin, 1) - epdconfig.delay_ms(200) + epdconfig.delay_ms(200) def send_command(self, command): epdconfig.digital_write(self.dc_pin, 0) @@ -73,74 +74,74 @@ class EPD: epdconfig.digital_write(self.cs_pin, 0) epdconfig.spi_writebyte2(data) epdconfig.digital_write(self.cs_pin, 1) - + def ReadBusy(self): logger.debug("e-Paper busy") self.send_command(0X71) - while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy + while (epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy self.send_command(0X71) epdconfig.delay_ms(200) logger.debug("e-Paper busy release") - + def init(self): if (epdconfig.module_init() != 0): return -1 - + self.reset() - self.send_command(0x01) #POWER SETTING - self.send_data (0x07) - self.send_data (0x07) #VGH=20V,VGL=-20V - self.send_data (0x3f) #VDH=15V - self.send_data (0x3f) #VDL=-15V + self.send_command(0x01) # POWER SETTING + self.send_data(0x07) + self.send_data(0x07) # VGH=20V,VGL=-20V + self.send_data(0x3f) # VDH=15V + self.send_data(0x3f) # VDL=-15V - self.send_command(0x04) #POWER ON - epdconfig.delay_ms(100) - self.ReadBusy() #waiting for the electronic paper IC to release the idle signal + self.send_command(0x04) # POWER ON + epdconfig.delay_ms(100) + self.ReadBusy() # waiting for the electronic paper IC to release the idle signal - self.send_command(0X00) #PANNEL SETTING - self.send_data(0x0F) #KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.send_command(0X00) # PANNEL SETTING + self.send_data(0x0F) # KW-3f KWR-2F BWROTP 0f BWOTP 1f - self.send_command(0x61) #tres - self.send_data (0x02) #source 648 - self.send_data (0x88) - self.send_data (0x01) #gate 480 - self.send_data (0xe0) + self.send_command(0x61) # tres + self.send_data(0x02) # source 648 + self.send_data(0x88) + self.send_data(0x01) # gate 480 + self.send_data(0xe0) self.send_command(0X15) self.send_data(0x00) - self.send_command(0X50) #VCOM AND DATA INTERVAL SETTING + self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING self.send_data(0x11) self.send_data(0x07) - self.send_command(0X60) #TCON SETTING + self.send_command(0X60) # TCON SETTING self.send_data(0x22) - + return 0 def getbuffer(self, image): # logger.debug("bufsiz = ",int(self.width/8) * self.height) - buf = [0xFF] * (int(self.width/8) * self.height) + buf = [0xFF] * (int(self.width / 8) * self.height) image_monocolor = image.convert('1') imwidth, imheight = image_monocolor.size pixels = image_monocolor.load() # logger.debug("imwidth = %d, imheight = %d",imwidth,imheight) - if(imwidth == self.width and imheight == self.height): + if (imwidth == self.width and imheight == self.height): logger.debug("Vertical") for y in range(imheight): for x in range(imwidth): # Set the bits for the column of pixels at the current position. if pixels[x, y] == 0: buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8)) - elif(imwidth == self.height and imheight == self.width): + elif (imwidth == self.height and imheight == self.width): logger.debug("Horizontal") for y in range(imheight): for x in range(imwidth): newx = y newy = self.height - x - 1 if pixels[x, y] == 0: - buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8)) + buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8)) return buf def display(self, imageblack, imagered): @@ -150,13 +151,13 @@ class EPD: if (imageblack != None): self.send_command(0X10) - self.send_data2(imageblack) + self.send_data2(imageblack) if (imagered != None): self.send_command(0X13) self.send_data2(buf) self.send_command(0x12) - epdconfig.delay_ms(200) + epdconfig.delay_ms(200) self.ReadBusy() def Clear(self): @@ -166,15 +167,15 @@ class EPD: self.send_data2([0x00] * int(self.width * self.height / 8)) self.send_command(0x12) - epdconfig.delay_ms(200) + epdconfig.delay_ms(200) self.ReadBusy() def sleep(self): - self.send_command(0X02) # power off + self.send_command(0X02) # power off self.ReadBusy() - self.send_command(0X07) # deep sleep + self.send_command(0X07) # deep sleep self.send_data(0xA5) - + epdconfig.delay_ms(2000) epdconfig.module_exit() ### END OF FILE ### diff --git a/inkycal/display/drivers/epd_12_in_48.py b/inkycal/display/drivers/epd_12_in_48.py index 334f121..ff208e6 100644 --- a/inkycal/display/drivers/epd_12_in_48.py +++ b/inkycal/display/drivers/epd_12_in_48.py @@ -1,221 +1,224 @@ -# /***************************************************************************** -# * | File : epd12in48.py -# * | Author : Waveshare electrices -# * | Function : Hardware underlying interface -# * | Info : -# *---------------- -# * | This version: V1.0 -# * | Date : 2019-11-01 -# * | Info : -# ******************************************************************************/ -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd12in48.py +* | Author : Waveshare electrices +* | Function : Hardware underlying interface +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2019-11-01 +* | Info : +******************************************************************************/ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import time + from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig -EPD_WIDTH = 1304 -EPD_HEIGHT = 984 +EPD_WIDTH = 1304 +EPD_HEIGHT = 984 + class EPD(object): def __init__(self): self.width = EPD_WIDTH self.height = EPD_HEIGHT - - self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN - self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN - self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN - self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN - self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN - self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN + self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN + self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN + self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN + self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN + + self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN + self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN - self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN - self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN - self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN - self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN + self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN + self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN + self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN + self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN def init(self): print("EPD init...") epdconfig.module_init() - - epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - self.Reset() - #panel setting - self.M1_SendCommand(0x00) - self.M1_SendData(0x1f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f - self.S1_SendCommand(0x00) - self.S1_SendData(0x1f) - self.M2_SendCommand(0x00) - self.M2_SendData(0x13) - self.S2_SendCommand(0x00) - self.S2_SendData(0x13) + epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + self.Reset() + + # panel setting + self.M1_SendCommand(0x00) + self.M1_SendData(0x1f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.S1_SendCommand(0x00) + self.S1_SendData(0x1f) + self.M2_SendCommand(0x00) + self.M2_SendData(0x13) + self.S2_SendCommand(0x00) + self.S2_SendData(0x13) # booster soft start - self.M1_SendCommand(0x06) - self.M1_SendData(0x17) #A - self.M1_SendData(0x17) #B - self.M1_SendData(0x39) #C - self.M1_SendData(0x17) - self.M2_SendCommand(0x06) - self.M2_SendData(0x17) - self.M2_SendData(0x17) - self.M2_SendData(0x39) - self.M2_SendData(0x17) + self.M1_SendCommand(0x06) + self.M1_SendData(0x17) # A + self.M1_SendData(0x17) # B + self.M1_SendData(0x39) # C + self.M1_SendData(0x17) + self.M2_SendCommand(0x06) + self.M2_SendData(0x17) + self.M2_SendData(0x17) + self.M2_SendData(0x39) + self.M2_SendData(0x17) - #resolution setting - self.M1_SendCommand(0x61) - self.M1_SendData(0x02) - self.M1_SendData(0x88) #source 648 - self.M1_SendData(0x01) #gate 492 - self.M1_SendData(0xEC) - self.S1_SendCommand(0x61) - self.S1_SendData(0x02) - self.S1_SendData(0x90) #source 656 - self.S1_SendData(0x01) #gate 492 - self.S1_SendData(0xEC) - self.M2_SendCommand(0x61) - self.M2_SendData(0x02) - self.M2_SendData(0x90) #source 656 - self.M2_SendData(0x01) #gate 492 - self.M2_SendData(0xEC) - self.S2_SendCommand(0x61) - self.S2_SendData(0x02) - self.S2_SendData(0x88) #source 648 - self.S2_SendData(0x01) #gate 492 - self.S2_SendData(0xEC) + # resolution setting + self.M1_SendCommand(0x61) + self.M1_SendData(0x02) + self.M1_SendData(0x88) # source 648 + self.M1_SendData(0x01) # gate 492 + self.M1_SendData(0xEC) + self.S1_SendCommand(0x61) + self.S1_SendData(0x02) + self.S1_SendData(0x90) # source 656 + self.S1_SendData(0x01) # gate 492 + self.S1_SendData(0xEC) + self.M2_SendCommand(0x61) + self.M2_SendData(0x02) + self.M2_SendData(0x90) # source 656 + self.M2_SendData(0x01) # gate 492 + self.M2_SendData(0xEC) + self.S2_SendCommand(0x61) + self.S2_SendData(0x02) + self.S2_SendData(0x88) # source 648 + self.S2_SendData(0x01) # gate 492 + self.S2_SendData(0xEC) - self.M1S1M2S2_SendCommand(0x15) #DUSPI - self.M1S1M2S2_SendData(0x20) + self.M1S1M2S2_SendCommand(0x15) # DUSPI + self.M1S1M2S2_SendData(0x20) - self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting - self.M1S1M2S2_SendData(0x21) #Border KW - self.M1S1M2S2_SendData(0x07) + self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting + self.M1S1M2S2_SendData(0x21) # Border KW + self.M1S1M2S2_SendData(0x07) - self.M1S1M2S2_SendCommand(0x60) #TCON - self.M1S1M2S2_SendData(0x22) + self.M1S1M2S2_SendCommand(0x60) # TCON + self.M1S1M2S2_SendData(0x22) - self.M1S1M2S2_SendCommand(0xE3) - self.M1S1M2S2_SendData(0x00) + self.M1S1M2S2_SendCommand(0xE3) + self.M1S1M2S2_SendData(0x00) - #temperature - temp = self.M1_ReadTemperature() + # temperature + temp = self.M1_ReadTemperature() - self.M1S1M2S2_SendCommand(0xe0) #Cascade setting - self.M1S1M2S2_SendData(0x03) - self.M1S1M2S2_SendCommand(0xe5) #Force temperature + self.M1S1M2S2_SendCommand(0xe0) # Cascade setting + self.M1S1M2S2_SendData(0x03) + self.M1S1M2S2_SendCommand(0xe5) # Force temperature self.M1S1M2S2_SendData(temp) - + def getbuffer(self, image): # logging.debug("bufsiz = ",int(self.width/8) * self.height) - buf = [0xFF] * (int(self.width/8) * self.height) + buf = [0xFF] * (int(self.width / 8) * self.height) image_monocolor = image.convert('1') imwidth, imheight = image_monocolor.size pixels = image_monocolor.load() - - if(imwidth == self.width and imheight == self.height): + + if (imwidth == self.width and imheight == self.height): for y in range(imheight): for x in range(imwidth): # Set the bits for the column of pixels at the current position. if pixels[x, y] == 0: buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8)) - elif(imwidth == self.height and imheight == self.width): + elif (imwidth == self.height and imheight == self.width): for y in range(imheight): for x in range(imwidth): newx = y newy = self.height - x - 1 if pixels[x, y] == 0: - buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8)) + buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8)) return buf - + def display(self, buf): - #M1 part 648*492 + # M1 part 648*492 self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): - self.M1_SendData(buf[y*163 + x]) + for y in range(492, 984): + for x in range(0, 81): + self.M1_SendData(buf[y * 163 + x]) - #S1 part 656*492 + # S1 part 656*492 self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): - self.S1_SendData(buf[y*163 + x]) + for y in range(492, 984): + for x in range(81, 163): + self.S1_SendData(buf[y * 163 + x]) - #M2 part 656*492 + # M2 part 656*492 self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(buf[y*163 + x]) + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(buf[y * 163 + x]) - #S2 part 648*492 + # S2 part 648*492 self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(buf[y*163 + x]) - + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(buf[y * 163 + x]) + self.TurnOnDisplay() def clear(self): """Clear contents of image buffer""" self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): + for y in range(492, 984): + for x in range(0, 81): self.M1_SendData(0xff) self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): + for y in range(492, 984): + for x in range(81, 163): self.S1_SendData(0xff) - + self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): + for y in range(0, 492): + for x in range(81, 163): self.M2_SendData(0xff) self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): + for y in range(0, 492): + for x in range(0, 81): self.S2_SendData(0xff) self.TurnOnDisplay() - + """ M1S1M2S2 Write register address and data """ + def M1S1M2S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) - + epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + def M1S1M2S2_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) @@ -224,59 +227,62 @@ class EPD(object): epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) """ M1M2 Write register address and data """ + def M1M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - - def M1S1M2S2_Senddata(self, val): + + def M1S1M2S2_Senddata(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + """ S2 Write register address and data """ + def S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - def S2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + """ M2 Write register address and data """ + def M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) def M2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) """ S1 Write register address and data """ + def S1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) @@ -288,8 +294,9 @@ class EPD(object): epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - + """ M1 Write register address and data """ + def M1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) @@ -303,97 +310,96 @@ class EPD(object): epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) def Reset(self): - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) - time.sleep(0.01) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - - def sleep(self): - self.M1S1M2S2_SendCommand(0X02) - time.sleep(0.3) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) + time.sleep(0.01) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) - self.M1S1M2S2_SendCommand(0X07) - self.M1S1M2S2_SendData(0xA5) - time.sleep(0.3) + def sleep(self): + self.M1S1M2S2_SendCommand(0X02) + time.sleep(0.3) + + self.M1S1M2S2_SendCommand(0X07) + self.M1S1M2S2_SendData(0xA5) + time.sleep(0.3) print("module_exit") epdconfig.module_exit() - - + def TurnOnDisplay(self): - self.M1M2_SendCommand(0x04) - time.sleep(0.3) - self.M1S1M2S2_SendCommand(0x12) + self.M1M2_SendCommand(0x04) + time.sleep(0.3) + self.M1S1M2S2_SendCommand(0x12) self.M1_ReadBusy() self.S1_ReadBusy() self.M2_ReadBusy() self.S2_ReadBusy() - - #Busy + + # Busy def M1_ReadBusy(self): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) print("M1_ReadBusy") - while(busy): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) + while (busy): + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) time.sleep(0.2) - + def M2_ReadBusy(self): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy = not(busy & 0x01) + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) print("M2_ReadBusy") - while(busy): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy =not(busy & 0x01) - time.sleep(0.2) - + while (busy): + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) + def S1_ReadBusy(self): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) print("s1_ReadBusy") - while(busy): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) - + while (busy): + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) + def S2_ReadBusy(self): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) print("S2_ReadBusy") - while(busy): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) - + while (busy): + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) + def M1_ReadTemperature(self): - self.M1_SendCommand(0x40) - self.M1_ReadBusy() + self.M1_SendCommand(0x40) + self.M1_ReadBusy() time.sleep(0.3) - epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) - epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - - epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) - time.sleep(0.01) - + epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) + epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + + epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) + time.sleep(0.01) + # temp = epdconfig.spi_readbyte(0x00) temp = 25 - print("Read Temperature Reg:%d"%temp) - epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + print("Read Temperature Reg:%d" % temp) + epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) # temp =0x29 - return temp + return temp diff --git a/inkycal/display/drivers/epd_12_in_48_colour.py b/inkycal/display/drivers/epd_12_in_48_colour.py index f364bd0..3ecf569 100644 --- a/inkycal/display/drivers/epd_12_in_48_colour.py +++ b/inkycal/display/drivers/epd_12_in_48_colour.py @@ -1,97 +1,99 @@ -# /***************************************************************************** -# * | File : epd12in48.py -# * | Author : Waveshare electrices -# * | Function : Hardware underlying interface -# * | Info : -# *---------------- -# * | This version: V1.0 -# * | Date : 2019-11-01 -# * | Info : -# ******************************************************************************/ -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd12in48.py +* | Author : Waveshare electrices +* | Function : Hardware underlying interface +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2019-11-01 +* | Info : +******************************************************************************/ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import time + from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig -EPD_WIDTH = 1304 -EPD_HEIGHT = 984 +EPD_WIDTH = 1304 +EPD_HEIGHT = 984 + class EPD(object): def __init__(self): self.width = EPD_WIDTH self.height = EPD_HEIGHT - - self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN - self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN - self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN - self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN - self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN - self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN + self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN + self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN + self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN + self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN + + self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN + self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN - self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN - self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN - self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN - self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN + self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN + self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN + self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN + self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN def init(self): print("EPD init...") epdconfig.module_init() - - epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - self.Reset() - #panel setting - self.M1_SendCommand(0x00) - self.M1_SendData(0x2f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f - self.S1_SendCommand(0x00) - self.S1_SendData(0x2f) - self.M2_SendCommand(0x00) - self.M2_SendData(0x23) - self.S2_SendCommand(0x00) - self.S2_SendData(0x23) + epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + self.Reset() + + # panel setting + self.M1_SendCommand(0x00) + self.M1_SendData(0x2f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.S1_SendCommand(0x00) + self.S1_SendData(0x2f) + self.M2_SendCommand(0x00) + self.M2_SendData(0x23) + self.S2_SendCommand(0x00) + self.S2_SendData(0x23) # POWER SETTING self.M1_SendCommand(0x01) self.M1_SendData(0x07) - self.M1_SendData(0x17) # VGH=20V,VGL=-20V - self.M1_SendData(0x3F) # VDH=15V - self.M1_SendData(0x3F) # VDL=-15V + self.M1_SendData(0x17) # VGH=20V,VGL=-20V + self.M1_SendData(0x3F) # VDH=15V + self.M1_SendData(0x3F) # VDL=-15V self.M1_SendData(0x0d) self.M2_SendCommand(0x01) self.M2_SendData(0x07) - self.M2_SendData(0x17) # VGH=20V,VGL=-20V - self.M2_SendData(0x3F) # VDH=15V + self.M2_SendData(0x17) # VGH=20V,VGL=-20V + self.M2_SendData(0x3F) # VDH=15V self.M2_SendData(0x3F) # VDL=-15V self.M2_SendData(0x0d) - + # booster soft start self.M1_SendCommand(0x06) - self.M1_SendData(0x17) #A - self.M1_SendData(0x17) #B - self.M1_SendData(0x39) #C + self.M1_SendData(0x17) # A + self.M1_SendData(0x17) # B + self.M1_SendData(0x39) # C self.M1_SendData(0x17) self.M2_SendCommand(0x06) self.M2_SendData(0x17) @@ -99,44 +101,44 @@ class EPD(object): self.M2_SendData(0x39) self.M2_SendData(0x17) - #resolution setting + # resolution setting self.M1_SendCommand(0x61) self.M1_SendData(0x02) - self.M1_SendData(0x88) #source 648 - self.M1_SendData(0x01) #gate 492 + self.M1_SendData(0x88) # source 648 + self.M1_SendData(0x01) # gate 492 self.M1_SendData(0xEC) self.S1_SendCommand(0x61) self.S1_SendData(0x02) - self.S1_SendData(0x90) #source 656 - self.S1_SendData(0x01) #gate 492 + self.S1_SendData(0x90) # source 656 + self.S1_SendData(0x01) # gate 492 self.S1_SendData(0xEC) self.M2_SendCommand(0x61) self.M2_SendData(0x02) - self.M2_SendData(0x90) #source 656 - self.M2_SendData(0x01) #gate 492 + self.M2_SendData(0x90) # source 656 + self.M2_SendData(0x01) # gate 492 self.M2_SendData(0xEC) self.S2_SendCommand(0x61) self.S2_SendData(0x02) - self.S2_SendData(0x88) #source 648 - self.S2_SendData(0x01) #gate 492 + self.S2_SendData(0x88) # source 648 + self.S2_SendData(0x01) # gate 492 self.S2_SendData(0xEC) - self.M1S1M2S2_SendCommand(0x15) #DUSPI + self.M1S1M2S2_SendCommand(0x15) # DUSPI self.M1S1M2S2_SendData(0x20) - self.M1S1M2S2_SendCommand(0x30) # PLL + self.M1S1M2S2_SendCommand(0x30) # PLL self.M1S1M2S2_SendData(0x08) - self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting + self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting self.M1S1M2S2_SendData(0x31) self.M1S1M2S2_SendData(0x07) - self.M1S1M2S2_SendCommand(0x60)#TCON + self.M1S1M2S2_SendCommand(0x60) # TCON self.M1S1M2S2_SendData(0x22) - self.M1_SendCommand(0xE0) #POWER SETTING + self.M1_SendCommand(0xE0) # POWER SETTING self.M1_SendData(0x01) - self.M2_SendCommand(0xE0) #POWER SETTING + self.M2_SendCommand(0xE0) # POWER SETTING self.M2_SendData(0x01) self.M1S1M2S2_SendCommand(0xE3) @@ -148,158 +150,159 @@ class EPD(object): self.M2_SendData(0x1c) self.SetLut() - + def getbuffer(self, image): # logging.debug("bufsiz = ",int(self.width/8) * self.height) - buf = [0xFF] * (int(self.width/8) * self.height) + buf = [0xFF] * (int(self.width / 8) * self.height) image_monocolor = image.convert('1') imwidth, imheight = image_monocolor.size pixels = image_monocolor.load() - - if(imwidth == self.width and imheight == self.height): + + if (imwidth == self.width and imheight == self.height): for y in range(imheight): for x in range(imwidth): # Set the bits for the column of pixels at the current position. if pixels[x, y] == 0: buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8)) - elif(imwidth == self.height and imheight == self.width): + elif (imwidth == self.height and imheight == self.width): for y in range(imheight): for x in range(imwidth): newx = y newy = self.height - x - 1 if pixels[x, y] == 0: - buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8)) + buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8)) return buf - - def display(self, blackbuf, redbuf): - - #S2 part 648*492 - self.S2_SendCommand(0x10) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(blackbuf[y*163 + x]) - self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(~redbuf[y*163 + x]) - - #M2 part 656*492 - self.M2_SendCommand(0x10) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(blackbuf[y*163 + x]) - self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(~redbuf[y*163 + x]) - #M1 part 648*492 + def display(self, blackbuf, redbuf): + + # S2 part 648*492 + self.S2_SendCommand(0x10) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(blackbuf[y * 163 + x]) + self.S2_SendCommand(0x13) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(~redbuf[y * 163 + x]) + + # M2 part 656*492 + self.M2_SendCommand(0x10) + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(blackbuf[y * 163 + x]) + self.M2_SendCommand(0x13) + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(~redbuf[y * 163 + x]) + + # M1 part 648*492 self.M1_SendCommand(0x10) - for y in range(492, 984): - for x in range(0, 81): - self.M1_SendData(blackbuf[y*163 + x]) + for y in range(492, 984): + for x in range(0, 81): + self.M1_SendData(blackbuf[y * 163 + x]) self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): - self.M1_SendData(~redbuf[y*163 + x]) - - #S1 part 656*492 + for y in range(492, 984): + for x in range(0, 81): + self.M1_SendData(~redbuf[y * 163 + x]) + + # S1 part 656*492 self.S1_SendCommand(0x10) - for y in range(492, 984): - for x in range(81, 163): - self.S1_SendData(blackbuf[y*163 + x]) + for y in range(492, 984): + for x in range(81, 163): + self.S1_SendData(blackbuf[y * 163 + x]) self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): - self.S1_SendData(~redbuf[y*163 + x]) + for y in range(492, 984): + for x in range(81, 163): + self.S1_SendData(~redbuf[y * 163 + x]) self.TurnOnDisplay() def clear(self): """Clear contents of image buffer""" - + self.S2_SendCommand(0x10) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(0xff) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(0xff) self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): + for y in range(0, 492): + for x in range(0, 81): self.S2_SendData(0x00) - + self.M2_SendCommand(0x10) - for y in range(0, 492): - for x in range(81, 163): + for y in range(0, 492): + for x in range(81, 163): self.M2_SendData(0xff) self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(0x00) - + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(0x00) + self.M1_SendCommand(0x10) - for y in range(492, 984): - for x in range(0, 81): + for y in range(492, 984): + for x in range(0, 81): self.M1_SendData(0xff) self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): + for y in range(492, 984): + for x in range(0, 81): self.M1_SendData(0x00) - + self.S1_SendCommand(0x10) - for y in range(492, 984): - for x in range(81, 163): + for y in range(492, 984): + for x in range(81, 163): self.S1_SendData(0xff) self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): + for y in range(492, 984): + for x in range(81, 163): self.S1_SendData(0x00) - - self.TurnOnDisplay() - - def Reset(self): - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) - time.sleep(0.01) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - - def sleep(self): - self.M1S1M2S2_SendCommand(0X02) - time.sleep(0.3) - self.M1S1M2S2_SendCommand(0X07) - self.M1S1M2S2_SendData(0xA5) - time.sleep(0.3) + self.TurnOnDisplay() + + def Reset(self): + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) + time.sleep(0.01) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) + + def sleep(self): + self.M1S1M2S2_SendCommand(0X02) + time.sleep(0.3) + + self.M1S1M2S2_SendCommand(0X07) + self.M1S1M2S2_SendData(0xA5) + time.sleep(0.3) print("module_exit") epdconfig.module_exit() def TurnOnDisplay(self): - self.M1M2_SendCommand(0x04) - time.sleep(0.3) - self.M1S1M2S2_SendCommand(0x12) + self.M1M2_SendCommand(0x04) + time.sleep(0.3) + self.M1S1M2S2_SendCommand(0x12) self.M1_ReadBusy() self.S1_ReadBusy() self.M2_ReadBusy() - self.S2_ReadBusy() - + self.S2_ReadBusy() + """ M1S1M2S2 Write register address and data """ + def M1S1M2S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) - + epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + def M1S1M2S2_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) @@ -308,200 +311,212 @@ class EPD(object): epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) """ M1M2 Write register address and data """ + def M1M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - - def M1M2_Sendata(self, val): + + def M1M2_Sendata(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + """ S2 Write register address and data """ + def S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + def S2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + """ M2 Write register address and data """ + def M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + def M2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) """ S1 Write register address and data """ + def S1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + def S1_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - + """ M1 Write register address and data """ + def M1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + def M1_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - #Busy + # Busy def M1_ReadBusy(self): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) time.sleep(0.2) + def M2_ReadBusy(self): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy = not(busy & 0x01) - self.M2_SendCommand(0x71) - while(busy): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy =not(busy & 0x01) + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) + self.M2_SendCommand(0x71) + while (busy): + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) time.sleep(0.2) + def S1_ReadBusy(self): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) + def S2_ReadBusy(self): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) lut_vcom1 = [ - 0x00, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x00, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x00, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_ww1 = [ - 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_bw1 = [ - 0xA8, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x84, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x86, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0xF0, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xA8, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x84, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x86, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0xF0, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_wb1 = [ - 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_bb1 = [ - 0x92, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x01, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x92, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x01, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] - + def SetLut(self): - self.M1S1M2S2_SendCommand(0x20) #vcom + self.M1S1M2S2_SendCommand(0x20) # vcom for count in range(0, 60): self.M1S1M2S2_SendData(self.lut_vcom1[count]) - self.M1S1M2S2_SendCommand(0x21) #red not use + self.M1S1M2S2_SendCommand(0x21) # red not use for count in range(0, 60): self.M1S1M2S2_SendData(self.lut_ww1[count]) - self.M1S1M2S2_SendCommand(0x22) #bw r + self.M1S1M2S2_SendCommand(0x22) # bw r for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r + self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r - self.M1S1M2S2_SendCommand(0x23) #wb w + self.M1S1M2S2_SendCommand(0x23) # wb w for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w + self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w - self.M1S1M2S2_SendCommand(0x24) #bb b + self.M1S1M2S2_SendCommand(0x24) # bb b for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b - - self.M1S1M2S2_SendCommand(0x25) #bb b + self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b + + self.M1S1M2S2_SendCommand(0x25) # bb b for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b + self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b diff --git a/inkycal/display/drivers/epd_12_in_48_colour_V2.py b/inkycal/display/drivers/epd_12_in_48_colour_V2.py index c58e48d..50e850e 100644 --- a/inkycal/display/drivers/epd_12_in_48_colour_V2.py +++ b/inkycal/display/drivers/epd_12_in_48_colour_V2.py @@ -1,71 +1,74 @@ -# /***************************************************************************** -# * | File : epd_12_in_48_colour.py -# * | Author : Waveshare electrices, modified by Sebastien Harnist -# * | Function : Hardware underlying interface -# * | Info : -# *---------------- -# * | This version: V1.1 -# * | Date : 2022-11-23 -# * | Info : -# ******************************************************************************/ -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd_12_in_48_colour.py +* | Author : Waveshare electrices, modified by Sebastien Harnist +* | Function : Hardware underlying interface +* | Info : +*---------------- +* | This version: V1.1 +* | Date : 2022-11-23 +* | Info : +******************************************************************************/ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" + import time + from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig -EPD_WIDTH = 1304 -EPD_HEIGHT = 984 +EPD_WIDTH = 1304 +EPD_HEIGHT = 984 + class EPD(object): def __init__(self): self.width = EPD_WIDTH self.height = EPD_HEIGHT - - self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN - self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN - self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN - self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN - self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN - self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN + self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN + self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN + self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN + self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN + + self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN + self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN - self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN - self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN - self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN - self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN + self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN + self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN + self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN + self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN def init(self): print("EPD init...") epdconfig.module_init() - - epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - self.Reset() + + epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + self.Reset() # panel setting for Display self.M1_SendCommand(0x00) - self.M1_SendData(0x0f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.M1_SendData(0x0f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f self.S1_SendCommand(0x00) self.S1_SendData(0x0f) self.M2_SendCommand(0x00) @@ -75,9 +78,9 @@ class EPD(object): # booster soft start self.M1_SendCommand(0x06) - self.M1_SendData(0x17) #A - self.M1_SendData(0x17) #B - self.M1_SendData(0x39) #C + self.M1_SendData(0x17) # A + self.M1_SendData(0x17) # B + self.M1_SendData(0x39) # C self.M1_SendData(0x17) self.M2_SendCommand(0x06) self.M2_SendData(0x17) @@ -85,196 +88,197 @@ class EPD(object): self.M2_SendData(0x39) self.M2_SendData(0x17) - #resolution setting + # resolution setting self.M1_SendCommand(0x61) self.M1_SendData(0x02) - self.M1_SendData(0x88) #source 648 - self.M1_SendData(0x01) #gate 492 + self.M1_SendData(0x88) # source 648 + self.M1_SendData(0x01) # gate 492 self.M1_SendData(0xEC) self.S1_SendCommand(0x61) self.S1_SendData(0x02) - self.S1_SendData(0x90) #source 656 - self.S1_SendData(0x01) #gate 492 + self.S1_SendData(0x90) # source 656 + self.S1_SendData(0x01) # gate 492 self.S1_SendData(0xEC) self.M2_SendCommand(0x61) self.M2_SendData(0x02) - self.M2_SendData(0x90) #source 656 - self.M2_SendData(0x01) #gate 492 + self.M2_SendData(0x90) # source 656 + self.M2_SendData(0x01) # gate 492 self.M2_SendData(0xEC) self.S2_SendCommand(0x61) self.S2_SendData(0x02) - self.S2_SendData(0x88) #source 648 - self.S2_SendData(0x01) #gate 492 + self.S2_SendData(0x88) # source 648 + self.S2_SendData(0x01) # gate 492 self.S2_SendData(0xEC) - self.M1S1M2S2_SendCommand(0x15) #DUSPI + self.M1S1M2S2_SendCommand(0x15) # DUSPI self.M1S1M2S2_SendData(0x20) - self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting + self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting self.M1S1M2S2_SendData(0x11) self.M1S1M2S2_SendData(0x07) - self.M1S1M2S2_SendCommand(0x60)#TCON + self.M1S1M2S2_SendCommand(0x60) # TCON self.M1S1M2S2_SendData(0x22) self.M1S1M2S2_SendCommand(0xE3) self.M1S1M2S2_SendData(0x00) self.M1_ReadTemperature() - + self.SetLut() def getbuffer(self, image): # logging.debug("bufsiz = ",int(self.width/8) * self.height) - buf = [0xFF] * (int(self.width/8) * self.height) + buf = [0xFF] * (int(self.width / 8) * self.height) image_monocolor = image.convert('1') imwidth, imheight = image_monocolor.size pixels = image_monocolor.load() - if(imwidth == self.width and imheight == self.height): + if (imwidth == self.width and imheight == self.height): for y in range(imheight): for x in range(imwidth): # Set the bits for the column of pixels at the current position. if pixels[x, y] == 0: buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8)) - elif(imwidth == self.height and imheight == self.width): + elif (imwidth == self.height and imheight == self.width): for y in range(imheight): for x in range(imwidth): newx = y newy = self.height - x - 1 if pixels[x, y] == 0: - buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8)) - return buf - - def display(self, blackbuf, redbuf): - - #S2 part 648*492 - self.S2_SendCommand(0x10) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(blackbuf[y*163 + x]) - self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(~redbuf[y*163 + x]) - - #M2 part 656*492 - self.M2_SendCommand(0x10) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(blackbuf[y*163 + x]) - self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(~redbuf[y*163 + x]) + buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8)) + return buf - #M1 part 648*492 + def display(self, blackbuf, redbuf): + + # S2 part 648*492 + self.S2_SendCommand(0x10) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(blackbuf[y * 163 + x]) + self.S2_SendCommand(0x13) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(~redbuf[y * 163 + x]) + + # M2 part 656*492 + self.M2_SendCommand(0x10) + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(blackbuf[y * 163 + x]) + self.M2_SendCommand(0x13) + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(~redbuf[y * 163 + x]) + + # M1 part 648*492 self.M1_SendCommand(0x10) - for y in range(492, 984): - for x in range(0, 81): - self.M1_SendData(blackbuf[y*163 + x]) + for y in range(492, 984): + for x in range(0, 81): + self.M1_SendData(blackbuf[y * 163 + x]) self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): - self.M1_SendData(~redbuf[y*163 + x]) - - #S1 part 656*492 + for y in range(492, 984): + for x in range(0, 81): + self.M1_SendData(~redbuf[y * 163 + x]) + + # S1 part 656*492 self.S1_SendCommand(0x10) - for y in range(492, 984): - for x in range(81, 163): - self.S1_SendData(blackbuf[y*163 + x]) + for y in range(492, 984): + for x in range(81, 163): + self.S1_SendData(blackbuf[y * 163 + x]) self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): - self.S1_SendData(~redbuf[y*163 + x]) + for y in range(492, 984): + for x in range(81, 163): + self.S1_SendData(~redbuf[y * 163 + x]) self.TurnOnDisplay() def clear(self): """Clear contents of image buffer""" - + self.S2_SendCommand(0x10) - for y in range(0, 492): - for x in range(0, 81): - self.S2_SendData(0xff) + for y in range(0, 492): + for x in range(0, 81): + self.S2_SendData(0xff) self.S2_SendCommand(0x13) - for y in range(0, 492): - for x in range(0, 81): + for y in range(0, 492): + for x in range(0, 81): self.S2_SendData(0x00) - + self.M2_SendCommand(0x10) - for y in range(0, 492): - for x in range(81, 163): + for y in range(0, 492): + for x in range(81, 163): self.M2_SendData(0xff) self.M2_SendCommand(0x13) - for y in range(0, 492): - for x in range(81, 163): - self.M2_SendData(0x00) - + for y in range(0, 492): + for x in range(81, 163): + self.M2_SendData(0x00) + self.M1_SendCommand(0x10) - for y in range(492, 984): - for x in range(0, 81): + for y in range(492, 984): + for x in range(0, 81): self.M1_SendData(0xff) self.M1_SendCommand(0x13) - for y in range(492, 984): - for x in range(0, 81): + for y in range(492, 984): + for x in range(0, 81): self.M1_SendData(0x00) - + self.S1_SendCommand(0x10) - for y in range(492, 984): - for x in range(81, 163): + for y in range(492, 984): + for x in range(81, 163): self.S1_SendData(0xff) self.S1_SendCommand(0x13) - for y in range(492, 984): - for x in range(81, 163): + for y in range(492, 984): + for x in range(81, 163): self.S1_SendData(0x00) - - self.TurnOnDisplay() - - def Reset(self): - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) - time.sleep(0.01) - epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) - epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) - time.sleep(0.2) - - def sleep(self): - self.M1S1M2S2_SendCommand(0X02) - time.sleep(0.3) - self.M1S1M2S2_SendCommand(0X07) - self.M1S1M2S2_SendData(0xA5) - time.sleep(0.3) + self.TurnOnDisplay() + + def Reset(self): + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0) + time.sleep(0.01) + epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1) + epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1) + time.sleep(0.2) + + def sleep(self): + self.M1S1M2S2_SendCommand(0X02) + time.sleep(0.3) + + self.M1S1M2S2_SendCommand(0X07) + self.M1S1M2S2_SendData(0xA5) + time.sleep(0.3) print("module_exit") epdconfig.module_exit() def TurnOnDisplay(self): - self.M1M2_SendCommand(0x04) - time.sleep(0.3) - self.M1S1M2S2_SendCommand(0x12) + self.M1M2_SendCommand(0x04) + time.sleep(0.3) + self.M1S1M2S2_SendCommand(0x12) self.M1_ReadBusy() self.S1_ReadBusy() self.M2_ReadBusy() - self.S2_ReadBusy() - + self.S2_ReadBusy() + """ M1S1M2S2 Write register address and data """ + def M1S1M2S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) - + epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + def M1S1M2S2_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) @@ -283,220 +287,232 @@ class EPD(object): epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) """ M1M2 Write register address and data """ + def M1M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - - def M1M2_Sendata(self, val): + + def M1M2_Sendata(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) - + epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + """ S2 Write register address and data """ + def S2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) + def S2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + """ M2 Write register address and data """ + def M2_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(cmd) + epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) + def M2_SendData(self, val): epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 0) - epdconfig.spi_writebyte(val) + epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) """ S1 Write register address and data """ + def S1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) + def S1_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_S1_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) - + """ M1 Write register address and data """ + def M1_SendCommand(self, cmd): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.spi_writebyte(cmd) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) + def M1_SendData(self, val): epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.spi_writebyte(val) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - #Busy + # Busy def M1_ReadBusy(self): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.M1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) - busy = not(busy & 0x01) + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.M1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN) + busy = not (busy & 0x01) time.sleep(0.2) + def M2_ReadBusy(self): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy = not(busy & 0x01) - self.M2_SendCommand(0x71) - while(busy): - self.M2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) - busy =not(busy & 0x01) + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) + self.M2_SendCommand(0x71) + while (busy): + self.M2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN) + busy = not (busy & 0x01) time.sleep(0.2) + def S1_ReadBusy(self): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.S1_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.S1_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) + def S2_ReadBusy(self): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) - while(busy): - self.S2_SendCommand(0x71) - busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) - busy = not(busy & 0x01) - time.sleep(0.2) + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) + while (busy): + self.S2_SendCommand(0x71) + busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN) + busy = not (busy & 0x01) + time.sleep(0.2) lut_vcom1 = [ - 0x00, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x00, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x00, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x00, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_ww1 = [ - 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_bw1 = [ - 0xA8, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x84, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x86, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0xF0, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xA8, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x84, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x86, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0xF0, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_wb1 = [ - 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x91, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x08, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] lut_bb1 = [ - 0x92, 0x10, 0x10, 0x01, 0x08, 0x01, - 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, - 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, - 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, - 0x01, 0x04, 0x05, 0x08, 0x08, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x92, 0x10, 0x10, 0x01, 0x08, 0x01, + 0x80, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x84, 0x08, 0x01, 0x08, 0x01, 0x06, + 0x04, 0x06, 0x01, 0x06, 0x01, 0x05, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06, + 0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01, + 0x01, 0x04, 0x05, 0x08, 0x08, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] - + def SetLut(self): - self.M1S1M2S2_SendCommand(0x20) #vcom + self.M1S1M2S2_SendCommand(0x20) # vcom for count in range(0, 60): self.M1S1M2S2_SendData(self.lut_vcom1[count]) - self.M1S1M2S2_SendCommand(0x21) #red not use + self.M1S1M2S2_SendCommand(0x21) # red not use for count in range(0, 60): self.M1S1M2S2_SendData(self.lut_ww1[count]) - self.M1S1M2S2_SendCommand(0x22) #bw r + self.M1S1M2S2_SendCommand(0x22) # bw r for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r + self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r - self.M1S1M2S2_SendCommand(0x23) #wb w + self.M1S1M2S2_SendCommand(0x23) # wb w for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w + self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w - self.M1S1M2S2_SendCommand(0x24) #bb b + self.M1S1M2S2_SendCommand(0x24) # bb b for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b - - self.M1S1M2S2_SendCommand(0x25) #bb b + self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b + + self.M1S1M2S2_SendCommand(0x25) # bb b for count in range(0, 60): - self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b + self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b def M1_ReadTemperature(self): self.M1_SendCommand(0x40) self.M1_ReadBusy() time.sleep(0.3) - + epdconfig.digital_write(self.EPD_M1_CS_PIN, 0) epdconfig.digital_write(self.EPD_S1_CS_PIN, 1) epdconfig.digital_write(self.EPD_M2_CS_PIN, 1) epdconfig.digital_write(self.EPD_S2_CS_PIN, 1) - + epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1) time.sleep(0.05) - + temp = epdconfig.spi_readbyte(0x00) epdconfig.digital_write(self.EPD_M1_CS_PIN, 1) - + self.M1S1M2S2_SendCommand(0xE0) self.M1S1M2S2_SendData(0x03) self.M1S1M2S2_SendCommand(0xE5) diff --git a/inkycal/display/drivers/epd_4_in_2.py b/inkycal/display/drivers/epd_4_in_2.py index 4d82448..d221857 100644 --- a/inkycal/display/drivers/epd_4_in_2.py +++ b/inkycal/display/drivers/epd_4_in_2.py @@ -1,37 +1,35 @@ -# ***************************************************************************** -# * | File : epd4in2.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd4in2.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig -from PIL import Image -import RPi.GPIO as GPIO # Display resolution EPD_WIDTH = 400 @@ -354,8 +352,8 @@ class EPD: i = i + 1 if (i % 4 == 0): buf[int((x + (y * self.width)) / 4)] = ( - (pixels[x - 3, y] & 0xc0) | (pixels[x - 2, y] & 0xc0) >> 2 | ( - pixels[x - 1, y] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6) + (pixels[x - 3, y] & 0xc0) | (pixels[x - 2, y] & 0xc0) >> 2 | ( + pixels[x - 1, y] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6) elif (imwidth == self.height and imheight == self.width): logging.debug("Horizontal") @@ -370,8 +368,8 @@ class EPD: i = i + 1 if (i % 4 == 0): buf[int((newx + (newy * self.width)) / 4)] = ( - (pixels[x, y - 3] & 0xc0) | (pixels[x, y - 2] & 0xc0) >> 2 | ( - pixels[x, y - 1] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6) + (pixels[x, y - 3] & 0xc0) | (pixels[x, y - 2] & 0xc0) >> 2 | ( + pixels[x, y - 1] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6) return buf diff --git a/inkycal/display/drivers/epd_4_in_2_colour.py b/inkycal/display/drivers/epd_4_in_2_colour.py index 0838618..ee543d1 100644 --- a/inkycal/display/drivers/epd_4_in_2_colour.py +++ b/inkycal/display/drivers/epd_4_in_2_colour.py @@ -1,33 +1,34 @@ -# ***************************************************************************** -# * | File : epd4in2bc.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd4in2bc.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_5_in_83.py b/inkycal/display/drivers/epd_5_in_83.py index e92371f..061fb2e 100644 --- a/inkycal/display/drivers/epd_5_in_83.py +++ b/inkycal/display/drivers/epd_5_in_83.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd5in83.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd5in83.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_5_in_83_colour.py b/inkycal/display/drivers/epd_5_in_83_colour.py index 4ace890..ac8ca57 100644 --- a/inkycal/display/drivers/epd_5_in_83_colour.py +++ b/inkycal/display/drivers/epd_5_in_83_colour.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd5in83b.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd5in83b.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_7_in_5.py b/inkycal/display/drivers/epd_7_in_5.py index b360aa1..f5324c9 100644 --- a/inkycal/display/drivers/epd_7_in_5.py +++ b/inkycal/display/drivers/epd_7_in_5.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd7in5.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_7_in_5_colour.py b/inkycal/display/drivers/epd_7_in_5_colour.py index 3723c12..9a1ca47 100644 --- a/inkycal/display/drivers/epd_7_in_5_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_colour.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd7in5bc.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5bc.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_7_in_5_v2.py b/inkycal/display/drivers/epd_7_in_5_v2.py index 92929b8..4ae9b53 100644 --- a/inkycal/display/drivers/epd_7_in_5_v2.py +++ b/inkycal/display/drivers/epd_7_in_5_v2.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd7in5.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution @@ -175,4 +175,4 @@ class EPD: epdconfig.delay_ms(2000) epdconfig.module_exit() -### END OF FILE ### \ No newline at end of file +### END OF FILE ### diff --git a/inkycal/display/drivers/epd_7_in_5_v2_colour.py b/inkycal/display/drivers/epd_7_in_5_v2_colour.py index f04d5a1..e1b1d7b 100644 --- a/inkycal/display/drivers/epd_7_in_5_v2_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_v2_colour.py @@ -1,34 +1,34 @@ -# ***************************************************************************** -# * | File : epd7in5bc.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5bc.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging + from inkycal.display.drivers import epdconfig # Display resolution diff --git a/inkycal/display/drivers/epd_7_in_5_v3.py b/inkycal/display/drivers/epd_7_in_5_v3.py index 9fb143b..76e6fac 100644 --- a/inkycal/display/drivers/epd_7_in_5_v3.py +++ b/inkycal/display/drivers/epd_7_in_5_v3.py @@ -1,31 +1,31 @@ -# ***************************************************************************** -# * | File : epd7in5.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging diff --git a/inkycal/display/drivers/epd_7_in_5_v3_colour.py b/inkycal/display/drivers/epd_7_in_5_v3_colour.py index a82fed4..860ffce 100644 --- a/inkycal/display/drivers/epd_7_in_5_v3_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_v3_colour.py @@ -1,31 +1,31 @@ -# ***************************************************************************** -# * | File : epd7in5bc.py -# * | Author : Waveshare team -# * | Function : Electronic paper driver -# * | Info : -# *---------------- -# * | This version: V4.0 -# * | Date : 2019-06-20 -# # | Info : python demo -# ----------------------------------------------------------------------------- -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epd7in5bc.py +* | Author : Waveshare team +* | Function : Electronic paper driver +* | Info : +*---------------- +* | This version: V4.0 +* | Date : 2019-06-20 +# | Info : python demo +----------------------------------------------------------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" import logging diff --git a/inkycal/display/drivers/epdconfig.py b/inkycal/display/drivers/epdconfig.py index 5755b9f..df1f584 100644 --- a/inkycal/display/drivers/epdconfig.py +++ b/inkycal/display/drivers/epdconfig.py @@ -1,34 +1,34 @@ -# /***************************************************************************** -# * | File : epdconfig.py -# * | Author : Waveshare team -# * | Function : Hardware underlying interface -# * | Info : -# *---------------- -# * | This version: V1.0 -# * | Date : 2019-06-21 -# * | Info : -# ****************************************************************************** -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# +""" +* | File : epdconfig.py +* | Author : Waveshare team +* | Function : Hardware underlying interface +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2019-06-21 +* | Info : +****************************************************************************** +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" -import os import logging +import os import sys import time diff --git a/inkycal/display/drivers/epdconfig_12_in_48.py b/inkycal/display/drivers/epdconfig_12_in_48.py index c490133..1fc1f34 100644 --- a/inkycal/display/drivers/epdconfig_12_in_48.py +++ b/inkycal/display/drivers/epdconfig_12_in_48.py @@ -1,39 +1,38 @@ -# /***************************************************************************** -# * | File : epdconfig.py -# * | Author : Waveshare electrices -# * | Function : Hardware underlying interface -# * | Info : -# *---------------- -# * | This version: V1.0 -# * | Date : 2019-11-01 -# * | Info : -# ******************************************************************************/ -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documnetation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -import RPi.GPIO as GPIO -import time -import os -import logging -import sys +""" +* | File : epdconfig.py +* | Author : Waveshare electrices +* | Function : Hardware underlying interface +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2019-11-01 +* | Info : +******************************************************************************/ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documnetation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" +import logging +import os +import time from ctypes import * +import RPi.GPIO as GPIO + EPD_SCK_PIN = 11 EPD_MOSI_PIN = 10 diff --git a/inkycal/display/drivers/image_file.py b/inkycal/display/drivers/image_file.py index e1ee623..e93480d 100644 --- a/inkycal/display/drivers/image_file.py +++ b/inkycal/display/drivers/image_file.py @@ -1,6 +1,9 @@ +"""Image file driver for testing""" + # Display resolution -EPD_WIDTH = 800 -EPD_HEIGHT = 480 +EPD_WIDTH = 800 +EPD_HEIGHT = 480 + class EPD: def init(self): diff --git a/inkycal/modules/dev_module.py b/inkycal/modules/dev_module.py index 619691b..13d6275 100755 --- a/inkycal/modules/dev_module.py +++ b/inkycal/modules/dev_module.py @@ -1,5 +1,3 @@ -#!python3 - """ Third party module template (inkycal-compatible module) diff --git a/inkycal/modules/inky_image.py b/inkycal/modules/inky_image.py index 785f6d6..340d50b 100755 --- a/inkycal/modules/inky_image.py +++ b/inkycal/modules/inky_image.py @@ -1,6 +1,3 @@ -#!python3 - - """ Custom image class for Inkycal Project Takes care of handling images. Made to be used by other modules to handle @@ -14,7 +11,6 @@ import os import PIL import numpy import requests - from PIL import Image logger = logging.getLogger(__name__) @@ -116,7 +112,7 @@ class Inkyimage: self.image = image logger.info(f'flipped image by {angle} degrees') - def autoflip(self, layout:str) -> None: + def autoflip(self, layout: str) -> None: """flips the image automatically to the given layout. Args: @@ -335,4 +331,3 @@ class Inkyimage: if __name__ == '__main__': print(f'running {__name__} in standalone/debug mode') - diff --git a/inkycal/modules/inkycal_image.py b/inkycal/modules/inkycal_image.py index da246e4..aed26e0 100755 --- a/inkycal/modules/inkycal_image.py +++ b/inkycal/modules/inkycal_image.py @@ -1,14 +1,11 @@ -#!python3 - """ Inkycal Image Module Copyright by aceinnolab """ -from inkycal.modules.template import inkycal_module from inkycal.custom import * - from inkycal.modules.inky_image import Inkyimage as Images +from inkycal.modules.template import inkycal_module logger = logging.getLogger(__name__) diff --git a/inkycal/modules/inkycal_server.py b/inkycal/modules/inkycal_server.py index 9a9d056..619c146 100755 --- a/inkycal/modules/inkycal_server.py +++ b/inkycal/modules/inkycal_server.py @@ -1,17 +1,12 @@ -#!python3 - """ Inkycal-server module for Inkycal Project by Aterju (https://inkycal.robertsirre.nl/) Copyright by aceinnolab """ -import requests - -from inkycal.modules.template import inkycal_module from inkycal.custom import * - from inkycal.modules.inky_image import Inkyimage as Images +from inkycal.modules.template import inkycal_module logger = logging.getLogger(__name__) diff --git a/inkycal/modules/inkycal_slideshow.py b/inkycal/modules/inkycal_slideshow.py index 6699377..afd4f94 100755 --- a/inkycal/modules/inkycal_slideshow.py +++ b/inkycal/modules/inkycal_slideshow.py @@ -1,16 +1,13 @@ -#!python3 - """ Inkycal Slideshow Module Copyright by aceinnolab """ import glob -from inkycal.modules.template import inkycal_module from inkycal.custom import * - # PIL has a class named Image, use alias for Inkyimage -> Images from inkycal.modules.inky_image import Inkyimage as Images +from inkycal.modules.template import inkycal_module logger = logging.getLogger(__name__) diff --git a/inkycal/modules/inkycal_weather.py b/inkycal/modules/inkycal_weather.py index cbb2cc8..a14abc3 100644 --- a/inkycal/modules/inkycal_weather.py +++ b/inkycal/modules/inkycal_weather.py @@ -1,18 +1,16 @@ -#!python3 - """ Inkycal weather module Copyright by aceinnolab """ -from inkycal.modules.template import inkycal_module -from inkycal.custom import * - -import math import decimal +import math + import arrow +from inkycal.custom import * from inkycal.custom import OpenWeatherMap +from inkycal.modules.template import inkycal_module logger = logging.getLogger(__name__) @@ -95,7 +93,7 @@ class Weather(inkycal_module): self.use_beaufort = config['use_beaufort'] # additional configuration - self.owm = OpenWeatherMap(api_key=self.api_key, city_id=self.location, units=config['units']) + self.owm = OpenWeatherMap(api_key=self.api_key, city_id=self.location, units=config['units']) self.timezone = get_system_tz() self.locale = config['language'] self.weatherfont = ImageFont.truetype( @@ -104,9 +102,8 @@ class Weather(inkycal_module): # give an OK message print(f"{__name__} loaded") - @staticmethod - def mps_to_beaufort(meters_per_second:float) -> int: + def mps_to_beaufort(meters_per_second: float) -> int: """Map meters per second to the beaufort scale. Args: @@ -120,7 +117,7 @@ class Weather(inkycal_module): return next((i for i, threshold in enumerate(thresholds) if meters_per_second < threshold), 11) @staticmethod - def mps_to_mph(meters_per_second:float) -> float: + def mps_to_mph(meters_per_second: float) -> float: """Map meters per second to miles per hour, rounded to one decimal place. Args: @@ -135,7 +132,7 @@ class Weather(inkycal_module): return round(miles_per_hour, 1) @staticmethod - def celsius_to_fahrenheit(celsius:int or float): + def celsius_to_fahrenheit(celsius: int or float): """Converts the given temperate from degrees Celsius to Fahrenheit.""" fahrenheit = (celsius * 9 / 5) + 32 return fahrenheit @@ -180,7 +177,8 @@ class Weather(inkycal_module): 4: '\uf0a3', 5: '\uf0a7', 6: '\uf0aa', - 7: '\uf0ae'}[int(index) & 7] + 7: '\uf0ae' + }[int(index) & 7] def is_negative(temp): """Check if temp is below freezing point of water (0°C/30°F) @@ -458,8 +456,9 @@ class Weather(inkycal_module): # Create a list containing time-objects for every 3rd hour of the day time_range = list( arrow.Arrow.range('hour', - now.shift(days=days_from_today).floor('day'),now.shift(days=days_from_today).ceil('day') - ))[::3] + now.shift(days=days_from_today).floor('day'), + now.shift(days=days_from_today).ceil('day') + ))[::3] # Get forecasts for each time-object forecasts = [_ for _ in forecast if arrow.get(_["dt"]) in time_range] @@ -493,7 +492,7 @@ class Weather(inkycal_module): if dec_temp != 0: temperature = f"{round(weather['main']['temp'])}°" else: - temperature = f"{round(weather['main']['temp'],ndigits=dec_temp)}°" + temperature = f"{round(weather['main']['temp'], ndigits=dec_temp)}°" weather_icon = weather["weather"][0]["icon"] humidity = str(weather["main"]["humidity"]) diff --git a/inkycal/modules/template.py b/inkycal/modules/template.py index 7172960..99ab27b 100755 --- a/inkycal/modules/template.py +++ b/inkycal/modules/template.py @@ -1,6 +1,6 @@ -#!python3 - +"""Inkycal module template""" import abc + from inkycal.custom import * diff --git a/setup.py b/setup.py index b5b45bf..6064cce 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ -#!python3 +from os import path from setuptools import setup -from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: From c656b3a562ed8cb7bd40ddf344c55933f7f9d699 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 18 Dec 2023 12:54:32 +0100 Subject: [PATCH 12/24] Updated driver for 7.5" v2 colour --- .../display/drivers/epd_7_in_5_v2_colour.py | 135 ++++++++++-------- 1 file changed, 74 insertions(+), 61 deletions(-) diff --git a/inkycal/display/drivers/epd_7_in_5_v2_colour.py b/inkycal/display/drivers/epd_7_in_5_v2_colour.py index e1b1d7b..f2d0a89 100644 --- a/inkycal/display/drivers/epd_7_in_5_v2_colour.py +++ b/inkycal/display/drivers/epd_7_in_5_v2_colour.py @@ -1,40 +1,43 @@ -""" -* | File : epd7in5bc.py -* | Author : Waveshare team -* | Function : Electronic paper driver -* | Info : -*---------------- -* | This version: V4.0 -* | Date : 2019-06-20 -# | Info : python demo ------------------------------------------------------------------------------ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documnetation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furished to do so, subject to the following conditions: +# ***************************************************************************** +# * | File : epd7in5b_V2.py +# * | Author : Waveshare team +# * | Function : Electronic paper driver +# * | Info : +# *---------------- +# * | This version: V4.2 +# * | Date : 2022-01-08 +# # | Info : python demo +# ----------------------------------------------------------------------------- +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -""" import logging -from inkycal.display.drivers import epdconfig +from . import epdconfig # Display resolution EPD_WIDTH = 800 EPD_HEIGHT = 480 +logger = logging.getLogger(__name__) + class EPD: def __init__(self): @@ -66,17 +69,24 @@ class EPD: epdconfig.spi_writebyte([data]) epdconfig.digital_write(self.cs_pin, 1) + def send_data2(self, data): # faster + epdconfig.digital_write(self.dc_pin, 1) + epdconfig.digital_write(self.cs_pin, 0) + epdconfig.spi_writebyte2(data) + epdconfig.digital_write(self.cs_pin, 1) + def ReadBusy(self): - logging.debug("e-Paper busy") + logger.debug("e-Paper busy") self.send_command(0x71) busy = epdconfig.digital_read(self.busy_pin) while (busy == 0): self.send_command(0x71) busy = epdconfig.digital_read(self.busy_pin) epdconfig.delay_ms(200) + logger.debug("e-Paper busy release") def init(self): - if (epdconfig.module_init() != 0): + if epdconfig.module_init() != 0: return -1 self.reset() @@ -92,7 +102,7 @@ class EPD: self.ReadBusy() self.send_command(0X00) # PANNEL SETTING - self.send_data(0x0F) # KW-3f KWR-2F BWROTP 0f BWOTP 1f + self.send_data(0x0F) # KW-3f KWR-2F BWROTP-0f BWOTP-1f self.send_command(0x61) # tres self.send_data(0x03) # source 800 @@ -110,53 +120,56 @@ class EPD: self.send_command(0X60) # TCON SETTING self.send_data(0x22) + self.send_command(0x65) + self.send_data(0x00) + self.send_data(0x00) + self.send_data(0x00) + self.send_data(0x00) + return 0 def getbuffer(self, image): - # logging.debug("bufsiz = ",int(self.width/8) * self.height) - buf = [0xFF] * (int(self.width / 8) * self.height) - image_monocolor = image.convert('1') - imwidth, imheight = image_monocolor.size - pixels = image_monocolor.load() - logging.debug('imwidth = %d imheight = %d ', imwidth, imheight) - if (imwidth == self.width and imheight == self.height): - logging.debug("Horizontal") - for y in range(imheight): - for x in range(imwidth): - # Set the bits for the column of pixels at the current position. - if pixels[x, y] == 0: - buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8)) - elif (imwidth == self.height and imheight == self.width): - logging.debug("Vertical") - for y in range(imheight): - for x in range(imwidth): - newx = y - newy = self.height - x - 1 - if pixels[x, y] == 0: - buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8)) + img = image + imwidth, imheight = img.size + if imwidth == self.width and imheight == self.height: + img = img.convert('1') + elif imwidth == self.height and imheight == self.width: + # image has correct dimensions, but needs to be rotated + img = img.rotate(90, expand=True).convert('1') + else: + logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height)) + # return a blank buffer + return [0x00] * (int(self.width / 8) * self.height) + + buf = bytearray(img.tobytes('raw')) + # The bytes need to be inverted, because in the PIL world 0=black and 1=white, but + # in the e-paper world 0=white and 1=black. + for i in range(len(buf)): + buf[i] ^= 0xFF return buf def display(self, imageblack, imagered): self.send_command(0x10) - for i in range(0, int(self.width * self.height / 8)): - self.send_data(imageblack[i]) + # The black bytes need to be inverted back from what getbuffer did + for i in range(len(imageblack)): + imageblack[i] ^= 0xFF + self.send_data2(imageblack) self.send_command(0x13) - for i in range(0, int(self.width * self.height / 8)): - self.send_data(~imagered[i]) + self.send_data2(imagered) self.send_command(0x12) epdconfig.delay_ms(100) self.ReadBusy() def Clear(self): + buf = [0x00] * (int(self.width / 8) * self.height) + buf2 = [0xff] * (int(self.width / 8) * self.height) self.send_command(0x10) - for i in range(0, int(self.width * self.height / 8)): - self.send_data(0xff) + self.send_data2(buf2) self.send_command(0x13) - for i in range(0, int(self.width * self.height / 8)): - self.send_data(0x00) + self.send_data2(buf) self.send_command(0x12) epdconfig.delay_ms(100) @@ -169,5 +182,5 @@ class EPD: self.send_command(0x07) # DEEP_SLEEP self.send_data(0XA5) + epdconfig.delay_ms(2000) epdconfig.module_exit() -### END OF FILE ### From 3f5446a83fddcc2072026a8d873513ce566b4e02 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 19 Dec 2023 21:46:21 +0100 Subject: [PATCH 13/24] test fix for display render on 2-colour displays --- inkycal/display/display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inkycal/display/display.py b/inkycal/display/display.py index e9fd834..5fb6420 100644 --- a/inkycal/display/display.py +++ b/inkycal/display/display.py @@ -54,7 +54,7 @@ class Display: raise NotImplementedError("Devs were too lazy again, sorry, please try again later") - def render(self, im_black: PIL.Image, im_colour: PIL.Image or None) -> None: + def render(self, im_black: PIL.Image, im_colour: PIL.Image or None=None) -> None: """Renders an image on the selected E-Paper display. Initlializes the E-Paper display, sends image data and executes command From a7c276e8803d2fcefcc9d2c7608f6ecc1cfca517 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 16:32:16 +0100 Subject: [PATCH 14/24] update epdconfig to fix bug --- inkycal/display/drivers/epdconfig.py | 175 +++++++++++++++++++++++---- 1 file changed, 150 insertions(+), 25 deletions(-) diff --git a/inkycal/display/drivers/epdconfig.py b/inkycal/display/drivers/epdconfig.py index df1f584..8eb40e6 100644 --- a/inkycal/display/drivers/epdconfig.py +++ b/inkycal/display/drivers/epdconfig.py @@ -4,12 +4,12 @@ * | Function : Hardware underlying interface * | Info : *---------------- -* | This version: V1.0 -* | Date : 2019-06-21 +* | This version: V1.2 +* | Date : 2022-10-29 * | Info : -****************************************************************************** + Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documnetation files (the "Software"), to deal +of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is @@ -29,6 +29,7 @@ THE SOFTWARE. import logging import os +import subprocess import sys import time @@ -41,21 +42,52 @@ class RaspberryPi: DC_PIN = 25 CS_PIN = 8 BUSY_PIN = 24 + PWR_PIN = 18 def __init__(self): import spidev - import RPi.GPIO + import gpiozero - self.GPIO = RPi.GPIO - - # SPI device, bus = 0, device = 0 - self.SPI = spidev.SpiDev(0, 0) + self.SPI = spidev.SpiDev() + self.GPIO_RST_PIN = gpiozero.LED(self.RST_PIN) + self.GPIO_DC_PIN = gpiozero.LED(self.DC_PIN) + # self.GPIO_CS_PIN = gpiozero.LED(self.CS_PIN) + self.GPIO_PWR_PIN = gpiozero.LED(self.PWR_PIN) + self.GPIO_BUSY_PIN = gpiozero.Button(self.BUSY_PIN, pull_up=False) def digital_write(self, pin, value): - self.GPIO.output(pin, value) + if pin == self.RST_PIN: + if value: + self.GPIO_RST_PIN.on() + else: + self.GPIO_RST_PIN.off() + elif pin == self.DC_PIN: + if value: + self.GPIO_DC_PIN.on() + else: + self.GPIO_DC_PIN.off() + # elif pin == self.CS_PIN: + # if value: + # self.GPIO_CS_PIN.on() + # else: + # self.GPIO_CS_PIN.off() + elif pin == self.PWR_PIN: + if value: + self.GPIO_PWR_PIN.on() + else: + self.GPIO_PWR_PIN.off() def digital_read(self, pin): - return self.GPIO.input(pin) + if pin == self.BUSY_PIN: + return self.GPIO_BUSY_PIN.value + elif pin == self.RST_PIN: + return self.RST_PIN.value + elif pin == self.DC_PIN: + return self.DC_PIN.value + # elif pin == self.CS_PIN: + # return self.CS_PIN.value + elif pin == self.PWR_PIN: + return self.PWR_PIN.value def delay_ms(self, delaytime): time.sleep(delaytime / 1000.0) @@ -63,26 +95,33 @@ class RaspberryPi: def spi_writebyte(self, data): self.SPI.writebytes(data) + def spi_writebyte2(self, data): + self.SPI.writebytes2(data) + def module_init(self): - self.GPIO.setmode(self.GPIO.BCM) - self.GPIO.setwarnings(False) - self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) - self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) - self.GPIO.setup(self.CS_PIN, self.GPIO.OUT) - self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN) + self.GPIO_PWR_PIN.on() + + # SPI device, bus = 0, device = 0 + self.SPI.open(0, 0) self.SPI.max_speed_hz = 4000000 self.SPI.mode = 0b00 return 0 def module_exit(self): logger.debug("spi end") - # self.SPI.close() #removed as it causes some problems + self.SPI.close() + + self.GPIO_RST_PIN.off() + self.GPIO_DC_PIN.off() + self.GPIO_PWR_PIN.off() + + self.GPIO_RST_PIN.close() + self.GPIO_DC_PIN.close() + # self.GPIO_CS_PIN.close() + self.GPIO_PWR_PIN.close() + self.GPIO_BUSY_PIN.close() logger.debug("close 5V, Module enters 0 power consumption ...") - self.GPIO.output(self.RST_PIN, 0) - self.GPIO.output(self.DC_PIN, 0) - - self.GPIO.cleanup() class JetsonNano: @@ -91,6 +130,7 @@ class JetsonNano: DC_PIN = 25 CS_PIN = 8 BUSY_PIN = 24 + PWR_PIN = 18 def __init__(self): import ctypes @@ -123,13 +163,21 @@ class JetsonNano: def spi_writebyte(self, data): self.SPI.SYSFS_software_spi_transfer(data[0]) + def spi_writebyte2(self, data): + for i in range(len(data)): + self.SPI.SYSFS_software_spi_transfer(data[i]) + def module_init(self): self.GPIO.setmode(self.GPIO.BCM) self.GPIO.setwarnings(False) self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) self.GPIO.setup(self.CS_PIN, self.GPIO.OUT) + self.GPIO.setup(self.PWR_PIN, self.GPIO.OUT) self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN) + + self.GPIO.output(self.PWR_PIN, 1) + self.SPI.SYSFS_software_spi_begin() return 0 @@ -140,16 +188,93 @@ class JetsonNano: logger.debug("close 5V, Module enters 0 power consumption ...") self.GPIO.output(self.RST_PIN, 0) self.GPIO.output(self.DC_PIN, 0) + self.GPIO.output(self.PWR_PIN, 0) - self.GPIO.cleanup() + self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN, self.PWR_PIN]) -if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'): +class SunriseX3: + # Pin definition + RST_PIN = 17 + DC_PIN = 25 + CS_PIN = 8 + BUSY_PIN = 24 + PWR_PIN = 18 + Flag = 0 + + def __init__(self): + import spidev + import Hobot.GPIO + + self.GPIO = Hobot.GPIO + self.SPI = spidev.SpiDev() + + def digital_write(self, pin, value): + self.GPIO.output(pin, value) + + def digital_read(self, pin): + return self.GPIO.input(pin) + + def delay_ms(self, delaytime): + time.sleep(delaytime / 1000.0) + + def spi_writebyte(self, data): + self.SPI.writebytes(data) + + def spi_writebyte2(self, data): + # for i in range(len(data)): + # self.SPI.writebytes([data[i]]) + self.SPI.xfer3(data) + + def module_init(self): + if self.Flag == 0: + self.Flag = 1 + self.GPIO.setmode(self.GPIO.BCM) + self.GPIO.setwarnings(False) + self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) + self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) + self.GPIO.setup(self.CS_PIN, self.GPIO.OUT) + self.GPIO.setup(self.PWR_PIN, self.GPIO.OUT) + self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN) + + self.GPIO.output(self.PWR_PIN, 1) + + # SPI device, bus = 0, device = 0 + self.SPI.open(2, 0) + self.SPI.max_speed_hz = 4000000 + self.SPI.mode = 0b00 + return 0 + else: + return 0 + + def module_exit(self): + logger.debug("spi end") + self.SPI.close() + + logger.debug("close 5V, Module enters 0 power consumption ...") + self.Flag = 0 + self.GPIO.output(self.RST_PIN, 0) + self.GPIO.output(self.DC_PIN, 0) + self.GPIO.output(self.PWR_PIN, 0) + + self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN], self.PWR_PIN) + + +if sys.version_info[0] == 2: + process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE) +else: + process = subprocess.Popen("cat /proc/cpuinfo | grep Raspberry", shell=True, stdout=subprocess.PIPE, text=True) +output, _ = process.communicate() +if sys.version_info[0] == 2: + output = output.decode(sys.stdout.encoding) + +if "Raspberry" in output: implementation = RaspberryPi() +elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'): + implementation = SunriseX3() else: implementation = JetsonNano() for func in [x for x in dir(implementation) if not x.startswith('_')]: setattr(sys.modules[__name__], func, getattr(implementation, func)) -### END OF FILE ### From 93ca6dc426a5169add7b4be7c3878149b1bbc5a5 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 16:54:23 +0100 Subject: [PATCH 15/24] update instructions --- .github/workflows/test-on-rpi.yml | 2 +- .github/workflows/update-os.yml | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-on-rpi.yml b/.github/workflows/test-on-rpi.yml index 52b9dc1..d97c918 100644 --- a/.github/workflows/test-on-rpi.yml +++ b/.github/workflows/test-on-rpi.yml @@ -51,7 +51,7 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install -e ./ - pip install RPi.GPIO==0.7.1 spidev==3.5 + pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0 wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json pip install pytest python -m pytest diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 8410fd2..fa7114c 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -46,7 +46,7 @@ jobs: python -m pip install --upgrade pip pip install wheel pip install -e ./ - pip install RPi.GPIO==0.7.1 spidev==3.5 + pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0 wget https://raw.githubusercontent.com/aceinnolab/Inkycal/assets/tests/settings.json pip install pytest python -m pytest diff --git a/README.md b/README.md index 3e3e96a..1187016 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ pip install wheel pip install -e ./ # If you are running on the Raspberry Pi, please install the following too to allow rendering on the display -pip install RPi.GPIO==0.7.1 spidev==3.5 +pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0 ``` ## Running Inkycal From 7c21807458fad61c1e50f49e38f17a8fb3968481 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 18:45:20 +0100 Subject: [PATCH 16/24] Update update-os.yml --- .github/workflows/update-os.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index fa7114c..92b6922 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -84,8 +84,8 @@ jobs: - name: Compress the release image run: | - mv ${{ steps.build_image.outputs.image }} inkycal_os_lite.img - xz -0 -T 0 -v inkycal_os_lite.img + mv ${{ steps.build_image.outputs.image }} InkycalOS_Lite_$(date +'%y%m%d').img + xz -0 -T 0 -v InkycalOS_Lite_$(date +'%y%m%d').img - name: Get latest release version run: | @@ -99,4 +99,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.version }} - files: inkycal_os_lite.img.xz + files: InkycalOS_Lite_$(date +'%y%m%d').img.xz From c0794d7e6da1b36c60c381138decc8e361a10c6a Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 19:05:12 +0100 Subject: [PATCH 17/24] Update update-os.yml --- .github/workflows/update-os.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 92b6922..0fde87a 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -84,8 +84,9 @@ jobs: - name: Compress the release image run: | - mv ${{ steps.build_image.outputs.image }} InkycalOS_Lite_$(date +'%y%m%d').img - xz -0 -T 0 -v InkycalOS_Lite_$(date +'%y%m%d').img + current_date=$(date +'%y%m%d') + mv ${{ steps.build_image.outputs.image }} "InkycalOS_Lite_${current_date}.img" + xz -0 -T 0 -v "InkycalOS_Lite_${current_date}.img" - name: Get latest release version run: | @@ -99,4 +100,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.version }} - files: InkycalOS_Lite_$(date +'%y%m%d').img.xz + files: "InkycalOS_Lite_${current_date}.img.xz" From af1ac7b20de6bdcb0bac5b29d9f1a90194a26c0d Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 19:37:32 +0100 Subject: [PATCH 18/24] Update update-os.yml --- .github/workflows/update-os.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 0fde87a..1571dd0 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -9,8 +9,13 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + env: + CURRENT_DATE: ${{ steps.set_date.outputs.date }} steps: + - name: Set Date + id: set_date + run: echo "date=$(date +'%y%m%d')" >> $GITHUB_ENV - name: Build Raspberry Pi OS uses: pguyot/arm-runner-action@v2 id: build_image @@ -84,9 +89,8 @@ jobs: - name: Compress the release image run: | - current_date=$(date +'%y%m%d') - mv ${{ steps.build_image.outputs.image }} "InkycalOS_Lite_${current_date}.img" - xz -0 -T 0 -v "InkycalOS_Lite_${current_date}.img" + mv ${{ steps.build_image.outputs.image }} "InkycalOS_Lite_${CURRENT_DATE}.img" + xz -0 -T 0 -v "InkycalOS_Lite_${CURRENT_DATE}.img" - name: Get latest release version run: | @@ -98,6 +102,7 @@ jobs: uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILES: "InkycalOS_Lite_${CURRENT_DATE}.img.xz" with: tag_name: ${{ env.version }} - files: "InkycalOS_Lite_${current_date}.img.xz" + files: ${{ env.FILES }} From c91096c967e792ed0a954d59ac1d73004595c19c Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 19:40:49 +0100 Subject: [PATCH 19/24] Update update-os.yml --- .github/workflows/update-os.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 1571dd0..dca697b 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -10,7 +10,8 @@ jobs: permissions: contents: write env: - CURRENT_DATE: ${{ steps.set_date.outputs.date }} + CURRENT_DATE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.date ? github.event.inputs.date : (env.DATE_OVERRIDE ? env.DATE_OVERRIDE : '') }} + steps: - name: Set Date From c5b3b02349fee0823923984255132a4548315637 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 19:49:00 +0100 Subject: [PATCH 20/24] Update update-os.yml --- .github/workflows/update-os.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index dca697b..babd17a 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -10,8 +10,7 @@ jobs: permissions: contents: write env: - CURRENT_DATE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.date ? github.event.inputs.date : (env.DATE_OVERRIDE ? env.DATE_OVERRIDE : '') }} - + CURRENT_DATE: "$(date +%Y%m%d%H%M)" steps: - name: Set Date From 999a0d3e7d531e41b9b75d933d73dc296320fe96 Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 20:09:40 +0100 Subject: [PATCH 21/24] revert --- .github/workflows/update-os.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index babd17a..4b85b7d 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -9,13 +9,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - env: - CURRENT_DATE: "$(date +%Y%m%d%H%M)" steps: - - name: Set Date - id: set_date - run: echo "date=$(date +'%y%m%d')" >> $GITHUB_ENV - name: Build Raspberry Pi OS uses: pguyot/arm-runner-action@v2 id: build_image @@ -89,8 +84,8 @@ jobs: - name: Compress the release image run: | - mv ${{ steps.build_image.outputs.image }} "InkycalOS_Lite_${CURRENT_DATE}.img" - xz -0 -T 0 -v "InkycalOS_Lite_${CURRENT_DATE}.img" + mv ${{ steps.build_image.outputs.image }} InkycalOS_Lite.img + xz -0 -T 0 -v InkycalOS_Lite.img - name: Get latest release version run: | @@ -102,7 +97,6 @@ jobs: uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILES: "InkycalOS_Lite_${CURRENT_DATE}.img.xz" with: tag_name: ${{ env.version }} - files: ${{ env.FILES }} + files: InkycalOS_Lite.img From bc1abe17301865a7a2613d5e9c4bb7b874c2712d Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 20:24:35 +0100 Subject: [PATCH 22/24] Update update-os.yml --- .github/workflows/update-os.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 4b85b7d..505cf0f 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -99,4 +99,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.version }} - files: InkycalOS_Lite.img + files: InkycalOS_Lite.img.xz From d23a4500a085aebbf27a6ed606490f527a5fc7df Mon Sep 17 00:00:00 2001 From: Ace Date: Thu, 21 Dec 2023 23:39:03 +0100 Subject: [PATCH 23/24] added latest featured article --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1187016..dd06b50 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,7 @@ perks after confirming 💯 * [ittagesschau.de](https://www.ittagesschau.de/artikel/inkycal-v3-smartes-display-auf-grundlage-des-raspberry-pi-mit-elektronischem-papier-und-vielen-moglichkeiten_365893) * [makeuseof - fantastic projects using an eink display](http://makeuseof.com/fantastic-projects-using-an-e-ink-display/) * [notebookcheck.com](https://www.notebookcheck.com/Inkycal-V3-Smartes-Display-auf-Grundlage-des-Raspberry-Pi-mit-elektronischem-Papier-und-vielen-Moeglichkeiten.783012.0.html?ref=ittagesschau.de) +* [moreware.com](https://www.moreware.org/wp/blog/2023/12/18/inkycal-v3-dashboard-con-display-e-paper-e-raspberry-pi/) * [Waveshare - additional resources](https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT) * [ereaderpro.co.uk](https://www.ereaderpro.co.uk/blogs/news/e-ink-product-made-in-germany-inkycal-v3) * [cnx-software.com](https://www.cnx-software.com/2023/12/13/inkycal-v3-is-a-raspberry-pi-powered-epaper-dashboard-for-your-desk/) From 094b31e1de4aa05934b477152118144f5a2e774d Mon Sep 17 00:00:00 2001 From: Ace Date: Fri, 22 Dec 2023 21:34:47 +0100 Subject: [PATCH 24/24] add latest articles --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index dd06b50..19b0eb5 100644 --- a/README.md +++ b/README.md @@ -281,9 +281,12 @@ perks after confirming 💯 * [raspberrypi.com](https://www.raspberrypi.com/news/ashleys-top-five-projects-for-raspberry-pi-first-timers/) * [hackster.io](https://www.hackster.io/news/ace-innovation-lab-s-inkycal-v3-puts-a-raspberry-pi-powered-modular-epaper-dashboard-on-your-desk-b55a83cc0f46) * [raspberryme.com](https://www.raspberryme.com/inkycal-v3-est-un-tableau-de-bord-epaper-alimente-par-raspberry-pi-pour-votre-bureau/) +* [adafruit.com](https://blog.adafruit.com/2023/12/19/icymi-python-on-microcontrollers-newsletter-circuitpython-9-alpha-6-released-gpt-via-circuitpython-new-books-and-more-circuitpython-python-micropython-icymi-raspberry_pi/) * [ittagesschau.de](https://www.ittagesschau.de/artikel/inkycal-v3-smartes-display-auf-grundlage-des-raspberry-pi-mit-elektronischem-papier-und-vielen-moglichkeiten_365893) * [makeuseof - fantastic projects using an eink display](http://makeuseof.com/fantastic-projects-using-an-e-ink-display/) * [notebookcheck.com](https://www.notebookcheck.com/Inkycal-V3-Smartes-Display-auf-Grundlage-des-Raspberry-Pi-mit-elektronischem-Papier-und-vielen-Moeglichkeiten.783012.0.html?ref=ittagesschau.de) +* [linkedin.com](https://www.linkedin.com/pulse/global-epaper-industry-weekly-bulletin-16epaper-jtcqe?trk=article-ssr-frontend-pulse_more-articles_related-content-card) +* [sohu.com](https://www.sohu.com/a/745630839_121311165) * [moreware.com](https://www.moreware.org/wp/blog/2023/12/18/inkycal-v3-dashboard-con-display-e-paper-e-raspberry-pi/) * [Waveshare - additional resources](https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT) * [ereaderpro.co.uk](https://www.ereaderpro.co.uk/blogs/news/e-ink-product-made-in-germany-inkycal-v3)