]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blob - displayio/epaperdisplay.py
Removed duplicate stubs
[hackapet/Adafruit_Blinka_Displayio.git] / displayio / epaperdisplay.py
1 # The MIT License (MIT)
2 #
3 # Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 # THE SOFTWARE.
22
23 """
24 `displayio.epaperdisplay`
25 ================================================================================
26
27 displayio for Blinka
28
29 **Software and Dependencies:**
30
31 * Adafruit Blinka:
32   https://github.com/adafruit/Adafruit_Blinka/releases
33
34 * Author(s): Melissa LeBlanc-Williams
35
36 """
37
38 import time
39 import digitalio
40 from recordclass import recordclass
41 from PIL import Image
42 from displayio.bitmap import Bitmap
43 from displayio.colorconverter import ColorConverter
44
45 __version__ = "0.0.0-auto.0"
46 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
47
48 # pylint: disable=unnecessary-pass, unused-argument
49
50 Rectangle = recordclass("Rectangle", "x1 y1 x2 y2")
51 Transform = recordclass("Transform", "x y dx dy scale transpose_xy mirror_x mirror_y")
52
53
54 class EPaperDisplay:
55     """Manage updating an epaper display over a display bus
56
57     This initializes an epaper display and connects it into CircuitPython. Unlike other
58     objects in CircuitPython, EPaperDisplay objects live until
59     displayio.release_displays() is called. This is done so that CircuitPython can use
60     the display itself.
61
62     Most people should not use this class directly. Use a specific display driver instead
63     that will contain the startup and shutdown sequences at minimum.
64     """
65
66     # pylint: disable=too-many-locals
67     def __init__(
68         self,
69         display_bus,
70         start_sequence,
71         stop_sequence,
72         *,
73         width,
74         height,
75         ram_width,
76         ram_height,
77         colstart=0,
78         rowstart=0,
79         rotation=0,
80         set_column_window_command=None,
81         set_row_window_command=None,
82         single_byte_bounds=False,
83         write_black_ram_command,
84         black_bits_inverted=False,
85         write_color_ram_command=None,
86         color_bits_inverted=False,
87         highlight_color=0x000000,
88         refresh_display_command,
89         refresh_time=40,
90         busy_pin=None,
91         busy_state=True,
92         seconds_per_frame=180,
93         always_toggle_chip_select=False
94     ):
95         """
96         Create a EPaperDisplay object on the given display bus (displayio.FourWire or
97         displayio.ParallelBus).
98
99         The start_sequence and stop_sequence are bitpacked to minimize the ram impact. Every
100         command begins with a command byte followed by a byte to determine the parameter
101         count and if a delay is need after. When the top bit of the second byte is 1, the
102         next byte will be the delay time in milliseconds. The remaining 7 bits are the
103         parameter count excluding any delay byte. The third through final bytes are the
104         remaining command parameters. The next byte will begin a new command definition.
105         """
106         pass
107
108     # pylint: enable=too-many-locals
109
110     def show(self, group):
111         """Switches to displaying the given group of layers. When group is None, the default
112         CircuitPython terminal will be shown (eventually).
113         """
114         pass
115
116     def refresh(self):
117         """Refreshes the display immediately or raises an exception if too soon. Use
118         ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.
119         """
120         pass
121
122     @property
123     def time_to_refresh(self):
124         """Time, in fractional seconds, until the ePaper display can be refreshed."""
125         return 0
126
127     @property
128     def width(self):
129         """Display Width"""
130         pass
131
132     @property
133     def height(self):
134         """Display Height"""
135         pass
136
137     @property
138     def bus(self):
139         """Current Display Bus"""
140         pass