File tree 2 files changed +46
-1
lines changed
2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -112,16 +112,50 @@ void EspClass::restart(void)
112
112
esp_restart ();
113
113
}
114
114
115
+ uint32_t EspClass::getHeapSize (void )
116
+ {
117
+ multi_heap_info_t info;
118
+ heap_caps_get_info (&info, MALLOC_CAP_INTERNAL);
119
+ return info.total_free_bytes + info.total_allocated_bytes ;
120
+ }
121
+
115
122
uint32_t EspClass::getFreeHeap (void )
116
123
{
117
124
return heap_caps_get_free_size (MALLOC_CAP_INTERNAL);
118
125
}
119
126
127
+ uint32_t EspClass::getMinFreeHeap (void )
128
+ {
129
+ return heap_caps_get_minimum_free_size (MALLOC_CAP_INTERNAL);
130
+ }
131
+
132
+ uint32_t EspClass::getMaxAllocHeap (void )
133
+ {
134
+ return heap_caps_get_largest_free_block (MALLOC_CAP_INTERNAL);
135
+ }
136
+
137
+ uint32_t EspClass::getPsramSize (void )
138
+ {
139
+ multi_heap_info_t info;
140
+ heap_caps_get_info (&info, MALLOC_CAP_SPIRAM);
141
+ return info.total_free_bytes + info.total_allocated_bytes ;
142
+ }
143
+
120
144
uint32_t EspClass::getFreePsram (void )
121
145
{
122
146
return heap_caps_get_free_size (MALLOC_CAP_SPIRAM);
123
147
}
124
148
149
+ uint32_t EspClass::getMinFreePsram (void )
150
+ {
151
+ return heap_caps_get_minimum_free_size (MALLOC_CAP_SPIRAM);
152
+ }
153
+
154
+ uint32_t EspClass::getMaxAllocPsram (void )
155
+ {
156
+ return heap_caps_get_largest_free_block (MALLOC_CAP_SPIRAM);
157
+ }
158
+
125
159
uint8_t EspClass::getChipRevision (void )
126
160
{
127
161
esp_chip_info_t chip_info;
Original file line number Diff line number Diff line change @@ -56,8 +56,19 @@ class EspClass
56
56
EspClass () {}
57
57
~EspClass () {}
58
58
void restart ();
59
- uint32_t getFreeHeap ();
59
+
60
+ // Internal RAM
61
+ uint32_t getHeapSize (); // total heap size
62
+ uint32_t getFreeHeap (); // available heap
63
+ uint32_t getMinFreeHeap (); // lowest level of free heap since boot
64
+ uint32_t getMaxAllocHeap (); // largest block of heap that can be allocated at once
65
+
66
+ // SPI RAM
67
+ uint32_t getPsramSize ();
60
68
uint32_t getFreePsram ();
69
+ uint32_t getMinFreePsram ();
70
+ uint32_t getMaxAllocPsram ();
71
+
61
72
uint8_t getChipRevision ();
62
73
uint8_t getCpuFreqMHz (){ return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; }
63
74
uint32_t getCycleCount ();
You can’t perform that action at this time.
0 commit comments