Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prodeveloper0/watchdogtimer
The WatchDogTimer Library written to be fully compatible with C++11 and as header-only to use easily.
https://github.com/prodeveloper0/watchdogtimer
cpp-library cpp11 header-only watchdogtimer wdt
Last synced: about 2 months ago
JSON representation
The WatchDogTimer Library written to be fully compatible with C++11 and as header-only to use easily.
- Host: GitHub
- URL: https://github.com/prodeveloper0/watchdogtimer
- Owner: prodeveloper0
- License: wtfpl
- Created: 2020-07-10T13:58:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T17:29:38.000Z (over 4 years ago)
- Last Synced: 2024-05-18T18:43:44.551Z (7 months ago)
- Topics: cpp-library, cpp11, header-only, watchdogtimer, wdt
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WatchDogTimer
The WatchDogTimer Library written to be fully compatible with C++11 and as header-only to use easily.## How to use
### 0. Including `wdt.hpp` header file on top of your cpp file.
```C++
#include
// Or
#include "wdt.hpp"
```### 1. Subtyping your dog with `WatchdogTimer` class and implementing `on_timeout()` to bark to you.
```C++
class MyWatchdogTimer : public WatchdogTimer
{
public:
virtual void on_timeout()
{
// To do when your dog is bark.
...
}
};
```### 2. Creating your dog with subtyped `WatchdogTimer` class.
```C++
MyWatchdogTimer wdt;
```### 3. Kicking your dog by calling `kick()`.
```C++
// wdt is scheduled to call on_timeout() after 100ms once.
wdt.kick(100);
```
As well as, you can also kick your dog to watch forever by calling `kick()` with `loop` flag `true`.
```C++
// wdt is scheduled to call on_timeout() after 100ms forever.
wdt.kick(100, true);
```### 4. Feeding your dog repeatedly to be silence by calling `clear()` repeatedly.
```C++
while (true)
{
// To do somethings
...
if (there_is_no_problem)
wdt.clear();
}
```### 5. Finally, Stopping your dog to watch by calling `stop()`.
```C++
wdt.stop();
```