@@ -84,94 +84,94 @@ typedef enum {
84
84
class EspClass {
85
85
public:
86
86
// TODO: figure out how to set WDT timeout
87
- void wdtEnable (uint32_t timeout_ms = 0 );
87
+ static void wdtEnable (uint32_t timeout_ms = 0 );
88
88
// note: setting the timeout value is not implemented at the moment
89
- void wdtEnable (WDTO_t timeout_ms = WDTO_0MS);
89
+ static void wdtEnable (WDTO_t timeout_ms = WDTO_0MS);
90
90
91
- void wdtDisable ();
92
- void wdtFeed ();
91
+ static void wdtDisable ();
92
+ static void wdtFeed ();
93
93
94
- void deepSleep (uint64_t time_us);
95
- void deepSleepInstant (uint64_t time_us);
96
- uint64_t deepSleepMax ();
94
+ static void deepSleep (uint64_t time_us);
95
+ static void deepSleepInstant (uint64_t time_us);
96
+ static uint64_t deepSleepMax ();
97
97
98
- bool forcedModemSleep (uint32_t duration_us = 0 , void (*wakeupCb)() = nullptr);
98
+ static bool forcedModemSleep (uint32_t duration_us = 0 , void (*wakeupCb)() = nullptr);
99
99
// / The prior sleep type is restored, but only as automatic.
100
100
// / If any forced sleep mode was effective before forcedModemSleep,
101
101
// / it would have to be restored explicitly.
102
- void forcedModemSleepOff ();
102
+ static void forcedModemSleepOff ();
103
103
104
- bool forcedLightSleepBegin (uint32_t duration_us = 0 , void (*wakeupCb)() = nullptr);
104
+ static bool forcedLightSleepBegin (uint32_t duration_us = 0 , void (*wakeupCb)() = nullptr);
105
105
// / The prior sleep type is restored, but only as automatic.
106
106
// / If any forced sleep mode was effective before forcedLightSleepBegin,
107
107
// / it would have to be restored explicitly.
108
- void forcedLightSleepEnd (bool cancel = false );
108
+ static void forcedLightSleepEnd (bool cancel = false );
109
109
110
- void autoModemSleep ();
111
- void autoLightSleep ();
110
+ static void autoModemSleep ();
111
+ static void autoLightSleep ();
112
112
// / The prior sleep type is restored, but only as automatic.
113
113
// / If any forced sleep mode was effective before auto{Modem,Light}Sleep,
114
114
// / it would have to be restored explicitly.
115
- void autoSleepOff ();
115
+ static void autoSleepOff ();
116
116
117
- bool rtcUserMemoryRead (uint32_t offset, uint32_t *data, size_t size);
118
- bool rtcUserMemoryWrite (uint32_t offset, uint32_t *data, size_t size);
117
+ static bool rtcUserMemoryRead (uint32_t offset, uint32_t *data, size_t size);
118
+ static bool rtcUserMemoryWrite (uint32_t offset, uint32_t *data, size_t size);
119
119
120
- void reset ();
121
- void restart ();
120
+ static void reset ();
121
+ static void restart ();
122
122
/* *
123
123
* @brief When calling this method the ESP8266 reboots into the UART download mode without
124
124
* the need of any external wiring. This is the same mode which can also be entered by
125
125
* pulling GPIO0=low, GPIO2=high, GPIO15=low and resetting the ESP8266.
126
126
*/
127
- [[noreturn]] void rebootIntoUartDownloadMode ();
127
+ [[noreturn]] static void rebootIntoUartDownloadMode ();
128
128
129
- uint16_t getVcc ();
130
- uint32_t getChipId ();
129
+ static uint16_t getVcc ();
130
+ static uint32_t getChipId ();
131
131
132
- uint32_t getFreeHeap ();
133
- uint16_t getMaxFreeBlockSize ();
134
- uint8_t getHeapFragmentation (); // in %
135
- void getHeapStats (uint32_t * free = nullptr , uint16_t * max = nullptr , uint8_t * frag = nullptr );
132
+ static uint32_t getFreeHeap ();
133
+ static uint16_t getMaxFreeBlockSize ();
134
+ static uint8_t getHeapFragmentation (); // in %
135
+ static void getHeapStats (uint32_t * free = nullptr , uint16_t * max = nullptr , uint8_t * frag = nullptr );
136
136
137
- uint32_t getFreeContStack ();
138
- void resetFreeContStack ();
137
+ static uint32_t getFreeContStack ();
138
+ static void resetFreeContStack ();
139
139
140
- const char * getSdkVersion ();
141
- String getCoreVersion ();
142
- String getFullVersion ();
140
+ static const char * getSdkVersion ();
141
+ static String getCoreVersion ();
142
+ static String getFullVersion ();
143
143
144
- uint8_t getBootVersion ();
145
- uint8_t getBootMode ();
144
+ static uint8_t getBootVersion ();
145
+ static uint8_t getBootMode ();
146
146
147
147
#if defined(F_CPU) || defined(CORE_MOCK)
148
148
constexpr
149
149
#endif
150
- inline uint8_t getCpuFreqMHz () const __attribute__((always_inline))
150
+ static inline uint8_t getCpuFreqMHz () __attribute__((always_inline))
151
151
{
152
152
return esp_get_cpu_freq_mhz ();
153
153
}
154
154
155
- uint32_t getFlashChipId ();
156
- uint8_t getFlashChipVendorId ();
155
+ static uint32_t getFlashChipId ();
156
+ static uint8_t getFlashChipVendorId ();
157
157
158
158
// gets the actual chip size based on the flash id
159
- uint32_t getFlashChipRealSize ();
159
+ static uint32_t getFlashChipRealSize ();
160
160
// gets the size of the flash as set by the compiler
161
- uint32_t getFlashChipSize ();
162
- uint32_t getFlashChipSpeed ();
163
- FlashMode_t getFlashChipMode ();
164
- uint32_t getFlashChipSizeByChipId ();
161
+ static uint32_t getFlashChipSize ();
162
+ static uint32_t getFlashChipSpeed ();
163
+ static FlashMode_t getFlashChipMode ();
164
+ static uint32_t getFlashChipSizeByChipId ();
165
165
166
- uint32_t magicFlashChipSize (uint8_t byte);
167
- uint32_t magicFlashChipSpeed (uint8_t byte);
168
- FlashMode_t magicFlashChipMode (uint8_t byte);
166
+ static uint32_t magicFlashChipSize (uint8_t byte);
167
+ static uint32_t magicFlashChipSpeed (uint8_t byte);
168
+ static FlashMode_t magicFlashChipMode (uint8_t byte);
169
169
170
- bool checkFlashConfig (bool needsEquals = false );
170
+ static bool checkFlashConfig (bool needsEquals = false );
171
171
172
- bool checkFlashCRC ();
172
+ static bool checkFlashCRC ();
173
173
174
- bool flashEraseSector (uint32_t sector);
174
+ static bool flashEraseSector (uint32_t sector);
175
175
/* *
176
176
* @brief Write @a size bytes from @a data to flash at @a address
177
177
* This overload requires @a data and @a size to be always 4 byte aligned and
@@ -184,7 +184,7 @@ class EspClass {
184
184
* @retval true success
185
185
* @retval false failure to write to flash or incorrect alignment of params
186
186
*/
187
- bool flashWrite (uint32_t address, const uint32_t *data, size_t size);
187
+ static bool flashWrite (uint32_t address, const uint32_t *data, size_t size);
188
188
/* *
189
189
* @brief Write @a size bytes from @a data to flash at @a address
190
190
* This overload handles all misalignment cases
@@ -193,7 +193,7 @@ class EspClass {
193
193
* @param size amount of data, passing not multiple of 4 will cause additional reads and writes
194
194
* @return bool result of operation
195
195
*/
196
- bool flashWrite (uint32_t address, const uint8_t *data, size_t size);
196
+ static bool flashWrite (uint32_t address, const uint8_t *data, size_t size);
197
197
/* *
198
198
* @brief Read @a size bytes to @a data to flash at @a address
199
199
* This overload requires @a data and @a size to be 4 byte aligned
@@ -204,7 +204,7 @@ class EspClass {
204
204
* @retval true success
205
205
* @retval false failure to read from flash or incorrect alignment of params
206
206
*/
207
- bool flashRead (uint32_t address, uint32_t *data, size_t size);
207
+ static bool flashRead (uint32_t address, uint32_t *data, size_t size);
208
208
/* *
209
209
* @brief Read @a size bytes to @a data to flash at @a address
210
210
* This overload handles all misalignment cases
@@ -213,59 +213,59 @@ class EspClass {
213
213
* @param size amount of data, passing not multiple of 4 will cause additional read
214
214
* @return bool result of operation
215
215
*/
216
- bool flashRead (uint32_t address, uint8_t *data, size_t size);
216
+ static bool flashRead (uint32_t address, uint8_t *data, size_t size);
217
217
218
- uint32_t getSketchSize ();
219
- String getSketchMD5 ();
220
- uint32_t getFreeSketchSpace ();
221
- bool updateSketch (Stream& in, uint32_t size, bool restartOnFail = false , bool restartOnSuccess = true );
218
+ static uint32_t getSketchSize ();
219
+ static String getSketchMD5 ();
220
+ static uint32_t getFreeSketchSpace ();
221
+ static bool updateSketch (Stream& in, uint32_t size, bool restartOnFail = false , bool restartOnSuccess = true );
222
222
223
- String getResetReason ();
224
- String getResetInfo ();
225
- struct rst_info * getResetInfoPtr ();
223
+ static String getResetReason ();
224
+ static String getResetInfo ();
225
+ static struct rst_info * getResetInfoPtr ();
226
226
227
- bool eraseConfig ();
227
+ static bool eraseConfig ();
228
228
229
- uint8_t *random (uint8_t *resultArray, const size_t outputSizeBytes) const ;
230
- uint32_t random () const ;
229
+ static uint8_t *random (uint8_t *resultArray, const size_t outputSizeBytes);
230
+ static uint32_t random ();
231
231
232
232
#if !defined(CORE_MOCK)
233
- inline uint32_t getCycleCount () __attribute__((always_inline))
233
+ static inline uint32_t getCycleCount () __attribute__((always_inline))
234
234
{
235
235
return esp_get_cycle_count ();
236
236
}
237
237
#else
238
- uint32_t getCycleCount ();
238
+ static uint32_t getCycleCount ();
239
239
#endif // !defined(CORE_MOCK)
240
240
/* *
241
241
* @brief Push current Heap selection and set Heap selection to DRAM.
242
242
*
243
243
* @param none
244
244
* @return none
245
245
*/
246
- void setDramHeap ();
246
+ static void setDramHeap ();
247
247
/* *
248
248
* @brief Push current Heap selection and set Heap selection to IRAM.
249
249
*
250
250
* @param none
251
251
* @return none
252
252
*/
253
- void setIramHeap ();
253
+ static void setIramHeap ();
254
254
/* *
255
255
* @brief Push current Heap selection and set Heap selection to External. (Experimental)
256
256
*
257
257
* @param none
258
258
* @return none
259
259
*/
260
- void setExternalHeap ();
260
+ static void setExternalHeap ();
261
261
/* *
262
262
* @brief Restores Heap selection back to value present when
263
263
* setDramHeap, setIramHeap, or setExternalHeap was called.
264
264
*
265
265
* @param none
266
266
* @return none
267
267
*/
268
- void resetHeap ();
268
+ static void resetHeap ();
269
269
private:
270
270
/* *
271
271
* @brief Replaces @a byteCount bytes of a 4 byte block on flash
@@ -277,7 +277,7 @@ class EspClass {
277
277
* @retval true success
278
278
* @retval false failed to read/write or invalid args
279
279
*/
280
- bool flashReplaceBlock (uint32_t address, const uint8_t *value, uint32_t byteCount);
280
+ static bool flashReplaceBlock (uint32_t address, const uint8_t *value, uint32_t byteCount);
281
281
/* *
282
282
* @brief Write up to @a size bytes from @a data to flash at @a address
283
283
* This function takes case of unaligned memory acces by copying @a data to a temporary buffer,
@@ -288,7 +288,7 @@ class EspClass {
288
288
* @param size amount of data
289
289
* @return size_t amount of data written, 0 on failure
290
290
*/
291
- size_t flashWriteUnalignedMemory (uint32_t address, const uint8_t *data, size_t size);
291
+ static size_t flashWriteUnalignedMemory (uint32_t address, const uint8_t *data, size_t size);
292
292
/* *
293
293
* @brief Splits up to 4 bytes into 4 byte blocks and writes them to flash
294
294
* We need this since spi_flash_write cannot handle writing over a page boundary with unaligned offset
@@ -299,7 +299,7 @@ class EspClass {
299
299
* @param size amount of data, must be < 4
300
300
* @return bool result of operation
301
301
*/
302
- bool flashWritePageBreak (uint32_t address, const uint8_t *data, size_t size);
302
+ static bool flashWritePageBreak (uint32_t address, const uint8_t *data, size_t size);
303
303
};
304
304
305
305
extern EspClass ESP;
0 commit comments