mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12511 from paul-szczepanek-arm/patch-1
allow reconfiguring a running watchdogpull/12599/head
commit
a937d30501
|
|
@ -38,7 +38,6 @@ protected:
|
|||
TEST_F(TestWatchdog, test_watchdog_start_stop_get_timeout)
|
||||
{
|
||||
EXPECT_TRUE(Watchdog::get_instance().start(500));
|
||||
EXPECT_FALSE(Watchdog::get_instance().start(2000));
|
||||
EXPECT_TRUE(Watchdog::get_instance().stop());
|
||||
EXPECT_FALSE(Watchdog::get_instance().stop());
|
||||
EXPECT_EQ(500, Watchdog::get_instance().get_timeout());
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ public:
|
|||
* @param timeout Watchdog timeout in milliseconds.
|
||||
*
|
||||
* @return true if the Watchdog timer was started successfully;
|
||||
* false if Watchdog timer was not started or if the Watchdog
|
||||
* timer is already running.
|
||||
* false if Watchdog timer was not started or if setting
|
||||
* a new watchdog timeout was not possible.
|
||||
*/
|
||||
bool start(uint32_t timeout);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@ bool Watchdog::start(uint32_t timeout)
|
|||
MBED_ASSERT(timeout > 0);
|
||||
|
||||
core_util_critical_section_enter();
|
||||
if (_running) {
|
||||
core_util_critical_section_exit();
|
||||
return false;
|
||||
}
|
||||
watchdog_config_t config;
|
||||
config.timeout_ms = timeout;
|
||||
watchdog_status_t sts = hal_watchdog_init(&config);
|
||||
|
|
@ -45,7 +41,7 @@ bool Watchdog::start(uint32_t timeout)
|
|||
_running = true;
|
||||
}
|
||||
core_util_critical_section_exit();
|
||||
return _running;
|
||||
return (sts == WATCHDOG_STATUS_OK);
|
||||
}
|
||||
|
||||
bool Watchdog::start()
|
||||
|
|
|
|||
Loading…
Reference in New Issue