Skip to content

Commit

Permalink
cpu/nrf5x: implement pm_off() for nRF53/9160
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
  • Loading branch information
dylad committed Apr 17, 2024
1 parent fc271ea commit f2f9656
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cpu/nrf5x_common/periph/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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) {}
}

0 comments on commit f2f9656

Please sign in to comment.