Skip to content
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/esp32/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ void EspClass::deepSleep(uint32_t time_us)
esp_deep_sleep(time_us);
}

uint32_t EspClass::getCycleCount()
{
uint32_t ccount;
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
return ccount;
}

void EspClass::restart(void)
{
esp_restart();
Expand Down
9 changes: 8 additions & 1 deletion cores/esp32/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class EspClass

uint8_t getChipRevision();
uint32_t getCpuFreqMHz(){ return getCpuFrequencyMhz(); }
uint32_t getCycleCount();
inline uint32_t getCycleCount() __attribute__((always_inline));
const char * getSdkVersion();

void deepSleep(uint32_t time_us);
Expand All @@ -101,6 +101,13 @@ class EspClass

};

uint32_t IRAM_ATTR EspClass::getCycleCount()
{
uint32_t ccount;
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
return ccount;
}

extern EspClass ESP;

#endif //ESP_H