@@ -384,27 +384,21 @@ STATIC mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map
384384}
385385STATIC MP_DEFINE_CONST_FUN_OBJ_KW (bluetooth_ble_config_obj , 1 , bluetooth_ble_config );
386386
387- STATIC mp_obj_t bluetooth_ble_irq (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
388- enum { ARG_handler };
389- static const mp_arg_t allowed_args [] = {
390- { MP_QSTR_handler , MP_ARG_OBJ | MP_ARG_REQUIRED , {.u_rom_obj = MP_ROM_NONE } },
391- };
392- mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
393- mp_arg_parse_all (n_args - 1 , pos_args + 1 , kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
394- mp_obj_t callback = args [ARG_handler ].u_obj ;
395- if (callback != mp_const_none && !mp_obj_is_callable (callback )) {
396- mp_raise_ValueError (MP_ERROR_TEXT ("invalid callback" ));
387+ STATIC mp_obj_t bluetooth_ble_irq (mp_obj_t self_in , mp_obj_t handler_in ) {
388+ (void )self_in ;
389+ if (handler_in != mp_const_none && !mp_obj_is_callable (handler_in )) {
390+ mp_raise_ValueError (MP_ERROR_TEXT ("invalid handler" ));
397391 }
398392
399393 // Update the callback.
400394 MICROPY_PY_BLUETOOTH_ENTER
401395 mp_obj_bluetooth_ble_t * o = MP_OBJ_TO_PTR (MP_STATE_VM (bluetooth ));
402- o -> irq_handler = callback ;
396+ o -> irq_handler = handler_in ;
403397 MICROPY_PY_BLUETOOTH_EXIT
404398
405399 return mp_const_none ;
406400}
407- STATIC MP_DEFINE_CONST_FUN_OBJ_KW (bluetooth_ble_irq_obj , 1 , bluetooth_ble_irq );
401+ STATIC MP_DEFINE_CONST_FUN_OBJ_2 (bluetooth_ble_irq_obj , bluetooth_ble_irq );
408402
409403// ----------------------------------------------------------------------------
410404// Bluetooth object: GAP
0 commit comments