diff options
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/displayio/__init__.c | 24 | ||||
| -rw-r--r-- | shared-module/displayio/__init__.h | 4 | ||||
| -rw-r--r-- | shared-module/rgbmatrix/RGBMatrix.c | 30 | ||||
| -rw-r--r-- | shared-module/rgbmatrix/allocator.h | 4 |
4 files changed, 31 insertions, 31 deletions
diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index cf1bc45d9..c898bbb98 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -21,8 +21,8 @@ primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; -#if CIRCUITPY_PROTOMATTER -STATIC bool any_display_uses_this_protomatter(protomatter_protomatter_obj_t* pm) { +#if CIRCUITPY_RGBMATRIX +STATIC bool any_display_uses_this_rgbmatrix(rgbmatrix_rgbmatrix_obj_t* pm) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display; @@ -103,8 +103,8 @@ void common_hal_displayio_release_displays(void) { } else if (bus_type == &displayio_parallelbus_type) { common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); #if CIRCUITPY_FRAMEBUFFERIO - } else if (bus_type == &protomatter_Protomatter_type) { - common_hal_protomatter_protomatter_deinit(&displays[i].protomatter); + } else if (bus_type == &rgbmatrix_RGBMatrix_type) { + common_hal_rgbmatrix_rgbmatrix_deinit(&displays[i].rgbmatrix); #endif } displays[i].fourwire_bus.base.type = &mp_type_NoneType; @@ -167,11 +167,11 @@ void reset_displays(void) { } } } -#if CIRCUITPY_PROTOMATTER - } else if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) { - protomatter_protomatter_obj_t * pm = &displays[i].protomatter; - if(!any_display_uses_this_protomatter(pm)) { - common_hal_protomatter_protomatter_deinit(pm); +#if CIRCUITPY_RGBMATRIX + } else if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { + rgbmatrix_rgbmatrix_obj_t * pm = &displays[i].rgbmatrix; + if(!any_display_uses_this_rgbmatrix(pm)) { + common_hal_rgbmatrix_rgbmatrix_deinit(pm); } #endif } else { @@ -200,9 +200,9 @@ void reset_displays(void) { void displayio_gc_collect(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { -#if CIRCUITPY_PROTOMATTER - if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) { - protomatter_protomatter_collect_ptrs(&displays[i].protomatter); +#if CIRCUITPY_RGBMATRIX + if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { + rgbmatrix_rgbmatrix_collect_ptrs(&displays[i].rgbmatrix); } #endif diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index 87c0d3356..9eb10c28b 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -43,8 +43,8 @@ typedef struct { displayio_fourwire_obj_t fourwire_bus; displayio_i2cdisplay_obj_t i2cdisplay_bus; displayio_parallelbus_obj_t parallel_bus; -#if CIRCUITPY_PROTOMATTER - protomatter_protomatter_obj_t protomatter; +#if CIRCUITPY_RGBMATRIX + rgbmatrix_rgbmatrix_obj_t rgbmatrix; #endif }; union { diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 17049494d..df064ff81 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -42,7 +42,7 @@ extern Protomatter_core *_PM_protoPtr; -void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void *timer) { +void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void *timer) { self->width = width; self->bit_depth = bit_depth; self->rgb_count = rgb_count; @@ -54,7 +54,7 @@ void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t self->latch_pin = latch_pin; self->doublebuffer = doublebuffer; - self->timer = timer ? timer : common_hal_protomatter_timer_allocate(); + self->timer = timer ? timer : common_hal_rgbmatrix_timer_allocate(); if (self->timer == NULL) { mp_raise_ValueError(translate("No timer available")); } @@ -62,10 +62,10 @@ void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t self->width = width; self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count); - common_hal_protomatter_protomatter_reconstruct(self, framebuffer); + common_hal_rgbmatrix_rgbmatrix_reconstruct(self, framebuffer); } -void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_t* self, mp_obj_t framebuffer) { +void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self, mp_obj_t framebuffer) { if (framebuffer) { self->framebuffer = framebuffer; framebuffer = mp_obj_new_bytearray_of_zeros(self->bufsize); @@ -99,7 +99,7 @@ void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_ if (stat == PROTOMATTER_OK) { _PM_protoPtr = &self->core; common_hal_mcu_disable_interrupts(); - common_hal_protomatter_timer_enable(self->timer); + common_hal_rgbmatrix_timer_enable(self->timer); stat = _PM_begin(&self->core); _PM_convert_565(&self->core, self->bufinfo.buf, self->width); common_hal_mcu_enable_interrupts(); @@ -109,7 +109,7 @@ void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_ if (stat != PROTOMATTER_OK) { // XXX this deinit() actually makes crashy-crashy // can trigger it by sending inappropriate pins - common_hal_protomatter_protomatter_deinit(self); + common_hal_rgbmatrix_rgbmatrix_deinit(self); switch (stat) { case PROTOMATTER_ERR_PINS: mp_raise_ValueError(translate("Invalid pin")); @@ -120,7 +120,7 @@ void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_ case PROTOMATTER_ERR_MALLOC: /// should have already been signaled as NLR default: mp_raise_msg_varg(&mp_type_RuntimeError, - translate("Protomatter internal error #%d"), (int)stat); + translate("Internal error #%d"), (int)stat); break; } } @@ -142,9 +142,9 @@ STATIC void free_pin_seq(uint8_t *seq, int count) { } } -void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t* self) { +void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t* self) { if (self->timer) { - common_hal_protomatter_timer_free(self->timer); + common_hal_rgbmatrix_timer_free(self->timer); self->timer = 0; } @@ -173,14 +173,14 @@ void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t* se self->framebuffer = NULL; } -void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t* self) { +void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t* self) { gc_collect_ptr(self->framebuffer); gc_collect_ptr(self->core.rgbPins); gc_collect_ptr(self->core.addr); gc_collect_ptr(self->core.screenData); } -void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused) { +void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t* self, bool paused) { if (paused && !self->paused) { _PM_stop(&self->core); } else if (!paused && self->paused) { @@ -189,20 +189,20 @@ void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t self->paused = paused; } -bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self) { +bool common_hal_rgbmatrix_rgbmatrix_get_paused(rgbmatrix_rgbmatrix_obj_t* self) { return self->paused; } -void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self) { +void common_hal_rgbmatrix_rgbmatrix_refresh(rgbmatrix_rgbmatrix_obj_t* self) { _PM_convert_565(&self->core, self->bufinfo.buf, self->width); _PM_swapbuffer_maybe(&self->core); } -int common_hal_protomatter_protomatter_get_width(protomatter_protomatter_obj_t* self) { +int common_hal_rgbmatrix_rgbmatrix_get_width(rgbmatrix_rgbmatrix_obj_t* self) { return self->width; } -int common_hal_protomatter_protomatter_get_height(protomatter_protomatter_obj_t* self) { +int common_hal_rgbmatrix_rgbmatrix_get_height(rgbmatrix_rgbmatrix_obj_t* self) { int computed_height = (self->rgb_count / 3) << (self->addr_count); return computed_height; } diff --git a/shared-module/rgbmatrix/allocator.h b/shared-module/rgbmatrix/allocator.h index b7f517ce5..5e6f0b41d 100644 --- a/shared-module/rgbmatrix/allocator.h +++ b/shared-module/rgbmatrix/allocator.h @@ -1,5 +1,5 @@ -#ifndef MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H -#define MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H +#ifndef MICROPY_INCLUDED_SHARED_MODULE_RGBMATRIX_ALLOCATOR_H +#define MICROPY_INCLUDED_SHARED_MODULE_RGBMATRIX_ALLOCATOR_H #include <stdbool.h> #include "py/gc.h" |
