File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
hal/targets/hal/TARGET_NORDIC/TARGET_NRF5 Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 26
26
void sleep (void )
27
27
{
28
28
// ensure debug is disconnected if semihost is enabled....
29
- NRF_POWER -> TASKS_LOWPWR = 1 ;
30
29
31
30
SCB -> SCR |= SCB_SCR_SEVONPEND_Msk ; /* send an event when an interrupt is pending.
32
31
* This helps with the wakeup from the following app_evt_wait(). */
@@ -37,8 +36,11 @@ void sleep(void)
37
36
// and check if the soft device is running
38
37
if ((__get_PRIMASK () == 0 ) && (sd_softdevice_is_enabled (& sd_enabled ) == NRF_SUCCESS ) && (sd_enabled == 1 )) {
39
38
// soft device is enabled, use the primitives from the soft device to go to sleep
39
+ sd_power_mode_set (NRF_POWER_MODE_LOWPWR );
40
40
sd_app_evt_wait ();
41
41
} else {
42
+ NRF_POWER -> TASKS_LOWPWR = 1 ;
43
+
42
44
// Note: it is not possible to just use WFE at this stage because WFE
43
45
// will read the event register (not accessible) and if an event occured,
44
46
// in the past, it will just clear the event register and continue execution.
You can’t perform that action at this time.
0 commit comments