arduino-esp32/cores/esp32/main.cpp

30 lines
510 B
C++
Raw Normal View History

2016-10-06 13:21:30 +02:00
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp32-hal.h"
2016-10-06 13:21:30 +02:00
#if CONFIG_AUTOSTART_ARDUINO
2016-10-06 13:21:30 +02:00
extern "C" void initArduino();
extern void loop();
extern void setup();
2016-10-06 13:21:30 +02:00
void loopTask(void *pvParameters)
{
bool setup_done = false;
for(;;) {
if(!setup_done) {
setup();
setup_done = true;
}
loop();
}
}
extern "C" void app_main()
{
initArduino();
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
2016-10-06 13:21:30 +02:00
}
#endif