Skip to content

Commit 680d086

Browse files
committed
[nRF52840] use core_util_critical_section_enter/exit instead of __enable_irq/__disable_irq
1 parent c78f73c commit 680d086

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

targets/TARGET_NORDIC/TARGET_NRF5_SDK13/us_ticker.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "app_util.h"
4242
#include "nrf_drv_common.h"
4343
#include "lp_ticker_api.h"
44+
#include "mbed_critical.h"
4445

4546
#if defined(NRF52_ERRATA_20)
4647
#include "softdevice_handler.h"
@@ -531,7 +532,7 @@ static void register_next_tick()
531532
// the RTC1 keeps running.
532533
// This code is very short 20-38 cycles in the worst case, it shouldn't
533534
// disturb softdevice.
534-
__disable_irq();
535+
core_util_critical_section_enter();
535536
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
536537

537538
// If an overflow occur, set the next tick in COUNTER + delta clock cycles
@@ -543,7 +544,7 @@ static void register_next_tick()
543544
// Enable generation of the compare event for the value set above (this
544545
// event will trigger the interrupt).
545546
nrf_rtc_event_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK);
546-
__enable_irq();
547+
core_util_critical_section_exit();
547548
}
548549

549550
/**

0 commit comments

Comments
 (0)