summaryrefslogtreecommitdiff
path: root/shared-bindings/bleio
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-08-07 11:10:21 -0400
committerDan Halbert <halbert@halwitz.org>2019-08-07 11:10:21 -0400
commitd047b73a9cd0f17f9e11d60f3004ada473b2c803 (patch)
treef4402588a40ea8e8ebfd78aa9b1fec0361caca3f /shared-bindings/bleio
parentd74c8b9425d38fe2dce56e044b128ab5693f5f06 (diff)
fix newly-introduced bugs; UART client/server working again
Diffstat (limited to 'shared-bindings/bleio')
-rw-r--r--shared-bindings/bleio/Characteristic.c12
-rw-r--r--shared-bindings/bleio/__init__.c2
2 files changed, 8 insertions, 6 deletions
diff --git a/shared-bindings/bleio/Characteristic.c b/shared-bindings/bleio/Characteristic.c
index 45bec6c28..4adc897eb 100644
--- a/shared-bindings/bleio/Characteristic.c
+++ b/shared-bindings/bleio/Characteristic.c
@@ -96,16 +96,16 @@ STATIC mp_obj_t bleio_characteristic_make_new(const mp_obj_type_t *type, size_t
bleio_characteristic_obj_t *self = m_new_obj(bleio_characteristic_obj_t);
self->base.type = &bleio_characteristic_type;
- // If descriptors is not an iterable, an exception will be thrown.
- mp_obj_iter_buf_t iter_buf;
- mp_obj_t iterable = mp_getiter(args[ARG_descriptors].u_obj, &iter_buf);
-
-// Copy the descriptors list and validate its items.
+ // Copy the descriptors list and validate its items.
mp_obj_t desc_list_obj = mp_obj_new_list(0, NULL);
mp_obj_list_t *desc_list = MP_OBJ_TO_PTR(desc_list_obj);
+ // If descriptors is not an iterable, an exception will be thrown.
+ mp_obj_iter_buf_t iter_buf;
+ mp_obj_t descriptors_iter = mp_getiter(descriptors, &iter_buf);
+
mp_obj_t descriptor_obj;
- while ((descriptor_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
+ while ((descriptor_obj = mp_iternext(descriptors_iter)) != MP_OBJ_STOP_ITERATION) {
if (!MP_OBJ_IS_TYPE(descriptor_obj, &bleio_descriptor_type)) {
mp_raise_ValueError(translate("descriptors includes an object that is not a Descriptors"));
}
diff --git a/shared-bindings/bleio/__init__.c b/shared-bindings/bleio/__init__.c
index 0009cf113..05be48ddc 100644
--- a/shared-bindings/bleio/__init__.c
+++ b/shared-bindings/bleio/__init__.c
@@ -28,6 +28,7 @@
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Address.h"
+#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Central.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/CharacteristicBuffer.h"
@@ -80,6 +81,7 @@
STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bleio) },
{ MP_ROM_QSTR(MP_QSTR_Address), MP_ROM_PTR(&bleio_address_type) },
+ { MP_ROM_QSTR(MP_QSTR_Attribute), MP_ROM_PTR(&bleio_attribute_type) },
{ MP_ROM_QSTR(MP_QSTR_Central), MP_ROM_PTR(&bleio_central_type) },
{ MP_ROM_QSTR(MP_QSTR_Characteristic), MP_ROM_PTR(&bleio_characteristic_type) },
{ MP_ROM_QSTR(MP_QSTR_CharacteristicBuffer), MP_ROM_PTR(&bleio_characteristic_buffer_type) },