3232#include "shared-bindings/util.h"
3333#include "PewPew.h"
3434#include "shared-module/_pew/PewPew.h"
35+ #include "supervisor/shared/translate.h"
3536
3637
3738//| .. currentmodule:: _pew
4950//|
5051//|
5152STATIC mp_obj_t pewpew_make_new (const mp_obj_type_t * type , size_t n_args ,
52- size_t n_kw , const mp_obj_t * pos_args ) {
53- mp_arg_check_num (n_args , n_kw , 4 , 4 , true);
54- mp_map_t kw_args ;
55- mp_map_init_fixed_table (& kw_args , n_kw , pos_args + n_args );
53+ const mp_obj_t * pos_args , mp_map_t * kw_args ) {
54+ mp_arg_check_num (n_args , kw_args , 4 , 4 , true);
5655 enum { ARG_buffer , ARG_rows , ARG_cols , ARG_buttons };
5756 static const mp_arg_t allowed_args [] = {
5857 { MP_QSTR_buffer , MP_ARG_OBJ | MP_ARG_REQUIRED },
@@ -61,7 +60,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args,
6160 { MP_QSTR_buttons , MP_ARG_OBJ | MP_ARG_REQUIRED },
6261 };
6362 mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
64- mp_arg_parse_all (n_args , pos_args , & kw_args , MP_ARRAY_SIZE (allowed_args ),
63+ mp_arg_parse_all (n_args , pos_args , kw_args , MP_ARRAY_SIZE (allowed_args ),
6564 allowed_args , args );
6665
6766 mp_buffer_info_t bufinfo ;
@@ -76,12 +75,12 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args,
7675 mp_obj_get_array (args [ARG_cols ].u_obj , & cols_size , & cols );
7776
7877 if (bufinfo .len != rows_size * cols_size ) {
79- mp_raise_TypeError ("wrong buffer size" );
78+ mp_raise_TypeError (translate ( "" ) );
8079 }
8180
8281 for (size_t i = 0 ; i < rows_size ; ++ i ) {
8382 if (!MP_OBJ_IS_TYPE (rows [i ], & digitalio_digitalinout_type )) {
84- mp_raise_TypeError ("expected a DigitalInOut" );
83+ mp_raise_TypeError (translate ( "" ) );
8584 }
8685 digitalio_digitalinout_obj_t * pin = MP_OBJ_TO_PTR (rows [i ]);
8786 raise_error_if_deinited (
@@ -90,7 +89,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args,
9089
9190 for (size_t i = 0 ; i < cols_size ; ++ i ) {
9291 if (!MP_OBJ_IS_TYPE (cols [i ], & digitalio_digitalinout_type )) {
93- mp_raise_TypeError ("expected a DigitalInOut" );
92+ mp_raise_TypeError (translate ( "" ) );
9493 }
9594 digitalio_digitalinout_obj_t * pin = MP_OBJ_TO_PTR (cols [i ]);
9695 raise_error_if_deinited (
@@ -99,7 +98,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args,
9998
10099 if (!MP_OBJ_IS_TYPE (args [ARG_buttons ].u_obj ,
101100 & digitalio_digitalinout_type )) {
102- mp_raise_TypeError ("expected a DigitalInOut" );
101+ mp_raise_TypeError (translate ( "" ) );
103102 }
104103 digitalio_digitalinout_obj_t * buttons = MP_OBJ_TO_PTR (
105104 args [ARG_buttons ].u_obj );
0 commit comments