Merge pull request #12511 from paul-szczepanek-arm/patch-1

allow reconfiguring a running watchdog
pull/12599/head
Martin Kojtal 2020-03-03 13:00:45 +00:00 committed by GitHub
commit a937d30501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 8 deletions

View File

@ -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());

View File

@ -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);

View File

@ -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()