summaryrefslogtreecommitdiff
path: root/devices/ble_hci
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-12-15 12:23:56 -0500
committerDan Halbert <halbert@halwitz.org>2020-12-15 12:23:56 -0500
commitfb33c4e1c0f83bce8f8cc1e8cae83695aeb2471d (patch)
tree5873d051adb7a74e11b6a15c6f4e20c39a1deeb1 /devices/ble_hci
parentbbbd621b184ee13740c0c8e4c94e7aed0db4f070 (diff)
-ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio
Diffstat (limited to 'devices/ble_hci')
-rw-r--r--devices/ble_hci/common-hal/_bleio/att.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c
index 8e9f5f017..4573d5e9f 100644
--- a/devices/ble_hci/common-hal/_bleio/att.c
+++ b/devices/ble_hci/common-hal/_bleio/att.c
@@ -1010,21 +1010,22 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
}
int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
- struct __packed {
+
+ typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_read_group_req r;
- } req = { {
- .code = BT_ATT_OP_READ_GROUP_REQ,
- }, {
- .start_handle = start_handle,
- .end_handle = end_handle,
- }
- };
- req.r.uuid[0] = uuid & 0xff;
- req.r.uuid[1] = uuid >> 8;
+ } req_t;
+ uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)];
+ req_t *req = (req_t *) req_bytes;
- return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
+ req->h.code = BT_ATT_OP_READ_GROUP_REQ;
+ req->r.start_handle = start_handle;
+ req->r.end_handle = end_handle;
+ req->r.uuid[0] = uuid & 0xff;
+ req->r.uuid[1] = uuid >> 8;
+
+ return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
}
STATIC void process_read_group_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
@@ -1305,20 +1306,21 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
- struct __packed {
+ typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_read_type_req r;
- } req = { {
- .code = BT_ATT_OP_READ_TYPE_REQ,
- }, {
- .start_handle = start_handle,
- .end_handle = end_handle,
- }
- };
- req.r.uuid[0] = type & 0xff;
- req.r.uuid[1] = type >> 8;
+ } req_t;
- return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *) &req, response_buffer);
+ uint8_t req_bytes[sizeof(req_t) + sizeof(type)];
+ req_t *req = (req_t *) req_bytes;
+
+ req->h.code = BT_ATT_OP_READ_TYPE_REQ;
+ req->r.start_handle = start_handle;
+ req->r.end_handle = end_handle;
+ req->r.uuid[0] = type & 0xff;
+ req->r.uuid[1] = type >> 8;
+
+ return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
}
STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {