1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 01:32:19 +01:00

Remove "delay_microseconds_accurate()" and improve systemwide delayMicroseconds() (#2497)

This commit is contained in:
Carlos Garcia Saura
2021-11-10 04:22:00 +01:00
committed by GitHub
parent 6e5cfac927
commit 875b803483
8 changed files with 25 additions and 30 deletions

View File

@@ -21,11 +21,7 @@ void IRAM_ATTR HOT yield() { vPortYield(); }
uint32_t IRAM_ATTR HOT millis() { return (uint32_t)(esp_timer_get_time() / 1000ULL); }
void IRAM_ATTR HOT delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
uint32_t IRAM_ATTR HOT micros() { return (uint32_t) esp_timer_get_time(); }
void IRAM_ATTR HOT delayMicroseconds(uint32_t us) {
auto start = (uint64_t) esp_timer_get_time();
while (((uint64_t) esp_timer_get_time()) - start < us)
;
}
void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); }
void arch_restart() {
esp_restart();
// restart() doesn't always end execution