Disable us ticker in deep-sleep mode.

pull/7009/head
Przemyslaw Stekiel 2018-05-17 15:10:17 +02:00 committed by Bartek Szatkowski
parent 4fe068834c
commit fac7d744d5
2 changed files with 14 additions and 1 deletions

View File

@ -18,6 +18,8 @@
#include "mbed_interface.h"
#include "softdevice_handler.h"
#include "nrf_soc.h"
#include "nrf_timer.h"
#include "us_ticker.h"
// Mask of reserved bits of the register ICSR in the System Control Block peripheral
// In this case, bits which are equal to 0 are the bits reserved in this register
@ -25,6 +27,8 @@
#define FPU_EXCEPTION_MASK 0x0000009F
extern bool us_ticker_initialized;
void hal_sleep(void)
{
// ensure debug is disconnected if semihost is enabled....
@ -75,6 +79,15 @@ void hal_sleep(void)
void hal_deepsleep(void)
{
if (us_ticker_initialized) {
nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_STOP);
}
hal_sleep();
if (us_ticker_initialized) {
nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_START);
}
// NRF_POWER->SYSTEMOFF=1;
}

View File

@ -44,7 +44,7 @@
#include "nrf_drv_common.h"
#include "mbed_critical.h"
static bool us_ticker_initialized = false;
bool us_ticker_initialized = false;
/* us ticker is driven by 1MHz clock and counter length is 16 bits. */
const ticker_info_t* us_ticker_get_info()