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.
Fork of nRF51822 by
Diff: source/nRF5xn.cpp
- Revision:
- 463:b869f947a37a
- Parent:
- 461:1f352d938a33
- Child:
- 475:fe3d08b3a8e9
--- a/source/nRF5xn.cpp Mon Nov 02 17:34:04 2015 +0000 +++ b/source/nRF5xn.cpp Tue Nov 03 12:45:21 2015 +0000 @@ -77,12 +77,14 @@ return versionString; } -ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, BLE::InitializationCompleteCallback_t callback) +ble_error_t nRF5xn::init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback) { if (initialized) { - if (callback) { - callback(BLE::Instance(instanceID), BLE_ERROR_ALREADY_INITIALIZED); - } + BLE::InitializationCompleteCallbackContext context = { + BLE::Instance(instanceID), + BLE_ERROR_ALREADY_INITIALIZED + }; + callback.call(&context); return BLE_ERROR_ALREADY_INITIALIZED; } @@ -92,9 +94,11 @@ btle_init(); initialized = true; - if (callback) { - callback(BLE::Instance(instanceID), BLE_ERROR_NONE); - } + BLE::InitializationCompleteCallbackContext context = { + BLE::Instance(instanceID), + BLE_ERROR_NONE + }; + callback.call(&context); return BLE_ERROR_NONE; }