Skip to content

Commit 6810c02

Browse files
committed
Nordic BLE: Fix processing of events.
If new events are signaled during processing then they should be processed when processEvent is called again. The goal is to let other processing happen and not process sollely ble events.
1 parent 8fbecf2 commit 6810c02

File tree

1 file changed

+6
-7
lines changed
  • features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5x/source

1 file changed

+6
-7
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5x/source/nRF5xn.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,18 @@ nRF5xn::waitForEvent(void)
223223

224224
void nRF5xn::processEvents() {
225225
core_util_critical_section_enter();
226-
while (isEventsSignaled) {
226+
if (isEventsSignaled) {
227227
isEventsSignaled = false;
228228
core_util_critical_section_exit();
229-
#if NRF_SD_BLE_API_VERSION >= 5
229+
#if NRF_SD_BLE_API_VERSION >= 5
230230
// We use the "polling" dispatch model
231231
// http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__nrf__sdh.html?cp=4_0_0_6_11_60_20#gab4d7be69304d4f5feefd1d440cc3e6c7
232232
// This will process any pending events from the Softdevice
233233
nrf_sdh_evts_poll();
234-
#else
234+
#else
235235
intern_softdevice_events_execute();
236-
#endif
237-
238-
core_util_critical_section_enter();
236+
#endif
237+
} else {
238+
core_util_critical_section_exit();
239239
}
240-
core_util_critical_section_exit();
241240
}

0 commit comments

Comments
 (0)