From bd3c36ce6d3b440dcb7591cacccbd2bc72a2268c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 14 Jan 2019 18:08:45 -0800 Subject: fixup m0 and nrf --- shared-bindings/bleio/CharacteristicBuffer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'shared-bindings/bleio/CharacteristicBuffer.c') diff --git a/shared-bindings/bleio/CharacteristicBuffer.c b/shared-bindings/bleio/CharacteristicBuffer.c index f0578a7ad..2bb4448c4 100644 --- a/shared-bindings/bleio/CharacteristicBuffer.c +++ b/shared-bindings/bleio/CharacteristicBuffer.c @@ -44,14 +44,7 @@ //| :param int buffer_size: Size of ring buffer that stores incoming data coming from client. //| Must be >= 1. //| -STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) { - mp_arg_check_num(n_args, n_kw, 1, 2, true); - bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t); - self->base.type = &bleio_characteristic_buffer_type; - - mp_map_t kw_args; - mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args); - +STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_characteristic, ARG_buffer_size, }; static const mp_arg_t allowed_args[] = { { MP_QSTR_characteristic, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -59,7 +52,7 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, &kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); const mp_obj_t characteristic = args[ARG_characteristic].u_obj; const int buffer_size = args[ARG_buffer_size].u_int; @@ -72,6 +65,8 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, mp_raise_ValueError(translate("Expected a Characteristic")); } + bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t); + self->base.type = &bleio_characteristic_buffer_type; self->characteristic = MP_OBJ_TO_PTR(characteristic); common_hal_bleio_characteristic_buffer_construct(self, self->characteristic, buffer_size); -- cgit v1.2.3