Skip to content

Commit 6f8266c

Browse files
author
Filip Jagodzinski
committed
Watchdog: Clean up the doxygen comments
1 parent 608e4c2 commit 6f8266c

File tree

1 file changed

+56
-33
lines changed

1 file changed

+56
-33
lines changed

drivers/Watchdog.h

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,23 @@
3030
namespace mbed {
3131

3232
/** \addtogroup drivers */
33-
/** Hardware system timer that will reset the system in the case of system failures or
34-
* malfunctions. There is only one instance in the system.
33+
/** A hardware watchdog timer that will reset the system in the case of system
34+
* failures or malfunctions. If you fail to refresh the Watchdog periodically,
35+
* it will reset the system after a set period of time.
36+
*
37+
* There is only one instance in the system. Use Watchdog::get_instance to
38+
* obtain a reference.
39+
*
40+
* Watchdog::start initializes a system timer with a time period specified in
41+
* @a timeout param. This timer counts down and triggers a system reset
42+
* when it wraps. To prevent the system reset, the timer must be continually
43+
* kicked/refreshed by calling Watchdog::kick, which will reset the countdown
44+
* to the user specified reset value.
3545
*
3646
* Example:
3747
* @code
38-
*
3948
* Watchdog &watchdog = Watchdog::get_instance();
40-
* watchdog.start();
49+
* watchdog.start(500);
4150
*
4251
* while (true) {
4352
// kick watchdog regularly within provided timeout
@@ -52,9 +61,13 @@ namespace mbed {
5261
class Watchdog : private NonCopyable<Watchdog> {
5362
public:
5463

55-
/** As Watchdog might not stop ever, there is just one instance - we use single instance.
56-
* This ensures we keep Watchdog alive. To operate watchdog, use start/stop methods.
57-
*/
64+
/** Get a reference to the single Watchdog instance in the system.
65+
*
66+
* There is only one watchdog peripheral and only one Watchdog instance
67+
* to control it.
68+
*
69+
* @return A reference to the single Watchdog instance present in the system.
70+
*/
5871
static Watchdog &get_instance()
5972
{
6073
// Use this implementation of singleton (Meyer's) rather than the one that allocates
@@ -64,61 +77,71 @@ class Watchdog : private NonCopyable<Watchdog> {
6477
return instance;
6578
}
6679

67-
/** Start the watchdog timer with the maximum timeout available on a target
80+
/** Start the Watchdog timer with the maximum timeout value available for
81+
* the target.
82+
*
83+
* @note The timeout is set to a value returned by Watchdog::get_max_timeout.
6884
*
69-
* Timeout is defined as get_max_timeout()
85+
* If the Watchdog is already running, this function does nothing.
7086
*
71-
* @return status true if the watchdog timer was started
72-
* successfully. assert if one of the input parameters is out of range for the current platform.
73-
* false if watchdog timer was not started
87+
* @return true, if the Watchdog timer was started successfully,
88+
* false, if Watchdog timer was not started or if the Watchdog
89+
* is already running.
7490
*/
7591
bool start();
7692

77-
/** Start the watchdog timer
93+
/** Start the Watchdog timer.
7894
*
79-
* @param timeout Watchdog timeout
95+
* @note Asset that the timeout param is supported by the target
96+
* (0 < timeout <= Watchdog::get_max_timeout).
8097
*
81-
* @return status true if the watchdog timer was started
82-
* successfully. assert if one of the input parameters is out of range for the current platform.
83-
* false if watchdog timer was not started
98+
* @param timeout Watchdog timeout in milliseconds.
99+
*
100+
* @return true, if the Watchdog timer was started successfully,
101+
* false, if Watchdog timer was not started or if the Watchdog
102+
* is already running.
84103
*/
85104
bool start(uint32_t timeout);
86105

87-
/** Stops the watchdog timer
106+
/** Stop the Watchdog timer.
88107
*
89-
* Calling this function will attempt to disable any currently running
90-
* watchdog timers if supported by the current platform.
108+
* Calling this function will attempt to disable a running Watchdog
109+
* peripheral if supported by the platform.
91110
*
92-
* @return Returns true if the watchdog timer was successfully
93-
* stopped, Returns false if the watchdog cannot be disabled
94-
* on the current platform or if the timer was never started.
111+
* @return true, if the Watchdog timer was successfully stopped,
112+
* false, if the Watchdog cannot be disabled on this platform
113+
* or if the Watchdog has not been started.
95114
*/
96115
bool stop();
97116

98-
/** Get the watchdog timer refresh value
117+
/** Get the Watchdog timer refresh value.
99118
*
100-
* This function returns the refresh timeout of the watchdog timer.
119+
* This function returns the refresh timeout of the watchdog peripheral.
101120
*
102-
* @return Reload value for the watchdog timer in milliseconds.
121+
* @return Reload value for the Watchdog timer in milliseconds.
103122
*/
104123
uint32_t get_timeout() const;
105124

106-
/** Get the maximum refresh value for the current platform in milliseconds
125+
/** Get the maximum Watchdog refresh value for this platform.
107126
*
108-
* @return Maximum refresh value supported by the watchdog for the current
109-
* platform in milliseconds
127+
* @return Maximum reload value supported by the Watchdog timer for this
128+
* platform in milliseconds.
110129
*/
111130
uint32_t get_max_timeout() const;
112131

113-
/** Check if watchdog is already running
132+
/** Check if the Watchdog is already running.
114133
*
115-
* @return true if watchdog is running, false otherwise
134+
* @return true, if the Watchdog is running,
135+
* false, otherwise.
116136
*/
117137
bool is_running() const;
118138

119-
/** Kick watchdog
139+
/** Refresh the Watchdog timer.
140+
*
141+
* Call this function periodically before the Watchdog times out.
142+
* Otherwise, the system is reset.
120143
*
121-
* This method is useful to control kicking by application in ticker callback periodically
144+
* If the Watchdog is not running, this function does nothing.
122145
*/
123146
void kick();
124147

0 commit comments

Comments
 (0)