From c285f2e1d3e714f5b8675b15cb4cc8fea20dbb91 Mon Sep 17 00:00:00 2001 From: Jonathan Austin Date: Tue, 21 Jul 2015 13:56:24 +0100 Subject: [PATCH] Nordic: refactor the way we select the LFCLKSRC Rather than indefinitely adding platforms to a #define list that use the internal RC oscillator instead of an external crystal, let platforms define this and the 'core code' can be platform agnostic. Note, that this also allows people to use this symbol in libraries. There's one notable example in the BLE_API that can now be refactored to the same method, hopefully saving someone some unpleasant debugging when their platform doesn't work because of a missing platform dependent define in the high level API. Signed-off-by: Jonathan Austin --- .../cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c index 76857bb161..dd4fc2bf4f 100644 --- a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c +++ b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/system_nrf51.c @@ -83,7 +83,8 @@ void SystemInit(void) // Start the external 32khz crystal oscillator. -#if defined(TARGET_DELTA_DFCM_NNN40) || defined(TARGET_HRM1017) || defined(TARGET_NRF_LFCLK_RC) + /* for Nordic devices without an external LF crystal */ +#if defined(TARGET_NRF_LFCLK_RC) NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos); #else NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);