diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-01-14 18:08:45 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-01-14 18:08:45 -0800 |
| commit | bd3c36ce6d3b440dcb7591cacccbd2bc72a2268c (patch) | |
| tree | 4c112251295a7f786b62405c64f884b98300edf0 /shared-bindings/bleio/CharacteristicBuffer.c | |
| parent | 12c8b00556859bd9dc97b4f11761f45ad23098a3 (diff) | |
fixup m0 and nrf
Diffstat (limited to 'shared-bindings/bleio/CharacteristicBuffer.c')
| -rw-r--r-- | shared-bindings/bleio/CharacteristicBuffer.c | 13 |
1 files changed, 4 insertions, 9 deletions
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); |
