@@ -70,21 +70,21 @@ STATIC mp_obj_t common_LightMatrix_char(size_t n_args, const mp_obj_t *pos_args,
7070 pb_assert (PBIO_ERROR_INVALID_ARG );
7171 }
7272
73- // Pick corresponding image and display it
73+ // Pick corresponding icon and display it
7474 pb_assert (pbio_light_matrix_set_rows (self -> light_matrix , pb_font_5x5 [text [0 ] - 32 ]));
7575
7676 return mp_const_none ;
7777}
7878STATIC MP_DEFINE_CONST_FUN_OBJ_KW (common_LightMatrix_char_obj , 1 , common_LightMatrix_char );
7979
80- static void common_LightMatrix_image__extract (mp_obj_t image_in , size_t size , uint8_t * data ) {
80+ static void common_LightMatrix_icon__extract (mp_obj_t icon_in , size_t size , uint8_t * data ) {
8181
8282 #if MICROPY_PY_BUILTINS_FLOAT
83- // If image is a matrix, copy data from there
84- if (mp_obj_is_type (image_in , & pb_type_Matrix )) {
83+ // If icon is a matrix, copy data from there
84+ if (mp_obj_is_type (icon_in , & pb_type_Matrix )) {
8585 for (size_t r = 0 ; r < size ; r ++ ) {
8686 for (size_t c = 0 ; c < size ; c ++ ) {
87- float scalar = pb_type_Matrix_get_scalar (image_in , r , c );
87+ float scalar = pb_type_Matrix_get_scalar (icon_in , r , c );
8888 scalar = scalar > 100 ? 100 : (scalar < 0 ? 0 : scalar );
8989 data [r * size + c ] = (uint8_t )scalar ;
9090 }
@@ -96,7 +96,7 @@ static void common_LightMatrix_image__extract(mp_obj_t image_in, size_t size, ui
9696 // Unpack the main list of rows and get the requested sizes
9797 mp_obj_t * row_objs , * scalar_objs ;
9898 size_t m ;
99- mp_obj_get_array (image_in , & m , & row_objs );
99+ mp_obj_get_array (icon_in , & m , & row_objs );
100100 if (m != size ) {
101101 pb_assert (PBIO_ERROR_INVALID_ARG );
102102 }
@@ -115,23 +115,23 @@ static void common_LightMatrix_image__extract(mp_obj_t image_in, size_t size, ui
115115 }
116116}
117117
118- // pybricks._common.LightMatrix.image
119- STATIC mp_obj_t common_LightMatrix_image (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
118+ // pybricks._common.LightMatrix.icon
119+ STATIC mp_obj_t common_LightMatrix_icon (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
120120 PB_PARSE_ARGS_METHOD (n_args , pos_args , kw_args ,
121121 common_LightMatrix_obj_t , self ,
122- PB_ARG_REQUIRED (image ));
122+ PB_ARG_REQUIRED (icon ));
123123
124124 // Allocate and extract image data
125125 size_t size = pbio_light_matrix_get_size (self -> light_matrix );
126126 common_LightMatrix__renew (self , 1 );
127- common_LightMatrix_image__extract ( image_in , size , self -> data );
127+ common_LightMatrix_icon__extract ( icon_in , size , self -> data );
128128
129- // Display the image
129+ // Display the icon
130130 pb_assert (pbio_light_matrix_set_image (self -> light_matrix , self -> data ));
131131
132132 return mp_const_none ;
133133}
134- STATIC MP_DEFINE_CONST_FUN_OBJ_KW (common_LightMatrix_image_obj , 1 , common_LightMatrix_image );
134+ STATIC MP_DEFINE_CONST_FUN_OBJ_KW (common_LightMatrix_icon_obj , 1 , common_LightMatrix_icon );
135135
136136// pybricks._common.LightMatrix.on
137137STATIC mp_obj_t common_LightMatrix_on (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
@@ -220,16 +220,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(common_LightMatrix_number_obj, 1, common_Light
220220STATIC mp_obj_t common_LightMatrix_animate (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
221221 PB_PARSE_ARGS_METHOD (n_args , pos_args , kw_args ,
222222 common_LightMatrix_obj_t , self ,
223- PB_ARG_REQUIRED (images ),
223+ PB_ARG_REQUIRED (icons ),
224224 PB_ARG_REQUIRED (interval ));
225225
226226 // Time between frames
227227 mp_int_t interval = pb_obj_get_int (interval_in );
228228
229- // Unpack the list of images
230- mp_obj_t * image_objs ;
229+ // Unpack the list of icons
230+ mp_obj_t * icon_objs ;
231231 size_t n ;
232- mp_obj_get_array (images_in , & n , & image_objs );
232+ mp_obj_get_array (icons_in , & n , & icon_objs );
233233 if (n > UINT8_MAX || n < 2 ) {
234234 pb_assert (PBIO_ERROR_INVALID_ARG );
235235 }
@@ -240,7 +240,7 @@ STATIC mp_obj_t common_LightMatrix_animate(size_t n_args, const mp_obj_t *pos_ar
240240
241241 // Extract animation data
242242 for (uint8_t i = 0 ; i < n ; i ++ ) {
243- common_LightMatrix_image__extract ( image_objs [i ], size , self -> data + size * size * i );
243+ common_LightMatrix_icon__extract ( icon_objs [i ], size , self -> data + size * size * i );
244244 }
245245
246246 // Activate the animation
@@ -304,7 +304,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(common_LightMatrix_text_obj, 1, common_LightMa
304304// dir(pybricks.builtins.LightMatrix)
305305STATIC const mp_rom_map_elem_t common_LightMatrix_locals_dict_table [] = {
306306 { MP_ROM_QSTR (MP_QSTR_char ), MP_ROM_PTR (& common_LightMatrix_char_obj ) },
307- { MP_ROM_QSTR (MP_QSTR_image ), MP_ROM_PTR (& common_LightMatrix_image_obj ) },
307+ { MP_ROM_QSTR (MP_QSTR_icon ), MP_ROM_PTR (& common_LightMatrix_icon_obj ) },
308308 { MP_ROM_QSTR (MP_QSTR_number ), MP_ROM_PTR (& common_LightMatrix_number_obj ) },
309309 { MP_ROM_QSTR (MP_QSTR_off ), MP_ROM_PTR (& common_LightMatrix_off_obj ) },
310310 { MP_ROM_QSTR (MP_QSTR_on ), MP_ROM_PTR (& common_LightMatrix_on_obj ) },
0 commit comments