forked from janelia-arduino/Watchdog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWatchdog.h
60 lines (44 loc) · 1.27 KB
/
Watchdog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// ----------------------------------------------------------------------------
// Watchdog.h
//
// Authors:
// Peter Polidoro [email protected]
// ----------------------------------------------------------------------------
#ifndef WATCHDOG_H
#define WATCHDOG_H
#include <Arduino.h>
#if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__)
#include "Watchdog/WatchdogBaseTeensy2.h"
#elif defined(__AVR__) && defined(MCUSR) && !defined(__AVR_ATmega32U4__) && !defined(__AVR_AT90USB1286__)
#include "Watchdog/WatchdogBaseAvr.h"
#elif defined(__AVR__) && defined(RSTCTRL_RSTFR)
#include "Watchdog/WatchdogBaseMegaavr.h"
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include "Watchdog/WatchdogBaseTeensy3.h"
#elif defined(__IMXRT1062__)
#include "Watchdog/WatchdogBaseTeensy4.h"
#endif
class Watchdog : public WatchdogBase
{
public:
enum Timeout {
TIMEOUT_15MS=15,
TIMEOUT_30MS=30,
TIMEOUT_60MS=60,
TIMEOUT_120MS=120,
TIMEOUT_250MS=250,
TIMEOUT_500MS=500,
TIMEOUT_1S=1000,
TIMEOUT_2S=2000,
TIMEOUT_4S=4000,
TIMEOUT_8S=8000
};
Watchdog();
void enable(Timeout timeout=TIMEOUT_1S);
bool enabled();
void reset();
bool tripped();
private:
bool enabled_;
};
#endif