diff --git a/samples/bluetooth/peripheral_power_profiling/Kconfig b/samples/bluetooth/peripheral_power_profiling/Kconfig index 556f0588d974..ae7071312df0 100644 --- a/samples/bluetooth/peripheral_power_profiling/Kconfig +++ b/samples/bluetooth/peripheral_power_profiling/Kconfig @@ -73,9 +73,15 @@ config BT_POWER_PROFILING_NON_CONNECTABLE_ADV_INTERVAL_MAX config BT_POWER_PROFILING_LED_DISABLED bool "Disable LEDs" + default y help Disables the LEDs to reduce power consumption. +config BT_POWER_PROFILING_NFC_DISABLED + bool "Disable NFC" + help + Disables the NFC to reduce power consumption. + config SETTINGS default y diff --git a/samples/bluetooth/peripheral_power_profiling/README.rst b/samples/bluetooth/peripheral_power_profiling/README.rst index 79ebe4803adb..008799c084c2 100644 --- a/samples/bluetooth/peripheral_power_profiling/README.rst +++ b/samples/bluetooth/peripheral_power_profiling/README.rst @@ -224,6 +224,17 @@ CONFIG_BT_POWER_PROFILING_NON_CONNECTABLE_ADV_INTERVAL_MAX - Non-connectable adv CONFIG_BT_POWER_PROFILING_LED_DISABLED - Disable LEDs Disables the LEDs to reduce power consumption. +.. _CONFIG_BT_POWER_PROFILING_NFC_DISABLED: + +CONFIG_BT_POWER_PROFILING_NFC_DISABLED - Disable NFC + Disables the NFC to reduce power consumption. + +You can also consider using the following global configuration options to disable the console and UART, reducing power consumption: + +* :kconfig:option:`CONFIG_SERIAL` +* :kconfig:option:`CONFIG_CONSOLE` +* :kconfig:option:`CONFIG_UART_CONSOLE` + Building and running ******************** diff --git a/samples/bluetooth/peripheral_power_profiling/src/main.c b/samples/bluetooth/peripheral_power_profiling/src/main.c index b7ee17e679f4..c9e74a3955ef 100644 --- a/samples/bluetooth/peripheral_power_profiling/src/main.c +++ b/samples/bluetooth/peripheral_power_profiling/src/main.c @@ -104,7 +104,7 @@ static const struct bt_le_adv_param *connectable_ad_params = NULL); static const struct bt_le_adv_param *non_connectable_ad_params = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_SCANNABLE, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_NONE, NON_CONNECTABLE_ADV_INTERVAL_MIN, NON_CONNECTABLE_ADV_INTERVAL_MAX, NULL); @@ -774,10 +774,12 @@ int main(void) return 0; } - err = nfc_init(); - if (err) { - printk("Failed to initialize NFC (err %d)\n", err); - return 0; + if (!IS_ENABLED(BT_POWER_PROFILING_NFC_DISABLED)) { + err = nfc_init(); + if (err) { + printk("Failed to initialize NFC (err %d)\n", err); + return 0; + } } button_handler(button_state, has_changed); @@ -786,8 +788,12 @@ int main(void) k_work_schedule(&system_off_work, K_SECONDS(SYSTEM_OFF_DELAY)); } - for (;;) { - set_led(RUN_STATUS_LED, (++blink_status) % 2); - k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL)); + if (!IS_ENABLED(CONFIG_BT_POWER_PROFILING_LED_DISABLED)) { + for (;;) { + set_led(RUN_STATUS_LED, (++blink_status) % 2); + k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL)); + } + } else { + return 0; } }