summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-05-30 23:23:31 +0200
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-05-30 23:23:31 +0200
commita81de242c560aa8cf871b43b32efb5afff04baaa (patch)
tree4adedc111d01798c134974fc37abc35a5bba44f4
parentb17665b8adf3eae47be29f2046a52c233d5ec249 (diff)
nrf5/drivers/bluetooth: Moving stop condition initialization before call to bluetooth stack write function is done, to make sure that its not overwritten after reception of the write event in case of with_response writes.
-rw-r--r--nrf5/drivers/bluetooth/ble_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nrf5/drivers/bluetooth/ble_drv.c b/nrf5/drivers/bluetooth/ble_drv.c
index b1670d035..8d3348f5f 100644
--- a/nrf5/drivers/bluetooth/ble_drv.c
+++ b/nrf5/drivers/bluetooth/ble_drv.c
@@ -696,10 +696,10 @@ void ble_drv_attr_c_write(uint16_t conn_handle, uint16_t handle, uint16_t len, u
write_params.len = len;
write_params.p_value = p_data;
- uint32_t err_code = sd_ble_gattc_write(conn_handle, &write_params);
-
m_write_done = !w_response;
+ uint32_t err_code = sd_ble_gattc_write(conn_handle, &write_params);
+
if (err_code != 0) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError,
"Can not write attribute value. status: 0x" HEX2_FMT, (uint16_t)err_code));