Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emulation on host: Add missing ESP.*() mocking methods to EspClass. #5765

Merged
merged 2 commits into from
Feb 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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