summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-04-15 10:19:33 -0500
committerJeff Epler <jepler@gmail.com>2020-04-17 18:43:57 -0500
commit64c3968a2e2c626036fcd3d148eae7ba092e6096 (patch)
treea85acce646d2fbd5f80858a2ec79ee036f7a0cf2 /shared-bindings
parent545b6e560a206fe2836647829e1707240d364c5f (diff)
protomatter: move get_width/height to common_hal
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/protomatter/Protomatter.c5
-rw-r--r--shared-bindings/protomatter/Protomatter.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/shared-bindings/protomatter/Protomatter.c b/shared-bindings/protomatter/Protomatter.c
index e3f735dde..4554c30bf 100644
--- a/shared-bindings/protomatter/Protomatter.c
+++ b/shared-bindings/protomatter/Protomatter.c
@@ -321,7 +321,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_refresh_obj, protomatter_proto
STATIC mp_obj_t protomatter_protomatter_get_width(mp_obj_t self_in) {
protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
check_for_deinit(self);
- return MP_OBJ_NEW_SMALL_INT(self->width);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_protomatter_protomatter_get_width(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_get_width_obj, protomatter_protomatter_get_width);
const mp_obj_property_t protomatter_protomatter_width_obj = {
@@ -338,8 +338,7 @@ const mp_obj_property_t protomatter_protomatter_width_obj = {
STATIC mp_obj_t protomatter_protomatter_get_height(mp_obj_t self_in) {
protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
check_for_deinit(self);
- int computed_get_height = (self->rgb_count / 3) << (self->addr_count);
- return MP_OBJ_NEW_SMALL_INT(computed_get_height);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_protomatter_protomatter_get_height(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_get_height_obj, protomatter_protomatter_get_height);
diff --git a/shared-bindings/protomatter/Protomatter.h b/shared-bindings/protomatter/Protomatter.h
index 4704a626f..061c8de4e 100644
--- a/shared-bindings/protomatter/Protomatter.h
+++ b/shared-bindings/protomatter/Protomatter.h
@@ -55,5 +55,7 @@ void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_
void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused);
bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self);
void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self);
+int common_hal_protomatter_protomatter_get_width(protomatter_protomatter_obj_t* self);
+int common_hal_protomatter_protomatter_get_height(protomatter_protomatter_obj_t* self);
#endif