Bluetooth: Add common BT_CONN_INTERVAL_TO_MS macro
The same macro was defined in multiple places. Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This commit is contained in:
parent
6ba6894580
commit
8b46aaaf69
4 changed files with 15 additions and 15 deletions
|
@ -299,6 +299,9 @@ struct bt_conn_le_info {
|
|||
#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
|
||||
};
|
||||
|
||||
/* Multiply bt 1.25 to get MS */
|
||||
#define BT_CONN_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)
|
||||
|
||||
/** BR/EDR Connection Info Structure */
|
||||
struct bt_conn_br_info {
|
||||
const bt_addr_t *dst; /** Destination (Remote) BR/EDR address */
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/iso.h>
|
||||
#include <sys/byteorder.h>
|
||||
#include <console/console.h>
|
||||
|
@ -16,7 +17,6 @@ LOG_MODULE_REGISTER(iso_broadcast_receiver, LOG_LEVEL_DBG);
|
|||
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
|
||||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME))
|
||||
|
||||
#define BT_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)
|
||||
#define PA_RETRY_COUNT 6
|
||||
#define ISO_RETRY_COUNT 10
|
||||
|
||||
|
@ -102,7 +102,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
broadcaster_found = true;
|
||||
|
||||
per_sid = info->sid;
|
||||
per_interval_ms = BT_INTERVAL_TO_MS(info->interval);
|
||||
per_interval_ms = BT_CONN_INTERVAL_TO_MS(info->interval);
|
||||
bt_addr_le_copy(&per_addr, info->addr);
|
||||
|
||||
k_sem_give(&sem_per_adv);
|
||||
|
@ -140,13 +140,13 @@ static void biginfo_cb(struct bt_le_per_adv_sync *sync,
|
|||
"bn %u, pto %u, irc %u, max_pdu %u, sdu_interval %u us, "
|
||||
"max_sdu %u, phy %s, %s framing, %sencrypted",
|
||||
biginfo->num_bis, biginfo->sub_evt_count,
|
||||
BT_INTERVAL_TO_MS((float)biginfo->iso_interval),
|
||||
BT_CONN_INTERVAL_TO_MS((float)biginfo->iso_interval),
|
||||
biginfo->burst_number, biginfo->offset, biginfo->rep_count,
|
||||
biginfo->max_pdu, biginfo->sdu_interval, biginfo->max_sdu,
|
||||
phy2str(biginfo->phy), biginfo->framing ? "with" : "without",
|
||||
biginfo->encryption ? "" : "not ");
|
||||
|
||||
iso_interval_ms = BT_INTERVAL_TO_MS(biginfo->iso_interval);
|
||||
iso_interval_ms = BT_CONN_INTERVAL_TO_MS(biginfo->iso_interval);
|
||||
bis_count = MIN(biginfo->num_bis, CONFIG_BT_ISO_MAX_CHAN);
|
||||
biginfo_received = true;
|
||||
k_sem_give(&sem_per_big_info);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <devicetree.h>
|
||||
#include <drivers/gpio.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/iso.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
|
@ -19,7 +20,6 @@
|
|||
BT_GAP_SCAN_FAST_INTERVAL, \
|
||||
BT_GAP_SCAN_FAST_WINDOW)
|
||||
|
||||
#define BT_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)
|
||||
#define PA_RETRY_COUNT 6
|
||||
|
||||
static bool per_adv_found;
|
||||
|
@ -112,13 +112,13 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
(info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0,
|
||||
(info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0,
|
||||
phy2str(info->primary_phy), phy2str(info->secondary_phy),
|
||||
info->interval, BT_INTERVAL_TO_MS(info->interval), info->sid);
|
||||
info->interval, BT_CONN_INTERVAL_TO_MS(info->interval), info->sid);
|
||||
|
||||
if (!per_adv_found && info->interval) {
|
||||
per_adv_found = true;
|
||||
|
||||
per_sid = info->sid;
|
||||
per_interval_ms = BT_INTERVAL_TO_MS(info->interval);
|
||||
per_interval_ms = BT_CONN_INTERVAL_TO_MS(info->interval);
|
||||
bt_addr_le_copy(&per_addr, info->addr);
|
||||
|
||||
k_sem_give(&sem_per_adv);
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
#include "ll.h"
|
||||
#include "hci.h"
|
||||
|
||||
/* Multiply bt 1.25 to get MS */
|
||||
#define BT_INTERVAL_TO_MS(interval) ((interval) * 5 / 4)
|
||||
|
||||
static bool no_settings_load;
|
||||
|
||||
uint8_t selected_id = BT_ID_DEFAULT;
|
||||
|
@ -172,7 +169,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info,
|
|||
(info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0,
|
||||
(info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0,
|
||||
phy2str(info->primary_phy), phy2str(info->secondary_phy),
|
||||
info->interval, BT_INTERVAL_TO_MS(info->interval),
|
||||
info->interval, BT_CONN_INTERVAL_TO_MS(info->interval),
|
||||
info->sid);
|
||||
}
|
||||
|
||||
|
@ -529,7 +526,7 @@ static void per_adv_sync_sync_cb(struct bt_le_per_adv_sync *sync,
|
|||
shell_print(ctx_shell, "PER_ADV_SYNC[%u]: [DEVICE]: %s synced, "
|
||||
"Interval 0x%04x (%u ms), PHY %s, SD 0x%04X, PAST peer %s",
|
||||
bt_le_per_adv_sync_get_index(sync), le_addr,
|
||||
info->interval, BT_INTERVAL_TO_MS(info->interval),
|
||||
info->interval, BT_CONN_INTERVAL_TO_MS(info->interval),
|
||||
phy2str(info->phy), info->service_data, past_peer);
|
||||
|
||||
if (info->conn) { /* if from PAST */
|
||||
|
@ -586,7 +583,7 @@ static void per_adv_sync_biginfo_cb(struct bt_le_per_adv_sync *sync,
|
|||
"%sencrypted",
|
||||
bt_le_per_adv_sync_get_index(sync), le_addr, biginfo->sid, biginfo->num_bis,
|
||||
biginfo->sub_evt_count, biginfo->iso_interval,
|
||||
BT_INTERVAL_TO_MS(biginfo->iso_interval), biginfo->burst_number,
|
||||
BT_CONN_INTERVAL_TO_MS(biginfo->iso_interval), biginfo->burst_number,
|
||||
biginfo->offset, biginfo->rep_count, biginfo->max_pdu, biginfo->sdu_interval,
|
||||
biginfo->max_sdu, phy2str(biginfo->phy), biginfo->framing,
|
||||
biginfo->encryption ? "" : "not ");
|
||||
|
@ -2192,10 +2189,10 @@ static int cmd_info(const struct shell *sh, size_t argc, char *argv[])
|
|||
|
||||
shell_print(ctx_shell, "Interval: 0x%04x (%u ms)",
|
||||
info.le.interval,
|
||||
BT_INTERVAL_TO_MS(info.le.interval));
|
||||
BT_CONN_INTERVAL_TO_MS(info.le.interval));
|
||||
shell_print(ctx_shell, "Latency: 0x%04x (%u ms)",
|
||||
info.le.latency,
|
||||
BT_INTERVAL_TO_MS(info.le.latency));
|
||||
BT_CONN_INTERVAL_TO_MS(info.le.latency));
|
||||
shell_print(ctx_shell, "Supervision timeout: 0x%04x (%d ms)",
|
||||
info.le.timeout, info.le.timeout * 10);
|
||||
#if defined(CONFIG_BT_USER_PHY_UPDATE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue