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 {
38
38
TEST_F (TestWatchdog, test_watchdog_start_stop_get_timeout)
39
39
{
40
40
EXPECT_TRUE (Watchdog::get_instance ().start (500 ));
41
- EXPECT_FALSE (Watchdog::get_instance ().start (2000 ));
42
41
EXPECT_TRUE (Watchdog::get_instance ().stop ());
43
42
EXPECT_FALSE (Watchdog::get_instance ().stop ());
44
43
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> {
98
98
* @param timeout Watchdog timeout in milliseconds.
99
99
*
100
100
* @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 .
103
103
*/
104
104
bool start (uint32_t timeout);
105
105
Original file line number Diff line number Diff line change @@ -34,18 +34,14 @@ bool Watchdog::start(uint32_t timeout)
34
34
MBED_ASSERT (timeout > 0 );
35
35
36
36
core_util_critical_section_enter ();
37
- if (_running) {
38
- core_util_critical_section_exit ();
39
- return false ;
40
- }
41
37
watchdog_config_t config;
42
38
config.timeout_ms = timeout;
43
39
watchdog_status_t sts = hal_watchdog_init (&config);
44
40
if (sts == WATCHDOG_STATUS_OK) {
45
41
_running = true ;
46
42
}
47
43
core_util_critical_section_exit ();
48
- return _running ;
44
+ return (sts == WATCHDOG_STATUS_OK) ;
49
45
}
50
46
51
47
bool Watchdog::start ()
You can’t perform that action at this time.
0 commit comments