93c45af256
esp_timer_get_time returns monotonic time in microseconds, as a 64-bit number. It can be called from tasks and interrupts, does not use any critical sections/mutexes, and is thread safe.
28 lines
454 B
C++
28 lines
454 B
C++
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "Arduino.h"
|
|
|
|
#if CONFIG_AUTOSTART_ARDUINO
|
|
|
|
#if CONFIG_FREERTOS_UNICORE
|
|
#define ARDUINO_RUNNING_CORE 0
|
|
#else
|
|
#define ARDUINO_RUNNING_CORE 1
|
|
#endif
|
|
|
|
void loopTask(void *pvParameters)
|
|
{
|
|
setup();
|
|
for(;;) {
|
|
loop();
|
|
}
|
|
}
|
|
|
|
extern "C" void app_main()
|
|
{
|
|
initArduino();
|
|
xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
|
|
}
|
|
|
|
#endif
|