Skip to content

Commit 7c323ba

Browse files
committed
Add adafruit_pixelmap.PixelMap
.. a fast helper for animations. It is similar to and inspired by the PixelMap helper in Adafruit LED Animation library, but with an extremely fast 'paste' method for setting a series of pixels. This is a common operation for many animations, and can give a substantial speed improvement. It's named `adafruit_pixelmap` so that we can package a compatible version in pure Python for systems that can't fit it in C in flash, or for Blinka. This is a proof of concept and can make a very fast comet animation: ```python import time import adafruit_pixelbuf import adafruti_pixelmap import board import neopixel from supervisor import ticks_ms from adafruit_led_animation.animation.solid import Solid from adafruit_led_animation import color pixel_pin = board.GP0 pixel_num = 96 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB") evens = adafruit_pixelmap.PixelMap(pixels, tuple(range(0, pixel_num, 2))) odd_indices = tuple((i, i+2) for i in range(1, pixel_num, 4)) print(odd_indices) odds = adafruit_pixelbuf.PixelMap(pixels, odd_indices) assert len(odds) == len(odd_indices) comet_length = 16 comet1 = [color.calculate_intensity(color.GREEN, ((1+i) / comet_length) ** 2.4) for i in range(comet_length)] comet2 = [color.calculate_intensity(color.PURPLE, ((1+i) / comet_length) ** 2.4) for i in range(comet_length)] pos1 = 0 pos2 = 96//4 while True: evens.paste(comet1, pos1, wrap=True, reverse=False, others=0) pos1 = (pos1 + 1) % len(evens) odds.paste(comet2, pos2, wrap=True, reverse=True, others=0) pos2 = (pos2 - 1) % len(odds) pixels.show() m = ticks_ms() if m % 2000 > 1000: time.sleep(.02) ```
1 parent 1853f49 commit 7c323ba

File tree

12 files changed

+563
-30
lines changed

12 files changed

+563
-30
lines changed

locale/circuitpython.pot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,7 @@ msgid "Unkown error code %d"
22672267
msgstr ""
22682268

22692269
#: shared-bindings/adafruit_pixelbuf/PixelBuf.c
2270+
#: shared-module/adafruit_pixelbuf/PixelMap.c
22702271
#, c-format
22712272
msgid "Unmatched number of items on RHS (expected %d, got %d)."
22722273
msgstr ""
@@ -3152,6 +3153,10 @@ msgstr ""
31523153
msgid "index is out of bounds"
31533154
msgstr ""
31543155

3156+
#: shared-bindings/adafruit_pixelbuf/PixelMap.c
3157+
msgid "index must be tuple or int"
3158+
msgstr ""
3159+
31553160
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
31563161
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c
31573162
#: shared-bindings/bitmaptools/__init__.c
@@ -3537,6 +3542,10 @@ msgstr ""
35373542
msgid "negative shift count"
35383543
msgstr ""
35393544

3545+
#: shared-bindings/adafruit_pixelbuf/PixelMap.c
3546+
msgid "nested index must be int"
3547+
msgstr ""
3548+
35403549
#: shared-module/sdcardio/SDCard.c
35413550
msgid "no SD card"
35423551
msgstr ""

py/circuitpy_defns.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ endif
266266
ifeq ($(CIRCUITPY_PIXELBUF),1)
267267
SRC_PATTERNS += adafruit_pixelbuf/%
268268
endif
269+
ifeq ($(CIRCUITPY_PIXELMAP),1)
270+
SRC_PATTERNS += adafruit_pixelmap/%
271+
endif
269272
ifeq ($(CIRCUITPY_QRIO),1)
270273
SRC_PATTERNS += qrio/%
271274
endif
@@ -543,6 +546,8 @@ SRC_SHARED_MODULE_ALL = \
543546
_eve/__init__.c \
544547
adafruit_pixelbuf/PixelBuf.c \
545548
adafruit_pixelbuf/__init__.c \
549+
adafruit_pixelmap/PixelMap.c \
550+
adafruit_pixelmap/__init__.c \
546551
_stage/Layer.c \
547552
_stage/Text.c \
548553
_stage/__init__.c \

py/circuitpy_mpconfig.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW)
319319
CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD)
320320
CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF)
321321

322+
CIRCUITPY_PIXELMAP ?= $(CIRCUITPY_PIXELBUF)
323+
CFLAGS += -DCIRCUITPY_PIXELMAP=$(CIRCUITPY_PIXELMAP)
324+
322325
# Only for SAMD boards for the moment
323326
CIRCUITPY_PS2IO ?= 0
324327
CFLAGS += -DCIRCUITPY_PS2IO=$(CIRCUITPY_PS2IO)

shared-bindings/adafruit_pixelbuf/PixelBuf.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
253253
}
254254
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
255255

