summaryrefslogtreecommitdiff
path: root/ports/nrf
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2020-05-08 16:59:39 +0800
committerSean Cross <sean@xobs.io>2020-05-21 22:04:20 +0800
commit67cf005ee545df6b1d6f2a4947c58d6c2afb0f51 (patch)
treea78193a084a8772f3e98b19b918e3e45e5f75b53 /ports/nrf
parentfd4ef233c6d9b312c3582466c68390a16ddf15fa (diff)
nrf: nvm: assume sd is not enabled if interrupts are off
If interrupts are disabled, then calling sd_* functions will hardfault. Instead, assume that it's safe to write if interrupts are disabled. Signed-off-by: Sean Cross <sean@xobs.io>
Diffstat (limited to 'ports/nrf')
-rw-r--r--ports/nrf/peripherals/nrf/nvm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ports/nrf/peripherals/nrf/nvm.c b/ports/nrf/peripherals/nrf/nvm.c
index 63b168f14..dc50e2eef 100644
--- a/ports/nrf/peripherals/nrf/nvm.c
+++ b/ports/nrf/peripherals/nrf/nvm.c
@@ -40,6 +40,8 @@
STATIC bool sd_is_enabled(void) {
uint8_t sd_en = 0;
+ if (__get_PRIMASK())
+ return false;
(void) sd_softdevice_is_enabled(&sd_en);
return sd_en;
}