Skip to content

Commit b45cf11

Browse files
authored
Fixed ESP::getCycleCount for S2/C3 (#5075)
Fixes #5071
1 parent fb0d63b commit b45cf11

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cores/esp32/Esp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#include <Arduino.h>
2424
#include <esp_partition.h>
25+
#ifndef CONFIG_IDF_TARGET_ESP32 // Broken in IDF 20210417
26+
#include <hal/systimer_hal.h>
27+
#endif
2528

2629
/**
2730
* AVR macros for WDT managment
@@ -111,7 +114,11 @@ class EspClass
111114
uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount()
112115
{
113116
uint32_t ccount;
117+
#ifdef CONFIG_IDF_TARGET_ESP32
114118
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
119+
#else // This should work on ESP32 once the hal is complete
120+
ccount = systimer_hal_get_counter_value(SYSTIMER_COUNTER_0);
121+
#endif
115122
return ccount;
116123
}
117124

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy