Skip to content

Commit

Permalink
Update soc.c for soft shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsamlarose authored Oct 8, 2022
1 parent 8adeab4 commit 9557914
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions soc/arm/nordic_nrf/nrf52/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <hal/nrf_power.h>
#include <soc/nrfx_coredep.h>
#include <logging/log.h>
#include <pm/state.h>

#ifdef CONFIG_RUNTIME_NMI
extern void z_arm_nmi_init(void);
Expand Down Expand Up @@ -51,8 +52,13 @@ LOG_MODULE_REGISTER(soc);
Set general purpose retention register and reboot */
void sys_arch_reboot(int type)
{
nrf_power_gpregret_set(NRF_POWER, (uint8_t)type);
NVIC_SystemReset();
if (type == 0xFE){
nrf_power_system_off(NRF_POWER);
}
else{
nrf_power_gpregret_set(NRF_POWER, (uint8_t)type);
NVIC_SystemReset();
}
}

static int nordicsemi_nrf52_init(const struct device *arg)
Expand Down

0 comments on commit 9557914

Please sign in to comment.