mirror of
https://github.com/bbulkow/FastLED-idf.git
synced 2025-07-30 18:58:07 +02:00
Recode another delay in an esp32 specific fashion that should be faster
This commit is contained in:
@ -153,17 +153,11 @@ void delay(uint32_t ms)
|
|||||||
|
|
||||||
void IRAM_ATTR delayMicroseconds(uint32_t us)
|
void IRAM_ATTR delayMicroseconds(uint32_t us)
|
||||||
{
|
{
|
||||||
uint32_t m = micros();
|
uint64_t now = esp_timer_get_time();
|
||||||
if(us){
|
if(us){
|
||||||
uint32_t e = (m + us);
|
do {
|
||||||
if(m > e){ //overflow
|
|
||||||
while(micros() > e){
|
|
||||||
NOP();
|
NOP();
|
||||||
}
|
} while ((esp_timer_get_time() - now) < us);
|
||||||
}
|
|
||||||
while(micros() < e){
|
|
||||||
NOP();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user