samples: boards: stm32: power_mgmt: stm32wb_ble: use sys_poweroff

Use sys_poweroff to power off the system.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2023-08-07 18:27:57 +02:00 committed by Carles Cufí
commit 825b0fb5d3
2 changed files with 5 additions and 4 deletions

View file

@ -1,5 +1,5 @@
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME="Test beacon"
CONFIG_PM=y
CONFIG_POWEROFF=y
#CONFIG_DEBUG=y

View file

@ -12,7 +12,7 @@
#include <stddef.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/util.h>
#include <zephyr/pm/pm.h>
#include <zephyr/sys/poweroff.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
@ -146,7 +146,8 @@ int main(void)
printk("Bluetooth disable failed (err %d)\n", err);
}
printk("Shutdown\n");
pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
printk("Powering off\n");
sys_poweroff();
return 0;
}