File tree Expand file tree Collapse file tree 3 files changed +31
-8
lines changed
samples/bluetooth/peripheral_power_profiling Expand file tree Collapse file tree 3 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,15 @@ config BT_POWER_PROFILING_NON_CONNECTABLE_ADV_INTERVAL_MAX
7373
7474config BT_POWER_PROFILING_LED_DISABLED
7575 bool "Disable LEDs"
76+ default y
7677 help
7778 Disables the LEDs to reduce power consumption.
7879
80+ config BT_POWER_PROFILING_NFC_DISABLED
81+ bool "Disable NFC"
82+ help
83+ Disables the NFC to reduce power consumption.
84+
7985config SETTINGS
8086 default y
8187
Original file line number Diff line number Diff line change @@ -224,6 +224,17 @@ CONFIG_BT_POWER_PROFILING_NON_CONNECTABLE_ADV_INTERVAL_MAX - Non-connectable adv
224224CONFIG_BT_POWER_PROFILING_LED_DISABLED - Disable LEDs
225225 Disables the LEDs to reduce power consumption.
226226
227+ .. _CONFIG_BT_POWER_PROFILING_NFC_DISABLED :
228+
229+ CONFIG_BT_POWER_PROFILING_NFC_DISABLED - Disable NFC
230+ Disables the NFC to reduce power consumption.
231+
232+ You can also consider using the following global configuration options to disable the console and UART, reducing power consumption:
233+
234+ * :kconfig:option: `CONFIG_SERIAL `
235+ * :kconfig:option: `CONFIG_CONSOLE `
236+ * :kconfig:option: `CONFIG_UART_CONSOLE `
237+
227238Building and running
228239********************
229240
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ static const struct bt_le_adv_param *connectable_ad_params =
104104 NULL );
105105
106106static const struct bt_le_adv_param * non_connectable_ad_params =
107- BT_LE_ADV_PARAM (BT_LE_ADV_OPT_SCANNABLE ,
107+ BT_LE_ADV_PARAM (BT_LE_ADV_OPT_NONE ,
108108 NON_CONNECTABLE_ADV_INTERVAL_MIN ,
109109 NON_CONNECTABLE_ADV_INTERVAL_MAX ,
110110 NULL );
@@ -774,10 +774,12 @@ int main(void)
774774 return 0 ;
775775 }
776776
777- err = nfc_init ();
778- if (err ) {
779- printk ("Failed to initialize NFC (err %d)\n" , err );
780- return 0 ;
777+ if (!IS_ENABLED (BT_POWER_PROFILING_NFC_DISABLED )) {
778+ err = nfc_init ();
779+ if (err ) {
780+ printk ("Failed to initialize NFC (err %d)\n" , err );
781+ return 0 ;
782+ }
781783 }
782784
783785 button_handler (button_state , has_changed );
@@ -786,8 +788,12 @@ int main(void)
786788 k_work_schedule (& system_off_work , K_SECONDS (SYSTEM_OFF_DELAY ));
787789 }
788790
789- for (;;) {
790- set_led (RUN_STATUS_LED , (++ blink_status ) % 2 );
791- k_sleep (K_MSEC (RUN_LED_BLINK_INTERVAL ));
791+ if (!IS_ENABLED (CONFIG_BT_POWER_PROFILING_LED_DISABLED )) {
792+ for (;;) {
793+ set_led (RUN_STATUS_LED , (++ blink_status ) % 2 );
794+ k_sleep (K_MSEC (RUN_LED_BLINK_INTERVAL ));
795+ }
796+ } else {
797+ return 0 ;
792798 }
793799}
You can’t perform that action at this time.
0 commit comments