@@ -82,30 +82,25 @@ static const char default_name[] = "CIRCUITPY";
8282//| :param str name: The name used when advertising this peripheral
8383//|
8484
85- STATIC mp_obj_t bleio_peripheral_make_new (const mp_obj_type_t * type , size_t n_args , size_t n_kw , const mp_obj_t * pos_args ) {
86- mp_arg_check_num (n_args , n_kw , 0 , 1 , true);
87- bleio_peripheral_obj_t * self = m_new_obj (bleio_peripheral_obj_t );
88- self -> base .type = & bleio_peripheral_type ;
89- self -> service_list = mp_obj_new_list (0 , NULL );
90- self -> notif_handler = mp_const_none ;
91-
92- mp_map_t kw_args ;
93- mp_map_init_fixed_table (& kw_args , n_kw , pos_args + n_args );
94-
85+ STATIC mp_obj_t bleio_peripheral_make_new (const mp_obj_type_t * type , size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
9586 enum { ARG_services , ARG_name };
9687 static const mp_arg_t allowed_args [] = {
9788 { MP_QSTR_services , MP_ARG_OBJ , {.u_obj = mp_const_none } },
9889 { MP_QSTR_name , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = mp_const_none } },
9990 };
10091
10192 mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
102- mp_arg_parse_all (n_args , pos_args , & kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
93+ mp_arg_parse_all (n_args , pos_args , kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
10394
10495 // If services is not an iterable, an exception will be thrown.
10596 mp_obj_iter_buf_t iter_buf ;
10697 mp_obj_t iterable = mp_getiter (args [ARG_services ].u_obj , & iter_buf );
10798 mp_obj_t service ;
10899
100+ bleio_peripheral_obj_t * self = m_new_obj (bleio_peripheral_obj_t );
101+ self -> base .type = & bleio_peripheral_type ;
102+ self -> service_list = mp_obj_new_list (0 , NULL );
103+ self -> notif_handler = mp_const_none ;
109104 while ((service = mp_iternext (iterable )) != MP_OBJ_STOP_ITERATION ) {
110105 if (!MP_OBJ_IS_TYPE (service , & bleio_service_type )) {
111106 mp_raise_ValueError (translate ("services includes an object that is not a Service" ));
0 commit comments