From a30f69aaedc2d52ef227f36e3e31610462b67fff Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Jan 2023 15:58:03 -0600 Subject: [PATCH] Fixes for microcontroller.on_next_reset() on NRF --- ports/nrf/common-hal/microcontroller/__init__.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index d84cc58455..7bf853fb30 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -82,10 +82,10 @@ void common_hal_mcu_enable_interrupts() { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { enum { DFU_MAGIC_UF2_RESET = 0x57 }; - if (runmode == RUNMODE_BOOTLOADER) { - NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET; + if (runmode == RUNMODE_BOOTLOADER || runmode == RUNMODE_UF2) { + sd_power_gpregret_set(0,DFU_MAGIC_UF2_RESET); } else { - NRF_POWER->GPREGRET = 0; + sd_power_gpregret_set(0,0); } if (runmode == RUNMODE_SAFE_MODE) { safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);