File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
samples/bluetooth/peripheral_power_profiling Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 44# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55#
66
7- CONFIG_NCS_SAMPLES_DEFAULTS=y
8-
97CONFIG_BT=y
108CONFIG_BT_SMP=y
119CONFIG_BT_PERIPHERAL=y
@@ -31,5 +29,9 @@ CONFIG_FLASH_PAGE_LAYOUT=y
3129CONFIG_FLASH_MAP=y
3230
3331CONFIG_POWEROFF=y
32+ CONFIG_PM_DEVICE=y
3433
3534CONFIG_MAIN_STACK_SIZE=2048
35+
36+ CONFIG_BT_ASSERT=n
37+ CONFIG_ASSERT_VERBOSE=n
Original file line number Diff line number Diff line change 88
99#include <zephyr/kernel.h>
1010#include <zephyr/sys/poweroff.h>
11+ #include <zephyr/pm/device.h>
1112#include <zephyr/sys/atomic.h>
1213#include <zephyr/settings/settings.h>
1314
5758
5859#define NFC_BUFFER_SIZE 1024
5960
61+ const struct device * const cons = DEVICE_DT_GET (DT_CHOSEN (zephyr_console ));
62+
6063static struct bt_le_oob oob_local ;
6164static uint8_t tk_local [NFC_NDEF_LE_OOB_REC_TK_LEN ];
6265static uint8_t nfc_buffer [NFC_BUFFER_SIZE ];
@@ -625,6 +628,12 @@ static void system_off(void)
625628
626629 dk_set_led_off (RUN_STATUS_LED );
627630
631+ int rc = pm_device_action_run (cons , PM_DEVICE_ACTION_SUSPEND );
632+
633+ if (rc < 0 ) {
634+ printk ("Could not suspend console (%d)\n" , rc );
635+ }
636+
628637 sys_poweroff ();
629638}
630639
@@ -656,6 +665,11 @@ int main(void)
656665
657666 printk ("Starting Bluetooth Power Profiling example\n" );
658667
668+ if (!device_is_ready (cons )) {
669+ printk ("%s: device not ready.\n" , cons -> name );
670+ return 0 ;
671+ }
672+
659673 err = dk_buttons_init (button_handler );
660674 if (err ) {
661675 printk ("Failed to initialize buttons (err %d)\n" , err );
You can’t perform that action at this time.
0 commit comments