256-
//| def fill(
257-
//| self, color: Union[int, Tuple[int, int, int], Tuple[int, int, int, float]]
258-
//| ) -> None:
256+
//| def fill(self, color: PixelType) -> None:
259257
//| """Fills the given pixelbuf with the given color."""
260258
//| ...
261259

@@ -267,29 +265,21 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
267265
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
268266

269267
//| @overload
270-
//| def __getitem__(
271-
//| self, index: slice
272-
//| ) -> Union[Tuple[Tuple[int, int, int], ...], Tuple[Tuple[int, int, int, float], ...]]: ...
273-
//| @overload
274-
//| def __getitem__(
275-
//| self, index: int
276-
//| ) -> Union[Tuple[int, int, int], Tuple[int, int, int, float]]:
268+
//| def __getitem__(self, index: slice) -> PixelReturnSequence:
277269
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
278270
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
279271
//| intensity from 0-1.0."""
280272
//| ...
281273
//| @overload
282-
//| def __setitem__(
283-
//| self, index: slice, value: Tuple[Union[int, Tuple[float, ...], List[float]], ...]
284-
//| ) -> None: ...
274+
//| def __getitem__(self, index: int) -> PixelReturnType:
275+
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
276+
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
277+
//| intensity from 0-1.0."""
278+
//| ...
285279
//| @overload
286-
//| def __setitem__(
287-
//| self, index: slice, value: List[Union[int, Tuple[float, ...], List[float]]]
288-
//| ) -> None: ...
280+
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
289281
//| @overload
290-
//| def __setitem__(
291-
//| self, index: int, value: Union[int, Tuple[float, ...], List[float]]
292-
//| ) -> None:
282+
//| def __setitem__(self, index: int, value: PixelType) -> None:
293283
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
294284
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
295285
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).

shared-bindings/adafruit_pixelbuf/PixelBuf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#ifndef CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
2828
#define CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
2929

30+
#include "py/objtuple.h"
3031
#include "shared-module/adafruit_pixelbuf/PixelBuf.h"
3132

3233
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
@@ -48,5 +49,7 @@ void common_hal_adafruit_pixelbuf_pixelbuf_show(mp_obj_t self);
4849
mp_obj_t common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(mp_obj_t self, size_t index);
4950
void common_hal_adafruit_pixelbuf_pixelbuf_set_pixel(mp_obj_t self, size_t index, mp_obj_t item);
5051
void common_hal_adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values, mp_obj_tuple_t *flatten_to);
52+
void common_hal_adafruit_pixelbuf_pixelbuf_parse_color(mp_obj_t self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w);
53+
void common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(mp_obj_t self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w);
5154

5255
#endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H

shared-bindings/adafruit_pixelbuf/__init__.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@
3939
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
4040
//|
4141
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
42+
//|
43+
//| # The types accepted when getting a pixel value
44+
//| PixelReturnType = Union[
45+
//| Tuple[int, int, int], Tuple[int, int, int, int], Tuple[int, int, int, float]
46+
//| ]
47+
//| PixelReturnSequence = Tuple[PixelReturnType]
48+
//| # The types returned when getting a pixel value
49+
//| PixelType = Union[int, PixelReturnType]
50+
//| PixelSequence = Union[Tuple[PixelType], List[PixelType]]
4251
// TODO: Pull in docs from adafruit_pixelbuf.
4352

