1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-07 07:12:34 +00:00
trezor-firmware/core/embed/ble_firmware/power.c

22 lines
558 B
C

#include "power.h"
#include "app_error.h"
#include "bsp_btn_ble.h"
/**@brief Function for putting the chip into sleep mode.
*
* @note This function will not return.
*/
void sleep_mode_enter(void) {
uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
// Prepare wakeup buttons.
err_code = bsp_btn_ble_sleep_mode_prepare();
APP_ERROR_CHECK(err_code);
// Go to system-off mode (this function will not return; wakeup will cause a
// reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}