Skip to content

Commit 9ba89eb

Browse files
everslickd-a-v
authored andcommitted
emulation on host: Add missing ESP.*() mocking methods to EspClass. (#5765)
1 parent d3a2ab9 commit 9ba89eb

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/host/common/MockEsp.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,40 @@ uint32_t EspClass::getFreeHeap()
105105
return 30000;
106106
}
107107

108+
String EspClass::getResetReason()
109+
{
110+
return "Power on";
111+
}
112+
113+
uint32_t EspClass::getFreeSketchSpace()
114+
{
115+
return 4 * 1024 * 1024;
116+
}
117+
118+
uint8_t EspClass::getCpuFreqMHz()
119+
{
120+
return 160;
121+
}
122+
123+
const char *EspClass::getSdkVersion()
124+
{
125+
return "2.5.0";
126+
}
127+
128+
uint32_t EspClass::getFlashChipSpeed()
129+
{
130+
return 40;
131+
}
132+
133+
void EspClass::getHeapStats(uint32_t* hfree, uint16_t* hmax, uint8_t* hfrag) {
134+
uint32_t hf = 10 * 1024;
135+
float hm = 1 * 1024;
136+
137+
if (hfree) *hfree = hf;
138+
if (hmax) *hmax = hm;
139+
if (hfrag) *hfrag = 100 - (sqrt(hm) * 100) / hf;
140+
}
141+
108142
bool EspClass::flashEraseSector(uint32_t sector)
109143
{
110144
return true;

0 commit comments

Comments
 (0)