File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
ports/nrf/common-hal/microcontroller Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 37
37
#include "shared-bindings/microcontroller/Processor.h"
38
38
39
39
#include "supervisor/filesystem.h"
40
+ #include "supervisor/shared/safe_mode.h"
40
41
#include "nrfx_glue.h"
41
42
42
43
// This routine should work even when interrupts are disabled. Used by OneWire
@@ -52,7 +53,13 @@ void common_hal_mcu_enable_interrupts() {
52
53
}
53
54
54
55
void common_hal_mcu_on_next_reset (mcu_runmode_t runmode ) {
55
- // TODO: see atmel-samd for functionality
56
+ enum { DFU_MAGIC_UF2_RESET = 0x57 };
57
+ if (runmode == RUNMODE_BOOTLOADER )
58
+ NRF_POWER -> GPREGRET = DFU_MAGIC_UF2_RESET ;
59
+ else
60
+ NRF_POWER -> GPREGRET = 0 ;
61
+ if (runmode == RUNMODE_SAFE_MODE )
62
+ safe_mode_on_next_reset (PROGRAMMATIC_SAFE_MODE );
56
63
}
57
64
58
65
void common_hal_mcu_reset (void ) {
You can’t perform that action at this time.
0 commit comments