Nano RGB LED mesh
Fork of nRF51822 by
Diff: source/nRF5xn.cpp
- Revision:
- 586:533fd7fdb0fe
- Parent:
- 582:37fd3190598e
- Child:
- 587:596071444447
--- a/source/nRF5xn.cpp Mon Jan 11 10:19:28 2016 +0000 +++ b/source/nRF5xn.cpp Mon Jan 11 10:19:29 2016 +0000 @@ -95,6 +95,20 @@ return versionString; } +/**************************************************************************/ +/*! + @brief Initialize the BLE stack. + + @returns ble_error_t + + @retval BLE_ERROR_NONE if everything executed properly and + BLE_ERROR_ALREADY_INITIALIZED if the stack has already + been initialized (possibly through a call to nRF5xn::init(). + BLE_ERROR_INTERNAL_STACK_FAILURE is returned if initialization + of the internal stack (SoftDevice) failed. + +*/ +/**************************************************************************/ ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback) { if (initialized) { @@ -109,7 +123,9 @@ instanceID = instanceID; /* ToDo: Clear memory contents, reset the SD, etc. */ - btle_init(); + if (btle_init() != ERROR_NONE) { + return BLE_ERROR_INTERNAL_STACK_FAILURE; + } initialized = true; BLE::InitializationCompleteCallbackContext context = {