Skip to content

Commit

Permalink
emulation on host: Add missing ESP.*() mocking methods to EspClass. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
everslick authored and d-a-v committed Feb 15, 2019
1 parent d3a2ab9 commit 9ba89eb
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/host/common/MockEsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ uint32_t EspClass::getFreeHeap()
return 30000;
}

String EspClass::getResetReason()
{
return "Power on";
}

uint32_t EspClass::getFreeSketchSpace()
{
return 4 * 1024 * 1024;
}

uint8_t EspClass::getCpuFreqMHz()
{
return 160;
}

const char *EspClass::getSdkVersion()
{
return "2.5.0";
}

uint32_t EspClass::getFlashChipSpeed()
{
return 40;
}

void EspClass::getHeapStats(uint32_t* hfree, uint16_t* hmax, uint8_t* hfrag) {
uint32_t hf = 10 * 1024;
float hm = 1 * 1024;

if (hfree) *hfree = hf;
if (hmax) *hmax = hm;
if (hfrag) *hfrag = 100 - (sqrt(hm) * 100) / hf;
}

bool EspClass::flashEraseSector(uint32_t sector)
{
return true;
Expand Down

0 comments on commit 9ba89eb

Please sign in to comment.