static void yys_rtc_task(void* arg)
{
static int64_t time = 0;
static int64_t endTime = 0;
static int64_t deltaT = 0;
static TickType_t xLastWakeTime;
static const TickType_t xFrequency = 7;
static BaseType_t xWasDelayed;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for (;;)
{
time = esp_timer_get_time();
deltaT = time - endTime;
endTime = time;
// Wait for the next cycle.
//xWasDelayed = xTaskDelayUntil(&xLastWakeTime, xFrequency);
vTaskDelayUntil(&xLastWakeTime, xFrequency);
// time = esp_timer_get_time();
// deltaT = time - endTime;
// endTime = time;
// Perform action here. xWasDelayed value can be used to determine
// whether a deadline was missed if the code here took too long.
ESP_LOGE("TEST", "time %lld -- deltaT %lld -- xWasDelayed %d", time, deltaT, xWasDelayed);
}
}