aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/NRF51/NRF51822/hal_lld.c
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-02-05 23:54:23 +0100
committerStephane D'Alu <sdalu@sdalu.com>2016-02-05 23:54:23 +0100
commit8fe62a0f907639db23f14d17a45a7970854f1d22 (patch)
tree94ed5d7c466003fabd19065fc74906d30dced297 /os/hal/ports/NRF51/NRF51822/hal_lld.c
parent80af295f27f0fc5daaaea04cb249d3ad3704d338 (diff)
downloadChibiOS-Contrib-8fe62a0f907639db23f14d17a45a7970854f1d22.tar.gz
ChibiOS-Contrib-8fe62a0f907639db23f14d17a45a7970854f1d22.tar.bz2
ChibiOS-Contrib-8fe62a0f907639db23f14d17a45a7970854f1d22.zip
use mcuconf.h with NRF51_SYSTEM_TICKS to select the timer source (TIMER or RTC)
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822/hal_lld.c')
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_lld.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/hal_lld.c b/os/hal/ports/NRF51/NRF51822/hal_lld.c
index 30fe6c0..af5e377 100644
--- a/os/hal/ports/NRF51/NRF51822/hal_lld.c
+++ b/os/hal/ports/NRF51/NRF51822/hal_lld.c
@@ -66,22 +66,16 @@ void hal_lld_init(void)
NRF_CLOCK->XTALFREQ = 0x00;
#endif
#endif
+
/* Low frequency clock initialisation
- * If source not specified, use the internal RC (0) which is prefered
- * over synthetized clock from the high frequency clock (2)
+ * Clock is only started if st driver requires it
*/
-#if defined(NRF51_LFCLK_SOURCE)
-#if (NRF51_LFCLK_SOURCE >=0) && (NRF51_LFCLK_SOURCE <= 2)
+ NRF_CLOCK->TASKS_LFCLKSTOP = 1;
NRF_CLOCK->LFCLKSRC = NRF51_LFCLK_SOURCE;
-#else
-#error "Possible value for NRF51_LFCLK_SOURCE are 0=RC, 1=XTAL, 2=Synth"
-#endif
-#else
- NRF_CLOCK->LFCLKSRC = 0;
-#endif
-#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE)
+#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) && \
+ (NRF51_SYSTEM_TICKS == NRF51_SYSTEM_TICKS_AS_RTC)
NRF_CLOCK->TASKS_LFCLKSTART = 1;
#endif
}