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