File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -107,13 +107,22 @@ void EspClass::wdtFeed(void)
107
107
108
108
extern " C" void esp_yield ();
109
109
110
- void EspClass::deepSleep (uint32_t time_us, WakeMode mode)
110
+ void EspClass::deepSleep (uint64_t time_us, WakeMode mode)
111
111
{
112
112
system_deep_sleep_set_option (static_cast <int >(mode));
113
113
system_deep_sleep (time_us);
114
114
esp_yield ();
115
115
}
116
116
117
+ // this calculation was taken verbatim from the SDK api reference for SDK 2.1.0.
118
+ // Note: system_rtc_clock_cali_proc() returns a uint32_t, even though system_deep_sleep() takes a uint64_t.
119
+ uint64_t EspClass::deepSleepMax ()
120
+ {
121
+ // cali*(2^31-1)/(2^12)
122
+ return (uint64_t )system_rtc_clock_cali_proc ()*(0x80000000 -1 )/(0x1000 );
123
+
124
+ }
125
+
117
126
bool EspClass::rtcUserMemoryRead (uint32_t offset, uint32_t *data, size_t size)
118
127
{
119
128
if (size + offset > 512 ) {
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ class EspClass {
92
92
void wdtDisable ();
93
93
void wdtFeed ();
94
94
95
- void deepSleep (uint32_t time_us, RFMode mode = RF_DEFAULT);
95
+ void deepSleep (uint64_t time_us, RFMode mode = RF_DEFAULT);
96
+ uint64_t deepSleepMax ();
96
97
97
98
bool rtcUserMemoryRead (uint32_t offset, uint32_t *data, size_t size);
98
99
bool rtcUserMemoryWrite (uint32_t offset, uint32_t *data, size_t size);
You can’t perform that action at this time.
0 commit comments