Note: this patch refers to the following pull request: mbedmicro/mbed#1276
If that change gets merged into mbed, this patch will be necessary for a proper clock source compatibility. Otherwise, #ifdef can be kept to select the oscillator in btle_init, but the tested macro will need to be changed to TARGET_NRF_LFCLK_RC.
Note: request cloned from https://github.com/ARMmbed/nRF51822/pull/31#issuecomment-127614531
Instead of relying on build macros to know which oscillator we're
supposedly using, check the value of LFCLKSRC register. This way, we can
trust mbed's init code to fallback on the internal clock if the user
specified a wrong target.
This change, along with the mbed patch that selects clock source
dynamically, will allow lots of application to still run and provide
FOTA, when the wrong Nordic platform is specified.
Instead of relying on build macros to know which oscillator we're supposedly using, check the value of LFCLKSRC register. This way, we can trust mbed's init code to fallback on the internal clock if the user specified a wrong target. This change, along with the mbed patch that selects clock source dynamically, will allow lots of application to still run and provide FOTA, when the wrong Nordic platform is specified.
Signed-off-by: Jean-Philippe Brucker jean-philippe.brucker@arm.com