Rename _pixelbuf to adafruit_pixelbuf, alias.
This commit is contained in:
parent
c16f559574
commit
dc2907ac1b
|
@ -19,8 +19,8 @@ shared-bindings/_bleio/__init__.rst shared-bindings/_bleio/
|
|||
shared-bindings/_eve/__init__.rst shared-bindings/_eve/
|
||||
shared-bindings/_pew/PewPew.rst shared-bindings/_pew/#_pew.PewPew
|
||||
shared-bindings/_pew/__init__.rst shared-bindings/_pew/
|
||||
shared-bindings/_pixelbuf/PixelBuf.rst shared-bindings/_pixelbuf/#_pixelbuf.PixelBuf
|
||||
shared-bindings/_pixelbuf/__init__.rst shared-bindings/_pixelbuf/
|
||||
shared-bindings/adafruit_pixelbuf/PixelBuf.rst shared-bindings/adafruit_pixelbuf/#adafruit_pixelbuf.PixelBuf
|
||||
shared-bindings/adafruit_pixelbuf/__init__.rst shared-bindings/adafruit_pixelbuf/
|
||||
shared-bindings/_stage/Layer.rst shared-bindings/_stage/#_stage.Layer
|
||||
shared-bindings/_stage/Text.rst shared-bindings/_stage/#_stage.Text
|
||||
shared-bindings/_stage/__init__.rst shared-bindings/_stage/
|
||||
|
|
|
@ -63,6 +63,7 @@ additional_modules = {
|
|||
"terminalio": "CIRCUITPY_DISPLAYIO",
|
||||
# "socket": "CIRCUITPY_NETWORK",
|
||||
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
|
||||
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF"
|
||||
}
|
||||
|
||||
def get_circuitpython_root_dir():
|
||||
|
|
|
@ -227,7 +227,7 @@ ifeq ($(CIRCUITPY_DUALBANK),1)
|
|||
SRC_PATTERNS += dualbank/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_PIXELBUF),1)
|
||||
SRC_PATTERNS += _pixelbuf/%
|
||||
SRC_PATTERNS += adafruit_pixelbuf/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_RAINBOWIO),1)
|
||||
SRC_PATTERNS += rainbowio/%
|
||||
|
@ -469,8 +469,8 @@ SRC_SHARED_MODULE_ALL = \
|
|||
_bleio/ScanEntry.c \
|
||||
_bleio/ScanResults.c \
|
||||
_eve/__init__.c \
|
||||
_pixelbuf/PixelBuf.c \
|
||||
_pixelbuf/__init__.c \
|
||||
adafruit_pixelbuf/PixelBuf.c \
|
||||
adafruit_pixelbuf/__init__.c \
|
||||
_stage/Layer.c \
|
||||
_stage/Text.c \
|
||||
_stage/__init__.c \
|
||||
|
|
|
@ -618,7 +618,8 @@ extern const struct _mp_obj_module_t pew_module;
|
|||
|
||||
#if CIRCUITPY_PIXELBUF
|
||||
extern const struct _mp_obj_module_t pixelbuf_module;
|
||||
#define PIXELBUF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__pixelbuf),(mp_obj_t)&pixelbuf_module },
|
||||
#define PIXELBUF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_adafruit_pixelbuf),(mp_obj_t)&pixelbuf_module }, \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR__pixelbuf),(mp_obj_t)&pixelbuf_module },
|
||||
#else
|
||||
#define PIXELBUF_MODULE
|
||||
#endif
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "shared-bindings/_pixelbuf/PixelBuf.h"
|
||||
#include "shared-module/_pixelbuf/PixelBuf.h"
|
||||
#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h"
|
||||
#include "shared-module/adafruit_pixelbuf/PixelBuf.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
|
||||
#ifdef CIRCUITPY_ULAB
|
||||
|
@ -110,7 +110,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a
|
|||
// Validation complete, allocate and populate object.
|
||||
pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t);
|
||||
self->base.type = &pixelbuf_pixelbuf_type;
|
||||
common_hal__pixelbuf_pixelbuf_construct(self, args[ARG_size].u_int,
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_construct(self, args[ARG_size].u_int,
|
||||
&byteorder_details, brightness, args[ARG_auto_write].u_bool, header_bufinfo.buf,
|
||||
header_bufinfo.len, trailer_bufinfo.buf, trailer_bufinfo.len);
|
||||
|
||||
|
@ -158,7 +158,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
|
|||
//| """The number of bytes per pixel in the buffer (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal__pixelbuf_pixelbuf_get_bpp(self_in));
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal__adafruit_pixelbuf_pixelbuf_get_bpp(self_in));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_bpp_obj, pixelbuf_pixelbuf_obj_get_bpp);
|
||||
|
||||
|
@ -177,7 +177,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
|
|||
//| before they are adjusted for brightness."""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) {
|
||||
return mp_obj_new_float(common_hal__pixelbuf_pixelbuf_get_brightness(self_in));
|
||||
return mp_obj_new_float(common_hal__adafruit_pixelbuf_pixelbuf_get_brightness(self_in));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_brightness_obj, pixelbuf_pixelbuf_obj_get_brightness);
|
||||
|
||||
|
@ -189,7 +189,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_brightness(mp_obj_t self_in, mp_obj_t
|
|||
} else if (brightness < 0) {
|
||||
brightness = 0;
|
||||
}
|
||||
common_hal__pixelbuf_pixelbuf_set_brightness(self_in, brightness);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(self_in, brightness);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_brightness_obj, pixelbuf_pixelbuf_obj_set_brightness);
|
||||
|
@ -205,13 +205,13 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
|
|||
//| """Whether to automatically write the pixels after each update."""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
|
||||
return mp_obj_new_bool(common_hal__pixelbuf_pixelbuf_get_auto_write(self_in));
|
||||
return mp_obj_new_bool(common_hal__adafruit_pixelbuf_pixelbuf_get_auto_write(self_in));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_auto_write_obj, pixelbuf_pixelbuf_obj_get_auto_write);
|
||||
|
||||
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_auto_write(mp_obj_t self_in, mp_obj_t value) {
|
||||
common_hal__pixelbuf_pixelbuf_set_auto_write(self_in, mp_obj_is_true(value));
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_set_auto_write(self_in, mp_obj_is_true(value));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_auto_write_obj, pixelbuf_pixelbuf_obj_set_auto_write);
|
||||
|
@ -227,7 +227,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
|
|||
//| """byteorder string for the buffer (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
||||
return common_hal__pixelbuf_pixelbuf_get_byteorder_string(self_in);
|
||||
return common_hal__adafruit_pixelbuf_pixelbuf_get_byteorder_string(self_in);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_byteorder_str, pixelbuf_pixelbuf_obj_get_byteorder);
|
||||
|
||||
|
@ -243,7 +243,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
case MP_UNARY_OP_BOOL:
|
||||
return mp_const_true;
|
||||
case MP_UNARY_OP_LEN:
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal__pixelbuf_pixelbuf_get_len(self_in));
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal__adafruit_pixelbuf_pixelbuf_get_len(self_in));
|
||||
default:
|
||||
return MP_OBJ_NULL; // op not supported
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
//|
|
||||
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
||||
common_hal__pixelbuf_pixelbuf_show(self_in);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
|
||||
|
@ -267,7 +267,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_s
|
|||
//|
|
||||
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
|
||||
common_hal__pixelbuf_pixelbuf_fill(self_in, value);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_fill(self_in, value);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
|
|||
} else if (mp_obj_is_type(index_in, &mp_type_slice)) {
|
||||
mp_bound_slice_t slice;
|
||||
|
||||
size_t length = common_hal__pixelbuf_pixelbuf_get_len(self_in);
|
||||
size_t length = common_hal__adafruit_pixelbuf_pixelbuf_get_len(self_in);
|
||||
mp_seq_get_fast_slice_indexes(length, index_in, &slice);
|
||||
static mp_obj_tuple_t flat_item_tuple = {
|
||||
.base = {&mp_type_tuple},
|
||||
|
@ -334,7 +334,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
|
|||
if (value == MP_OBJ_SENTINEL) { // Get
|
||||
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(slice_len, NULL));
|
||||
for (uint i = 0; i < slice_len; i++) {
|
||||
t->items[i] = common_hal__pixelbuf_pixelbuf_get_pixel(self_in, i * slice.step + slice.start);
|
||||
t->items[i] = common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(self_in, i * slice.step + slice.start);
|
||||
}
|
||||
return MP_OBJ_FROM_PTR(t);
|
||||
} else { // Set
|
||||
|
@ -342,10 +342,10 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
|
|||
|
||||
size_t num_items = mp_obj_get_int(mp_obj_len(value));
|
||||
|
||||
if (num_items != slice_len && num_items != (slice_len * common_hal__pixelbuf_pixelbuf_get_bpp(self_in))) {
|
||||
if (num_items != slice_len && num_items != (slice_len * common_hal__adafruit_pixelbuf_pixelbuf_get_bpp(self_in))) {
|
||||
mp_raise_ValueError_varg(translate("Unmatched number of items on RHS (expected %d, got %d)."), slice_len, num_items);
|
||||
}
|
||||
common_hal__pixelbuf_pixelbuf_set_pixels(self_in, slice.start, slice.step, slice_len, value,
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_set_pixels(self_in, slice.start, slice.step, slice_len, value,
|
||||
num_items != slice_len ? &flat_item_tuple : mp_const_none);
|
||||
return mp_const_none;
|
||||
#else
|
||||
|
@ -354,13 +354,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
|
|||
}
|
||||
#endif
|
||||
} else { // Single index rather than slice.
|
||||
size_t length = common_hal__pixelbuf_pixelbuf_get_len(self_in);
|
||||
size_t length = common_hal__adafruit_pixelbuf_pixelbuf_get_len(self_in);
|
||||
size_t index = mp_get_index(mp_obj_get_type(self_in), length, index_in, false);
|
||||
|
||||
if (value == MP_OBJ_SENTINEL) { // Get
|
||||
return common_hal__pixelbuf_pixelbuf_get_pixel(self_in, index);
|
||||
return common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(self_in, index);
|
||||
} else { // Store
|
||||
common_hal__pixelbuf_pixelbuf_set_pixel(self_in, index, value);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_set_pixel(self_in, index, value);
|
||||
return mp_const_none;
|
||||
}
|
||||
}
|
|
@ -27,26 +27,26 @@
|
|||
#ifndef CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
|
||||
#define CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
|
||||
|
||||
#include "shared-module/_pixelbuf/PixelBuf.h"
|
||||
#include "shared-module/adafruit_pixelbuf/PixelBuf.h"
|
||||
|
||||
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
|
||||
pixelbuf_byteorder_details_t *byteorder, mp_float_t brightness, bool auto_write, uint8_t *header,
|
||||
size_t header_len, uint8_t *trailer, size_t trailer_len);
|
||||
|
||||
// These take mp_obj_t because they are called on subclasses of PixelBuf.
|
||||
uint8_t common_hal__pixelbuf_pixelbuf_get_bpp(mp_obj_t self);
|
||||
mp_float_t common_hal__pixelbuf_pixelbuf_get_brightness(mp_obj_t self);
|
||||
void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self, mp_float_t brightness);
|
||||
bool common_hal__pixelbuf_pixelbuf_get_auto_write(mp_obj_t self);
|
||||
void common_hal__pixelbuf_pixelbuf_set_auto_write(mp_obj_t self, bool auto_write);
|
||||
size_t common_hal__pixelbuf_pixelbuf_get_len(mp_obj_t self_in);
|
||||
mp_obj_t common_hal__pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self);
|
||||
void common_hal__pixelbuf_pixelbuf_fill(mp_obj_t self, mp_obj_t item);
|
||||
void common_hal__pixelbuf_pixelbuf_show(mp_obj_t self);
|
||||
mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self, size_t index);
|
||||
void common_hal__pixelbuf_pixelbuf_set_pixel(mp_obj_t self, size_t index, mp_obj_t item);
|
||||
void common_hal__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);
|
||||
uint8_t common_hal__adafruit_pixelbuf_pixelbuf_get_bpp(mp_obj_t self);
|
||||
mp_float_t common_hal__adafruit_pixelbuf_pixelbuf_get_brightness(mp_obj_t self);
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self, mp_float_t brightness);
|
||||
bool common_hal__adafruit_pixelbuf_pixelbuf_get_auto_write(mp_obj_t self);
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_auto_write(mp_obj_t self, bool auto_write);
|
||||
size_t common_hal__adafruit_pixelbuf_pixelbuf_get_len(mp_obj_t self_in);
|
||||
mp_obj_t common_hal__adafruit_pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self);
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self, mp_obj_t item);
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_show(mp_obj_t self);
|
||||
mp_obj_t common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(mp_obj_t self, size_t index);
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_pixel(mp_obj_t self, size_t index, mp_obj_t item);
|
||||
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);
|
||||
|
||||
#endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
|
|
@ -29,20 +29,22 @@
|
|||
#include "py/runtime.h"
|
||||
#include "py/objproperty.h"
|
||||
|
||||
#include "shared-bindings/_pixelbuf/__init__.h"
|
||||
#include "shared-bindings/_pixelbuf/PixelBuf.h"
|
||||
#include "shared-bindings/adafruit_pixelbuf/__init__.h"
|
||||
#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h"
|
||||
|
||||
|
||||
//| """A fast RGB(W) pixel buffer library for like NeoPixel and DotStar
|
||||
//|
|
||||
//| The `_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate
|
||||
//| The `adafruit_pixelbuf` module provides the :py:class:`PixelBuf` class to accelerate
|
||||
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
|
||||
//|
|
||||
//| Also available as `_pixelbuf`. This usage has been deprecated.
|
||||
//|
|
||||
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
|
||||
// TODO: Pull in docs from pypixelbuf.
|
||||
// TODO: Pull in docs from adafruit_pixelbuf.
|
||||
|
||||
STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelbuf) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_adafruit_pixelbuf) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PixelBuf), MP_ROM_PTR(&pixelbuf_pixelbuf_type) },
|
||||
};
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
#include "py/objstr.h"
|
||||
#include "py/objtype.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/_pixelbuf/PixelBuf.h"
|
||||
#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -40,7 +40,7 @@ static pixelbuf_pixelbuf_obj_t *native_pixelbuf(mp_obj_t pixelbuf_obj) {
|
|||
return MP_OBJ_TO_PTR(native_pixelbuf);
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
|
||||
pixelbuf_byteorder_details_t *byteorder, mp_float_t brightness, bool auto_write,
|
||||
uint8_t *header, size_t header_len, uint8_t *trailer, size_t trailer_len) {
|
||||
|
||||
|
@ -71,43 +71,43 @@ void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size
|
|||
// Call set_brightness so that it can allocate a second buffer if needed.
|
||||
self->brightness = 1.0;
|
||||
self->scaled_brightness = 0x100;
|
||||
common_hal__pixelbuf_pixelbuf_set_brightness(MP_OBJ_FROM_PTR(self), brightness);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(MP_OBJ_FROM_PTR(self), brightness);
|
||||
|
||||
// Turn on auto_write. We don't want to do it with the above brightness call.
|
||||
self->auto_write = auto_write;
|
||||
}
|
||||
|
||||
size_t common_hal__pixelbuf_pixelbuf_get_len(mp_obj_t self_in) {
|
||||
size_t common_hal__adafruit_pixelbuf_pixelbuf_get_len(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
return self->pixel_count;
|
||||
}
|
||||
|
||||
uint8_t common_hal__pixelbuf_pixelbuf_get_bpp(mp_obj_t self_in) {
|
||||
uint8_t common_hal__adafruit_pixelbuf_pixelbuf_get_bpp(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
return self->byteorder.bpp;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal__pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self_in) {
|
||||
mp_obj_t common_hal__adafruit_pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
return self->byteorder.order_string;
|
||||
}
|
||||
|
||||
bool common_hal__pixelbuf_pixelbuf_get_auto_write(mp_obj_t self_in) {
|
||||
bool common_hal__adafruit_pixelbuf_pixelbuf_get_auto_write(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
return self->auto_write;
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_set_auto_write(mp_obj_t self_in, bool auto_write) {
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_auto_write(mp_obj_t self_in, bool auto_write) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
self->auto_write = auto_write;
|
||||
}
|
||||
|
||||
mp_float_t common_hal__pixelbuf_pixelbuf_get_brightness(mp_obj_t self_in) {
|
||||
mp_float_t common_hal__adafruit_pixelbuf_pixelbuf_get_brightness(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
return self->brightness;
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_float_t brightness) {
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_float_t brightness) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
// Skip out if the brightness is already set. The default of self->brightness is 1.0. So, this
|
||||
// also prevents the pre_brightness_buffer allocation when brightness is set to 1.0 again.
|
||||
|
@ -135,7 +135,7 @@ void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_float_t b
|
|||
}
|
||||
|
||||
if (self->auto_write) {
|
||||
common_hal__pixelbuf_pixelbuf_show(self_in);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t v
|
|||
_pixelbuf_set_pixel_color(self, index, r, g, b, w);
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values,
|
||||
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) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
mp_obj_iter_buf_t iter_buf;
|
||||
|
@ -268,21 +268,21 @@ void common_hal__pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp
|
|||
}
|
||||
}
|
||||
if (self->auto_write) {
|
||||
common_hal__pixelbuf_pixelbuf_show(self_in);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_set_pixel(mp_obj_t self_in, size_t index, mp_obj_t value) {
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_set_pixel(mp_obj_t self_in, size_t index, mp_obj_t value) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
_pixelbuf_set_pixel(self, index, value);
|
||||
if (self->auto_write) {
|
||||
common_hal__pixelbuf_pixelbuf_show(self_in);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||
}
|
||||
}
|
||||
|
||||
mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index) {
|
||||
mp_obj_t common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
mp_obj_t elems[self->byteorder.bpp];
|
||||
uint8_t *pixel_buffer = self->post_brightness_buffer;
|
||||
|
@ -307,7 +307,7 @@ mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index)
|
|||
return mp_obj_new_tuple(self->byteorder.bpp, elems);
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
mp_obj_t dest[2 + 1];
|
||||
mp_load_method(self_in, MP_QSTR__transmit, dest);
|
||||
|
@ -317,7 +317,7 @@ void common_hal__pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
|||
mp_call_method_n_kw(1, 0, dest);
|
||||
}
|
||||
|
||||
void common_hal__pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) {
|
||||
void common_hal__adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) {
|
||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||
|
||||
uint8_t r;
|
||||
|
@ -330,6 +330,6 @@ void common_hal__pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) {
|
|||
_pixelbuf_set_pixel_color(self, i, r, g, b, w);
|
||||
}
|
||||
if (self->auto_write) {
|
||||
common_hal__pixelbuf_pixelbuf_show(self_in);
|
||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue