diff --git a/cpu/nrf52/periph/pm.c b/cpu/nrf52/periph/pm.c deleted file mode 100644 index 8416e349ee..0000000000 --- a/cpu/nrf52/periph/pm.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 Kaspar Schleiser - * 2016 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup cpu_nrf52 - * @{ - * - * @file - * @brief Implementation of the kernels power management interface - * - * @author Kaspar Schleiser - * @author Hauke Petersen - * - * @} - */ - -#include "periph/pm.h" -#include "cpu.h" - -void pm_off(void) -{ - NRF_POWER->SYSTEMOFF = 1; -} diff --git a/cpu/nrf51/periph/pm.c b/cpu/nrf5x_common/periph/pm.c similarity index 55% rename from cpu/nrf51/periph/pm.c rename to cpu/nrf5x_common/periph/pm.c index 1979c53e35..f4c1f8a0af 100644 --- a/cpu/nrf51/periph/pm.c +++ b/cpu/nrf5x_common/periph/pm.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2017 Kaspar Schleiser - * 2014 Freie Universität Berlin + * 2014-2017 Freie Universität Berlin * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level @@ -8,11 +8,11 @@ */ /** - * @ingroup cpu_nrf51 + * @ingroup cpu_nrf5x_common * @{ * * @file - * @brief Implementation of the kernels power management interface + * @brief NRF5x specific power management implementations * * @author Kaspar Schleiser * @author Hauke Petersen @@ -20,11 +20,18 @@ * @} */ -#include "periph/pm.h" #include "cpu.h" void pm_off(void) { +#ifdef CPU_FAM_NRF51 NRF_POWER->RAMON = 0; +#else + for (int i = 0; i < 8; i++) { + NRF_POWER->RAM[i].POWERCLR = (POWER_RAM_POWERCLR_S1RETENTION_Msk | + POWER_RAM_POWERCLR_S0RETENTION_Msk); + } +#endif NRF_POWER->SYSTEMOFF = 1; + while(1) {} }