Watchdog: start without arg uses max timeout from a target

pull/10857/head
Martin Kojtal 2019-07-02 10:13:03 +01:00
parent 25fbd3956b
commit e12125bb25
2 changed files with 16 additions and 2 deletions

View File

@ -48,6 +48,11 @@ bool Watchdog::start(uint32_t timeout)
return _running; return _running;
} }
bool Watchdog::start()
{
return start(get_max_timeout());
}
bool Watchdog::stop() bool Watchdog::stop()
{ {

View File

@ -51,7 +51,6 @@ namespace mbed {
*/ */
class Watchdog : private NonCopyable<Watchdog> { class Watchdog : private NonCopyable<Watchdog> {
public: public:
static const uint32_t watchdog_timeout = 800;
/** As Watchdog might not stop ever, there is just one instance - we use single instance. /** As Watchdog might not stop ever, there is just one instance - we use single instance.
* This ensures we keep Watchdog alive. To operate watchdog, use start/stop methods. * This ensures we keep Watchdog alive. To operate watchdog, use start/stop methods.
@ -65,6 +64,16 @@ public:
return instance; return instance;
} }
/** Start the watchdog timer with the maximum timeout available on a target
*
* Timeout is defined as get_max_timeout()
*
* @return status true if the watchdog timer was started
* successfully. assert if one of the input parameters is out of range for the current platform.
* false if watchdog timer was not started
*/
bool start();
/** Start the watchdog timer /** Start the watchdog timer
* *
* @param timeout Watchdog timeout * @param timeout Watchdog timeout
@ -73,7 +82,7 @@ public:
* successfully. assert if one of the input parameters is out of range for the current platform. * successfully. assert if one of the input parameters is out of range for the current platform.
* false if watchdog timer was not started * false if watchdog timer was not started
*/ */
bool start(uint32_t timeout = watchdog_timeout); bool start(uint32_t timeout);
/** Stops the watchdog timer /** Stops the watchdog timer
* *