summaryrefslogtreecommitdiff
path: root/ports
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 /ports
parentd74c8b9425d38fe2dce56e044b128ab5693f5f06 (diff)
fix newly-introduced bugs; UART client/server working again
Diffstat (limited to 'ports')
-rw-r--r--ports/nrf/common-hal/bleio/Service.c12
-rw-r--r--ports/nrf/common-hal/bleio/__init__.c5
2 files changed, 8 insertions, 9 deletions
diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/bleio/Service.c
index 6d2d9d74f..0ac0107f5 100644
--- a/ports/nrf/common-hal/bleio/Service.c
+++ b/ports/nrf/common-hal/bleio/Service.c
@@ -73,12 +73,12 @@ void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self)
MP_OBJ_TO_PTR(self->characteristic_list->items[characteristic_idx]);
ble_gatts_char_md_t char_md = {
- .char_props.broadcast = (bool) characteristic->props & CHAR_PROP_BROADCAST,
- .char_props.read = (bool) characteristic->props & CHAR_PROP_READ,
- .char_props.write_wo_resp = (bool) characteristic->props & CHAR_PROP_WRITE_NO_RESPONSE,
- .char_props.write = (bool) characteristic->props & CHAR_PROP_WRITE,
- .char_props.notify = (bool) characteristic->props & CHAR_PROP_NOTIFY,
- .char_props.indicate = (bool) characteristic->props & CHAR_PROP_INDICATE,
+ .char_props.broadcast = (characteristic->props & CHAR_PROP_BROADCAST) ? 1 : 0,
+ .char_props.read = (characteristic->props & CHAR_PROP_READ) ? 1 : 0,
+ .char_props.write_wo_resp = (characteristic->props & CHAR_PROP_WRITE_NO_RESPONSE) ? 1 : 0,
+ .char_props.write = (characteristic->props & CHAR_PROP_WRITE) ? 1 : 0,
+ .char_props.notify = (characteristic->props & CHAR_PROP_NOTIFY) ? 1 : 0,
+ .char_props.indicate = (characteristic->props & CHAR_PROP_INDICATE) ? 1 : 0,
};
ble_gatts_attr_md_t cccd_md = {
diff --git a/ports/nrf/common-hal/bleio/__init__.c b/ports/nrf/common-hal/bleio/__init__.c
index 9879a9ff4..d09b6f5af 100644
--- a/ports/nrf/common-hal/bleio/__init__.c
+++ b/ports/nrf/common-hal/bleio/__init__.c
@@ -195,8 +195,6 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, mp_ob
bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t);
characteristic->base.type = &bleio_characteristic_type;
- characteristic->descriptor_list = mp_obj_new_list(0, NULL);
-
bleio_uuid_obj_t *uuid = NULL;
if (gattc_char->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
@@ -219,7 +217,8 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, mp_ob
(gattc_char->char_props.write_wo_resp ? CHAR_PROP_WRITE_NO_RESPONSE : 0);
// Call common_hal_bleio_characteristic_construct() to initalize some fields and set up evt handler.
- common_hal_bleio_characteristic_construct(characteristic, uuid, props, SEC_MODE_OPEN, SEC_MODE_OPEN, mp_const_empty_tuple);
+ common_hal_bleio_characteristic_construct(
+ characteristic, uuid, props, SEC_MODE_OPEN, SEC_MODE_OPEN, mp_obj_new_list(0, NULL));
characteristic->handle = gattc_char->handle_value;
characteristic->service = m_char_discovery_service;