samples: Bluetooth: Kconfig for limited printout in some ISO samples
Add kconfig to let the ISO broadcast and ISO receive samples report packets no more than once per set interval of packets. Signed-off-by: Frode van der Meeren <frode.vandermeeren@nordicsemi.no>
This commit is contained in:
parent
05e78fa128
commit
264ccd2e67
13
samples/bluetooth/iso_broadcast/Kconfig
Normal file
13
samples/bluetooth/iso_broadcast/Kconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source "Kconfig.zephyr"
|
||||
|
||||
mainmenu "Bluetooth: ISO Broadcast"
|
||||
|
||||
config ISO_PRINT_INTERVAL
|
||||
int "Interval between each packet report"
|
||||
range 1 360000
|
||||
default 1
|
||||
help
|
||||
Only print the packet report once in a given interval of ISO packets.
|
|
@ -167,13 +167,13 @@ void main(void)
|
|||
|
||||
}
|
||||
|
||||
iso_send_count++;
|
||||
seq_num++;
|
||||
|
||||
if ((iso_send_count % 100) == 0) {
|
||||
if ((iso_send_count % CONFIG_ISO_PRINT_INTERVAL) == 0) {
|
||||
printk("Sending value %u\n", iso_send_count);
|
||||
}
|
||||
|
||||
iso_send_count++;
|
||||
seq_num++;
|
||||
|
||||
timeout_counter--;
|
||||
if (!timeout_counter) {
|
||||
timeout_counter = INITIAL_TIMEOUT_COUNTER;
|
||||
|
|
20
samples/bluetooth/iso_receive/Kconfig
Normal file
20
samples/bluetooth/iso_receive/Kconfig
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source "Kconfig.zephyr"
|
||||
|
||||
mainmenu "Bluetooth: ISO Receive"
|
||||
|
||||
config ISO_PRINT_INTERVAL
|
||||
int "Interval between each packet report"
|
||||
range 1 360000
|
||||
default 1
|
||||
help
|
||||
Only print the packet report once in a given interval of ISO packets.
|
||||
|
||||
config ISO_ALIGN_PRINT_INTERVALS
|
||||
bool "Align report interval with incoming packets"
|
||||
help
|
||||
Align interval-counter with packet number from incoming ISO packets.
|
||||
This may be needed if report printouts are to be synchronized between
|
||||
the iso_broadcast sample and the iso_receive sample.
|
|
@ -30,6 +30,8 @@ static bt_addr_le_t per_addr;
|
|||
static uint8_t per_sid;
|
||||
static uint32_t per_interval_us;
|
||||
|
||||
static uint32_t iso_recv_count;
|
||||
|
||||
static K_SEM_DEFINE(sem_per_adv, 0, 1);
|
||||
static K_SEM_DEFINE(sem_per_sync, 0, 1);
|
||||
static K_SEM_DEFINE(sem_per_sync_lost, 0, 1);
|
||||
|
@ -215,12 +217,19 @@ static void iso_recv(struct bt_iso_chan *chan, const struct bt_iso_recv_info *in
|
|||
|
||||
if (buf->len == sizeof(count)) {
|
||||
count = sys_get_le32(buf->data);
|
||||
if (IS_ENABLED(CONFIG_ISO_ALIGN_PRINT_INTERVALS)) {
|
||||
iso_recv_count = count;
|
||||
}
|
||||
}
|
||||
|
||||
str_len = bin2hex(buf->data, buf->len, data_str, sizeof(data_str));
|
||||
printk("Incoming data channel %p flags 0x%x seq_num %u ts %u len %u: "
|
||||
"%s (counter value %u)\n", chan, info->flags, info->seq_num,
|
||||
info->ts, buf->len, data_str, count);
|
||||
if ((iso_recv_count % CONFIG_ISO_PRINT_INTERVAL) == 0) {
|
||||
str_len = bin2hex(buf->data, buf->len, data_str, sizeof(data_str));
|
||||
printk("Incoming data channel %p flags 0x%x seq_num %u ts %u len %u: "
|
||||
"%s (counter value %u)\n", chan, info->flags, info->seq_num,
|
||||
info->ts, buf->len, data_str, count);
|
||||
}
|
||||
|
||||
iso_recv_count++;
|
||||
}
|
||||
|
||||
static void iso_connected(struct bt_iso_chan *chan)
|
||||
|
@ -280,6 +289,8 @@ void main(void)
|
|||
uint32_t sem_timeout_us;
|
||||
int err;
|
||||
|
||||
iso_recv_count = 0;
|
||||
|
||||
printk("Starting Synchronized Receiver Demo\n");
|
||||
|
||||
#if defined(HAS_LED)
|
||||
|
|
Loading…
Reference in a new issue