From f2f9656145c563e395514de350778a3d939722c9 Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Wed, 17 Apr 2024 19:02:57 +0200 Subject: [PATCH] cpu/nrf5x: implement pm_off() for nRF53/9160 Signed-off-by: Dylan Laduranty --- cpu/nrf5x_common/periph/pm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cpu/nrf5x_common/periph/pm.c b/cpu/nrf5x_common/periph/pm.c index 4f09682eb7185..8bfbbd8817dc8 100644 --- a/cpu/nrf5x_common/periph/pm.c +++ b/cpu/nrf5x_common/periph/pm.c @@ -27,7 +27,11 @@ #define NRF_POWER NRF_POWER_S #endif -/* TODO: implement proper pm_off for nRF9160 */ +/* Workaround inconsistency between nRF9160 / nRF53 headers */ +#ifdef REGULATORS_SYSTEMOFF_SYSTEMOFF_Enable +#define REGULATORS_SYSTEMOFF_SYSTEMOFF_Enter REGULATORS_SYSTEMOFF_SYSTEMOFF_Enable +#endif + void pm_off(void) { #if (!defined(CPU_FAM_NRF9160) && !defined(CPU_FAM_NRF53)) @@ -40,6 +44,8 @@ void pm_off(void) } #endif NRF_POWER->SYSTEMOFF = 1; - while (1) {} +#else /* nRF9160 / nRF53 */ + NRF_REGULATORS_S->SYSTEMOFF = REGULATORS_SYSTEMOFF_SYSTEMOFF_Enter; #endif /* ndef CPU_FAM_NRF9160 */ + while (1) {} }