File tree Expand file tree Collapse file tree 3 files changed +3
-8
lines changed
UNITTESTS/drivers/Watchdog Expand file tree Collapse file tree 3 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ class TestWatchdog : public testing::Test {
3838TEST_F (TestWatchdog, test_watchdog_start_stop_get_timeout)
3939{
4040 EXPECT_TRUE (Watchdog::get_instance ().start (500 ));
41- EXPECT_FALSE (Watchdog::get_instance ().start (2000 ));
4241 EXPECT_TRUE (Watchdog::get_instance ().stop ());
4342 EXPECT_FALSE (Watchdog::get_instance ().stop ());
4443 EXPECT_EQ (500 , Watchdog::get_instance ().get_timeout ());
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ class Watchdog : private NonCopyable<Watchdog> {
9898 * @param timeout Watchdog timeout in milliseconds.
9999 *
100100 * @return true if the Watchdog timer was started successfully;
101- * false if Watchdog timer was not started or if the Watchdog
102- * timer is already running .
101+ * false if Watchdog timer was not started or if setting
102+ * a new watchdog timeout was not possible .
103103 */
104104 bool start (uint32_t timeout);
105105
Original file line number Diff line number Diff line change @@ -34,18 +34,14 @@ bool Watchdog::start(uint32_t timeout)
3434 MBED_ASSERT (timeout > 0 );
3535
3636 core_util_critical_section_enter ();
37- if (_running) {
38- core_util_critical_section_exit ();
39- return false ;
40- }
4137 watchdog_config_t config;
4238 config.timeout_ms = timeout;
4339 watchdog_status_t sts = hal_watchdog_init (&config);
4440 if (sts == WATCHDOG_STATUS_OK) {
4541 _running = true ;
4642 }
4743 core_util_critical_section_exit ();
48- return _running ;
44+ return (sts == WATCHDOG_STATUS_OK) ;
4945}
5046
5147bool Watchdog::start ()
You can’t perform that action at this time.
0 commit comments