1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Force gcc inlining, use same style for getCycleCount as for getCpuFreqMHz.

This commit is contained in:
Dirk O. Kaar 2020-08-31 15:56:46 +02:00
parent 400632f818
commit c74dcc924c

View File

@ -124,7 +124,7 @@ class EspClass {
#if defined(F_CPU) || defined(CORE_MOCK) #if defined(F_CPU) || defined(CORE_MOCK)
constexpr constexpr
#endif #endif
uint8_t getCpuFreqMHz() const inline uint8_t getCpuFreqMHz() const __attribute__((always_inline))
{ {
return esp_get_cpu_freq_mhz(); return esp_get_cpu_freq_mhz();
} }
@ -166,21 +166,15 @@ class EspClass {
uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const; uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const;
uint32_t random() const; uint32_t random() const;
#ifndef CORE_MOCK #if !defined(CORE_MOCK)
inline uint32_t getCycleCount() __attribute__((always_inline)); inline uint32_t getCycleCount() __attribute__((always_inline))
{
return esp_get_cycle_count();
}
#else #else
uint32_t getCycleCount(); uint32_t getCycleCount();
#endif
};
#ifndef CORE_MOCK
uint32_t EspClass::getCycleCount()
{
return esp_get_cycle_count();
}
#endif // !defined(CORE_MOCK) #endif // !defined(CORE_MOCK)
};
extern EspClass ESP; extern EspClass ESP;