mirror of https://github.com/ARMmbed/mbed-os.git
Disable us ticker in deep-sleep mode.
parent
4fe068834c
commit
fac7d744d5
|
@ -18,6 +18,8 @@
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "softdevice_handler.h"
|
#include "softdevice_handler.h"
|
||||||
#include "nrf_soc.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
|
// 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
|
// 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
|
#define FPU_EXCEPTION_MASK 0x0000009F
|
||||||
|
|
||||||
|
extern bool us_ticker_initialized;
|
||||||
|
|
||||||
void hal_sleep(void)
|
void hal_sleep(void)
|
||||||
{
|
{
|
||||||
// ensure debug is disconnected if semihost is enabled....
|
// ensure debug is disconnected if semihost is enabled....
|
||||||
|
@ -75,6 +79,15 @@ void hal_sleep(void)
|
||||||
|
|
||||||
void hal_deepsleep(void)
|
void hal_deepsleep(void)
|
||||||
{
|
{
|
||||||
|
if (us_ticker_initialized) {
|
||||||
|
nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_STOP);
|
||||||
|
}
|
||||||
|
|
||||||
hal_sleep();
|
hal_sleep();
|
||||||
|
|
||||||
|
if (us_ticker_initialized) {
|
||||||
|
nrf_timer_task_trigger(NRF_TIMER1, NRF_TIMER_TASK_START);
|
||||||
|
}
|
||||||
|
|
||||||
// NRF_POWER->SYSTEMOFF=1;
|
// NRF_POWER->SYSTEMOFF=1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "nrf_drv_common.h"
|
#include "nrf_drv_common.h"
|
||||||
#include "mbed_critical.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. */
|
/* us ticker is driven by 1MHz clock and counter length is 16 bits. */
|
||||||
const ticker_info_t* us_ticker_get_info()
|
const ticker_info_t* us_ticker_get_info()
|
||||||
|
|
Loading…
Reference in New Issue