Skip to content

Commit a3d5adb

Browse files
committed
Did _eve, fontio, framebufferio, and frequencyio
1 parent 2ebe303 commit a3d5adb

File tree

8 files changed

+371
-364
lines changed

8 files changed

+371
-364
lines changed

shared-bindings/_eve/__init__.c

Lines changed: 226 additions & 215 deletions
Large diffs are not rendered by default.

shared-bindings/fontio/BuiltinFont.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@
3636
#include "shared-bindings/util.h"
3737
#include "supervisor/shared/translate.h"
3838

39-
//| .. currentmodule:: fontio
39+
//| class BuiltinFont:
40+
//| """.. currentmodule:: fontio
4041
//|
41-
//| :class:`BuiltinFont` -- A font built into CircuitPython
42-
//| =========================================================================================
42+
//| :class:`BuiltinFont` -- A font built into CircuitPython
43+
//| =========================================================================================
4344
//|
44-
//| A font built into CircuitPython.
45+
//| A font built into CircuitPython."""
4546
//|
46-
//| .. class:: BuiltinFont()
47-
//|
48-
//| Creation not supported. Available fonts are defined when CircuitPython is built. See the
49-
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
50-
//| library for dynamically loaded fonts.
47+
//| def __init__(self, ):
48+
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the
49+
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
50+
//| library for dynamically loaded fonts."""
51+
//| ...
5152
//|
5253

53-
//| .. attribute:: bitmap
54-
//|
55-
//| Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
54+
//| bitmap: Any = ...
55+
//| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
5656
//| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and
57-
//| `terminalio.Terminal`.
57+
//| `terminalio.Terminal`."""
5858
//|
5959
STATIC mp_obj_t fontio_builtinfont_obj_get_bitmap(mp_obj_t self_in) {
6060
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);
@@ -69,9 +69,9 @@ const mp_obj_property_t fontio_builtinfont_bitmap_obj = {
6969
(mp_obj_t)&mp_const_none_obj},
7070
};
7171

72-
//| .. method:: get_bounding_box()
73-
//|
74-
//| Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height.
72+
//| def get_bounding_box(self, ) -> Any:
73+
//| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height."""
74+
//| ...
7575
//|
7676
STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) {
7777
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);
@@ -81,9 +81,9 @@ STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) {
8181
MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box);
8282

8383

84-
//| .. method:: get_glyph(codepoint)
85-
//|
86-
//| Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available.
84+
//| def get_glyph(self, codepoint: Any) -> Any:
85+
//| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available."""
86+
//| ...
8787
//|
8888
STATIC mp_obj_t fontio_builtinfont_obj_get_glyph(mp_obj_t self_in, mp_obj_t codepoint_obj) {
8989
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);

shared-bindings/fontio/Glyph.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,24 @@
2828

2929
#include <stdint.h>
3030

31-
//| .. currentmodule:: fontio
31+
//| class Glyph:
32+
//| """.. currentmodule:: fontio
3233
//|
33-
//| :class:`Glyph` -- Storage of glyph info
34-
//| ==========================================================================
34+
//| :class:`Glyph` -- Storage of glyph info
35+
//| =========================================================================="""
3536
//|
36-
//| .. class:: Glyph(bitmap, tile_index, width, height, dx, dy, shift_x, shift_y)
37+
//| def __init__(self, bitmap: displayio.Bitmap, tile_index: int, width: int, height: int, dx: int, dy: int, shift_x: int, shift_y: int):
38+
//| """Named tuple used to capture a single glyph and its attributes.
3739
//|
38-
//| Named tuple used to capture a single glyph and its attributes.
39-
//|
40-
//| :param displayio.Bitmap bitmap: the bitmap including the glyph
41-
//| :param int tile_index: the tile index within the bitmap
42-
//| :param int width: the width of the glyph's bitmap
43-
//| :param int height: the height of the glyph's bitmap
44-
//| :param int dx: x adjustment to the bitmap's position
45-
//| :param int dy: y adjustment to the bitmap's position
46-
//| :param int shift_x: the x difference to the next glyph
47-
//| :param int shift_y: the y difference to the next glyph
40+
//| :param displayio.Bitmap bitmap: the bitmap including the glyph
41+
//| :param int tile_index: the tile index within the bitmap
42+
//| :param int width: the width of the glyph's bitmap
43+
//| :param int height: the height of the glyph's bitmap
44+
//| :param int dx: x adjustment to the bitmap's position
45+
//| :param int dy: y adjustment to the bitmap's position
46+
//| :param int shift_x: the x difference to the next glyph
47+
//| :param int shift_y: the y difference to the next glyph"""
48+
//| ...
4849
//|
4950
const mp_obj_namedtuple_type_t fontio_glyph_type = {
5051
.base = {

shared-bindings/fontio/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "shared-bindings/fontio/BuiltinFont.h"
3434
#include "shared-bindings/fontio/Glyph.h"
3535

36-
//| :mod:`fontio` --- Core font related data structures
36+
//| """:mod:`fontio` --- Core font related data structures
3737
//| =========================================================================
3838
//|
3939
//| .. module:: fontio
@@ -48,7 +48,7 @@
4848
//| :maxdepth: 3
4949
//|
5050
//| BuiltinFont
51-
//| Glyph
51+
//| Glyph"""
5252
//|
5353

5454
STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = {

shared-bindings/framebufferio/FramebufferDisplay.c

Lines changed: 52 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,24 @@
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
//|
6162
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) {
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
//|
106107
STATIC 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
}
119120
MP_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
//|
137138
STATIC 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
}
154155
MP_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
//|
160160
STATIC 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
//|
188187
STATIC 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
//|
227225
STATIC 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
//|
256253
STATIC 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
//|
273269
STATIC 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
//|
290285
STATIC 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
//|
315309
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 = {
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
335330
STATIC 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[] = {

shared-bindings/framebufferio/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "shared-bindings/framebufferio/__init__.h"
2929
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
3030

31-
//| :mod:`framebufferio` --- Native framebuffer display driving
31+
//| """:mod:`framebufferio` --- Native framebuffer display driving
3232
//| =========================================================================
3333
//|
3434
//| .. module:: framebufferio
@@ -46,7 +46,7 @@
4646
//| .. toctree::
4747
//| :maxdepth: 3
4848
//|
49-
//| FramebufferDisplay
49+
//| FramebufferDisplay"""
5050
//|
5151

5252
#if CIRCUITPY_FRAMEBUFFERIO

0 commit comments

Comments
 (0)