Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/nrf5340_audio/unicast_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static void le_audio_msg_sub_thread(void)
if (ret) {
LOG_ERR("Failed to get conn info");
} else {
interval = conn_info.le.interval;
interval = BT_GAP_US_TO_CONN_INTERVAL(conn_info.le.interval_us);
}

/* Only update conn param once */
Expand Down
16 changes: 10 additions & 6 deletions applications/nrf_desktop/src/modules/ble_conn_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
LOG_MODULE_REGISTER(MODULE, CONFIG_DESKTOP_BLE_CONN_PARAMS_LOG_LEVEL);

#define CONN_INTERVAL_LLPM_US 1000 /* 1 ms */
#define CONN_INTERVAL_LLPM_REG 0x0d01 /* 1 ms */
#if (CONFIG_CAF_BLE_USE_LLPM && (CONFIG_BT_MAX_CONN >= 2))
#define CONN_INTERVAL_BLE_REG 0x0008 /* 10 ms */
#define CONN_INTERVAL_BLE_US 10000
#else
#define CONN_INTERVAL_BLE_REG 0x0006 /* 7.5 ms */
#define CONN_INTERVAL_BLE_US 7500
Comment on lines 27 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use BT_GAP_US_TO_CONN_INTERVAL macro instead of defining CONN_INTERVAL_BLE_REG macro? That would simplify implementation and got rid of redundant definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i do that in a follow up pr? I would prefer not to delay this one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, no problem

#endif
#define CONN_SUPERVISION_TIMEOUT 400

Expand Down Expand Up @@ -77,8 +78,10 @@
return bt_conn_le_param_update(conn, &param);
}

static int interval_reg_to_us(uint16_t reg)
/* Handle llpm encoding in interval_us values */
static int strip_llpm_encoding_to_us(uint32_t interval_us)
{
uint16_t reg = BT_GAP_US_TO_CONN_INTERVAL(interval_us);
bool is_llpm = ((reg & 0x0d00) == 0x0d00) ? true : false;

return (reg & BIT_MASK(8)) * ((is_llpm) ? 1000 : 1250);
Expand Down Expand Up @@ -128,7 +131,7 @@
LOG_ERR("Cannot get conn info (%d)", err);
return err;
}
uint32_t curr_ci_us = interval_reg_to_us(info.le.interval);
uint32_t curr_ci_us = strip_llpm_encoding_to_us(info.le.interval_us);

