Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:56 2016 +0100
Revision:
28:041dac1366b2
Parent:
20:a90c48eb1d30
Child:
29:286940b7ee5a
Synchronized with git rev 012b8118
Author: Liyou Zhou
Pull in files from sdk 10.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 28:041dac1366b2 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
vcoubard 28:041dac1366b2 2 *
vcoubard 28:041dac1366b2 3 * The information contained herein is property of Nordic Semiconductor ASA.
vcoubard 28:041dac1366b2 4 * Terms and conditions of usage are described in detail in NORDIC
vcoubard 28:041dac1366b2 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
vcoubard 28:041dac1366b2 6 *
vcoubard 28:041dac1366b2 7 * Licensees are granted free, non-transferable use of the information. NO
vcoubard 28:041dac1366b2 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
vcoubard 28:041dac1366b2 9 * the file.
vcoubard 28:041dac1366b2 10 *
Vincent Coubard 0:f2542974c862 11 */
Vincent Coubard 0:f2542974c862 12
Vincent Coubard 0:f2542974c862 13 #include "softdevice_handler.h"
Vincent Coubard 0:f2542974c862 14 #include <stdlib.h>
Vincent Coubard 0:f2542974c862 15 #include "nordic_common.h"
Vincent Coubard 0:f2542974c862 16 #include "app_error.h"
Vincent Coubard 0:f2542974c862 17 #include "app_util.h"
Vincent Coubard 0:f2542974c862 18 #include "nrf_assert.h"
Vincent Coubard 0:f2542974c862 19 #include "nrf_soc.h"
vcoubard 28:041dac1366b2 20 #include "nrf.h"
Vincent Coubard 0:f2542974c862 21
Vincent Coubard 0:f2542974c862 22 #if defined(ANT_STACK_SUPPORT_REQD) && defined(BLE_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 23 #include "ant_interface.h"
Vincent Coubard 0:f2542974c862 24 #elif defined(ANT_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 25 #include "ant_interface.h"
Vincent Coubard 0:f2542974c862 26 #elif defined(BLE_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 27 #include "ble.h"
Vincent Coubard 0:f2542974c862 28 #endif
Vincent Coubard 0:f2542974c862 29
vcoubard 28:041dac1366b2 30 #ifdef NRF51
vcoubard 28:041dac1366b2 31 #define SOFTDEVICE_EVT_IRQ SD_EVT_IRQn /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
vcoubard 28:041dac1366b2 32 #define SOFTDEVICE_EVT_IRQHandler SD_EVT_IRQHandler
vcoubard 28:041dac1366b2 33 #elif defined (NRF52)
vcoubard 28:041dac1366b2 34 #define SOFTDEVICE_EVT_IRQ SWI2_EGU2_IRQn
vcoubard 28:041dac1366b2 35 #define SOFTDEVICE_EVT_IRQHandler SWI2_EGU2_IRQHandler
vcoubard 28:041dac1366b2 36 #endif /* NRF51 */
Vincent Coubard 0:f2542974c862 37
Vincent Coubard 0:f2542974c862 38 static softdevice_evt_schedule_func_t m_evt_schedule_func; /**< Pointer to function for propagating SoftDevice events to the scheduler. */
Vincent Coubard 0:f2542974c862 39
Vincent Coubard 0:f2542974c862 40 static volatile bool m_softdevice_enabled = false; /**< Variable to indicate whether the SoftDevice is enabled. */
Vincent Coubard 0:f2542974c862 41
Vincent Coubard 0:f2542974c862 42 #ifdef BLE_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 43 // The following three definitions is needed only if BLE events are needed to be pulled from the stack.
Vincent Coubard 0:f2542974c862 44 static uint8_t * mp_ble_evt_buffer; /**< Buffer for receiving BLE events from the SoftDevice. */
Vincent Coubard 0:f2542974c862 45 static uint16_t m_ble_evt_buffer_size; /**< Size of BLE event buffer. */
Vincent Coubard 0:f2542974c862 46 static ble_evt_handler_t m_ble_evt_handler; /**< Application event handler for handling BLE events. */
Vincent Coubard 0:f2542974c862 47 #endif
Vincent Coubard 0:f2542974c862 48
Vincent Coubard 0:f2542974c862 49 #ifdef ANT_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 50 // The following two definition is needed only if ANT events are needed to be pulled from the stack.
Vincent Coubard 0:f2542974c862 51 static ant_evt_t m_ant_evt_buffer; /**< Buffer for receiving ANT events from the SoftDevice. */
Vincent Coubard 0:f2542974c862 52 static ant_evt_handler_t m_ant_evt_handler; /**< Application event handler for handling ANT events. */
Vincent Coubard 0:f2542974c862 53 #endif
Vincent Coubard 0:f2542974c862 54
Vincent Coubard 0:f2542974c862 55 static sys_evt_handler_t m_sys_evt_handler; /**< Application event handler for handling System (SOC) events. */
Vincent Coubard 0:f2542974c862 56
Vincent Coubard 0:f2542974c862 57
Vincent Coubard 0:f2542974c862 58 /**@brief Callback function for asserts in the SoftDevice.
Vincent Coubard 0:f2542974c862 59 *
Vincent Coubard 0:f2542974c862 60 * @details A pointer to this function will be passed to the SoftDevice. This function will be
Vincent Coubard 0:f2542974c862 61 * called if an ASSERT statement in the SoftDevice fails.
Vincent Coubard 0:f2542974c862 62 *
Vincent Coubard 0:f2542974c862 63 * @param[in] pc The value of the program counter when the ASSERT call failed.
Vincent Coubard 0:f2542974c862 64 * @param[in] line_num Line number of the failing ASSERT call.
Vincent Coubard 0:f2542974c862 65 * @param[in] file_name File name of the failing ASSERT call.
Vincent Coubard 0:f2542974c862 66 */
Vincent Coubard 0:f2542974c862 67 void softdevice_assertion_handler(uint32_t pc, uint16_t line_num, const uint8_t * file_name)
Vincent Coubard 0:f2542974c862 68 {
Vincent Coubard 0:f2542974c862 69 UNUSED_PARAMETER(pc);
Vincent Coubard 0:f2542974c862 70 assert_nrf_callback(line_num, file_name);
Vincent Coubard 0:f2542974c862 71 }
Vincent Coubard 0:f2542974c862 72
Vincent Coubard 0:f2542974c862 73
Vincent Coubard 0:f2542974c862 74 void intern_softdevice_events_execute(void)
Vincent Coubard 0:f2542974c862 75 {
Vincent Coubard 0:f2542974c862 76 if (!m_softdevice_enabled)
Vincent Coubard 0:f2542974c862 77 {
Vincent Coubard 0:f2542974c862 78 // SoftDevice not enabled. This can be possible if the SoftDevice was enabled by the
Vincent Coubard 0:f2542974c862 79 // application without using this module's API (i.e softdevice_handler_init)
Vincent Coubard 0:f2542974c862 80
Vincent Coubard 0:f2542974c862 81 return;
Vincent Coubard 0:f2542974c862 82 }
Vincent Coubard 0:f2542974c862 83
Vincent Coubard 0:f2542974c862 84 bool no_more_soc_evts = (m_sys_evt_handler == NULL);
Vincent Coubard 0:f2542974c862 85 #ifdef BLE_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 86 bool no_more_ble_evts = (m_ble_evt_handler == NULL);
Vincent Coubard 0:f2542974c862 87 #endif
Vincent Coubard 0:f2542974c862 88 #ifdef ANT_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 89 bool no_more_ant_evts = (m_ant_evt_handler == NULL);
Vincent Coubard 0:f2542974c862 90 #endif
Vincent Coubard 0:f2542974c862 91
Vincent Coubard 0:f2542974c862 92 for (;;)
Vincent Coubard 0:f2542974c862 93 {
Vincent Coubard 0:f2542974c862 94 uint32_t err_code;
Vincent Coubard 0:f2542974c862 95
Vincent Coubard 0:f2542974c862 96 if (!no_more_soc_evts)
Vincent Coubard 0:f2542974c862 97 {
Vincent Coubard 0:f2542974c862 98 uint32_t evt_id;
Vincent Coubard 0:f2542974c862 99
Vincent Coubard 0:f2542974c862 100 // Pull event from SOC.
Vincent Coubard 0:f2542974c862 101 err_code = sd_evt_get(&evt_id);
Vincent Coubard 0:f2542974c862 102
Vincent Coubard 0:f2542974c862 103 if (err_code == NRF_ERROR_NOT_FOUND)
Vincent Coubard 0:f2542974c862 104 {
Vincent Coubard 0:f2542974c862 105 no_more_soc_evts = true;
Vincent Coubard 0:f2542974c862 106 }
Vincent Coubard 0:f2542974c862 107 else if (err_code != NRF_SUCCESS)
Vincent Coubard 0:f2542974c862 108 {
Vincent Coubard 0:f2542974c862 109 APP_ERROR_HANDLER(err_code);
Vincent Coubard 0:f2542974c862 110 }
Vincent Coubard 0:f2542974c862 111 else
Vincent Coubard 0:f2542974c862 112 {
Vincent Coubard 0:f2542974c862 113 // Call application's SOC event handler.
Vincent Coubard 0:f2542974c862 114 m_sys_evt_handler(evt_id);
Vincent Coubard 0:f2542974c862 115 }
Vincent Coubard 0:f2542974c862 116 }
Vincent Coubard 0:f2542974c862 117
Vincent Coubard 0:f2542974c862 118 #ifdef BLE_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 119 // Fetch BLE Events.
Vincent Coubard 0:f2542974c862 120 if (!no_more_ble_evts)
Vincent Coubard 0:f2542974c862 121 {
Vincent Coubard 0:f2542974c862 122 // Pull event from stack
Vincent Coubard 0:f2542974c862 123 uint16_t evt_len = m_ble_evt_buffer_size;
Vincent Coubard 0:f2542974c862 124
Vincent Coubard 0:f2542974c862 125 err_code = sd_ble_evt_get(mp_ble_evt_buffer, &evt_len);
Vincent Coubard 0:f2542974c862 126 if (err_code == NRF_ERROR_NOT_FOUND)
Vincent Coubard 0:f2542974c862 127 {
Vincent Coubard 0:f2542974c862 128 no_more_ble_evts = true;
Vincent Coubard 0:f2542974c862 129 }
Vincent Coubard 0:f2542974c862 130 else if (err_code != NRF_SUCCESS)
Vincent Coubard 0:f2542974c862 131 {
Vincent Coubard 0:f2542974c862 132 APP_ERROR_HANDLER(err_code);
Vincent Coubard 0:f2542974c862 133 }
Vincent Coubard 0:f2542974c862 134 else
Vincent Coubard 0:f2542974c862 135 {
Vincent Coubard 0:f2542974c862 136 // Call application's BLE stack event handler.
Vincent Coubard 0:f2542974c862 137 m_ble_evt_handler((ble_evt_t *)mp_ble_evt_buffer);
Vincent Coubard 0:f2542974c862 138 }
Vincent Coubard 0:f2542974c862 139 }
Vincent Coubard 0:f2542974c862 140 #endif
Vincent Coubard 0:f2542974c862 141
Vincent Coubard 0:f2542974c862 142 #ifdef ANT_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 143 // Fetch ANT Events.
Vincent Coubard 0:f2542974c862 144 if (!no_more_ant_evts)
Vincent Coubard 0:f2542974c862 145 {
Vincent Coubard 0:f2542974c862 146 // Pull event from stack
Vincent Coubard 0:f2542974c862 147 err_code = sd_ant_event_get(&m_ant_evt_buffer.channel,
Vincent Coubard 0:f2542974c862 148 &m_ant_evt_buffer.event,
Vincent Coubard 0:f2542974c862 149 m_ant_evt_buffer.evt_buffer);
Vincent Coubard 0:f2542974c862 150 if (err_code == NRF_ERROR_NOT_FOUND)
Vincent Coubard 0:f2542974c862 151 {
Vincent Coubard 0:f2542974c862 152 no_more_ant_evts = true;
Vincent Coubard 0:f2542974c862 153 }
Vincent Coubard 0:f2542974c862 154 else if (err_code != NRF_SUCCESS)
Vincent Coubard 0:f2542974c862 155 {
Vincent Coubard 0:f2542974c862 156 APP_ERROR_HANDLER(err_code);
Vincent Coubard 0:f2542974c862 157 }
Vincent Coubard 0:f2542974c862 158 else
Vincent Coubard 0:f2542974c862 159 {
Vincent Coubard 0:f2542974c862 160 // Call application's ANT stack event handler.
Vincent Coubard 0:f2542974c862 161 m_ant_evt_handler(&m_ant_evt_buffer);
Vincent Coubard 0:f2542974c862 162 }
Vincent Coubard 0:f2542974c862 163 }
Vincent Coubard 0:f2542974c862 164 #endif
Vincent Coubard 0:f2542974c862 165
Vincent Coubard 0:f2542974c862 166 if (no_more_soc_evts)
Vincent Coubard 0:f2542974c862 167 {
Vincent Coubard 0:f2542974c862 168 // There are no remaining System (SOC) events to be fetched from the SoftDevice.
Vincent Coubard 0:f2542974c862 169 #if defined(ANT_STACK_SUPPORT_REQD) && defined(BLE_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 170 // Check if there are any remaining BLE and ANT events.
Vincent Coubard 0:f2542974c862 171 if (no_more_ble_evts && no_more_ant_evts)
Vincent Coubard 0:f2542974c862 172 {
Vincent Coubard 0:f2542974c862 173 break;
Vincent Coubard 0:f2542974c862 174 }
Vincent Coubard 0:f2542974c862 175 #elif defined(BLE_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 176 // Check if there are any remaining BLE events.
Vincent Coubard 0:f2542974c862 177 if (no_more_ble_evts)
Vincent Coubard 0:f2542974c862 178 {
Vincent Coubard 0:f2542974c862 179 break;
Vincent Coubard 0:f2542974c862 180 }
Vincent Coubard 0:f2542974c862 181 #elif defined(ANT_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 182 // Check if there are any remaining ANT events.
Vincent Coubard 0:f2542974c862 183 if (no_more_ant_evts)
Vincent Coubard 0:f2542974c862 184 {
Vincent Coubard 0:f2542974c862 185 break;
Vincent Coubard 0:f2542974c862 186 }
Vincent Coubard 0:f2542974c862 187 #else
Vincent Coubard 0:f2542974c862 188 // No need to check for BLE or ANT events since there is no support for BLE and ANT
Vincent Coubard 0:f2542974c862 189 // required.
Vincent Coubard 0:f2542974c862 190 break;
Vincent Coubard 0:f2542974c862 191 #endif
Vincent Coubard 0:f2542974c862 192 }
Vincent Coubard 0:f2542974c862 193 }
Vincent Coubard 0:f2542974c862 194 }
Vincent Coubard 0:f2542974c862 195
vcoubard 28:041dac1366b2 196 bool softdevice_handler_isEnabled(void)
vcoubard 28:041dac1366b2 197 {
vcoubard 28:041dac1366b2 198 return m_softdevice_enabled;
vcoubard 28:041dac1366b2 199 }
Vincent Coubard 0:f2542974c862 200
Vincent Coubard 0:f2542974c862 201 uint32_t softdevice_handler_init(nrf_clock_lfclksrc_t clock_source,
Vincent Coubard 0:f2542974c862 202 void * p_ble_evt_buffer,
Vincent Coubard 0:f2542974c862 203 uint16_t ble_evt_buffer_size,
Vincent Coubard 0:f2542974c862 204 softdevice_evt_schedule_func_t evt_schedule_func)
Vincent Coubard 0:f2542974c862 205 {
Vincent Coubard 0:f2542974c862 206 uint32_t err_code;
Vincent Coubard 0:f2542974c862 207
Vincent Coubard 0:f2542974c862 208 // Save configuration.
Vincent Coubard 0:f2542974c862 209 #if defined (BLE_STACK_SUPPORT_REQD)
Vincent Coubard 0:f2542974c862 210 // Check that buffer is not NULL.
Vincent Coubard 0:f2542974c862 211 if (p_ble_evt_buffer == NULL)
Vincent Coubard 0:f2542974c862 212 {
Vincent Coubard 0:f2542974c862 213 return NRF_ERROR_INVALID_PARAM;
Vincent Coubard 0:f2542974c862 214 }
Vincent Coubard 0:f2542974c862 215
Vincent Coubard 0:f2542974c862 216 // Check that buffer is correctly aligned.
Vincent Coubard 0:f2542974c862 217 if (!is_word_aligned(p_ble_evt_buffer))
Vincent Coubard 0:f2542974c862 218 {
Vincent Coubard 0:f2542974c862 219 return NRF_ERROR_INVALID_PARAM;
Vincent Coubard 0:f2542974c862 220 }
Vincent Coubard 0:f2542974c862 221
Vincent Coubard 0:f2542974c862 222 mp_ble_evt_buffer = (uint8_t *)p_ble_evt_buffer;
Vincent Coubard 0:f2542974c862 223 m_ble_evt_buffer_size = ble_evt_buffer_size;
Vincent Coubard 0:f2542974c862 224 #else
Vincent Coubard 0:f2542974c862 225 // The variables p_ble_evt_buffer and ble_evt_buffer_size is not needed if BLE Stack support
Vincent Coubard 0:f2542974c862 226 // is not required.
Vincent Coubard 0:f2542974c862 227 UNUSED_PARAMETER(p_ble_evt_buffer);
Vincent Coubard 0:f2542974c862 228 UNUSED_PARAMETER(ble_evt_buffer_size);
Vincent Coubard 0:f2542974c862 229 #endif
Vincent Coubard 0:f2542974c862 230
Vincent Coubard 0:f2542974c862 231 m_evt_schedule_func = evt_schedule_func;
Vincent Coubard 0:f2542974c862 232
vcoubard 28:041dac1366b2 233 //Enabling FPU for SoftDevice
vcoubard 28:041dac1366b2 234 #ifdef S132
vcoubard 28:041dac1366b2 235 SCB->CPACR |= (3UL << 20) | (3UL << 22);
vcoubard 28:041dac1366b2 236 __DSB();
vcoubard 28:041dac1366b2 237 __ISB();
vcoubard 28:041dac1366b2 238 #endif
Vincent Coubard 0:f2542974c862 239 // Initialize SoftDevice.
Vincent Coubard 0:f2542974c862 240 err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler);
Vincent Coubard 0:f2542974c862 241 if (err_code != NRF_SUCCESS)
Vincent Coubard 0:f2542974c862 242 {
Vincent Coubard 0:f2542974c862 243 return err_code;
Vincent Coubard 0:f2542974c862 244 }
vcoubard 28:041dac1366b2 245 #ifdef S132
vcoubard 28:041dac1366b2 246 SCB->CPACR = 0;
vcoubard 28:041dac1366b2 247 __DSB();
vcoubard 28:041dac1366b2 248 __ISB();
vcoubard 28:041dac1366b2 249 #endif
Vincent Coubard 0:f2542974c862 250
Vincent Coubard 0:f2542974c862 251 m_softdevice_enabled = true;
Vincent Coubard 0:f2542974c862 252
Vincent Coubard 0:f2542974c862 253 // Enable BLE event interrupt (interrupt priority has already been set by the stack).
vcoubard 28:041dac1366b2 254 return sd_nvic_EnableIRQ(SOFTDEVICE_EVT_IRQ);
Vincent Coubard 0:f2542974c862 255 }
Vincent Coubard 0:f2542974c862 256
Vincent Coubard 0:f2542974c862 257
Vincent Coubard 0:f2542974c862 258 uint32_t softdevice_handler_sd_disable(void)
Vincent Coubard 0:f2542974c862 259 {
Vincent Coubard 0:f2542974c862 260 uint32_t err_code = sd_softdevice_disable();
Vincent Coubard 0:f2542974c862 261
Vincent Coubard 0:f2542974c862 262 m_softdevice_enabled = !(err_code == NRF_SUCCESS);
Vincent Coubard 0:f2542974c862 263
Vincent Coubard 0:f2542974c862 264 return err_code;
Vincent Coubard 0:f2542974c862 265 }
Vincent Coubard 0:f2542974c862 266
Vincent Coubard 0:f2542974c862 267
Vincent Coubard 0:f2542974c862 268 #ifdef BLE_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 269 uint32_t softdevice_ble_evt_handler_set(ble_evt_handler_t ble_evt_handler)
Vincent Coubard 0:f2542974c862 270 {
Vincent Coubard 0:f2542974c862 271 if (ble_evt_handler == NULL)
Vincent Coubard 0:f2542974c862 272 {
Vincent Coubard 0:f2542974c862 273 return NRF_ERROR_NULL;
Vincent Coubard 0:f2542974c862 274 }
Vincent Coubard 0:f2542974c862 275
Vincent Coubard 0:f2542974c862 276 m_ble_evt_handler = ble_evt_handler;
Vincent Coubard 0:f2542974c862 277
Vincent Coubard 0:f2542974c862 278 return NRF_SUCCESS;
Vincent Coubard 0:f2542974c862 279 }
Vincent Coubard 0:f2542974c862 280 #endif
Vincent Coubard 0:f2542974c862 281
Vincent Coubard 0:f2542974c862 282
Vincent Coubard 0:f2542974c862 283 #ifdef ANT_STACK_SUPPORT_REQD
Vincent Coubard 0:f2542974c862 284 uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler)
Vincent Coubard 0:f2542974c862 285 {
Vincent Coubard 0:f2542974c862 286 if (ant_evt_handler == NULL)
Vincent Coubard 0:f2542974c862 287 {
Vincent Coubard 0:f2542974c862 288 return NRF_ERROR_NULL;
Vincent Coubard 0:f2542974c862 289 }
Vincent Coubard 0:f2542974c862 290
Vincent Coubard 0:f2542974c862 291 m_ant_evt_handler = ant_evt_handler;
Vincent Coubard 0:f2542974c862 292
Vincent Coubard 0:f2542974c862 293 return NRF_SUCCESS;
Vincent Coubard 0:f2542974c862 294 }
Vincent Coubard 0:f2542974c862 295 #endif
Vincent Coubard 0:f2542974c862 296
Vincent Coubard 0:f2542974c862 297
Vincent Coubard 0:f2542974c862 298 uint32_t softdevice_sys_evt_handler_set(sys_evt_handler_t sys_evt_handler)
Vincent Coubard 0:f2542974c862 299 {
Vincent Coubard 0:f2542974c862 300 if (sys_evt_handler == NULL)
Vincent Coubard 0:f2542974c862 301 {
Vincent Coubard 0:f2542974c862 302 return NRF_ERROR_NULL;
Vincent Coubard 0:f2542974c862 303 }
Vincent Coubard 0:f2542974c862 304
Vincent Coubard 0:f2542974c862 305 m_sys_evt_handler = sys_evt_handler;
Vincent Coubard 0:f2542974c862 306
Vincent Coubard 0:f2542974c862 307 return NRF_SUCCESS;
Vincent Coubard 0:f2542974c862 308 }
Vincent Coubard 0:f2542974c862 309
Vincent Coubard 0:f2542974c862 310
Vincent Coubard 0:f2542974c862 311 /**@brief Function for handling the Application's BLE Stack events interrupt.
Vincent Coubard 0:f2542974c862 312 *
Vincent Coubard 0:f2542974c862 313 * @details This function is called whenever an event is ready to be pulled.
Vincent Coubard 0:f2542974c862 314 */
vcoubard 28:041dac1366b2 315 void SOFTDEVICE_EVT_IRQHandler(void)
Vincent Coubard 0:f2542974c862 316 {
Vincent Coubard 0:f2542974c862 317 if (m_evt_schedule_func != NULL)
Vincent Coubard 0:f2542974c862 318 {
Vincent Coubard 0:f2542974c862 319 uint32_t err_code = m_evt_schedule_func();
Vincent Coubard 0:f2542974c862 320 APP_ERROR_CHECK(err_code);
Vincent Coubard 0:f2542974c862 321 }
Vincent Coubard 0:f2542974c862 322 else
Vincent Coubard 0:f2542974c862 323 {
Vincent Coubard 0:f2542974c862 324 intern_softdevice_events_execute();
Vincent Coubard 0:f2542974c862 325 }
vcoubard 1:ebc0e0ef0a11 326 }