40
40
#include "shared-module/displayio/__init__.h"
41
41
#include "supervisor/shared/translate.h"
42
42
43
- //| .. currentmodule:: framebufferio
43
+ //| class FramebufferDisplay:
44
+ //| """.. currentmodule:: framebufferio
44
45
//|
45
- //| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
46
- //| ================================================================================
46
+ //| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
47
+ //| ================================================================================
47
48
//|
48
- //| This initializes a display and connects it into CircuitPython. Unlike other
49
- //| objects in CircuitPython, Display objects live until `displayio.release_displays()`
50
- //| is called. This is done so that CircuitPython can use the display itself.
49
+ //| This initializes a display and connects it into CircuitPython. Unlike other
50
+ //| objects in CircuitPython, Display objects live until `displayio.release_displays()`
51
+ //| is called. This is done so that CircuitPython can use the display itself."""
51
52
//|
52
- //| .. class:: FramebufferDisplay(framebuffer, *, rotation=0, auto_refresh=True)
53
+ //| def __init__(self, framebuffer: Any, *, rotation: int = 0, auto_refresh: bool = True):
54
+ //| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
53
55
//|
54
- //| Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
55
- //|
56
- //| :param framebuffer: The framebuffer that the display is connected to
57
- //| :type framebuffer: any core object implementing the framebuffer protocol
58
- //| :param bool auto_refresh: Automatically refresh the screen
59
- //| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
56
+ //| :param framebuffer: The framebuffer that the display is connected to
57
+ //| :type framebuffer: any core object implementing the framebuffer protocol
58
+ //| :param bool auto_refresh: Automatically refresh the screen
59
+ //| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)"""
60
+ //| ...
60
61
//|
61
62
STATIC mp_obj_t framebufferio_framebufferdisplay_make_new (const mp_obj_type_t * type , size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
62
63
enum { ARG_framebuffer , ARG_rotation , ARG_auto_refresh , NUM_ARGS };
@@ -96,12 +97,12 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o
96
97
return MP_OBJ_TO_PTR (native_display );
97
98
}
98
99
99
- //| .. method:: show(group)
100
- //|
101
- //| Switches to displaying the given group of layers. When group is None, the default
102
- //| CircuitPython terminal will be shown.
100
+ //| def show(self, group: Group) -> Any:
101
+ //| """Switches to displaying the given group of layers. When group is None, the default
102
+ //| CircuitPython terminal will be shown.
103
103
//|
104
- //| :param Group group: The group to show.
104
+ //| :param Group group: The group to show."""
105
+ //| ...
105
106
//|
106
107
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show (mp_obj_t self_in , mp_obj_t group_in ) {
107
108
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -118,21 +119,21 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_o
118
119
}
119
120
MP_DEFINE_CONST_FUN_OBJ_2 (framebufferio_framebufferdisplay_show_obj , framebufferio_framebufferdisplay_obj_show );
120
121
121
- //| .. method:: refresh(*, target_frames_per_second=60, minimum_frames_per_second=1)
122
- //|
123
- //| When auto refresh is off, waits for the target frame rate and then refreshes the display,
124
- //| returning True. If the call has taken too long since the last refresh call for the given
125
- //| target frame rate, then the refresh returns False immediately without updating the screen to
126
- //| hopefully help getting caught up.
122
+ //| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any:
123
+ //| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
124
+ //| returning True. If the call has taken too long since the last refresh call for the given
125
+ //| target frame rate, then the refresh returns False immediately without updating the screen to
126
+ //| hopefully help getting caught up.
127
127
//|
128
- //| If the time since the last successful refresh is below the minimum frame rate, then an
129
- //| exception will be raised. Set minimum_frames_per_second to 0 to disable.
128
+ //| If the time since the last successful refresh is below the minimum frame rate, then an
129
+ //| exception will be raised. Set minimum_frames_per_second to 0 to disable.
130
130
//|
131
- //| When auto refresh is on, updates the display immediately. (The display will also update
132
- //| without calls to this.)
131
+ //| When auto refresh is on, updates the display immediately. (The display will also update
132
+ //| without calls to this.)
133
133
//|
134
- //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
135
- //| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
134
+ //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
135
+ //| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
136
+ //| ...
136
137
//|
137
138
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
138
139
enum { ARG_target_frames_per_second , ARG_minimum_frames_per_second };
@@ -153,9 +154,8 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons
153
154
}
154
155
MP_DEFINE_CONST_FUN_OBJ_KW (framebufferio_framebufferdisplay_refresh_obj , 1 , framebufferio_framebufferdisplay_obj_refresh );
155
156
156
- //| .. attribute:: auto_refresh
157
- //|
158
- //| True when the display is refreshed automatically.
157
+ //| auto_refresh: Any = ...
158
+ //| """True when the display is refreshed automatically."""
159
159
//|
160
160
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh (mp_obj_t self_in ) {
161
161
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -179,11 +179,10 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = {
179
179
(mp_obj_t )& mp_const_none_obj },
180
180
};
181
181
182
- //| .. attribute:: brightness
183
- //|
184
- //| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
182
+ //| brightness: Any = ...
183
+ //| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
185
184
//| `auto_brightness` is True, the value of `brightness` will change automatically.
186
- //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.
185
+ //| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
187
186
//|
188
187
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness (mp_obj_t self_in ) {
189
188
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -217,12 +216,11 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = {
217
216
(mp_obj_t )& mp_const_none_obj },
218
217
};
219
218
220
- //| .. attribute:: auto_brightness
221
- //|
222
- //| True when the display brightness is adjusted automatically, based on an ambient
219
+ //| auto_brightness: Any = ...
220
+ //| """True when the display brightness is adjusted automatically, based on an ambient
223
221
//| light sensor or other method. Note that some displays may have this set to True by default,
224
222
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
225
- //| if `brightness` is set manually.
223
+ //| if `brightness` is set manually."""
226
224
//|
227
225
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness (mp_obj_t self_in ) {
228
226
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -249,9 +247,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = {
249
247
(mp_obj_t )& mp_const_none_obj },
250
248
};
251
249
252
- //| .. attribute:: width
253
- //|
254
- //| Gets the width of the framebuffer
250
+ //| width: Any = ...
251
+ //| """Gets the width of the framebuffer"""
255
252
//|
256
253
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width (mp_obj_t self_in ) {
257
254
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -266,9 +263,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = {
266
263
(mp_obj_t )& mp_const_none_obj },
267
264
};
268
265
269
- //| .. attribute:: height
270
- //|
271
- //| Gets the height of the framebuffer
266
+ //| height: Any = ...
267
+ //| """Gets the height of the framebuffer"""
272
268
//|
273
269
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height (mp_obj_t self_in ) {
274
270
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -283,9 +279,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = {
283
279
(mp_obj_t )& mp_const_none_obj },
284
280
};
285
281
286
- //| .. attribute:: rotation
287
- //|
288
- //| The rotation of the display as an int in degrees.
282
+ //| rotation: Any = ...
283
+ //| """The rotation of the display as an int in degrees."""
289
284
//|
290
285
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation (mp_obj_t self_in ) {
291
286
framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -307,9 +302,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = {
307
302
(mp_obj_t )& mp_const_none_obj },
308
303
};
309
304
310
- //| .. attribute:: framebuffer
311
- //|
312
- //| The framebuffer being used by the display
305
+ //| framebuffer: Any = ...
306
+ //| """The framebuffer being used by the display"""
313
307
//|
314
308
//|
315
309
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_framebuffer (mp_obj_t self_in ) {
@@ -326,12 +320,13 @@ const mp_obj_property_t framebufferio_framebufferframebuffer_obj = {
326
320
};
327
321
328
322
329
- //| .. method:: fill_row(y, buffer)
323
+ //| def fill_row(self, y: int, buffer: bytearray) -> Any:
324
+ //| """Extract the pixels from a single row
330
325
//|
331
- //| Extract the pixels from a single row
326
+ //| :param int y: The top edge of the area
327
+ //| :param bytearray buffer: The buffer in which to place the pixel data"""
328
+ //| ...
332
329
//|
333
- //| :param int y: The top edge of the area
334
- //| :param bytearray buffer: The buffer in which to place the pixel data
335
330
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
336
331
enum { ARG_y , ARG_buffer };
337
332
static const mp_arg_t allowed_args [] = {
0 commit comments