diff --git a/esphome/components/esp8266/core.cpp b/esphome/components/esp8266/core.cpp index 200ca567c2..784b87916b 100644 --- a/esphome/components/esp8266/core.cpp +++ b/esphome/components/esp8266/core.cpp @@ -6,7 +6,11 @@ #include "esphome/core/helpers.h" #include "preferences.h" #include -#include +#include + +extern "C" { +#include +} namespace esphome { @@ -16,23 +20,19 @@ void IRAM_ATTR HOT delay(uint32_t ms) { ::delay(ms); } uint32_t IRAM_ATTR HOT micros() { return ::micros(); } void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); } void arch_restart() { - ESP.restart(); // NOLINT(readability-static-accessed-through-instance) + system_restart(); // restart() doesn't always end execution while (true) { // NOLINT(clang-diagnostic-unreachable-code) yield(); } } void arch_init() {} -void IRAM_ATTR HOT arch_feed_wdt() { - ESP.wdtFeed(); // NOLINT(readability-static-accessed-through-instance) -} +void IRAM_ATTR HOT arch_feed_wdt() { system_soft_wdt_feed(); } uint8_t progmem_read_byte(const uint8_t *addr) { return pgm_read_byte(addr); // NOLINT } -uint32_t IRAM_ATTR HOT arch_get_cpu_cycle_count() { - return ESP.getCycleCount(); // NOLINT(readability-static-accessed-through-instance) -} +uint32_t IRAM_ATTR HOT arch_get_cpu_cycle_count() { return esp_get_cycle_count(); } uint32_t arch_get_cpu_freq_hz() { return F_CPU; } void force_link_symbols() {