5 #include "preferences.h" 6 #include <freertos/FreeRTOS.h> 7 #include <freertos/task.h> 8 #include <esp_idf_version.h> 9 #include <esp_task_wdt.h> 12 #if ESP_IDF_VERSION_MAJOR >= 4 13 #include <hal/cpu_hal.h> 17 #include <esp32-hal.h> 25 void IRAM_ATTR HOT
yield() { vPortYield(); }
26 uint32_t IRAM_ATTR HOT
millis() {
return (uint32_t)(esp_timer_get_time() / 1000ULL); }
27 void IRAM_ATTR HOT
delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
28 uint32_t IRAM_ATTR HOT
micros() {
return (uint32_t) esp_timer_get_time(); }
40 #if defined(USE_ESP_IDF) 41 esp_task_wdt_add(
nullptr);
43 #elif defined(USE_ARDUINO) 46 #if defined(CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0) && CONFIG_ARDUINO_RUNNING_CORE == 0 49 #if defined(CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1) && CONFIG_ARDUINO_RUNNING_CORE == 1 58 #if ESP_IDF_VERSION_MAJOR >= 4 59 return cpu_hal_get_cycle_count();
62 __asm__ __volatile__(
"esync; rsr %0,ccount" :
"=a"(ccount));
80 xTaskCreate(
loop_task,
"loopTask", 8192,
nullptr, 1, &loop_task_handle);
void IRAM_ATTR HOT arch_feed_wdt()
void delay_microseconds_safe(uint32_t us)
Delay for the given amount of microseconds, possibly yielding to other processes during the wait...
uint32_t IRAM_ATTR HOT micros()
uint32_t IRAM_ATTR HOT millis()
void loop_task(void *pv_params)
uint32_t arch_get_cpu_freq_hz()
TaskHandle_t loop_task_handle
uint8_t progmem_read_byte(const uint8_t *addr)
void IRAM_ATTR HOT yield()
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
uint32_t arch_get_cpu_cycle_count()
void IRAM_ATTR HOT delay(uint32_t ms)