BLE - Legacy nordic implementation: Move static singleton into a function.

The change of scope all the code from BLE when this code is not used by the end
user application.
pull/2778/head
Vincent Coubard 2016-09-22 12:10:14 +01:00
parent b4ac8f214a
commit e8bddd6711
1 changed files with 6 additions and 2 deletions

View File

@ -33,7 +33,11 @@ extern "C" {
/**
* The singleton which represents the nRF51822 transport for the BLE.
*/
static nRF5xn deviceInstance;
static nRF5xn& getDeviceInstance() {
static nRF5xn deviceInstance;
return deviceInstance;
}
/**
* BLE-API requires an implementation of the following function in order to
@ -47,7 +51,7 @@ createBLEInstance(void)
nRF5xn& nRF5xn::Instance(BLE::InstanceID_t instanceId)
{
return deviceInstance;
return getDeviceInstance();
}
nRF5xn::nRF5xn(void) :