arduino-esp32/cores/esp32/main.cpp

29 lines
490 B
C++
Raw Normal View History

2016-10-06 13:21:30 +02:00
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "Arduino.h"
2016-10-06 13:21:30 +02:00
#if CONFIG_AUTOSTART_ARDUINO
2016-10-06 13:21:30 +02:00
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
2016-10-06 13:21:30 +02:00
void loopTask(void *pvParameters)
{
setup();
2016-10-06 13:21:30 +02:00
for(;;) {
micros(); //update overflow
2016-10-06 13:21:30 +02:00
loop();
}
}
extern "C" void app_main()
{
initArduino();
2017-08-01 23:08:56 +02:00
xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
2016-10-06 13:21:30 +02:00
}
#endif