@@ -314,10 +314,49 @@ STATIC mp_obj_t protomatter_protomatter_refresh(mp_obj_t self_in) {
314314}
315315MP_DEFINE_CONST_FUN_OBJ_1 (protomatter_protomatter_refresh_obj , protomatter_protomatter_refresh );
316316
317+ //| .. attribute:: width
318+ //|
319+ //| The width of the display, in pixels
320+ //|
321+ STATIC mp_obj_t protomatter_protomatter_get_width (mp_obj_t self_in ) {
322+ protomatter_protomatter_obj_t * self = (protomatter_protomatter_obj_t * )self_in ;
323+ check_for_deinit (self );
324+ return MP_OBJ_NEW_SMALL_INT (self -> width );
325+ }
326+ MP_DEFINE_CONST_FUN_OBJ_1 (protomatter_protomatter_get_width_obj , protomatter_protomatter_get_width );
327+ const mp_obj_property_t protomatter_protomatter_width_obj = {
328+ .base .type = & mp_type_property ,
329+ .proxy = {(mp_obj_t )& protomatter_protomatter_get_width_obj ,
330+ (mp_obj_t )& mp_const_none_obj ,
331+ (mp_obj_t )& mp_const_none_obj },
332+ };
333+
334+ //| .. attribute:: height
335+ //|
336+ //| The height of the display, in pixels
337+ //|
338+ STATIC mp_obj_t protomatter_protomatter_get_height (mp_obj_t self_in ) {
339+ protomatter_protomatter_obj_t * self = (protomatter_protomatter_obj_t * )self_in ;
340+ check_for_deinit (self );
341+ int computed_get_height = (self -> rgb_count / 3 ) << (self -> addr_count );
342+ return MP_OBJ_NEW_SMALL_INT (computed_get_height );
343+ }
344+ MP_DEFINE_CONST_FUN_OBJ_1 (protomatter_protomatter_get_height_obj , protomatter_protomatter_get_height );
345+
346+ const mp_obj_property_t protomatter_protomatter_height_obj = {
347+ .base .type = & mp_type_property ,
348+ .proxy = {(mp_obj_t )& protomatter_protomatter_get_height_obj ,
349+ (mp_obj_t )& mp_const_none_obj ,
350+ (mp_obj_t )& mp_const_none_obj },
351+ };
352+
353+
317354STATIC const mp_rom_map_elem_t protomatter_protomatter_locals_dict_table [] = {
318355 { MP_ROM_QSTR (MP_QSTR_deinit ), MP_ROM_PTR (& protomatter_protomatter_deinit_obj ) },
319356 { MP_ROM_QSTR (MP_QSTR_brightness ), MP_ROM_PTR (& protomatter_protomatter_brightness_obj ) },
320357 { MP_ROM_QSTR (MP_QSTR_refresh ), MP_ROM_PTR (& protomatter_protomatter_refresh_obj ) },
358+ { MP_ROM_QSTR (MP_QSTR_width ), MP_ROM_PTR (& protomatter_protomatter_width_obj ) },
359+ { MP_ROM_QSTR (MP_QSTR_height ), MP_ROM_PTR (& protomatter_protomatter_height_obj ) },
321360};
322361STATIC MP_DEFINE_CONST_DICT (protomatter_protomatter_locals_dict , protomatter_protomatter_locals_dict_table );
323362
0 commit comments