aboutsummaryrefslogtreecommitdiff
path: root/extmod/modbluetooth.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-09-11 11:43:53 +1000
committerDamien George <damien@micropython.org>2020-09-15 15:28:45 +1000
commit6a6a5f9e151473bdcc1d14725d680691ff665a82 (patch)
tree1dee3a863c5c19aa1ec691c2116176e93960031c /extmod/modbluetooth.c
parent504522bd02f9d9f9848d5a6e38427df3d1e4a6e3 (diff)
extmod/modbluetooth: Make BLE.irq() method positional only.
Simplifcation now that the trigger arg has been removed.
Diffstat (limited to 'extmod/modbluetooth.c')
-rw-r--r--extmod/modbluetooth.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index 14d0921c8..64cd38352 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -384,27 +384,21 @@ STATIC mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_config_obj, 1, bluetooth_ble_config);
-STATIC mp_obj_t bluetooth_ble_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_handler };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_handler, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE} },
- };
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t callback = args[ARG_handler].u_obj;
- if (callback != mp_const_none && !mp_obj_is_callable(callback)) {
- mp_raise_ValueError(MP_ERROR_TEXT("invalid callback"));
+STATIC mp_obj_t bluetooth_ble_irq(mp_obj_t self_in, mp_obj_t handler_in) {
+ (void)self_in;
+ if (handler_in != mp_const_none && !mp_obj_is_callable(handler_in)) {
+ mp_raise_ValueError(MP_ERROR_TEXT("invalid handler"));
}
// Update the callback.
MICROPY_PY_BLUETOOTH_ENTER
mp_obj_bluetooth_ble_t *o = MP_OBJ_TO_PTR(MP_STATE_VM(bluetooth));
- o->irq_handler = callback;
+ o->irq_handler = handler_in;
MICROPY_PY_BLUETOOTH_EXIT
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_irq_obj, 1, bluetooth_ble_irq);
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_irq_obj, bluetooth_ble_irq);
// ----------------------------------------------------------------------------
// Bluetooth object: GAP