4040#include "shared-module/displayio/__init__.h"
4141#include "supervisor/shared/translate.h"
4242
43- //| .. currentmodule:: framebufferio
43+ //| class FramebufferDisplay:
44+ //| """.. currentmodule:: framebufferio
4445//|
45- //| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
46- //| ================================================================================
46+ //| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
47+ //| ================================================================================
4748//|
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."""
5152//|
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)
5355//|
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+ //| ...
6061//|
6162STATIC 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 ) {
6263 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
9697 return MP_OBJ_TO_PTR (native_display );
9798}
9899
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.
103103//|
104- //| :param Group group: The group to show.
104+ //| :param Group group: The group to show."""
105+ //| ...
105106//|
106107STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show (mp_obj_t self_in , mp_obj_t group_in ) {
107108 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
118119}
119120MP_DEFINE_CONST_FUN_OBJ_2 (framebufferio_framebufferdisplay_show_obj , framebufferio_framebufferdisplay_obj_show );
120121
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.
127127//|
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.
130130//|
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.)
133133//|
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+ //| ...
136137//|
137138STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
138139 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
153154}
154155MP_DEFINE_CONST_FUN_OBJ_KW (framebufferio_framebufferdisplay_refresh_obj , 1 , framebufferio_framebufferdisplay_obj_refresh );
155156
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."""
159159//|
160160STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh (mp_obj_t self_in ) {
161161 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -179,11 +179,10 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = {
179179 (mp_obj_t )& mp_const_none_obj },
180180};
181181
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
185184//| `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."""
187186//|
188187STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness (mp_obj_t self_in ) {
189188 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -217,12 +216,11 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = {
217216 (mp_obj_t )& mp_const_none_obj },
218217};
219218
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
223221//| light sensor or other method. Note that some displays may have this set to True by default,
224222//| 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."""
226224//|
227225STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness (mp_obj_t self_in ) {
228226 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -249,9 +247,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = {
249247 (mp_obj_t )& mp_const_none_obj },
250248};
251249
252- //| .. attribute:: width
253- //|
254- //| Gets the width of the framebuffer
250+ //| width: Any = ...
251+ //| """Gets the width of the framebuffer"""
255252//|
256253STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width (mp_obj_t self_in ) {
257254 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -266,9 +263,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = {
266263 (mp_obj_t )& mp_const_none_obj },
267264};
268265
269- //| .. attribute:: height
270- //|
271- //| Gets the height of the framebuffer
266+ //| height: Any = ...
267+ //| """Gets the height of the framebuffer"""
272268//|
273269STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height (mp_obj_t self_in ) {
274270 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -283,9 +279,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = {
283279 (mp_obj_t )& mp_const_none_obj },
284280};
285281
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."""
289284//|
290285STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation (mp_obj_t self_in ) {
291286 framebufferio_framebufferdisplay_obj_t * self = native_display (self_in );
@@ -307,9 +302,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = {
307302 (mp_obj_t )& mp_const_none_obj },
308303};
309304
310- //| .. attribute:: framebuffer
311- //|
312- //| The framebuffer being used by the display
305+ //| framebuffer: Any = ...
306+ //| """The framebuffer being used by the display"""
313307//|
314308//|
315309STATIC 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 = {
326320};
327321
328322
329- //| .. method:: fill_row(y, buffer)
323+ //| def fill_row(self, y: int, buffer: bytearray) -> Any:
324+ //| """Extract the pixels from a single row
330325//|
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+ //| ...
332329//|
333- //| :param int y: The top edge of the area
334- //| :param bytearray buffer: The buffer in which to place the pixel data
335330STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
336331 enum { ARG_y , ARG_buffer };
337332 static const mp_arg_t allowed_args [] = {
0 commit comments