#include <stdio.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
static const char *TAG = "MAIN";
void WaitForTimeout(unsigned long timeout)
{
//TaskHandle_t TaskHandle =
xTaskGetCurrentTaskHandle();
TickType_t start = xTaskGetTickCount();
int counter = 0;
while(xTaskGetTickCount() - start <
timeout) {
esp_rom_delay_us(10000);
//vTaskDelay(1);
counter++;
}
ESP_LOGI(TAG, "counter=%d", counter);
}
void app_main(void)
{
ESP_LOGI(TAG, "app_main start");
for (int i=0;i<10;i++) {
ESP_LOGI(TAG,
"i=%d", i);
WaitForTimeout(500);
}
}
|