Skip to content

Fixup #7554: Inline, fewer LOC, remove redundant definition in cpp. #7557

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

Merged
merged 3 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,6 @@ uint8_t EspClass::getBootMode(void)
return system_get_boot_mode();
}

#ifndef F_CPU
uint8_t EspClass::getCpuFreqMHz(void)
{
return system_get_cpu_freq();
}
#endif

uint32_t EspClass::getFlashChipId(void)
{
static uint32_t flash_chip_id = 0;
Expand Down
25 changes: 9 additions & 16 deletions cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ class EspClass {
uint8_t getBootMode();

#if defined(F_CPU) || defined(CORE_MOCK)
constexpr uint8_t getCpuFreqMHz() const
constexpr
#endif
inline uint8_t getCpuFreqMHz() const __attribute__((always_inline))
{
return esp_get_cpu_freq_mhz();
}
#else
uint8_t getCpuFreqMHz() const;
#endif

uint32_t getFlashChipId();
uint8_t getFlashChipVendorId();
Expand Down Expand Up @@ -167,21 +166,15 @@ class EspClass {
uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const;
uint32_t random() const;

#ifndef CORE_MOCK
inline uint32_t getCycleCount() __attribute__((always_inline));
#if !defined(CORE_MOCK)
inline uint32_t getCycleCount() __attribute__((always_inline))
{
return esp_get_cycle_count();
}
#else
uint32_t getCycleCount();
#endif
};

#ifndef CORE_MOCK

uint32_t EspClass::getCycleCount()
{
return esp_get_cycle_count();
}

#endif // !defined(CORE_MOCK)
};

extern EspClass ESP;

Expand Down