Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding isForSleep parameter in WatchdogSAMD::enable() #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ulysse314
Copy link

@ulysse314 ulysse314 commented Jun 30, 2020

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);

@ulysse314
Copy link
Author

ulysse314 commented Sep 23, 2020

Hello,

Any hope to get a review?

thanks

@siddacious
Copy link
Contributor

I can't guarantee that this will get it reviewed, but you should probably include an explanation of what problem you're trying to solve as well as how this PR solves it.

@ulysse314
Copy link
Author

Sorry, I guess my description was not obvious. Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants