-
Notifications
You must be signed in to change notification settings - Fork 6
/
DeepSleepScheduler_esp_definition.h
43 lines (36 loc) · 1.2 KB
/
DeepSleepScheduler_esp_definition.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
// -------------------------------------------------------------------------------------------------
// Definition of ESP, included inside of class Scheduler
// -------------------------------------------------------------------------------------------------
#ifndef ESP32_TASK_WDT_TIMER_NUMBER
#define ESP32_TASK_WDT_TIMER_NUMBER 3
#endif
#ifndef ESP8266_MAX_DELAY_TIME_MS
#define ESP8266_MAX_DELAY_TIME_MS 7000
#endif
private:
void init();
#ifdef ESP32
// ---------------------------------------------------------------------------------------------
public:
/**
Do not call this method, it is used by the watchdog interrupt.
*/
static void IRAM_ATTR isrWatchdogExpiredStatic();
private:
hw_timer_t *timer = NULL;
#elif ESP8266
public:
#endif
// ---------------------------------------------------------------------------------------------
private:
void taskWdtEnable(const uint8_t value);
void taskWdtDisable();
inline unsigned long wdtTimeoutToDurationMs(const uint8_t value);
void sleepIfRequired();
inline void sleep(unsigned long durationMs, bool queueEmpty);
inline SleepMode evaluateSleepMode();
// unused here, only used for AVR
bool isWakeupByOtherInterrupt() {
return false;
}
void wdtEnableInterrupt() {}