6#include <freertos/FreeRTOS.h>
7#include <freertos/task.h>
8#include <esp_idf_version.h>
9#include <esp_ota_ops.h>
10#include <esp_task_wdt.h>
14#include <hal/cpu_hal.h>
19#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
20#include <esp_clk_tree.h>
28void IRAM_ATTR HOT
yield() { vPortYield(); }
29uint32_t IRAM_ATTR HOT
millis() {
return (uint32_t) (esp_timer_get_time() / 1000ULL); }
30void IRAM_ATTR HOT
delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
31uint32_t IRAM_ATTR HOT
micros() {
return (uint32_t) esp_timer_get_time(); }
43#if defined(USE_ESP_IDF)
44 esp_task_wdt_add(
nullptr);
46#elif defined(USE_ARDUINO)
49#if defined(CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0) && CONFIG_ARDUINO_RUNNING_CORE == 0
52#if defined(CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1) && CONFIG_ARDUINO_RUNNING_CORE == 1
59 esp_ota_img_states_t
state;
60 const esp_partition_t *running = esp_ota_get_running_partition();
61 if (esp_ota_get_state_partition(running, &
state) == ESP_OK) {
62 if (
state == ESP_OTA_IMG_PENDING_VERIFY) {
63 esp_ota_mark_app_valid_cancel_rollback();
74#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
75 esp_clk_tree_src_get_freq_hz(SOC_MOD_CLK_CPU, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &freq);
77 rtc_cpu_freq_config_t config;
78 rtc_clk_cpu_freq_get_config(&config);
79 freq = config.freq_mhz * 1000000U;
81#elif defined(USE_ARDUINO)
82 freq = ESP.getCpuFreqMHz() * 1000000;
Providing packet encoding functions for exchanging data with a remote host.
uint32_t arch_get_cpu_cycle_count()
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
void IRAM_ATTR HOT yield()
uint32_t arch_get_cpu_freq_hz()
TaskHandle_t loop_task_handle
uint32_t IRAM_ATTR HOT micros()
void IRAM_ATTR HOT delay_microseconds_safe(uint32_t us)
Delay for the given amount of microseconds, possibly yielding to other processes during the wait.
void IRAM_ATTR HOT arch_feed_wdt()
void IRAM_ATTR HOT delay(uint32_t ms)
uint32_t IRAM_ATTR HOT millis()
void loop_task(void *pv_params)
uint8_t progmem_read_byte(const uint8_t *addr)