Added the ticker support

-Modified the device dont have support of lp ticker will ticker for watchdog callback register
pull/10645/head
Rajkumar Kanagaraj 2019-04-02 10:59:33 +01:00 committed by Filip Jagodzinski
parent dfe4b533c3
commit 33793e710d
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@ static bool is_watchdog_started = false; //boolean to control watchdog start and
static uint32_t elapsed_ms = (HW_WATCHDOG_TIMEOUT / 2);
MBED_STATIC_ASSERT((HW_WATCHDOG_TIMEOUT > 0), "Timeout must be greater than zero");
#if DEVICE_LPTICKER
/** Create singleton instance of LowPowerTicker for watchdog periodic call back of kick.
*/
static SingletonPtr<mbed::LowPowerTicker> get_ticker()
@ -31,6 +32,15 @@ static SingletonPtr<mbed::LowPowerTicker> get_ticker()
static SingletonPtr<mbed::LowPowerTicker> ticker;
return ticker;
}
#else
/** Create singleton instance of Ticker for watchdog periodic call back of kick.
*/
static SingletonPtr<mbed::Ticker> get_ticker()
{
static SingletonPtr<mbed::Ticker> ticker;
return ticker;
}
#endif
/** Refreshes the watchdog timer.
*

View File

@ -25,7 +25,11 @@
#include "platform/Callback.h"
#include "platform/mbed_critical.h"
#include "platform/SingletonPtr.h"
#if DEVICE_LPTICKER
#include "LowPowerTicker.h"
#else
#include "Ticker.h"
#endif
#include "Watchdog.h"
#ifdef __cplusplus