]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blob - displayio/epaperdisplay.py
f7a6e11dbf1eeb9ff62317c703b568df1a0b019e
[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
39 __version__ = "0.0.0-auto.0"
40 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
41
42 # pylint: disable=unnecessary-pass, unused-argument
43
44
45 class EPaperDisplay:
46     """Manage updating an epaper display over a display bus
47
48     This initializes an epaper display and connects it into CircuitPython. Unlike other
49     objects in CircuitPython, EPaperDisplay objects live until
50     displayio.release_displays() is called. This is done so that CircuitPython can use
51     the display itself.
52
53     Most people should not use this class directly. Use a specific display driver instead
54     that will contain the startup and shutdown sequences at minimum.
55     """
56
57     # pylint: disable=too-many-locals
58     def __init__(
59         self,
60         display_bus,
61         start_sequence,
62         stop_sequence,
63         *,
64         width,
65         height,
66         ram_width,
67         ram_height,
68         colstart=0,
69         rowstart=0,
70         rotation=0,
71         set_column_window_command=None,
72         set_row_window_command=None,
73         single_byte_bounds=False,
74         write_black_ram_command,
75         black_bits_inverted=False,
76         write_color_ram_command=None,
77         color_bits_inverted=False,
78         highlight_color=0x000000,
79         refresh_display_command,
80         refresh_time=40,
81         busy_pin=None,
82         busy_state=True,
83         seconds_per_frame=180,
84         always_toggle_chip_select=False
85     ):
86         """
87         Create a EPaperDisplay object on the given display bus (displayio.FourWire or
88         displayio.ParallelBus).
89
90         The start_sequence and stop_sequence are bitpacked to minimize the ram impact. Every
91         command begins with a command byte followed by a byte to determine the parameter
92         count and if a delay is need after. When the top bit of the second byte is 1, the
93         next byte will be the delay time in milliseconds. The remaining 7 bits are the
94         parameter count excluding any delay byte. The third through final bytes are the
95         remaining command parameters. The next byte will begin a new command definition.
96         """
97         pass
98
99     # pylint: enable=too-many-locals
100
101     def show(self, group):
102         """Switches to displaying the given group of layers. When group is None, the default
103         CircuitPython terminal will be shown (eventually).
104         """
105         pass
106
107     def refresh(self):
108         """Refreshes the display immediately or raises an exception if too soon. Use
109         ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.
110         """
111         pass
112
113     @property
114     def time_to_refresh(self):
115         """Time, in fractional seconds, until the ePaper display can be refreshed."""
116         return 0
117
118     @property
119     def width(self):
120         """Display Width"""
121         pass
122
123     @property
124     def height(self):
125         """Display Height"""
126         pass
127
128     @property
129     def bus(self):
130         """Current Display Bus"""
131         pass