arduino-esp32/cores/esp32/main.cpp
Ivan Grokhotkov 93c45af256 Use esp_timer_get_time as time source for micros and mills (#1424)
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.
2018-05-22 16:12:30 +02:00

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