Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: nrf51-sdk-bluetooth-mdw
Fork of nRF51822 by
Diff: source/nRF5xn.cpp
- Revision:
- 458:b42881afcc6e
- Parent:
- 403:92d6b4c7bf14
- Child:
- 459:98c44deafc70
--- a/source/nRF5xn.cpp Mon Nov 02 09:05:11 2015 +0000
+++ b/source/nRF5xn.cpp Mon Nov 02 09:05:11 2015 +0000
@@ -38,7 +38,7 @@
return (&deviceInstance);
}
-nRF5xn::nRF5xn(void)
+nRF5xn::nRF5xn(void) : initialized(false), instanceID(BLE::DEFAULT_INSTANCE)
{
}
@@ -72,11 +72,24 @@
return versionString;
}
-ble_error_t nRF5xn::init(void)
+ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, BLE::InitializationCompleteCallback_t callback)
{
+ if (initialized) {
+ if (callback) {
+ callback(BLE::Instance(instanceID), BLE_ERROR_ALREADY_INITIALIZED);
+ }
+ return BLE_ERROR_ALREADY_INITIALIZED;
+ }
+
+ instanceID = instanceID;
+
/* ToDo: Clear memory contents, reset the SD, etc. */
btle_init();
+ initialized = true;
+ if (callback) {
+ callback(BLE::Instance(instanceID), BLE_ERROR_NONE);
+ }
return BLE_ERROR_NONE;
}
