42
42
43
43
extern Protomatter_core * _PM_protoPtr ;
44
44
45
- 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 , void * timer ) {
45
+ 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 ) {
46
46
self -> width = width ;
47
47
self -> bit_depth = bit_depth ;
48
48
self -> rgb_count = rgb_count ;
@@ -54,14 +54,15 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i
54
54
self -> latch_pin = latch_pin ;
55
55
self -> doublebuffer = doublebuffer ;
56
56
self -> tile = tile ;
57
+ self -> serpentine = serpentine ;
57
58
58
59
self -> timer = timer ? timer : common_hal_rgbmatrix_timer_allocate ();
59
60
if (self -> timer == NULL ) {
60
61
mp_raise_ValueError (translate ("No timer available" ));
61
62
}
62
63
63
64
self -> width = width ;
64
- self -> bufsize = 2 * width * rgb_count / 3 * (1 << addr_count );
65
+ self -> bufsize = 2 * width * rgb_count / 3 * (1 << addr_count ) * tile ;
65
66
66
67
common_hal_rgbmatrix_rgbmatrix_reconstruct (self , framebuffer );
67
68
}
@@ -96,7 +97,8 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t* self,
96
97
self -> rgb_count /6 , self -> rgb_pins ,
97
98
self -> addr_count , self -> addr_pins ,
98
99
self -> clock_pin , self -> latch_pin , self -> oe_pin ,
99
- self -> doublebuffer , self -> tile , self -> timer );
100
+ self -> doublebuffer , self -> serpentine ? - self -> tile : self -> tile ,
101
+ self -> timer );
100
102
101
103
if (stat == PROTOMATTER_OK ) {
102
104
_PM_protoPtr = & self -> protomatter ;
@@ -210,7 +212,7 @@ int common_hal_rgbmatrix_rgbmatrix_get_width(rgbmatrix_rgbmatrix_obj_t* self) {
210
212
}
211
213
212
214
int common_hal_rgbmatrix_rgbmatrix_get_height (rgbmatrix_rgbmatrix_obj_t * self ) {
213
- int computed_height = (self -> rgb_count / 3 ) << (self -> addr_count );
215
+ int computed_height = (self -> rgb_count / 3 ) * ( 1 << (self -> addr_count )) * self -> tile ;
214
216
return computed_height ;
215
217
}
216
218
0 commit comments