removed debug

Committer:
spin7ion
Date:
Tue Sep 29 17:39:13 2020 +0000
Revision:
8:c5a5935e59a4
Parent:
4:22c5c4aa4661
removed unnecessary debug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 0:7a316f14da9c 1 /// @file Watchdog.h provides the interface to the Watchdog module
WiredHome 0:7a316f14da9c 2 ///
WiredHome 0:7a316f14da9c 3 /// This provides basic Watchdog service for the mbed. You can configure
WiredHome 0:7a316f14da9c 4 /// various timeout intervals that meet your system needs. Additionally,
WiredHome 0:7a316f14da9c 5 /// it is possible to identify if the Watchdog was the cause of any
WiredHome 2:2873f068f325 6 /// system restart, permitting the application code to take appropriate
WiredHome 2:2873f068f325 7 /// behavior.
WiredHome 0:7a316f14da9c 8 ///
WiredHome 0:7a316f14da9c 9 /// Adapted from Simon's Watchdog code from http://mbed.org/forum/mbed/topic/508/
WiredHome 0:7a316f14da9c 10 ///
WiredHome 0:7a316f14da9c 11 /// @note Copyright © 2011 by Smartware Computing, all rights reserved.
WiredHome 0:7a316f14da9c 12 /// This software may be used to derive new software, as long as
WiredHome 0:7a316f14da9c 13 /// this copyright statement remains in the source file.
WiredHome 0:7a316f14da9c 14 /// @author David Smart
WiredHome 0:7a316f14da9c 15 ///
WiredHome 2:2873f068f325 16 /// History
WiredHome 2:2873f068f325 17 /// \li v1.00 - 20110616: initial release with some documentation improvements
WiredHome 2:2873f068f325 18 ///
WiredHome 0:7a316f14da9c 19 #ifndef WATCHDOG_H
WiredHome 0:7a316f14da9c 20 #define WATCHDOG_H
WiredHome 0:7a316f14da9c 21 #include "mbed.h"
WiredHome 0:7a316f14da9c 22
WiredHome 2:2873f068f325 23 /// The Watchdog class provides the interface to the Watchdog feature
WiredHome 2:2873f068f325 24 ///
WiredHome 2:2873f068f325 25 /// Embedded programs, by their nature, are usually unattended. If things
WiredHome 2:2873f068f325 26 /// go wrong, it is usually important that the system attempts to recover.
WiredHome 2:2873f068f325 27 /// Aside from robust software, a hardware watchdog can monitor the
WiredHome 2:2873f068f325 28 /// system and initiate a system reset when appropriate.
WiredHome 2:2873f068f325 29 ///
WiredHome 2:2873f068f325 30 /// This Watchdog is patterned after one found elsewhere on the mbed site,
WiredHome 2:2873f068f325 31 /// however this one also provides a method for the application software
WiredHome 2:2873f068f325 32 /// to determine the cause of the reset - watchdog or otherwise.
WiredHome 0:7a316f14da9c 33 ///
WiredHome 0:7a316f14da9c 34 /// example:
WiredHome 0:7a316f14da9c 35 /// @code
WiredHome 0:7a316f14da9c 36 /// Watchdog wd;
WiredHome 0:7a316f14da9c 37 ///
WiredHome 0:7a316f14da9c 38 /// ...
WiredHome 0:7a316f14da9c 39 /// main() {
WiredHome 0:7a316f14da9c 40 /// if (wd.WatchdogCausedReset())
WiredHome 2:2873f068f325 41 /// pc.printf("Watchdog caused reset.\r\n");
WiredHome 0:7a316f14da9c 42 ///
WiredHome 2:2873f068f325 43 /// wd.Configure(3.0); // sets the timeout interval
WiredHome 0:7a316f14da9c 44 /// for (;;) {
WiredHome 1:5a1ff72b5915 45 /// wd.Service(); // kick the dog before the timeout
WiredHome 2:2873f068f325 46 /// // do other work
WiredHome 2:2873f068f325 47 /// }
WiredHome 2:2873f068f325 48 /// }
WiredHome 0:7a316f14da9c 49 /// @endcode
WiredHome 0:7a316f14da9c 50 ///
WiredHome 0:7a316f14da9c 51 class Watchdog {
WiredHome 0:7a316f14da9c 52 public:
WiredHome 0:7a316f14da9c 53 /// Create a Watchdog object
WiredHome 0:7a316f14da9c 54 ///
WiredHome 0:7a316f14da9c 55 /// example:
WiredHome 0:7a316f14da9c 56 /// @code
WiredHome 0:7a316f14da9c 57 /// Watchdog wd; // placed before main
WiredHome 0:7a316f14da9c 58 /// @endcode
WiredHome 0:7a316f14da9c 59 Watchdog();
WiredHome 0:7a316f14da9c 60
WiredHome 0:7a316f14da9c 61 /// Configure the timeout for the Watchdog
WiredHome 0:7a316f14da9c 62 ///
WiredHome 0:7a316f14da9c 63 /// This configures the Watchdog service and starts it. It must
WiredHome 0:7a316f14da9c 64 /// be serviced before the timeout, or the system will be restarted.
WiredHome 0:7a316f14da9c 65 ///
WiredHome 0:7a316f14da9c 66 /// example:
WiredHome 0:7a316f14da9c 67 /// @code
WiredHome 0:7a316f14da9c 68 /// ...
WiredHome 0:7a316f14da9c 69 /// wd.Configure(1.4); // configure for a 1.4 second timeout
WiredHome 0:7a316f14da9c 70 /// ...
WiredHome 0:7a316f14da9c 71 /// @endcode
WiredHome 0:7a316f14da9c 72 ///
WiredHome 4:22c5c4aa4661 73 /// @param[in] timeout in seconds, as a floating point number
WiredHome 0:7a316f14da9c 74 /// @returns none
WiredHome 0:7a316f14da9c 75 ///
WiredHome 0:7a316f14da9c 76 void Configure(float timeout);
WiredHome 0:7a316f14da9c 77
WiredHome 0:7a316f14da9c 78 /// Service the Watchdog so it does not cause a system reset
WiredHome 0:7a316f14da9c 79 ///
WiredHome 1:5a1ff72b5915 80 /// example:
WiredHome 1:5a1ff72b5915 81 /// @code
WiredHome 1:5a1ff72b5915 82 /// wd.Service();
WiredHome 1:5a1ff72b5915 83 /// @endcode
WiredHome 0:7a316f14da9c 84 /// @returns none
WiredHome 0:7a316f14da9c 85 void Service();
WiredHome 0:7a316f14da9c 86
WiredHome 0:7a316f14da9c 87 /// WatchdogCausedReset identifies if the cause of the system
WiredHome 0:7a316f14da9c 88 /// reset was the Watchdog
WiredHome 0:7a316f14da9c 89 ///
WiredHome 0:7a316f14da9c 90 /// example:
WiredHome 0:7a316f14da9c 91 /// @code
WiredHome 0:7a316f14da9c 92 /// if (wd.WatchdogCausedReset())) {
WiredHome 0:7a316f14da9c 93 /// @endcode
WiredHome 0:7a316f14da9c 94 ///
WiredHome 0:7a316f14da9c 95 /// @returns true if the Watchdog was the cause of the reset
WiredHome 0:7a316f14da9c 96 bool WatchdogCausedReset();
WiredHome 0:7a316f14da9c 97 private:
WiredHome 0:7a316f14da9c 98 bool wdreset;
WiredHome 0:7a316f14da9c 99 };
WiredHome 0:7a316f14da9c 100
WiredHome 0:7a316f14da9c 101 #endif // WATCHDOG_H