Add NRF event loop handler hook.
This commit is contained in:
parent
c5ce428dae
commit
040baa12c0
2 changed files with 10 additions and 0 deletions
|
@ -48,10 +48,13 @@ void app_error_handler(uint32_t error_code, uint32_t line_num, const
|
|||
|
||||
static void btle_handler(ble_evt_t *p_ble_evt);
|
||||
static uint32_t gatt_table_size = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT;
|
||||
static void (*user_cb)(uint32_t) = NULL;
|
||||
|
||||
static void sys_evt_dispatch(uint32_t sys_evt)
|
||||
{
|
||||
pstorage_sys_event_handler(sys_evt);
|
||||
if (user_cb)
|
||||
user_cb(sys_evt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,6 +93,11 @@ btle_set_gatt_table_size(uint32_t size)
|
|||
return ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
void btle_set_user_evt_handler(void (*func)(uint32_t))
|
||||
{
|
||||
user_cb = func;
|
||||
}
|
||||
|
||||
error_t btle_init(void)
|
||||
{
|
||||
nrf_clock_lfclksrc_t clockSource;
|
||||
|
|
|
@ -28,6 +28,8 @@ extern "C" {
|
|||
|
||||
error_t btle_init(void);
|
||||
error_t btle_set_gatt_table_size(uint32_t size);
|
||||
void btle_set_user_evt_handler(void (*func)(uint32_t));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue