forked from lvgl-micropython/lvgl_micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_driver_framework.pyi
296 lines (222 loc) · 7.9 KB
/
display_driver_framework.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
from typing import Optional, Tuple, Union, ClassVar, Callable, List, Any
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import micropython # NOQA
import machine # NOQA
import lvgl as lv # NOQA
import array # NOQA
import io_expander_framework # NOQA
import lcd_bus
# Constants
BYTE_ORDER_RGB: int = ...
BYTE_ORDER_BGR: int = ...
STATE_HIGH: int = ...
STATE_LOW: int = ...
STATE_PWM: int = ...
_BufferType = Union[bytearray, memoryview, bytes, array.array]
_PinType = Union[machine.Pin, int, io_expander_framework.Pin]
_DatabusType = Union[lcd_bus.I80Bus, lcd_bus.I2CBus, lcd_bus.RGBBus, lcd_bus.SPIBus, lcd_bus.SDLBus]
class DisplayDriver:
_INVON: ClassVar[int] = ...
_INVOFF: ClassVar[int] = ...
# MADCTL values for each of the orientation constants for non-st7789 displays.
_ORIENTATION_TABLE: ClassVar[Tuple[int, int, int, int]] = ...
_displays: ClassVar[_DatabusType] = ...
display_width: int = ...
display_height: int = ...
_reset_pin: Optional[_PinType] = ...
_reset_state: int = ...
_power_pin: Optional[_PinType] = ...
_power_on_state: int = ...
_backlight_pin: Optional[_PinType] = ...
_backlight_on_state: int = ...
_offset_x: int = ...
_offset_y: int = ...
_data_bus: _DatabusType = ...
_param_buf: bytearray = ...
_param_mv: memoryview = ...
_disp_drv: lv.display_driver_t = ... # NOQA
_color_byte_order: int = ...
_color_space: int = ...
_physical_width: int = ...
_physical_height: int = ...
_initilized: bool = ...
_frame_buffer1: Optional[_BufferType] = ...
_frame_buffer2: Optional[_BufferType] = ...
_backup_set_memory_location: Optional[Callable] = ...
_rotation: int = ...
_spi_3wire: lcd_bus.SPI3Wire = None
# Default values of "power" and "backlight" are reversed logic! 0 means ON.
# You can change this by setting backlight_on and power_on arguments.
#
# For the ESP32 the allocation of the frame buffers can be done one of 2
# ways depending on what is wanted in terms of performance VS memory use
# If a single frame buffer is used then using a DMA transfer is pointless
# to do. The frame buffer in this casse can be allocated as simple as
#
# buf = bytearray(buffer_size)
#
# If the user wants to be able to specify if the frame buffer is to be
# created in internal memory (SRAM) or in external memory (PSRAM/SPIRAM)
# this can be done using the heap_caps module.
#
# internal memory:
# buf = heap_caps.malloc(buffer_size, heap_caps.CAP_INTERNAL)
#
# external memory:
# buf = heap_caps.malloc(buffer_size, heap_caps.CAP_SPIRAM)
#
# If wanting to use DMA memory then use the bitwise OR "|" operator to add
# the DMA flag to the last parameter of the malloc function
#
# buf = heap_caps.malloc(
# buffer_size, heap_caps.CAP_INTERNAL | heap_caps.CAP_DMA
# )
@staticmethod
def get_default() -> "DisplayDriver":
...
@staticmethod
def get_displays() -> List["DisplayDriver"]:
...
def __init__(
self,
data_bus: _DatabusType,
display_width: int,
display_height: int,
frame_buffer1: Optional[_BufferType] = None,
frame_buffer2: Optional[_BufferType] = None,
reset_pin: Optional[_PinType] = None,
reset_state: int = STATE_HIGH,
power_pin: Optional[_PinType] = None,
power_on_state: int = STATE_HIGH,
backlight_pin: Optional[_PinType] = None,
backlight_on_state: int = STATE_HIGH,
offset_x: int = 0,
offset_y: int = 0,
color_byte_order: int = BYTE_ORDER_RGB,
color_space: int = lv.COLOR_FORMAT.RGB888, # NOQA
rgb565_byte_swap: bool = False,
spi_3wire: Optional[lcd_bus.SPI3Wire] = None,
_cmd_bits: int = 8,
_param_bits: int = 8
) -> object:
...
def set_physical_resolution(self, width: int, height: int) -> None:
...
def get_physical_horizontal_resolution(self) -> int:
...
def get_physical_vertical_resolution(self) -> int:
...
def set_physical_horizontal_resolution(self, width: int) -> None:
...
def set_physical_vertical_resolution(self, height: int) -> None:
...
def get_next(self) -> "DisplayDriver":
...
def set_offset(self, x: int, y: int) -> None:
...
def get_offset_x(self) -> int:
...
def get_offset_y(self) -> int:
...
def get_dpi(self) -> int:
...
def set_dpi(self, dpi: int) -> None:
...
def set_color_format(self, color_space: int) -> None:
...
def get_color_format(self) -> int:
...
def set_antialiasing(self, en: bool) -> None:
...
def get_antialiasing(self) -> bool:
...
def is_double_buffered(self) -> bool:
...
def get_screen_active(self) -> lv.obj: # NOQA
...
def get_screen_prev(self) -> lv.obj: # NOQA
...
def get_layer_top(self) -> lv.obj: # NOQA
...
def get_layer_sys(self) -> lv.obj: # NOQA
...
def get_layer_bottom(self) -> lv.obj: # NOQA
...
def add_event_cb(self, event_cb, filter, user_data) -> None: # NOQA
...
def get_event_count(self) -> int:
...
def get_event_dsc(self, index: int) -> lv.event_dsc_t:
...
def delete_event(self, index: int) -> bool:
...
def send_event(self, code: int, param: Any) -> int:
...
def set_theme(self, th: lv.theme_t) -> None:
...
def get_theme(self) -> lv.theme_t:
...
def get_inactive_time(self) -> int:
...
def trigger_activity(self) -> None:
...
def enable_invalidation(self, en: bool) -> None:
...
def is_invalidation_enabled(self) -> bool:
...
def get_refr_timer(self) -> lv.timer_t:
...
def delete_refr_timer(self) -> None:
...
def invert_colors(self) -> None:
...
def set_default(self) -> None:
...
def get_rotation(self) -> int:
...
def set_rotation(self, value: int) -> None:
...
def get_horizontal_resolution(self) -> int:
...
def get_vertical_resolution(self) -> int:
...
def init(self) -> None:
...
def set_params(self, cmd: int, params: Optional[_BufferType] = None) -> None:
...
def get_params(self, cmd: int, params: _BufferType) -> None:
...
def get_power(self) -> bool:
...
def set_power(self, value: bool) -> None:
...
def delete(self) -> None:
...
def __del__(self):
...
def reset(self) -> None:
...
def get_backlight(self) -> Union[int, float]:
...
def set_backlight(self, value: Union[int, float]) -> None:
...
def _dummy_set_memory_location(self, *_, **__) -> int: # NOQA
...
# this function is handeled in the viper code emitter. This will
# increase the performance to near C code execution times. While this is
# not really heavy lifting in terms of work being done every cycle counts
# and it adds up over time. Need to keep things running as fast as possible.
def _set_memory_location(self, x1: int, y1: int, x2: int, y2: int) -> int:
...
def _flush_cb(self, disp: lv.display_driver_t, area: lv.area_t, color_p: lv.CArray) -> None: # NOQA
...
# we always register this callback no matter what. This is what tells LVGL
# that the buffer is able to be written to. If this callback doesn't get
# registered then the flush function is going to block until the buffer
# gets emptied. Everything is handeled internally in the bus driver if
# using DMA and double buffer or a single buffer.
def _flush_ready_cb(self, *param) -> None:
...
def _madctl(self, colormode: int, rotations: Tuple[int, int, int, int], rotation: Optional[int] = None) -> int:
...