4453
STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
/*
2+
* This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2018 Rose Hooper
7+
* Copyright (c) 2022 Jeff Epler for Adafruit Industries
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
28+
#include "py/objproperty.h"
29+
#include "py/objtype.h"
30+
#include "py/runtime.h"
31+
32+
#include "shared-bindings/adafruit_pixelmap/PixelMap.h"
33+
#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h"
34+
#include "shared-module/adafruit_pixelmap/PixelMap.h"
35+
36+
//| class PixelMap:
37+
//| def __init__(self, pixelbuf: PixelBuf, indices: Tuple[Union[int, Tuple[int]]]) -> None:
38+
//| """Construct a PixelMap object that uses the given indices of the underlying pixelbuf"""
39+
40+
STATIC mp_obj_t pixelmap_pixelmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
41+
enum { ARG_pixelbuf, ARG_indices };
42+
static const mp_arg_t allowed_args[] = {
43+
{ MP_QSTR_pixelbuf, MP_ARG_REQUIRED },
44+
{ MP_QSTR_indices, MP_ARG_REQUIRED },
45+
};
46+
47+
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
48+
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
49+
50+
mp_obj_t pixelbuf = args[ARG_pixelbuf].u_obj;
51+
52+
mp_obj_t native_pixelbuf = mp_obj_cast_to_native_base(pixelbuf, &pixelbuf_pixelbuf_type);
53+
if (!native_pixelbuf) {
54+
(void)mp_arg_validate_type(args[ARG_pixelbuf].u_obj, &pixelbuf_pixelbuf_type, MP_QSTR_pixelbuf);
55+
}
56+
mp_obj_assert_native_inited(native_pixelbuf);
57+
58+
size_t buflen = common_hal_adafruit_pixelbuf_pixelbuf_get_len(pixelbuf);
59+
60+
mp_obj_t indices = mp_arg_validate_type(args[ARG_indices].u_obj, &mp_type_tuple, MP_QSTR_indices);
61+
62+
// validate indices
63+
size_t len;
64+
mp_obj_t *items;
65+
mp_obj_tuple_get(indices, &len, &items);
66+
mp_arg_validate_length_min(len, 1, MP_QSTR_items);
67+
68+
for (size_t i = 0; i < len; i++) {
69+
mp_obj_t item = items[i];
70+
if (mp_obj_is_small_int(item)) {
71+
mp_arg_validate_index_range(MP_OBJ_SMALL_INT_VALUE(item), 0, buflen - 1, MP_QSTR_index);
72+
} else if (mp_obj_is_tuple_compatible(item)) {
73+
size_t len1;
74+
mp_obj_t *items1;
75+
mp_obj_tuple_get(item, &len1, &items1);
76+
for (size_t j = 0; j < len1; j++) {
77+
mp_obj_t item1 = items1[j];
78+
if (!mp_obj_is_small_int(item1)) {
79+
mp_raise_TypeError(translate("nested index must be int"));
80+
}
81+
mp_arg_validate_index_range(MP_OBJ_SMALL_INT_VALUE(item1), 0, buflen - 1, MP_QSTR_index);
82+
}
83+
} else {
84+
mp_raise_TypeError(translate("index must be tuple or int"));
85+
}
86+
}
87+
88+
pixelmap_pixelmap_obj_t *self = m_new_obj(pixelmap_pixelmap_obj_t);
89+
self->base.type = &pixelmap_pixelmap_type;
90+
shared_module_pixelmap_pixelmap_construct(self, pixelbuf, indices);
91+
92+
return MP_OBJ_FROM_PTR(self);
93+
}
94+
95+
//| auto_write: bool
96+
//| """True if updates should be automatically written"""
97+
STATIC mp_obj_t pixelmap_pixelmap_auto_write_get(const mp_obj_t self_in) {
98+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
99+
return mp_obj_new_bool(shared_module_pixelmap_pixelmap_auto_write_get(self));
100+
}
101+
MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_auto_write_get_obj, pixelmap_pixelmap_auto_write_get);
102+
103+
STATIC mp_obj_t pixelmap_pixelmap_auto_write_set(const mp_obj_t self_in, const mp_obj_t arg) {
104+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
105+
shared_module_pixelmap_pixelmap_auto_write_set(self, mp_obj_is_true(arg));
106+
return mp_const_none;
107+
}
108+
MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_auto_write_set_obj, pixelmap_pixelmap_auto_write_set);
109+
110+
MP_PROPERTY_GETSET(pixelmap_pixelmap_auto_write_obj,
111+
(mp_obj_t)&pixelmap_pixelmap_auto_write_get_obj,
112+
(mp_obj_t)&pixelmap_pixelmap_auto_write_set_obj);
113+
114+
//| bpp: int
115+
//| """The number of bytes per pixel in the buffer (read-only)"""
116+
STATIC mp_obj_t pixelmap_pixelmap_obj_get_bpp(mp_obj_t self_in) {
117+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
118+
return MP_OBJ_NEW_SMALL_INT(common_hal_adafruit_pixelbuf_pixelbuf_get_bpp(self->pixelbuf));
119+
}
120+
MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_get_bpp_obj, pixelmap_pixelmap_obj_get_bpp);
121+
122+
MP_PROPERTY_GETTER(pixelmap_pixelmap_bpp_obj,
123+
(mp_obj_t)&pixelmap_pixelmap_get_bpp_obj);
124+
125+
//| byteorder: str
126+
//| """byteorder string for the buffer (read-only)"""
127+
STATIC mp_obj_t pixelmap_pixelmap_obj_get_byteorder(mp_obj_t self_in) {
128+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
129+
return common_hal_adafruit_pixelbuf_pixelbuf_get_byteorder_string(self->pixelbuf);
130+
}
131+
MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_get_byteorder, pixelmap_pixelmap_obj_get_byteorder);
132+
MP_PROPERTY_GETTER(pixelmap_pixelmap_byteorder_obj,
133+
(mp_obj_t)&pixelmap_pixelmap_get_byteorder);
134+
135+
//|
136+
//| def fill(self, color: PixelType, /) -> None:
137+
//| """Fill all the pixels in the map with the given color"""
138+
STATIC mp_obj_t pixelmap_pixelmap_fill(const mp_obj_t self_in, const mp_obj_t color) {
139+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
140+
141+
shared_module_pixelmap_pixelmap_fill(self, color);
142+
return mp_const_none;
143+
}
144+
MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_fill_obj, pixelmap_pixelmap_fill);
145+
146+
//|
147+
//| def indices(self, index: int, /) -> Tuple[int]:
148+
//| """Return the PixelBuf indices for a PixelMap index"""
149+
STATIC mp_obj_t pixelmap_pixelmap_indices(const mp_obj_t self_in, const mp_obj_t index) {
150+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
151+
152+
return shared_module_pixelmap_pixelmap_indices(self, mp_obj_get_int(index));
153+
return mp_const_none;
154+
}
155+
MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indices);
156+
157+
158+
//| @overload
159+
//| def __getitem__(self, index: int) -> PixelReturnType:
160+
//| """Retrieve the value of one of the underlying pixels at 'index'.
161+
//|
162+
//| Note that slices are not supported by PixelMap.__getitem__"""
163+
//| @overload
164+
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
165+
//| @overload
166+
//| def __setitem__(self, index: int, value: PixelType) -> None:
167+
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
168+
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
169+
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).
170+
//| For RGBW byteorders, if given only RGB values either as an int or as a tuple, the white value
171+
//| is used instead when the red, green, and blue values are the same."""
172+
//| ...
173+
STATIC mp_obj_t pixelmap_pixelmap_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
174+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
175+
if (value == MP_OBJ_NULL) {
176+
// delete
177+
return MP_OBJ_NULL; // op not supported
178+
} else if (value == MP_OBJ_SENTINEL) {
179+
int index = mp_obj_get_int(index_in);
180+
return shared_module_pixelmap_pixelmap_getitem(self, index);
181+
}
182+
183+
// get
184+
if (0) {
185+
#if MICROPY_PY_BUILTINS_SLICE
186+
} else if (mp_obj_is_type(index_in, &mp_type_slice)) {
187+
shared_module_pixelmap_pixelmap_setslice(self, index_in, value);
188+
#endif
189+
} else {
190+
shared_module_pixelmap_pixelmap_setitem(self, mp_obj_get_int(index_in), value);
191+
}
192+
return mp_const_none;
193+
}
194+
195+
//| def __len__(self) -> int:
196+
//| """Length of the map"""
197+
STATIC mp_obj_t pixelmap_pixelmap_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
198+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
199+
switch (op) {
200+
case MP_UNARY_OP_BOOL:
201+
return mp_const_true;
202+
case MP_UNARY_OP_LEN:
203+
return MP_OBJ_NEW_SMALL_INT(self->len);
204+
default:
205+
return MP_OBJ_NULL; // op not supported
206+
}
207+
}
208+
209+
//| def show(self) -> None:
210+
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
211+
//| when `auto_write` is True."""
212+
//| ...
213+
//|
214+
215+
STATIC mp_obj_t pixelmap_pixelmap_show(mp_obj_t self_in) {
216+
pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in);
217+
common_hal_adafruit_pixelbuf_pixelbuf_show(self->pixelbuf);
218+
return mp_const_none;
219+
}
220+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_show_obj, pixelmap_pixelmap_show);
221+
222+
STATIC const mp_rom_map_elem_t pixelmap_pixelmap_locals_dict_table[] = {
223+
{ MP_ROM_QSTR(MP_QSTR_auto_write), MP_ROM_PTR(&pixelmap_pixelmap_auto_write_obj) },
224+
{ MP_ROM_QSTR(MP_QSTR_bpp), MP_ROM_PTR(&pixelmap_pixelmap_bpp_obj) },
225+
{ MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelmap_pixelmap_byteorder_obj) },
226+
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelmap_pixelmap_fill_obj) },
227+
{ MP_ROM_QSTR(MP_QSTR_indices), MP_ROM_PTR(&pixelmap_pixelmap_indices_obj) },
228+
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pixelmap_pixelmap_show_obj) },
229+
};
230+
231+
STATIC MP_DEFINE_CONST_DICT(pixelmap_pixelmap_locals_dict, pixelmap_pixelmap_locals_dict_table);
232+
233+
234+
const mp_obj_type_t pixelmap_pixelmap_type = {
235+
{ &mp_type_type },
236+
.name = MP_QSTR_PixelMap,
237+
.flags = MP_TYPE_FLAG_EXTENDED,
238+
.locals_dict = (mp_obj_t)&pixelmap_pixelmap_locals_dict,
239+
.make_new = pixelmap_pixelmap_make_new,
240+
MP_TYPE_EXTENDED_FIELDS(
241+
.subscr = pixelmap_pixelmap_subscr,
242+
.unary_op = pixelmap_pixelmap_unary_op,
243+
),
244+
};

0 commit comments

Comments
 (0)