diff --git a/drivers/VirtualWatchdog.cpp b/drivers/VirtualWatchdog.cpp index 66e03ac486..ea91852a9b 100644 --- a/drivers/VirtualWatchdog.cpp +++ b/drivers/VirtualWatchdog.cpp @@ -33,7 +33,7 @@ VirtualWatchdog *VirtualWatchdog::_first = NULL; bool VirtualWatchdog::_is_hw_watchdog_running = false; us_timestamp_t VirtualWatchdog::_ticker_timeout = 0; -VirtualWatchdog::VirtualWatchdog(uint32_t timeout, const char *const str, uint32_t watchdog_hw_timeout) : _name(str) +VirtualWatchdog::VirtualWatchdog(uint32_t timeout, const char *const str) : _name(str) { _current_count = 0; _is_initialized = false; @@ -45,9 +45,8 @@ VirtualWatchdog::VirtualWatchdog(uint32_t timeout, const char *const str, uint32 if (watchdog.is_running() == true) { MBED_MAKE_ERROR(MBED_MODULE_DRIVER_WATCHDOG, MBED_ERROR_INITIALIZATION_FAILED); } - // we use default hw timeout provided by config - watchdog.start(watchdog_hw_timeout); - _ticker_timeout = MS_TO_US(watchdog_hw_timeout / 2); + watchdog.start(timeout); + _ticker_timeout = MS_TO_US(timeout / 2); if (_ticker_timeout == 0) { _ticker_timeout = 1; } diff --git a/drivers/VirtualWatchdog.h b/drivers/VirtualWatchdog.h index 3e00918ad6..27960d2ecd 100644 --- a/drivers/VirtualWatchdog.h +++ b/drivers/VirtualWatchdog.h @@ -65,13 +65,14 @@ class VirtualWatchdog { public: /** Constructor configured with timeout and name for this software watchdog instance. + * + * Note, the first instance of VirtualWatchog configures the hardware watchdog peripheral (uses timeout value passed here). * * @param timeout Timer timeout * @param str The name for this watchdog timer - * @param watchdog_hw_timeout The watchdog driver timeout - can be set only once (as soon as watchdog runs, cannot be reconfigured) * */ - VirtualWatchdog(uint32_t timeout = 1000, const char *const str = NULL, uint32_t watchdog_hw_timeout = Watchdog::watchdog_timeout); + VirtualWatchdog(uint32_t timeout = 1000, const char *const str = NULL); ~VirtualWatchdog(); public: