summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorHosted Weblate <hosted@weblate.org>2021-01-27 02:31:37 +0100
committerHosted Weblate <hosted@weblate.org>2021-01-27 02:31:37 +0100
commit83a99cbc33c47e398f511a098a7b4a6ba9a0d830 (patch)
tree8690556db97ebd0540249f169849ea0ed2a3ad92 /shared-module
parent2918b73828ea68e6a9765923173021fe95b7d808 (diff)
parent45b3c9ae4213008da092d5bb35e8602e1e90bca2 (diff)
Merge remote-tracking branch 'origin/main' into main
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/rgbmatrix/RGBMatrix.c11
-rw-r--r--shared-module/rgbmatrix/RGBMatrix.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c
index a09767b62..b8db0d893 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_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) {
+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, int8_t tile, bool serpentine, void *timer) {
self->width = width;
self->bit_depth = bit_depth;
self->rgb_count = rgb_count;
@@ -53,6 +53,8 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i
self->oe_pin = oe_pin;
self->latch_pin = latch_pin;
self->doublebuffer = doublebuffer;
+ self->tile = tile;
+ self->serpentine = serpentine;
self->timer = timer ? timer : common_hal_rgbmatrix_timer_allocate();
if (self->timer == NULL) {
@@ -60,7 +62,7 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i
}
self->width = width;
- self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count);
+ self->bufsize = 2 * width * common_hal_rgbmatrix_rgbmatrix_get_height(self);
common_hal_rgbmatrix_rgbmatrix_reconstruct(self, framebuffer);
}
@@ -95,7 +97,8 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self,
self->rgb_count/6, self->rgb_pins,
self->addr_count, self->addr_pins,
self->clock_pin, self->latch_pin, self->oe_pin,
- self->doublebuffer, self->timer);
+ self->doublebuffer, self->serpentine ? -self->tile : self->tile,
+ self->timer);
if (stat == PROTOMATTER_OK) {
_PM_protoPtr = &self->protomatter;
@@ -209,7 +212,7 @@ int common_hal_rgbmatrix_rgbmatrix_get_width(rgbmatrix_rgbmatrix_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);
+ int computed_height = (self->rgb_count / 3) * (1 << (self->addr_count)) * self->tile;
return computed_height;
}
diff --git a/shared-module/rgbmatrix/RGBMatrix.h b/shared-module/rgbmatrix/RGBMatrix.h
index 6dbc6fd41..4a0e9235e 100644
--- a/shared-module/rgbmatrix/RGBMatrix.h
+++ b/shared-module/rgbmatrix/RGBMatrix.h
@@ -44,4 +44,6 @@ typedef struct {
bool core_is_initialized;
bool paused;
bool doublebuffer;
+ bool serpentine;
+ int8_t tile;
} rgbmatrix_rgbmatrix_obj_t;