if (curr_ci_us > CONN_INTERVAL_PRE_LLPM_MAX_US) {
err = set_le_conn_param(peer->conn, CONN_INTERVAL_BLE_REG,
Expand Down Expand Up @@ -192,13 +195,14 @@

__ASSERT_NO_MSG(info.role == BT_CONN_ROLE_CENTRAL);

uint32_t interval_us = strip_llpm_encoding_to_us(info.le.interval_us);
if (IS_ENABLED(CONFIG_DESKTOP_BLE_USB_MANAGED_CI) && usb_suspended) {
if ((info.le.interval != CONN_INTERVAL_USB_SUSPEND) ||
if ((interval_us != BT_CONN_INTERVAL_TO_US(CONN_INTERVAL_USB_SUSPEND)) ||
(info.le.latency != CONN_LATENCY_USB_SUSPEND)) {
return true;
}
} else if ((peer->use_llpm && (info.le.interval != CONN_INTERVAL_LLPM_REG)) ||
(!peer->use_llpm && (info.le.interval != CONN_INTERVAL_BLE_REG)) ||
} else if ((peer->use_llpm && (interval_us != CONN_INTERVAL_LLPM_US)) ||

Check failure on line 204 in applications/nrf_desktop/src/modules/ble_conn_params.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

End this if...else if construct by an else clause.

See more on https://sonarcloud.io/project/issues?id=nrfconnect_sdk-nrf&issues=AZqiJTwwJQxvysHgm1HT&open=AZqiJTwwJQxvysHgm1HT&pullRequest=25678
(!peer->use_llpm && (interval_us != CONN_INTERVAL_BLE_US)) ||
(info.le.latency != peer->requested_latency)) {
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions applications/nrf_desktop/src/modules/ble_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ static void set_conn_latency(bool low_latency)
/* Request with connection interval set to a LLPM value is rejected
* by Zephyr Bluetooth API.
*/
uint16_t interval = (info.le.interval & REG_CONN_INTERVAL_LLPM_MASK) ?
REG_CONN_INTERVAL_BLE_DEFAULT : info.le.interval;
uint16_t info_interval_1250us = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us);
uint16_t interval = (info_interval_1250us & REG_CONN_INTERVAL_LLPM_MASK) ?
REG_CONN_INTERVAL_BLE_DEFAULT : info_interval_1250us;
const struct bt_le_conn_param param = {
.interval_min = interval,
.interval_max = interval,
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/conn_time_sync/src/peripheral.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static uint32_t conn_interval_us_get(const struct bt_conn *conn)
return 0;
}

return BT_CONN_INTERVAL_TO_US(info.le.interval);
return info.le.interval_us;
}

static ssize_t time_sync_data_received(struct bt_conn *conn,
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/llpm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void connected(struct bt_conn *conn, uint8_t err)

printk("Connected as %s\n",
conn_info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral");
__ASSERT_NO_MSG(conn_info.le.interval == INTERVAL_LLPM);
__ASSERT_NO_MSG(conn_info.le.interval_us == INTERVAL_LLPM * BT_HCI_LE_INTERVAL_UNIT_US);
printk("Conn. interval is 1 ms\n");
}

Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/radio_notification_cb/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void connected(struct bt_conn *conn, uint8_t conn_err)
return;
}

conn_interval_us = BT_CONN_INTERVAL_TO_US(info.le.interval);
conn_interval_us = info.le.interval_us;

/*Start service discovery when link is encrypted*/
err = bt_gatt_dm_start(conn, BT_UUID_LATENCY, &discovery_cb,
Expand Down
4 changes: 2 additions & 2 deletions samples/bluetooth/throughput/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static void connected(struct bt_conn *conn, uint8_t hci_err)

printk("Connected as %s\n",
info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral");
printk("Conn. interval is %u units\n", info.le.interval);
printk("Conn. interval is %u us\n", info.le.interval_us);

if (info.role == BT_CONN_ROLE_PERIPHERAL) {
err = bt_conn_set_security(conn, BT_SECURITY_L2);
Expand Down Expand Up @@ -497,7 +497,7 @@ static int connection_configuration_set(const struct shell *shell,
return err;
}

if (info.le.interval != conn_param->interval_max) {
if (BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us) != conn_param->interval_max) {
err = bt_conn_le_param_update(default_conn, conn_param);
if (err) {
shell_error(shell,
Expand Down
4 changes: 2 additions & 2 deletions samples/wifi/ble_coex/src/bt_throughput_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static void connected(struct bt_conn *conn, uint8_t hci_err)
}

LOG_INF("Connected as %s", info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral");
LOG_INF("Conn. interval is %u units", info.le.interval);
LOG_INF("Conn. interval is %u us", info.le.interval_us);

if (info.role == BT_CONN_ROLE_CENTRAL) {
err = bt_gatt_dm_start(default_conn,
Expand Down Expand Up @@ -475,7 +475,7 @@ int connection_configuration_set(const struct bt_le_conn_param *conn_param,
}
}

if (info.le.interval != conn_param->interval_max) {
if (BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us) != conn_param->interval_max) {
err = bt_conn_le_param_update(default_conn, conn_param);
if (err) {
LOG_ERR("Connection parameters update failed: %d", err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static uint32_t conn_interval_us_get(const struct bt_conn *conn)
return 0;
}

return BT_CONN_INTERVAL_TO_US(info.le.interval);
return info.le.interval_us;
}

static void work_handler(struct k_work *work)
Expand Down
5 changes: 4 additions & 1 deletion subsys/bluetooth/rpc/client/bt_rpc_conn_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ static void bt_conn_info_dec(struct nrf_rpc_cbor_ctx *ctx, struct bt_conn *conn,
info->id = nrf_rpc_decode_uint(ctx);

if (info->type == BT_CONN_TYPE_LE) {
info->le.interval = nrf_rpc_decode_uint(ctx);
info->le.interval_us = nrf_rpc_decode_uint(ctx);
#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS)
info->le._interval = nrf_rpc_decode_uint(ctx);
#endif
info->le.latency = nrf_rpc_decode_uint(ctx);
info->le.timeout = nrf_rpc_decode_uint(ctx);
LOCK_CONN_INFO();
Expand Down
10 changes: 8 additions & 2 deletions subsys/bluetooth/rpc/host/bt_rpc_conn_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ static const size_t bt_conn_info_buf_size =
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, type) +
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, role) +
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, id) +
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.interval) +
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.interval_us) +
#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS)
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le._interval) +
#endif
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.latency) +
1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.timeout) +
4 * (1 + sizeof(bt_addr_le_t)) +
Expand All @@ -269,7 +272,10 @@ static void bt_conn_info_enc(struct nrf_rpc_cbor_ctx *encoder, struct bt_conn_in
nrf_rpc_encode_uint(encoder, info->id);

if (info->type == BT_CONN_TYPE_LE) {
nrf_rpc_encode_uint(encoder, info->le.interval);
nrf_rpc_encode_uint(encoder, info->le.interval_us);
#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS)
nrf_rpc_encode_uint(encoder, info->le._interval);
#endif
nrf_rpc_encode_uint(encoder, info->le.latency);
nrf_rpc_encode_uint(encoder, info->le.timeout);
nrf_rpc_encode_buffer(encoder, info->le.src, sizeof(bt_addr_le_t));
Expand Down
5 changes: 3 additions & 2 deletions subsys/caf/modules/ble_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ static void broadcast_init_conn_params(struct bt_conn *conn)
LOG_ERR("Cannot get conn info (%d)", err);
} else {
struct ble_peer_conn_params_event *event = new_ble_peer_conn_params_event();
uint16_t info_interval_1250us = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us);

event->id = conn;
event->interval_min = info.le.interval;
event->interval_max = info.le.interval;
event->interval_min = info_interval_1250us;
event->interval_max = info_interval_1250us;
event->latency = info.le.latency;
event->timeout = info.le.timeout;
event->updated = true;
Expand Down
4 changes: 2 additions & 2 deletions west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ manifest:
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
- name: zephyr
repo-path: sdk-zephyr
revision: 8116dbcc6173ae9a1d6c526ec39f6c9b8c09de8d
revision: ca9ae7fc780e3d3ce61dd123441514b724b8d629
import:
# In addition to the zephyr repository itself, NCS also
# imports the contents of zephyr/west.yml at the above
Expand Down Expand Up @@ -244,7 +244,7 @@ manifest:
remote: throwtheswitch
- name: memfault-firmware-sdk
path: modules/lib/memfault-firmware-sdk
revision: 1.30.3
revision: 1.31.0
remote: memfault
- name: bsim
repo-path: bsim_west
Expand Down
Loading