3838#include "shared-module/framebufferio/__init__.h"
3939#include "shared-module/framebufferio/FramebufferDisplay.h"
4040
41- //| .. currentmodule:: rgbmatrix
41+ //| class RGBMatrix:
42+ //| """.. currentmodule:: rgbmatrix
4243//|
43- //| :class:`RGBMatrix` -- Driver for HUB75-style RGB LED matrices
44- //| ================================================================
44+ //| :class:`RGBMatrix` -- Driver for HUB75-style RGB LED matrices
45+ //| ================================================================
4546//|
4647
4748extern Protomatter_core * _PM_protoPtr ;
@@ -133,45 +134,45 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
133134 }
134135}
135136
136- //| :class:`~rgbmatrix.RGBMatrix` displays an in-memory framebuffer to an LED matrix.
137- //|
138- //| .. class:: RGBMatrix(*, width, bit_depth, rgb_pins, addr_pins, clock_pin, latch_pin, output_enable_pin, doublebuffer=True, framebuffer=None, height=0)
137+
138+ //| :class:`~rgbmatrix.RGBMatrix` displays an in-memory framebuffer to an LED matrix."""
139139//|
140- //| Create a RGBMatrix object with the given attributes. The height of
141- //| the display is determined by the number of rgb and address pins:
142- //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
143- //| address lines, the display will be 32 pixels tall. If the optional height
144- //| parameter is specified and is not 0, it is checked against the calculated
145- //| height.
140+ //| def __init__(self, *, width: Any, bit_depth: Any, rgb_pins: Any, addr_pins: Any, clock_pin: Any, latch_pin: Any, output_enable_pin: Any, doublebuffer: Any = True, framebuffer: Any = None, height: Any = 0):
141+ //| """Create a RGBMatrix object with the given attributes. The height of
142+ //| the display is determined by the number of rgb and address pins:
143+ //| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
144+ //| address lines, the display will be 32 pixels tall. If the optional height
145+ //| parameter is specified and is not 0, it is checked against the calculated
146+ //| height.
146147//|
147- //| Up to 30 RGB pins and 8 address pins are supported.
148+ //| Up to 30 RGB pins and 8 address pins are supported.
148149//|
149- //| The RGB pins must be within a single "port" and performance and memory
150- //| usage are best when they are all within "close by" bits of the port.
151- //| The clock pin must also be on the same port as the RGB pins. See the
152- //| documentation of the underlying protomatter C library for more
153- //| information. Generally, Adafruit's interface boards are designed so
154- //| that these requirements are met when matched with the intended
155- //| microcontroller board. For instance, the Feather M4 Express works
156- //| together with the RGB Matrix Feather.
150+ //| The RGB pins must be within a single "port" and performance and memory
151+ //| usage are best when they are all within "close by" bits of the port.
152+ //| The clock pin must also be on the same port as the RGB pins. See the
153+ //| documentation of the underlying protomatter C library for more
154+ //| information. Generally, Adafruit's interface boards are designed so
155+ //| that these requirements are met when matched with the intended
156+ //| microcontroller board. For instance, the Feather M4 Express works
157+ //| together with the RGB Matrix Feather.
157158//|
158- //| The framebuffer is in "RGB565" format.
159+ //| The framebuffer is in "RGB565" format.
159160//|
160- //| "RGB565" means that it is organized as a series of 16-bit numbers
161- //| where the highest 5 bits are interpreted as red, the next 6 as
162- //| green, and the final 5 as blue. The object can be any buffer, but
163- //| `array.array` and `ulab.array` objects are most often useful.
164- //| To update the content, modify the framebuffer and call refresh.
161+ //| "RGB565" means that it is organized as a series of 16-bit numbers
162+ //| where the highest 5 bits are interpreted as red, the next 6 as
163+ //| green, and the final 5 as blue. The object can be any buffer, but
164+ //| `array.array` and `ulab.array` objects are most often useful.
165+ //| To update the content, modify the framebuffer and call refresh.
165166//|
166- //| If a framebuffer is not passed in, one is allocated and initialized
167- //| to all black. In any case, the framebuffer can be retrieved
168- //| by passing the RGBMatrix object to memoryview().
167+ //| If a framebuffer is not passed in, one is allocated and initialized
168+ //| to all black. In any case, the framebuffer can be retrieved
169+ //| by passing the RGBMatrix object to memoryview().
169170//|
170- //| If doublebuffer is False, some memory is saved, but the display may
171- //| flicker during updates.
171+ //| If doublebuffer is False, some memory is saved, but the display may
172+ //| flicker during updates.
172173//|
173- //| A RGBMatrix is often used in conjunction with a
174- //| `framebufferio.FramebufferDisplay`.
174+ //| A RGBMatrix is often used in conjunction with a
175+ //| `framebufferio.FramebufferDisplay`."""
175176//|
176177
177178STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new (const mp_obj_type_t * type , size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
@@ -245,11 +246,11 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
245246 return MP_OBJ_FROM_PTR (self );
246247}
247248
248- //| .. method:: deinit
249- //|
250- //| Free the resources (pins, timers, etc.) associated with this
251- //| rgbmatrix instance. After deinitialization, no further operations
252- //| may be performed .
249+ //| def deinit(self, ) -> Any:
250+ //| """Free the resources (pins, timers, etc.) associated with this
251+ //| rgbmatrix instance. After deinitialization, no further operations
252+ //| may be performed."""
253+ //| .. .
253254//|
254255STATIC mp_obj_t rgbmatrix_rgbmatrix_deinit (mp_obj_t self_in ) {
255256 rgbmatrix_rgbmatrix_obj_t * self = (rgbmatrix_rgbmatrix_obj_t * )self_in ;
@@ -265,10 +266,9 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) {
265266 }
266267}
267268
268- //| .. attribute:: brightness
269- //|
270- //| In the current implementation, 0.0 turns the display off entirely
271- //| and any other value up to 1.0 turns the display on fully.
269+ //| brightness: Any = ...
270+ //| """In the current implementation, 0.0 turns the display off entirely
271+ //| and any other value up to 1.0 turns the display on fully."""
272272//|
273273STATIC mp_obj_t rgbmatrix_rgbmatrix_get_brightness (mp_obj_t self_in ) {
274274 rgbmatrix_rgbmatrix_obj_t * self = (rgbmatrix_rgbmatrix_obj_t * )self_in ;
@@ -297,10 +297,9 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_brightness_obj = {
297297 (mp_obj_t )& mp_const_none_obj },
298298};
299299
300- //| .. method:: refresh()
301- //|
302- //| Transmits the color data in the buffer to the pixels so that
303- //| they are shown.
300+ //| def refresh(self, ) -> Any: ...
301+ //| """Transmits the color data in the buffer to the pixels so that
302+ //| they are shown."""
304303//|
305304STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh (mp_obj_t self_in ) {
306305 rgbmatrix_rgbmatrix_obj_t * self = (rgbmatrix_rgbmatrix_obj_t * )self_in ;
@@ -310,9 +309,8 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) {
310309}
311310MP_DEFINE_CONST_FUN_OBJ_1 (rgbmatrix_rgbmatrix_refresh_obj , rgbmatrix_rgbmatrix_refresh );
312311
313- //| .. attribute:: width
314- //|
315- //| The width of the display, in pixels
312+ //| width: Any = ...
313+ //| """The width of the display, in pixels"""
316314//|
317315STATIC mp_obj_t rgbmatrix_rgbmatrix_get_width (mp_obj_t self_in ) {
318316 rgbmatrix_rgbmatrix_obj_t * self = (rgbmatrix_rgbmatrix_obj_t * )self_in ;
@@ -327,9 +325,8 @@ const mp_obj_property_t rgbmatrix_rgbmatrix_width_obj = {
327325 (mp_obj_t )& mp_const_none_obj },
328326};
329327
330- //| .. attribute:: height
331- //|
332- //| The height of the display, in pixels
328+ //| height: Any = ...
329+ //| """The height of the display, in pixels"""
333330//|
334331STATIC mp_obj_t rgbmatrix_rgbmatrix_get_height (mp_obj_t self_in ) {
335332 rgbmatrix_rgbmatrix_obj_t * self = (rgbmatrix_rgbmatrix_obj_t * )self_in ;
0 commit comments