Skip to content

Commit 885851a

Browse files
authored
Merge pull request #7557 from dok-net/fixfix
Fixup #7554: Inline, fewer LOC, remove redundant definition in cpp.
2 parents 5b767a3 + c74dcc9 commit 885851a

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

cores/esp8266/Esp.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,6 @@ uint8_t EspClass::getBootMode(void)
264264
return system_get_boot_mode();
265265
}
266266

267-
#ifndef F_CPU
268-
uint8_t EspClass::getCpuFreqMHz(void)
269-
{
270-
return system_get_cpu_freq();
271-
}
272-
#endif
273-
274267
uint32_t EspClass::getFlashChipId(void)
275268
{
276269
static uint32_t flash_chip_id = 0;

cores/esp8266/Esp.h

+9-16
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,12 @@ class EspClass {
122122
uint8_t getBootMode();
123123

124124
#if defined(F_CPU) || defined(CORE_MOCK)
125-
constexpr uint8_t getCpuFreqMHz() const
125+
constexpr
126+
#endif
127+
inline uint8_t getCpuFreqMHz() const __attribute__((always_inline))
126128
{
127129
return esp_get_cpu_freq_mhz();
128130
}
129-
#else
130-
uint8_t getCpuFreqMHz() const;
131-
#endif
132131

133132
uint32_t getFlashChipId();
134133
uint8_t getFlashChipVendorId();
@@ -167,21 +166,15 @@ class EspClass {
167166
uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const;
168167
uint32_t random() const;
169168

170-
#ifndef CORE_MOCK
171-
inline uint32_t getCycleCount() __attribute__((always_inline));
169+
#if !defined(CORE_MOCK)
170+
inline uint32_t getCycleCount() __attribute__((always_inline))
171+
{
172+
return esp_get_cycle_count();
173+
}
172174
#else
173175
uint32_t getCycleCount();
174-
#endif
175-
};
176-
177-
#ifndef CORE_MOCK
178-
179-
uint32_t EspClass::getCycleCount()
180-
{
181-
return esp_get_cycle_count();
182-
}
183-
184176
#endif // !defined(CORE_MOCK)
177+
};
185178

186179
extern EspClass ESP;
187180

0 commit comments

Comments
 (0)