From cca4090bf642961c9dfdbf7d762e23790bcbce14 Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Thu, 24 May 2018 13:19:50 +0200 Subject: [PATCH] NRF51, NRF52: Implement us_ticker_free() function. --- .../TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c | 7 +++++-- .../TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c index 0ab3738bb1..fe1f55a686 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/us_ticker.c @@ -137,6 +137,9 @@ void us_ticker_clear_interrupt(void) void us_ticker_free(void) { - // A common counter is used for RTC, lp_ticker and us_ticker, so it can't be - // disabled here, but this does not cause any extra cost. + nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_STOP); + + nrf_timer_int_disable(NRF_TIMER1, nrf_timer_compare_int_get(NRF_TIMER_CC_CHANNEL0)); + + us_ticker_initialized = false; } diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c index bacacf9135..3de870a2c6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c @@ -137,6 +137,9 @@ void us_ticker_clear_interrupt(void) void us_ticker_free(void) { - // A common counter is used for RTC, lp_ticker and us_ticker, so it can't be - // disabled here, but this does not cause any extra cost. + nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_STOP); + + nrf_timer_int_disable(NRF_TIMER1, nrf_timer_compare_int_get(NRF_TIMER_CC_CHANNEL0)); + + us_ticker_initialized = false; }