Remove _ from common_hal__adafruit_pixelbuf.
This commit is contained in:
parent
dc2907ac1b
commit
c21e16162c
@ -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.
|
// Validation complete, allocate and populate object.
|
||||||
pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t);
|
pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t);
|
||||||
self->base.type = &pixelbuf_pixelbuf_type;
|
self->base.type = &pixelbuf_pixelbuf_type;
|
||||||
common_hal__adafruit_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,
|
&byteorder_details, brightness, args[ARG_auto_write].u_bool, header_bufinfo.buf,
|
||||||
header_bufinfo.len, trailer_bufinfo.buf, trailer_bufinfo.len);
|
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)"""
|
//| """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) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
|
||||||
return MP_OBJ_NEW_SMALL_INT(common_hal__adafruit_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);
|
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."""
|
//| before they are adjusted for brightness."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) {
|
||||||
return mp_obj_new_float(common_hal__adafruit_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);
|
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) {
|
} else if (brightness < 0) {
|
||||||
brightness = 0;
|
brightness = 0;
|
||||||
}
|
}
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(self_in, brightness);
|
common_hal_adafruit_pixelbuf_pixelbuf_set_brightness(self_in, brightness);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_brightness_obj, pixelbuf_pixelbuf_obj_set_brightness);
|
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."""
|
//| """Whether to automatically write the pixels after each update."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
|
||||||
return mp_obj_new_bool(common_hal__adafruit_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);
|
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) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_auto_write(mp_obj_t self_in, mp_obj_t value) {
|
||||||
common_hal__adafruit_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;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_auto_write_obj, pixelbuf_pixelbuf_obj_set_auto_write);
|
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)"""
|
//| """byteorder string for the buffer (read-only)"""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
||||||
return common_hal__adafruit_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);
|
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:
|
case MP_UNARY_OP_BOOL:
|
||||||
return mp_const_true;
|
return mp_const_true;
|
||||||
case MP_UNARY_OP_LEN:
|
case MP_UNARY_OP_LEN:
|
||||||
return MP_OBJ_NEW_SMALL_INT(common_hal__adafruit_pixelbuf_pixelbuf_get_len(self_in));
|
return MP_OBJ_NEW_SMALL_INT(common_hal_adafruit_pixelbuf_pixelbuf_get_len(self_in));
|
||||||
default:
|
default:
|
||||||
return MP_OBJ_NULL; // op not supported
|
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) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
common_hal_adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
|
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) {
|
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_fill(self_in, value);
|
common_hal_adafruit_pixelbuf_pixelbuf_fill(self_in, value);
|
||||||
|
|
||||||
return mp_const_none;
|
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)) {
|
} else if (mp_obj_is_type(index_in, &mp_type_slice)) {
|
||||||
mp_bound_slice_t slice;
|
mp_bound_slice_t slice;
|
||||||
|
|
||||||
size_t length = common_hal__adafruit_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);
|
mp_seq_get_fast_slice_indexes(length, index_in, &slice);
|
||||||
static mp_obj_tuple_t flat_item_tuple = {
|
static mp_obj_tuple_t flat_item_tuple = {
|
||||||
.base = {&mp_type_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
|
if (value == MP_OBJ_SENTINEL) { // Get
|
||||||
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(slice_len, NULL));
|
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(slice_len, NULL));
|
||||||
for (uint i = 0; i < slice_len; i++) {
|
for (uint i = 0; i < slice_len; i++) {
|
||||||
t->items[i] = common_hal__adafruit_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);
|
return MP_OBJ_FROM_PTR(t);
|
||||||
} else { // Set
|
} 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));
|
size_t num_items = mp_obj_get_int(mp_obj_len(value));
|
||||||
|
|
||||||
if (num_items != slice_len && num_items != (slice_len * common_hal__adafruit_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);
|
mp_raise_ValueError_varg(translate("Unmatched number of items on RHS (expected %d, got %d)."), slice_len, num_items);
|
||||||
}
|
}
|
||||||
common_hal__adafruit_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);
|
num_items != slice_len ? &flat_item_tuple : mp_const_none);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
#else
|
#else
|
||||||
@ -354,13 +354,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else { // Single index rather than slice.
|
} else { // Single index rather than slice.
|
||||||
size_t length = common_hal__adafruit_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);
|
size_t index = mp_get_index(mp_obj_get_type(self_in), length, index_in, false);
|
||||||
|
|
||||||
if (value == MP_OBJ_SENTINEL) { // Get
|
if (value == MP_OBJ_SENTINEL) { // Get
|
||||||
return common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(self_in, index);
|
return common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(self_in, index);
|
||||||
} else { // Store
|
} else { // Store
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_set_pixel(self_in, index, value);
|
common_hal_adafruit_pixelbuf_pixelbuf_set_pixel(self_in, index, value);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,22 +31,22 @@
|
|||||||
|
|
||||||
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
|
extern const mp_obj_type_t pixelbuf_pixelbuf_type;
|
||||||
|
|
||||||
void common_hal__adafruit_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,
|
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);
|
size_t header_len, uint8_t *trailer, size_t trailer_len);
|
||||||
|
|
||||||
// These take mp_obj_t because they are called on subclasses of PixelBuf.
|
// These take mp_obj_t because they are called on subclasses of PixelBuf.
|
||||||
uint8_t common_hal__adafruit_pixelbuf_pixelbuf_get_bpp(mp_obj_t self);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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_fill(mp_obj_t self, mp_obj_t item);
|
||||||
void common_hal__adafruit_pixelbuf_pixelbuf_show(mp_obj_t self);
|
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);
|
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_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);
|
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
|
#endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//| The `adafruit_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.
|
//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.
|
||||||
//|
|
//|
|
||||||
//| Also available as `_pixelbuf`. This usage has been deprecated.
|
//| Also available as ``_pixelbuf``. This usage has been deprecated.
|
||||||
//|
|
//|
|
||||||
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
|
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
|
||||||
// TODO: Pull in docs from adafruit_pixelbuf.
|
// TODO: Pull in docs from adafruit_pixelbuf.
|
||||||
|
@ -40,7 +40,7 @@ static pixelbuf_pixelbuf_obj_t *native_pixelbuf(mp_obj_t pixelbuf_obj) {
|
|||||||
return MP_OBJ_TO_PTR(native_pixelbuf);
|
return MP_OBJ_TO_PTR(native_pixelbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal__adafruit_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,
|
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) {
|
uint8_t *header, size_t header_len, uint8_t *trailer, size_t trailer_len) {
|
||||||
|
|
||||||
@ -71,43 +71,43 @@ void common_hal__adafruit_pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *s
|
|||||||
// Call set_brightness so that it can allocate a second buffer if needed.
|
// Call set_brightness so that it can allocate a second buffer if needed.
|
||||||
self->brightness = 1.0;
|
self->brightness = 1.0;
|
||||||
self->scaled_brightness = 0x100;
|
self->scaled_brightness = 0x100;
|
||||||
common_hal__adafruit_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.
|
// Turn on auto_write. We don't want to do it with the above brightness call.
|
||||||
self->auto_write = auto_write;
|
self->auto_write = auto_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
return self->pixel_count;
|
return self->pixel_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
return self->byteorder.bpp;
|
return self->byteorder.bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
return self->byteorder.order_string;
|
return self->byteorder.order_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
return self->auto_write;
|
return self->auto_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
self->auto_write = auto_write;
|
self->auto_write = auto_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_float_t common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
return self->brightness;
|
return self->brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal__adafruit_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);
|
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
|
// 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.
|
// also prevents the pre_brightness_buffer allocation when brightness is set to 1.0 again.
|
||||||
@ -135,7 +135,7 @@ void common_hal__adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self->auto_write) {
|
if (self->auto_write) {
|
||||||
common_hal__adafruit_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);
|
_pixelbuf_set_pixel_color(self, index, r, g, b, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
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) {
|
mp_obj_tuple_t *flatten_to) {
|
||||||
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
mp_obj_iter_buf_t iter_buf;
|
mp_obj_iter_buf_t iter_buf;
|
||||||
@ -268,21 +268,21 @@ void common_hal__adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self->auto_write) {
|
if (self->auto_write) {
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
common_hal_adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void common_hal__adafruit_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_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
_pixelbuf_set_pixel(self, index, value);
|
_pixelbuf_set_pixel(self, index, value);
|
||||||
if (self->auto_write) {
|
if (self->auto_write) {
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
common_hal_adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
mp_obj_t elems[self->byteorder.bpp];
|
mp_obj_t elems[self->byteorder.bpp];
|
||||||
uint8_t *pixel_buffer = self->post_brightness_buffer;
|
uint8_t *pixel_buffer = self->post_brightness_buffer;
|
||||||
@ -307,7 +307,7 @@ mp_obj_t common_hal__adafruit_pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size
|
|||||||
return mp_obj_new_tuple(self->byteorder.bpp, elems);
|
return mp_obj_new_tuple(self->byteorder.bpp, elems);
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
mp_obj_t dest[2 + 1];
|
mp_obj_t dest[2 + 1];
|
||||||
mp_load_method(self_in, MP_QSTR__transmit, dest);
|
mp_load_method(self_in, MP_QSTR__transmit, dest);
|
||||||
@ -317,7 +317,7 @@ void common_hal__adafruit_pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
|||||||
mp_call_method_n_kw(1, 0, dest);
|
mp_call_method_n_kw(1, 0, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal__adafruit_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);
|
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
|
||||||
|
|
||||||
uint8_t r;
|
uint8_t r;
|
||||||
@ -330,6 +330,6 @@ void common_hal__adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill
|
|||||||
_pixelbuf_set_pixel_color(self, i, r, g, b, w);
|
_pixelbuf_set_pixel_color(self, i, r, g, b, w);
|
||||||
}
|
}
|
||||||
if (self->auto_write) {
|
if (self->auto_write) {
|
||||||
common_hal__adafruit_pixelbuf_pixelbuf_show(self_in);
|
common_hal_adafruit_pixelbuf_pixelbuf_show(self_in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user