Adafruit_SleepyDog
Adafruit_SleepyDog copied to clipboard
Hiding isForSleep parameter in WatchdogSAMD::enable()
Since isForSleep
parameter in WatchdogSAMD::enable()
method should not be used by users of this library (see the comment utility/WatchdogSAMD.h), this patch uses C++ mechanisms to make this parameter invisible by developers, without changing the behaviour of SleepyDog.
This is done by replacing (and by removing the comment related to isForSleep
):
public:
// Enable the watchdog timer to reset the machine after a period of time
// without any calls to reset(). The passed in period (in milliseconds)
// is just a suggestion and a lower value might be picked if the hardware
// does not support the exact desired value.
// User code should NOT set the 'isForSleep' argument either way --
// it's used internally by the library, but your sketch should leave this
// out when calling enable(), just let the default have its way.
//
// The actual period (in milliseconds) before a watchdog timer reset is
// returned.
int enable(int maxPeriodMS = 0, bool isForSleep = false);
By:
public:
// Enable the watchdog timer to reset the machine after a period of time
// without any calls to reset(). The passed in period (in milliseconds)
// is just a suggestion and a lower value might be picked if the hardware
// does not support the exact desired value.
//
// The actual period (in milliseconds) before a watchdog timer reset is
// returned.
int WatchdogSAMD::enable(int maxPeriodMS = 0);
private:
int WatchdogSAMD::enable(int maxPeriodMS, bool isForSleep);