From 6ef863997186e1893cdf19c0e04d0a8a3f33ad9d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 6 Dec 2018 14:24:20 -0800 Subject: Rework safe mode and have heap overwrite trigger it. This creates a common safe mode mechanic that ports can share. As a result, the nRF52 now has safe mode support as well. The common safe mode adds a 700ms delay at startup where a reset during that window will cause a reset into safe mode. This window is designated by a yellow status pixel and flashing the single led three times. A couple NeoPixel fixes are included for the nRF52 as well. Fixes #1034. Fixes #990. Fixes #615. --- ports/nrf/peripherals/nrf/clocks.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ports/nrf/peripherals') diff --git a/ports/nrf/peripherals/nrf/clocks.c b/ports/nrf/peripherals/nrf/clocks.c index 811c0161a..4acb878db 100644 --- a/ports/nrf/peripherals/nrf/clocks.c +++ b/ports/nrf/peripherals/nrf/clocks.c @@ -32,4 +32,7 @@ void nrf_peripherals_clocks_init(void) { // generalized. NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk); NRF_CLOCK->TASKS_LFCLKSTART = 1UL; + + // Wait for clocks to start. + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {} } -- cgit v1.2.3