arduino-esp32/cores/esp32/main.cpp
me-no-dev c30012ab78 Add Kconfig for IDF and option to disable HAL mutexes
IDF Options:
- Autostart Arduino (implements app_main)
- Disable HAL locks
- Set HAL debug level
- Auto-connect STA if configured (else will connect after WiFi.begin())
2016-11-18 15:07:25 +02:00

34 lines
596 B
C++

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp32-hal.h"
#if CONFIG_AUTOSTART_ARDUINO
extern "C" void initArduino();
extern void loop();
extern void setup();
void startWiFi() __attribute__((weak));
void startWiFi() {}
void loopTask(void *pvParameters)
{
bool setup_done = false;
for(;;) {
if(!setup_done) {
startWiFi();
setup();
setup_done = true;
}
loop();
}
}
extern "C" void app_main()
{
initArduino();
xTaskCreatePinnedToCore(loopTask, "loopTask", 4096, NULL, 1, NULL, 1);
}
#endif